[ { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/api/standard/utiltyping.py", "function_name": "iter_typing_attrs", "test_info": { "success": false, "failed": 9, "passed": 1112, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep\nLocation: /tmp/benchmark_jd8_i1y0/beartype_test/a00_unit/data/hint/nonpep/beartype/_data_nonpepbeartype.py:108\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_nonpep_meta() -> 'Tuple[HintNonpepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-noncompliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata`\n instances, each describing a sample PEP-noncompliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintNonpepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_nonpep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.nonpep.beartype._data_nonpepbeartype.hints_nonpepbeartype_meta',\n 'beartype_test.a00_unit.data.hint.nonpep.proposal._data_nonpep484.hints_nonpep484_meta',\n ))\n\n> func_list = func()\n\n> def hints_nonpepbeartype_meta() -> 'List[HintNonpepMetadata]':\n '''\n List of :mod:`beartype`-specific **type hint metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata`\n instances describing test-specific :mod:`beartype`-specific PEP-noncompliant\n sample type hints with metadata generically leveraged by various\n PEP-agnostic unit tests).\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.plug import BeartypeHintable\n from beartype.vale import Is\n from beartype._util.api.standard.utiltyping import iter_typing_attrs\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintNonpepMetadata,\n HintPithSatisfiedMetadata,\n HintPithUnsatisfiedMetadata,\n )\n \n # ..................{ LOCALS }..................\n # List of all PEP-noncompliant type hint metadata to be returned.\n hints_nonpep_meta = []\n \n # ..................{ LISTS }..................\n # Add beartype-specific PEP-noncompliant test type hints to this list.\n hints_nonpep_meta.extend((\n # ................{ TUPLE UNION }................\n # Beartype-specific tuple unions (i.e., tuples containing one or more\n # isinstanceable classes).\n \n # Tuple union of one isinstanceable class.\n HintNonpepMetadata(\n hint=(str,),\n piths_meta=(\n # String constant.\n HintPithSatisfiedMetadata('Pinioned coin tokens'),\n # Byte-string constant.\n HintPithUnsatisfiedMetadata(\n pith=b'Murkily',\n # Match that the exception message raised for this pith\n # declares the types *NOT* satisfied by this object.\n exception_str_match_regexes=(\n r'\\bstr\\b',\n ),\n # Match that the exception message raised for this pith\n # does *NOT* contain a newline or bullet delimiter.\n exception_str_not_match_regexes=(\n r'\\n',\n r'\\*',\n ),\n ),\n ),\n ),\n \n # Tuple union of two or more isinstanceable classes.\n HintNonpepMetadata(\n hint=(int, str),\n piths_meta=(\n # Integer constant.\n HintPithSatisfiedMetadata(12),\n # String constant.\n HintPithSatisfiedMetadata('Smirk\u2010opined \u2014 openly'),\n # Byte-string constant.\n HintPithUnsatisfiedMetadata(\n pith=b'Betokening',\n # Match that the exception message raised for this object\n # declares the types *NOT* satisfied by this object.\n exception_str_match_regexes=(\n r'\\bint\\b',\n r'\\bstr\\b',\n ),\n # Match that the exception message raised for this object\n # does *NOT* contain a newline or bullet delimiter.\n exception_str_not_match_regexes=(\n r'\\n',\n r'\\*',\n ),\n ),\n ),\n ),\n ))\n \n # ..................{ VALIDATORS ~ is }..................\n # Beartype-specific validators defined as lambda functions.\n IsNonempty = Is[lambda text: bool(text)]\n \n # ..................{ FACTORIES }..................\n # For each \"Annotated\" type hint factory importable from a typing module...\n> for Annotated in iter_typing_attrs('Annotated'):\nE TypeError: 'NoneType' object is not iterable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted\nLocation: /tmp/benchmark_jd8_i1y0/beartype_test/a00_unit/data/hint/nonpep/beartype/_data_nonpepbeartype.py:108\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_nonpep_meta() -> 'Tuple[HintNonpepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-noncompliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata`\n instances, each describing a sample PEP-noncompliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintNonpepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_nonpep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.nonpep.beartype._data_nonpepbeartype.hints_nonpepbeartype_meta',\n 'beartype_test.a00_unit.data.hint.nonpep.proposal._data_nonpep484.hints_nonpep484_meta',\n ))\n\n> func_list = func()\n\n> def hints_nonpepbeartype_meta() -> 'List[HintNonpepMetadata]':\n '''\n List of :mod:`beartype`-specific **type hint metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata`\n instances describing test-specific :mod:`beartype`-specific PEP-noncompliant\n sample type hints with metadata generically leveraged by various\n PEP-agnostic unit tests).\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.plug import BeartypeHintable\n from beartype.vale import Is\n from beartype._util.api.standard.utiltyping import iter_typing_attrs\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintNonpepMetadata,\n HintPithSatisfiedMetadata,\n HintPithUnsatisfiedMetadata,\n )\n \n # ..................{ LOCALS }..................\n # List of all PEP-noncompliant type hint metadata to be returned.\n hints_nonpep_meta = []\n \n # ..................{ LISTS }..................\n # Add beartype-specific PEP-noncompliant test type hints to this list.\n hints_nonpep_meta.extend((\n # ................{ TUPLE UNION }................\n # Beartype-specific tuple unions (i.e., tuples containing one or more\n # isinstanceable classes).\n \n # Tuple union of one isinstanceable class.\n HintNonpepMetadata(\n hint=(str,),\n piths_meta=(\n # String constant.\n HintPithSatisfiedMetadata('Pinioned coin tokens'),\n # Byte-string constant.\n HintPithUnsatisfiedMetadata(\n pith=b'Murkily',\n # Match that the exception message raised for this pith\n # declares the types *NOT* satisfied by this object.\n exception_str_match_regexes=(\n r'\\bstr\\b',\n ),\n # Match that the exception message raised for this pith\n # does *NOT* contain a newline or bullet delimiter.\n exception_str_not_match_regexes=(\n r'\\n',\n r'\\*',\n ),\n ),\n ),\n ),\n \n # Tuple union of two or more isinstanceable classes.\n HintNonpepMetadata(\n hint=(int, str),\n piths_meta=(\n # Integer constant.\n HintPithSatisfiedMetadata(12),\n # String constant.\n HintPithSatisfiedMetadata('Smirk\u2010opined \u2014 openly'),\n # Byte-string constant.\n HintPithUnsatisfiedMetadata(\n pith=b'Betokening',\n # Match that the exception message raised for this object\n # declares the types *NOT* satisfied by this object.\n exception_str_match_regexes=(\n r'\\bint\\b',\n r'\\bstr\\b',\n ),\n # Match that the exception message raised for this object\n # does *NOT* contain a newline or bullet delimiter.\n exception_str_not_match_regexes=(\n r'\\n',\n r'\\*',\n ),\n ),\n ),\n ),\n ))\n \n # ..................{ VALIDATORS ~ is }..................\n # Beartype-specific validators defined as lambda functions.\n IsNonempty = Is[lambda text: bool(text)]\n \n # ..................{ FACTORIES }..................\n # For each \"Annotated\" type hint factory importable from a typing module...\n> for Annotated in iter_typing_attrs('Annotated'):\nE TypeError: 'NoneType' object is not iterable\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #9: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py", "test_is_hint_pep" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py", "test_is_hint_pep_subscripted" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.035200000000002, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 3, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.009046052631578948, "bidirectional_harmonic": 0.2343666339143314, "degree": 3 }, "line_count": 47, "code_line_count": 47, "cyclomatic": 15, "halstead_volume": 15.509775004326936, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/checkmake.py", "function_name": "make_code_raiser_hint_object_check", "test_info": { "success": false, "failed": 9, "passed": 1121, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_ltx2_uyn/beartype/_check/checkmake.py:609\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n\n> return func(*args)\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> def _make_func_checker(\n # Mandatory parameters.\n hint: Hint,\n conf: BeartypeConf,\n make_code_check: Callable[..., CodeGenerated],\n \n # Optional parameters.\n exception_prefix: str = 'die_if_unbearable() or is_bearable() ',\n ) -> CallableRaiserOrTester:\n '''\n **Type-checking function factory** (i.e., low-level callable dynamically\n generating a pure-Python tester function testing whether an arbitrary object\n passed to that tester satisfies the type hint passed to this factory and\n either returning that result as its boolean return *or* raising a fatal\n exception or emitting a non-fatal warning if that result is :data:`False`).\n \n This factory is intentionally *not* memoized (e.g., by the\n ``@callable_cached`` decorator), as this factory is only called by\n higher-level memoized factories.\n \n Caveats\n -------\n **This factory intentionally accepts no** ``exception_cls`` **parameter.**\n Doing so would only ambiguously obscure context-sensitive exceptions raised\n by lower-level utility functions called by this higher-level factory.\n \n Parameters\n ----------\n hint : Hint\n Type hint to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n make_code_check : Callable[..., CodeGenerated]\n **Type-checking code factory** (i.e., function dynamically generating a\n code snippet of a function type-checking an arbitrary object against the\n passed type hint under the passed beartype configuration).\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to a reasonably sensible string.\n \n Returns\n -------\n CallableTester\n Type-checking tester function generated by this factory for this hint.\n \n Raises\n ------\n All exceptions raised by the lower-level :func:`.make_check_expr` factory.\n Additionally, this factory also raises:\n \n BeartypeConfException\n If this configuration is *not* a :class:`.BeartypeConf` instance.\n BeartypeDecorHintForwardRefException\n If this hint contains one or more relative forward references, which\n this factory explicitly prohibits to improve both the efficiency and\n portability of calls by users to the resulting type-checker.\n _BeartypeUtilCallableException\n If this function erroneously generates a syntactically invalid\n type-checking function. That should *never* happen, but let's admit that\n you're still reading this for a reason.\n \n Warns\n -----\n All warnings emitted by the lower-level :func:`.make_check_expr` factory.\n '''\n assert callable(make_code_check), f'{repr(make_code_check)} uncallable.'\n \n # Attempt to...\n #\n # Note that the passed \"exception_prefix\" is intentionally *NOT* passed to\n # functions in the body of this \"try\" block. Why? Memoization efficiency.\n # Instead, the placeholder \"EXCEPTION_PLACEHOLDER\" is intentionally passed.\n # The \"except\" block then catches and replaces that with \"exception_prefix\".\n try:\n # With a context manager \"catching\" *ALL* non-fatal warnings emitted\n # during this logic for subsequent \"playback\" below...\n with catch_warnings(record=True) as warnings_issued:\n # ....................{ VALIDATION }....................\n # If \"conf\" is *NOT* a configuration, raise an exception.\n die_unless_conf(conf)\n # Else, \"conf\" is a configuration.\n \n # Sane hint sanified from this possibly insane parameter hint if\n # sanifying this hint generated no supplementary metadata *OR*\n # that metadata otherwise. Additionally, if this hint is\n # unsupported by @beartype, raise an exception.\n #\n # Do this first *BEFORE* passing this hint to any further callables.\n hint_or_sane = sanify_hint_root_statement(\n hint=hint, conf=conf, exception_prefix=EXCEPTION_PLACEHOLDER)\n # print(f'Reduced tester root hint {repr(hint)} to hint or metadata {repr(hint_or_sane)}.')\n \n # If this hint is ignorable, all objects satisfy this hint. In this\n # case, return a trivial function unconditionally returning true.\n if hint_or_sane is Any:\n return _func_checker_ignorable\n # Else, this hint is unignorable.\n \n # ....................{ CODE }....................\n # Python code snippet comprising a single boolean expression\n # type-checking an arbitrary object against this hint.\n> (\n code_check,\n func_scope,\n hint_refs_type_basename,\n ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\nE TypeError: cannot unpack non-iterable NoneType object\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_ltx2_uyn/beartype/_check/checkmake.py:609\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n typehint.die_if_unbearable(pith, conf=conf)\n # Else, this pith satisfies this hint. In this case, assert this\n # raiser raises *NO* exception when passed this pith and hint.\n else:\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n\n> return func(*args)\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> def _make_func_checker(\n # Mandatory parameters.\n hint: Hint,\n conf: BeartypeConf,\n make_code_check: Callable[..., CodeGenerated],\n \n # Optional parameters.\n exception_prefix: str = 'die_if_unbearable() or is_bearable() ',\n ) -> CallableRaiserOrTester:\n '''\n **Type-checking function factory** (i.e., low-level callable dynamically\n generating a pure-Python tester function testing whether an arbitrary object\n passed to that tester satisfies the type hint passed to this factory and\n either returning that result as its boolean return *or* raising a fatal\n exception or emitting a non-fatal warning if that result is :data:`False`).\n \n This factory is intentionally *not* memoized (e.g., by the\n ``@callable_cached`` decorator), as this factory is only called by\n higher-level memoized factories.\n \n Caveats\n -------\n **This factory intentionally accepts no** ``exception_cls`` **parameter.**\n Doing so would only ambiguously obscure context-sensitive exceptions raised\n by lower-level utility functions called by this higher-level factory.\n \n Parameters\n ----------\n hint : Hint\n Type hint to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n make_code_check : Callable[..., CodeGenerated]\n **Type-checking code factory** (i.e., function dynamically generating a\n code snippet of a function type-checking an arbitrary object against the\n passed type hint under the passed beartype configuration).\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to a reasonably sensible string.\n \n Returns\n -------\n CallableTester\n Type-checking tester function generated by this factory for this hint.\n \n Raises\n ------\n All exceptions raised by the lower-level :func:`.make_check_expr` factory.\n Additionally, this factory also raises:\n \n BeartypeConfException\n If this configuration is *not* a :class:`.BeartypeConf` instance.\n BeartypeDecorHintForwardRefException\n If this hint contains one or more relative forward references, which\n this factory explicitly prohibits to improve both the efficiency and\n portability of calls by users to the resulting type-checker.\n _BeartypeUtilCallableException\n If this function erroneously generates a syntactically invalid\n type-checking function. That should *never* happen, but let's admit that\n you're still reading this for a reason.\n \n Warns\n -----\n All warnings emitted by the lower-level :func:`.make_check_expr` factory.\n '''\n assert callable(make_code_check), f'{repr(make_code_check)} uncallable.'\n \n # Attempt to...\n #\n # Note that the passed \"exception_prefix\" is intentionally *NOT* passed to\n # functions in the body of this \"try\" block. Why? Memoization efficiency.\n # Instead, the placeholder \"EXCEPTION_PLACEHOLDER\" is intentionally passed.\n # The \"except\" block then catches and replaces that with \"exception_prefix\".\n try:\n # With a context manager \"catching\" *ALL* non-fatal warnings emitted\n # during this logic for subsequent \"playback\" below...\n with catch_warnings(record=True) as warnings_issued:\n # ....................{ VALIDATION }....................\n # If \"conf\" is *NOT* a configuration, raise an exception.\n die_unless_conf(conf)\n # Else, \"conf\" is a configuration.\n \n # Sane hint sanified from this possibly insane parameter hint if\n # sanifying this hint generated no supplementary metadata *OR*\n # that metadata otherwise. Additionally, if this hint is\n # unsupported by @beartype, raise an exception.\n #\n # Do this first *BEFORE* passing this hint to any further callables.\n hint_or_sane = sanify_hint_root_statement(\n hint=hint, conf=conf, exception_prefix=EXCEPTION_PLACEHOLDER)\n # print(f'Reduced tester root hint {repr(hint)} to hint or metadata {repr(hint_or_sane)}.')\n \n # If this hint is ignorable, all objects satisfy this hint. In this\n # case, return a trivial function unconditionally returning true.\n if hint_or_sane is Any:\n return _func_checker_ignorable\n # Else, this hint is unignorable.\n \n # ....................{ CODE }....................\n # Python code snippet comprising a single boolean expression\n # type-checking an arbitrary object against this hint.\n> (\n code_check,\n func_scope,\n hint_refs_type_basename,\n ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\nE TypeError: cannot unpack non-iterable NoneType object\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #4: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #8: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 57.10841855999994, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.06585800438596494, "bidirectional_harmonic": 0.23088260423786747, "degree": 2 }, "line_count": 36, "code_line_count": 36, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/cls/pep/utilpep3119.py", "function_name": "die_unless_type_isinstanceable", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py::test_die_unless_object_isinstanceable\nLocation: /tmp/benchmark_9cieuoto/beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py:55\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_die_unless_object_isinstanceable() -> None:\n '''\n Test the\n :func:`beartype._util.cls.pep.utilpep3119.die_unless_object_isinstanceable`\n validator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep3119Exception\n from beartype._util.cls.pep.utilpep3119 import (\n die_unless_object_isinstanceable)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n Class,\n NonIsinstanceableClass,\n )\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this raiser accepts an isinstanceable type.\n die_unless_object_isinstanceable(Class)\n \n # Assert this raiser accepts a tuple of isinstanceable types.\n die_unless_object_isinstanceable((Class, str))\n \n # ....................{ FAIL }....................\n # Assert this raiser raises the expected exception when passed a\n # non-isinstanceable object.\n with raises(BeartypeDecorHintPep3119Exception):\n die_unless_object_isinstanceable('Moab.')\n \n # Assert this raiser raises the expected exception when passed a\n # non-isinstanceable type.\n> with raises(BeartypeDecorHintPep3119Exception):\nE Failed: DID NOT RAISE \n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py::test_die_unless_type_isinstanceable\nLocation: /tmp/benchmark_9cieuoto/beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py:101\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_die_unless_type_isinstanceable() -> None:\n '''\n Test the\n :func:`beartype._util.cls.pep.utilpep3119.die_unless_type_isinstanceable`\n validator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep3119Exception\n from beartype._util.cls.pep.utilpep3119 import (\n die_unless_type_isinstanceable)\n from beartype_test.a00_unit.data.data_type import (\n Class,\n NonIsinstanceableClass,\n )\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this validator accepts an isinstanceable type.\n die_unless_type_isinstanceable(Class)\n \n # ....................{ FAIL }....................\n # Assert this validator raises the expected exception when passed a\n # non-isinstanceable type.\n> with raises(BeartypeDecorHintPep3119Exception):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_fail", "Failure #4: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_add_func_scope_type", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py", "test_die_unless_object_isinstanceable" ], [ "beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py", "test_die_unless_type_isinstanceable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.8400000000000003, "in_degree": 6, "true_in_degree": 14.640000000000006, "out_degree": 4, "betweenness": 0.000199156767536634, "pagerank": 0.0008983866246750138, "harmonic": 0.007401315789473684, "bidirectional_harmonic": 0.22877191795777352, "degree": 10 }, "line_count": 32, "code_line_count": 32, "cyclomatic": 7, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/error/_pep/pep484585/errpep484585generic.py", "function_name": "find_cause_generic_unsubscripted", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_23_qd2_h/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_23_qd2_h/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #6: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 46.547036159999976, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 5, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.054752114661654104, "bidirectional_harmonic": 0.23977403261942748, "degree": 5 }, "line_count": 28, "code_line_count": 28, "cyclomatic": 6, "halstead_volume": 23.264662506490403, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep585.py", "function_name": "get_hint_pep585_generic_typevars", "test_info": { "success": false, "failed": 7, "passed": 1123, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars\nLocation: /tmp/benchmark_w0fzggn9/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py:122\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_get_hint_pep585_generic_typevars(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep585.get_hint_pep585_generic_typevars`\n function.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep585Exception\n from beartype._data.hint.pep.sign.datapepsigns import HintSignTypeVar\n from beartype._util.hint.pep.proposal.pep585 import (\n get_hint_pep585_generic_typevars)\n from beartype._util.hint.pep.utilpepget import get_hint_pep_sign_or_none\n from pytest import raises\n \n # ....................{ ASSERTS }....................\n # For each PEP-compliant test hint...\n for hint_pep_meta in hints_pep_meta:\n # If this hint is a PEP 585-compliant generic...\n if hint_pep_meta.is_pep585_generic:\n # Tuple of all type variables discovered by this getter.\n hint_typevars = get_hint_pep585_generic_typevars(hint_pep_meta.hint)\n assert isinstance(hint_typevars, tuple)\n \n # Assert that all items of this tuple are actually type variables.\n for hint_typevar in hint_typevars:\n assert get_hint_pep_sign_or_none(hint_typevar) is (\n HintSignTypeVar)\n \n # If this hint is parametrized by one or more type variables...\n if hint_pep_meta.is_typevars:\n # Assert that this getter returns one or more type variables.\n assert hint_typevars\n \n # If the exact type variables parametrizing this hint are known\n # at test time...\n if hint_pep_meta.typevars:\n # Assert that this getter returns only these type variables.\n assert hint_pep_meta.typevars == hint_typevars\n # Else, the exact type variables parametrizing this hint are\n # unknown at test time. In this case, silently ignore the exact\n # contents of this tuple.\n # Else, this hint is unparametrized by type variables. In this case,\n # assert that this getter returns the empty tuple.\n else:\n assert hint_typevars == ()\n # If this hint is *NOT* a PEP 585-compliant generic, assert that this\n # getter raises an exception.\n else:\n> with raises(BeartypeDecorHintPep585Exception):\nE Failed: DID NOT RAISE \n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars\nLocation: /tmp/benchmark_w0fzggn9/beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py:100\nError: assert False\n + where False = isinstance(None, tuple)\n\nTraceback:\n\n> def test_get_hint_pep_typevars(hints_pep_meta) -> None:\n '''\n Test the :func:`beartype._util.hint.pep.utilpepget.get_hint_pep_typevars`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._data.hint.pep.sign.datapepsigns import HintSignTypeVar\n from beartype._util.hint.pep.utilpepget import (\n get_hint_pep_typevars,\n get_hint_pep_sign_or_none,\n )\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n \n # ....................{ ASSERTS }....................\n # For each PEP-compliant test hint...\n for hint_pep_meta in hints_pep_meta:\n # Tuple of all type variables discovered by this getter.\n hint_typevars = get_hint_pep_typevars(hint_pep_meta.hint)\n> assert isinstance(hint_typevars, tuple)\nE assert False\nE + where False = isinstance(None, tuple)\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #7: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py", "test_get_hint_pep585_generic_typevars" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py", "test_get_hint_pep_typevars" ] ] }, "complexity_info": { "centrality": { "distance_discount": 10.196787200000003, "in_degree": 1, "true_in_degree": 5.960000000000003, "out_degree": 4, "betweenness": 0.0003861202635914333, "pagerank": 0.000550757058644018, "harmonic": 0.014516760651629075, "bidirectional_harmonic": 0.1830853174603182, "degree": 5 }, "line_count": 22, "code_line_count": 22, "cyclomatic": 3, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/ast/utilastmake.py", "function_name": "make_node_object_attr_load", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/ast/test_utilastmake.py::test_make_node_object_attr_load\nLocation: /tmp/benchmark_vpwhh85h/beartype_test/a00_unit/a20_util/ast/test_utilastmake.py:56\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_make_node_object_attr_load(node_sibling: 'ast.AST') -> None:\n '''\n Test the :func:`beartype._util.ast.utilastmake.make_node_object_attr_load`\n factory.\n \n Parameters\n ----------\n node_sibling : 'ast.AST'\n Arbitrary sibling node to be passed as the ``node_sibling`` parameter.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeClawImportAstException\n from beartype._util.ast.utilastmake import make_node_object_attr_load\n from pytest import raises\n \n # Assert that this factory raises the expected exception when passed neither\n # the \"node_obj\" nor \"obj_name\" parameters.\n> with raises(BeartypeClawImportAstException):\nE Failed: DID NOT RAISE \n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package\nLocation: /tmp/benchmark_vpwhh85h/conftest.py:126\nError: Failed: Test \"test_claw_intraprocess_beartype_this_package\" failed in isolated subprocess with:\n\nTraceback:\n\n> Test \"test_claw_intraprocess_beartype_this_package\" failed in isolated subprocess with:\n", "Failure #3: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #4: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/ast/test_utilastmake.py", "test_make_node_object_attr_load" ], [ "beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py", "test_claw_intraprocess_beartype_this_package" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.6, "in_degree": 3, "true_in_degree": 5.08, "out_degree": 2, "betweenness": 1.1290066186884012e-05, "pagerank": 0.0003870779454022989, "harmonic": 0.003289473684210526, "bidirectional_harmonic": 0.18714949159028174, "degree": 5 }, "line_count": 27, "code_line_count": 27, "cyclomatic": 6, "halstead_volume": 6.339850002884625, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/checkmake.py", "function_name": "make_func_raiser", "test_info": { "success": false, "failed": 11, "passed": 1119, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_yifua3sd/beartype/door/_func/doorcheck.py:137\nError: TypeError: 'NoneType' object is not callable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> def die_if_unbearable(\n # Mandatory flexible parameters.\n obj: object,\n \n #FIXME: Uncomment *AFTER* the third-party \"typing_extensions\" module releases\n #a new stable release.\n # hint: Hint,\n hint: object,\n \n # Optional keyword-only parameters.\n *,\n conf: BeartypeConf = BEARTYPE_CONF_DEFAULT,\n exception_prefix: str = 'die_if_unbearable() ',\n ) -> None:\n '''\n Raise an exception if the passed arbitrary object violates the passed type\n hint under the passed beartype configuration.\n \n To configure the type of violation exception raised by this function, set\n the :attr:`.BeartypeConf.violation_door_type` option of the passed ``conf``\n parameter accordingly.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this hint.\n hint : Hint\n Type hint to type-check this object against.\n conf : BeartypeConf, optional\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object). Defaults\n to ``BeartypeConf()``, the default :math:`O(1)` constant-time\n configuration.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to a reasonably sensible string.\n \n Raises\n ------\n ``conf.violation_door_type``\n If this object violates this hint.\n beartype.roar.BeartypeDecorHintNonpepException\n If this hint is *not* PEP-compliant (i.e., complies with *no* Python\n Enhancement Proposals (PEPs) currently supported by :mod:`beartype`).\n beartype.roar.BeartypeDecorHintPepUnsupportedException\n If this hint is currently unsupported by :mod:`beartype`.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.door import die_if_unbearable\n >>> die_if_unbearable(['And', 'what', 'rough', 'beast,'], list[str])\n >>> die_if_unbearable(['its', 'hour', 'come', 'round'], list[int])\n beartype.roar.BeartypeDoorHintViolation: Object ['its', 'hour', 'come',\n 'round'] violates type hint list[int], as list index 0 item 'its' not\n instance of int.\n '''\n # conf._is_debug = True\n \n # Memoized low-level type-checking raiser function either raising an\n # exception or emitting a warning only if the passed object passed violates\n # the type hint passed to this high-level type-checking raiser function.\n #\n # Note that parameters are intentionally passed positionally for efficiency.\n # Since make_func_raiser() is memoized, passing parameters by keyword would\n # raise a non-fatal\n # \"_BeartypeUtilCallableCachedKwargsWarning\" warning.\n func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n \n # Either raise an exception or emit a warning only if the passed object\n # violates this hint.\n> func_raiser(obj) # pyright: ignore\nE TypeError: 'NoneType' object is not callable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_yifua3sd/beartype/door/_func/doorcheck.py:137\nError: TypeError: 'NoneType' object is not callable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n typehint.die_if_unbearable(pith, conf=conf)\n # Else, this pith satisfies this hint. In this case, assert this\n # raiser raises *NO* exception when passed this pith and hint.\n else:\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> def die_if_unbearable(\n # Mandatory flexible parameters.\n obj: object,\n \n #FIXME: Uncomment *AFTER* the third-party \"typing_extensions\" module releases\n #a new stable release.\n # hint: Hint,\n hint: object,\n \n # Optional keyword-only parameters.\n *,\n conf: BeartypeConf = BEARTYPE_CONF_DEFAULT,\n exception_prefix: str = 'die_if_unbearable() ',\n ) -> None:\n '''\n Raise an exception if the passed arbitrary object violates the passed type\n hint under the passed beartype configuration.\n \n To configure the type of violation exception raised by this function, set\n the :attr:`.BeartypeConf.violation_door_type` option of the passed ``conf``\n parameter accordingly.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this hint.\n hint : Hint\n Type hint to type-check this object against.\n conf : BeartypeConf, optional\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object). Defaults\n to ``BeartypeConf()``, the default :math:`O(1)` constant-time\n configuration.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to a reasonably sensible string.\n \n Raises\n ------\n ``conf.violation_door_type``\n If this object violates this hint.\n beartype.roar.BeartypeDecorHintNonpepException\n If this hint is *not* PEP-compliant (i.e., complies with *no* Python\n Enhancement Proposals (PEPs) currently supported by :mod:`beartype`).\n beartype.roar.BeartypeDecorHintPepUnsupportedException\n If this hint is currently unsupported by :mod:`beartype`.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.door import die_if_unbearable\n >>> die_if_unbearable(['And', 'what', 'rough', 'beast,'], list[str])\n >>> die_if_unbearable(['its', 'hour', 'come', 'round'], list[int])\n beartype.roar.BeartypeDoorHintViolation: Object ['its', 'hour', 'come',\n 'round'] violates type hint list[int], as list index 0 item 'its' not\n instance of int.\n '''\n # conf._is_debug = True\n \n # Memoized low-level type-checking raiser function either raising an\n # exception or emitting a warning only if the passed object passed violates\n # the type hint passed to this high-level type-checking raiser function.\n #\n # Note that parameters are intentionally passed positionally for efficiency.\n # Since make_func_raiser() is memoized, passing parameters by keyword would\n # raise a non-fatal\n # \"_BeartypeUtilCallableCachedKwargsWarning\" warning.\n func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n \n # Either raise an exception or emit a warning only if the passed object\n # violates this hint.\n> func_raiser(obj) # pyright: ignore\nE TypeError: 'NoneType' object is not callable\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #6: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #8: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #10: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #11: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 38.043674623999976, "in_degree": 1, "true_in_degree": 2.6, "out_degree": 1, "betweenness": 2.438654296366947e-05, "pagerank": 0.0006632799671592775, "harmonic": 0.04177827380952377, "bidirectional_harmonic": 0.19234811697805201, "degree": 2 }, "line_count": 13, "code_line_count": 13, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/forward/fwdmain.py", "function_name": "resolve_hint", "test_info": { "success": false, "failed": 20, "passed": 1110, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563\nLocation: <@beartype(__beartype_checker_335) at 0x301e72e0>:22\nError: beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value violates type hint None, as not instance of .\n\nTraceback:\n\n> def test_resolve_pep563() -> None:\n '''\n Test the :func:`beartype.peps.resolve_pep563` resolver.\n '''\n \n # .....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.peps import resolve_pep563\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n BeartypePep563Exception,\n )\n from beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve import (\n ToAvariceOrPride,\n FrequentWith,\n their_starry_domes,\n )\n from pytest import raises\n \n # .....................{ LOCALS }....................\n # Arbitrary instance of the generic accepted by the function called below.\n numberless_and_immeasurable_halls = ToAvariceOrPride()\n \n # Arbitrary instance of the class defining various problematic methods\n # called below.\n and_thrones_radiant_with_chrysolite = FrequentWith()\n \n # .....................{ PASS }....................\n # Assert that this function unsuccessfully raises the expected exception\n # *BEFORE* resolving all PEP 563-postponed type hints annotating these\n # callables.\n with raises(BeartypeDecorHintForwardRefException):\n their_starry_domes(numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.until_the_doves(\n numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.crystal_column(\n 'Nor had that scene of ampler majesty')\n \n # Resolve all PEP 563-postponed type hints annotating these callables.\n resolve_pep563(their_starry_domes)\n resolve_pep563(FrequentWith.until_the_doves)\n resolve_pep563(FrequentWith.crystal_column)\n \n # Assert that this function successfully accepts and returns this instance.\n> assert their_starry_domes(numberless_and_immeasurable_halls) is (\n numberless_and_immeasurable_halls)\n\n> die_if_unbearable(of_diamond_and_of_gold, ExpandAbove_resolved)\n\n> func_raiser(obj) # pyright: ignore\n\n> > ???\nE beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value violates type hint None, as not instance of .\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data\nLocation: <@beartype(beartype_test.a00_unit.data.hint.data_hintref.OnTheBareMast.over_the_tranquil_sea) at 0x725fc8939580>:45\nError: beartype.roar.BeartypeCallHintReturnViolation: Class method beartype_test.a00_unit.data.hint.data_hintref.OnTheBareMast.over_the_tranquil_sea() return violates type hint None, as not instance of .\n\nTraceback:\n\n> def test_pep484_ref_data() -> None:\n '''\n Test successful usage of the :func:`beartype.beartype` decorator with\n respect to both PEP-compliant and -noncompliant forward references by\n importing an external data module declaring these references *before* the\n user-defined classes referred to by these references.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar import BeartypeCallHintReturnViolation\n> from beartype_test.a00_unit.data.hint.data_hintref import (\n BeforeTheHurricane,\n TheDarkestEveningOfTheYear,\n WithSluggishSurge,\n a_little_shallop,\n but_i_have_promises,\n its_fields_of_snow,\n of_easy_wind,\n stopping_by_woods_on,\n the_dry_leaf,\n the_woods_are_lovely,\n winding_among_the_springs,\n # between_the_woods_and_frozen_lake,\n )\n\n> And_felt_the_boat_speed = OnTheBareMast.over_the_tranquil_sea(0xFEEDBABE)\n\n> > ???\nE beartype.roar.BeartypeCallHintReturnViolation: Class method beartype_test.a00_unit.data.hint.data_hintref.OnTheBareMast.over_the_tranquil_sea() return violates type hint None, as not instance of .\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #16: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py", "test_resolve_pep563" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py", "test_pep484_ref_data" ] ] }, "complexity_info": { "centrality": { "distance_discount": 22.129459200000024, "in_degree": 2, "true_in_degree": 4.08, "out_degree": 4, "betweenness": 0.00014496444983959074, "pagerank": 0.0004278386129355957, "harmonic": 0.02764724310776942, "bidirectional_harmonic": 0.23694653299916454, "degree": 6 }, "line_count": 43, "code_line_count": 43, "cyclomatic": 8, "halstead_volume": 33.0, "halstead_difficulty": 2.1 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/error/_pep/pep484585/errpep484585container.py", "function_name": "find_cause_tuple_fixed", "test_info": { "success": false, "failed": 7, "passed": 1123, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_jy5at3cg/beartype/_check/error/_pep/pep484585/errpep484585container.py:137\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> return cause_finder(self)\n\n> cause_deep = cause_child.find_cause()\n\n> return cause_finder(self)\n\n> def find_cause_container_args_1(cause: ViolationCause) -> ViolationCause:\n '''\n Output cause describing whether the pith of the passed input cause either\n satisfies or violates the **single-argument container type hint**\n (i.e., :pep:`484`- or :pep:`585`-compliant type hint subscripted by one\n child type hint constraining *all* items contained in that container\n satisfying the :class:`collections.abc.Container` protocol) of that cause.\n \n Parameters\n ----------\n cause : ViolationCause\n Input violation cause finder to be inspected.\n \n Returns\n -------\n ViolationCause\n Output violation cause finder type-checking this input.\n '''\n assert isinstance(cause, ViolationCause), f'{repr(cause)} not cause.'\n assert cause.hint_sign in HINT_SIGNS_CONTAINER_ARGS_1, (\n f'{repr(cause.hint)} not 1-argument container type hint.')\n \n # Number of child type hints expected to be subscripting this hint.\n hints_child_len_expected = (\n HINT_SIGN_ORIGIN_ISINSTANCEABLE_TO_ARGS_LEN_RANGE[cause.hint_sign])\n \n # Assert this hint was subscripted by the expected number of child type\n # hints. Note that prior logic should have already guaranteed this.\n assert len(cause.hint_or_sane_childs) in hints_child_len_expected, (\n f'Sequence type hint {repr(cause.hint)} number of child type hints '\n f'{len(cause.hint_or_sane_childs)} not in {hints_child_len_expected}.'\n )\n \n # Shallow output cause describing the failure of this path to be a shallow\n # instance of the type originating this hint (e.g., \"list\" for the hint\n # \"list[str]\") if this pith is not an instance of this type *OR* \"None\"\n # otherwise (i.e., if this pith is an instance of this type).\n cause_shallow = find_cause_type_instance_origin(cause)\n \n # If this pith is *NOT* an instance of this type, return this shallow cause.\n if cause_shallow.cause_str_or_none is not None:\n return cause_shallow\n # Else, this pith is an instance of this type.\n \n # First sanified child hint metadata subscripting this parent container\n # hint. All remaining child hints if any are ignorable. Specifically, if\n # this hint is:\n # * A standard container (e.g., \"typing.List[str]\"), this hint is subscripted\n # by only one child hint.\n # * A variadic tuple (e.g., \"typing.Tuple[str, ...]\"), this hint is\n # subscripted by only two child hints -- the latter of which is guaranteed\n # to be an ellipses and thus ignorable syntactic chuff.\n hint_or_sane_child = cause.hint_or_sane_childs[0]\n \n # If either...\n if (\n # This container is empty, *ALL* items of this container (of which there\n # are none) are necessarily valid *OR*...\n not cause.pith or\n # This child hint is ignorable...\n hint_or_sane_child is Any\n ):\n # Then this container satisfies this hint. In this case, return the\n # passed cause as is.\n return cause\n # Else, this container is non-empty *AND* this child hint is unignorable.\n \n # Hint logic type-checking this sign if any *OR* \"None\" otherwise.\n hint_logic = HINT_SIGN_PEP484585_CONTAINER_TO_LOGIC_get(cause.hint_sign)\n \n # If *NO* hint logic type-checks this sign, raise an exception. Note\n # that this logic should *ALWAYS* be non-\"None\". Nonetheless, assumptions.\n if hint_logic is None: # pragma: no cover\n raise _BeartypeCallHintPepRaiseException(\n f'{cause.exception_prefix}1-argument container type hint '\n f'{repr(cause.hint)} beartype sign {repr(cause.hint_sign)} '\n f'code generation logic not found.'\n )\n # Else, some hint logic type-checks this sign.\n \n # If this pith is a collection, this pith is at least safely reiterable here\n # and thus deeply introspectable. In this case...\n if isinstance(cause.pith, CollectionABC):\n # Arbitrary iterator over this container configured by this beartype\n # configuration satisfying the enumerate() protocol. This iterator\n # yields zero or more 2-tuples of the form \"(item_index, item)\", where:\n # * \"item_index\" is the 0-based index of each item.\n # * \"item\" is an arbitrary item of this container.\n pith_enumerator = hint_logic.enumerate_cause_items(cause)\n \n # For each enumerated item of this container...\n for pith_item_index, pith_item in pith_enumerator:\n # Deep output cause describing the failure of this item to satisfy\n # this child hint if this item violates this child hint *OR* \"None\"\n # otherwise (i.e., if this item satisfies this child hint).\n cause_deep = cause.permute(\n hint_or_sane=hint_or_sane_child, pith=pith_item).find_cause()\n \n # If this item is the cause of this failure...\n> if cause_deep.cause_str_or_none is not None:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_jy5at3cg/beartype/_check/error/_pep/pep484585/errpep484585container.py:137\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> return cause_finder(self)\n\n> cause_deep = cause_child.find_cause()\n\n> return cause_finder(self)\n\n> def find_cause_container_args_1(cause: ViolationCause) -> ViolationCause:\n '''\n Output cause describing whether the pith of the passed input cause either\n satisfies or violates the **single-argument container type hint**\n (i.e., :pep:`484`- or :pep:`585`-compliant type hint subscripted by one\n child type hint constraining *all* items contained in that container\n satisfying the :class:`collections.abc.Container` protocol) of that cause.\n \n Parameters\n ----------\n cause : ViolationCause\n Input violation cause finder to be inspected.\n \n Returns\n -------\n ViolationCause\n Output violation cause finder type-checking this input.\n '''\n assert isinstance(cause, ViolationCause), f'{repr(cause)} not cause.'\n assert cause.hint_sign in HINT_SIGNS_CONTAINER_ARGS_1, (\n f'{repr(cause.hint)} not 1-argument container type hint.')\n \n # Number of child type hints expected to be subscripting this hint.\n hints_child_len_expected = (\n HINT_SIGN_ORIGIN_ISINSTANCEABLE_TO_ARGS_LEN_RANGE[cause.hint_sign])\n \n # Assert this hint was subscripted by the expected number of child type\n # hints. Note that prior logic should have already guaranteed this.\n assert len(cause.hint_or_sane_childs) in hints_child_len_expected, (\n f'Sequence type hint {repr(cause.hint)} number of child type hints '\n f'{len(cause.hint_or_sane_childs)} not in {hints_child_len_expected}.'\n )\n \n # Shallow output cause describing the failure of this path to be a shallow\n # instance of the type originating this hint (e.g., \"list\" for the hint\n # \"list[str]\") if this pith is not an instance of this type *OR* \"None\"\n # otherwise (i.e., if this pith is an instance of this type).\n cause_shallow = find_cause_type_instance_origin(cause)\n \n # If this pith is *NOT* an instance of this type, return this shallow cause.\n if cause_shallow.cause_str_or_none is not None:\n return cause_shallow\n # Else, this pith is an instance of this type.\n \n # First sanified child hint metadata subscripting this parent container\n # hint. All remaining child hints if any are ignorable. Specifically, if\n # this hint is:\n # * A standard container (e.g., \"typing.List[str]\"), this hint is subscripted\n # by only one child hint.\n # * A variadic tuple (e.g., \"typing.Tuple[str, ...]\"), this hint is\n # subscripted by only two child hints -- the latter of which is guaranteed\n # to be an ellipses and thus ignorable syntactic chuff.\n hint_or_sane_child = cause.hint_or_sane_childs[0]\n \n # If either...\n if (\n # This container is empty, *ALL* items of this container (of which there\n # are none) are necessarily valid *OR*...\n not cause.pith or\n # This child hint is ignorable...\n hint_or_sane_child is Any\n ):\n # Then this container satisfies this hint. In this case, return the\n # passed cause as is.\n return cause\n # Else, this container is non-empty *AND* this child hint is unignorable.\n \n # Hint logic type-checking this sign if any *OR* \"None\" otherwise.\n hint_logic = HINT_SIGN_PEP484585_CONTAINER_TO_LOGIC_get(cause.hint_sign)\n \n # If *NO* hint logic type-checks this sign, raise an exception. Note\n # that this logic should *ALWAYS* be non-\"None\". Nonetheless, assumptions.\n if hint_logic is None: # pragma: no cover\n raise _BeartypeCallHintPepRaiseException(\n f'{cause.exception_prefix}1-argument container type hint '\n f'{repr(cause.hint)} beartype sign {repr(cause.hint_sign)} '\n f'code generation logic not found.'\n )\n # Else, some hint logic type-checks this sign.\n \n # If this pith is a collection, this pith is at least safely reiterable here\n # and thus deeply introspectable. In this case...\n if isinstance(cause.pith, CollectionABC):\n # Arbitrary iterator over this container configured by this beartype\n # configuration satisfying the enumerate() protocol. This iterator\n # yields zero or more 2-tuples of the form \"(item_index, item)\", where:\n # * \"item_index\" is the 0-based index of each item.\n # * \"item\" is an arbitrary item of this container.\n pith_enumerator = hint_logic.enumerate_cause_items(cause)\n \n # For each enumerated item of this container...\n for pith_item_index, pith_item in pith_enumerator:\n # Deep output cause describing the failure of this item to satisfy\n # this child hint if this item violates this child hint *OR* \"None\"\n # otherwise (i.e., if this item satisfies this child hint).\n cause_deep = cause.permute(\n hint_or_sane=hint_or_sane_child, pith=pith_item).find_cause()\n \n # If this item is the cause of this failure...\n> if cause_deep.cause_str_or_none is not None:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #7: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 30.177751040000025, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 6, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.037116228070175415, "bidirectional_harmonic": 0.22169628616997075, "degree": 6 }, "line_count": 35, "code_line_count": 35, "cyclomatic": 10, "halstead_volume": 62.907475208398566, "halstead_difficulty": 2.4444444444444446 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/_pep/redpep484604.py", "function_name": "reduce_hint_pep484604", "test_info": { "success": false, "failed": 41, "passed": 1089, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_5ueu5omy/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:409\nError: AssertionError: assert False is True\n + where False = UnionTypeHint(typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType]).is_ignorable\n + where UnionTypeHint(typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType]) = (typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType])\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n> assert TypeHint(hint_ignorable).is_ignorable is True\nE AssertionError: assert False is True\nE + where False = UnionTypeHint(typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType]).is_ignorable\nE + where UnionTypeHint(typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType]) = (typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType])\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint\nLocation: /tmp/benchmark_5ueu5omy/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:73\nError: AssertionError: assert is float | int\n + where = (hint=float, conf=BeartypeConf(hint_overrides=BeartypeHintOverrides({: float | int, : complex | float | int}), is_pep484_tower=True))\n + where BeartypeConf(hint_overrides=BeartypeHintOverrides({: float | int, : complex | float | int}), is_pep484_tower=True) = (is_pep484_tower=True)\n\nTraceback:\n\n> def test_reduce_hint() -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintNonpepNumpyException\n from beartype.typing import (\n Annotated,\n )\n from beartype.vale import IsEqual\n from beartype._cave._cavefast import NoneType\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype._conf.confcls import BeartypeConf\n from beartype._conf.confcommon import BEARTYPE_CONF_DEFAULT\n from beartype._data.cls.datacls import TYPES_PEP484_GENERIC_IO\n from beartype._data.hint.datahinttyping import (\n Pep484TowerComplex,\n Pep484TowerFloat,\n )\n from beartype._data.hint.pep.sign.datapepsigns import HintSignAnnotated\n from beartype._util.hint.pep.proposal.pep593 import is_hint_pep593\n from beartype._util.hint.pep.utilpepget import get_hint_pep_sign\n # from beartype_test.a00_unit.data.hint.pep.proposal.data_pep484 import (\n # T_int,\n # T_str_or_bytes,\n # )\n from beartype_test._util.module.pytmodtest import is_package_numpy\n from dataclasses import InitVar\n from pytest import raises\n \n # Intentionally import PEP 484-specific type hint factories.\n from typing import Protocol\n \n # ..................{ LOCALS }..................\n # Keyword arguments to be passed to all calls to reduce_hints() below.\n kwargs = {\n 'conf': BEARTYPE_CONF_DEFAULT,\n }\n \n # ..................{ CORE }..................\n # Assert this reducer preserves an isinstanceable type as is.\n assert reduce_hint(hint=int, **kwargs) is int\n \n # Assert this reducer reduces \"None\" to \"type(None)\".\n assert reduce_hint(hint=None, **kwargs) is NoneType\n \n # ..................{ PEP 484 ~ tower }..................\n # Assert this reducer expands the builtin \"float\" and \"complex\" types to\n # their corresponding numeric towers when configured to do so.\n> assert reduce_hint(\n hint=float,\n conf=BeartypeConf(is_pep484_tower=True),\n ) is Pep484TowerFloat\nE AssertionError: assert is float | int\nE + where = (hint=float, conf=BeartypeConf(hint_overrides=BeartypeHintOverrides({: float | int, : complex | float | int}), is_pep484_tower=True))\nE + where BeartypeConf(hint_overrides=BeartypeHintOverrides({: float | int, : complex | float | int}), is_pep484_tower=True) = (is_pep484_tower=True)\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #35: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #36: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #37: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #38: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #39: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #40: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #41: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint" ] ] }, "complexity_info": { "centrality": { "distance_discount": 11.323166719999996, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.013792293233082705, "bidirectional_harmonic": 0.21748262702210094, "degree": 2 }, "line_count": 20, "code_line_count": 20, "cyclomatic": 4, "halstead_volume": 39.863137138648355, "halstead_difficulty": 2.6666666666666665 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep585.py", "function_name": "is_hint_pep585_generic_subscripted", "test_info": { "success": false, "failed": 15, "passed": 1115, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_8rq8l1m_/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:705\nError: beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep585SequenceU[complex] pseudo-superclasses not found.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484585_generic_args_full(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n hint_base_target: Optional[Hint] = None,\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> TupleHints:\n '''\n Tuple of the one or more **full child type hints** (i.e., complete tuple of\n *all* type hints directly subscripting both the passed generic *and*\n one or more pseudo-superclasses of this generic) transitively subscripting\n the passed :pep:`484`- or :pep:`585`-compliant **generic** (i.e., class\n superficially subclassing at least one PEP-compliant type hint that is\n possibly *not* an actual class) if this object is a generic *or* raise an\n exception otherwise (i.e., if this object is not a generic).\n \n This getter greedily replaces in the passed tuple as many abstract\n :pep:`484`-compliant **type variables** (i.e., :class:`typing.TypeVar`\n objects) as there are concrete child type hints directly subscripting the\n passed generic. Doing so effectively \"bubbles up\" these concrete children up\n the class hierarchy into the \"empty placeholders\" established by the type\n variables transitively subscripting all pseudo-superclasses of this generic.\n \n This getter is guaranteed to return a non-empty tuple. By definition, a\n generic subclasses one or more generic superclasses necessarily subscripted\n by one or more child type hints.\n \n This getter is memoized for efficiency.\n \n Caveats\n -------\n **This getter is computationally complex in both space and time.** This\n getter exhibits:\n \n * Amortized :math:`O(1)` constant time complexity, thanks to memoization.\n * Non-amortized worst-case :math:`O(jk)` quadratic time complexity for:\n \n * :math:`j` the largest number of child type hints transitively\n subscripting a pseudo-superclass of this generic.\n * :math:`k` the total number of transitive pseudo-superclasses of this\n generic.\n \n **This getter is currently implemented with recursion.** Doing so yields a\n relatively trivial algorithm at a relatively non-trivial increase in runtime\n overhead, due to overhead associated with function calls in Python.\n \n Parameters\n ----------\n hint : object\n Generic type hint to be inspected.\n hint_base_target : Optional[Hint] = None\n **Target pseudo-superclass** (i.e., erased transitive pseudo-superclass\n of the passed generic to specifically search, filter, and return the\n child type hints of). Defaults to :data:`None`. Specifically:\n \n * If this parameter is :data:`None`, this getter returns the complete\n tuple of *all* type hints directly subscripting both the passed\n generic *and* one or more pseudo-superclasses of this generic.\n * If this parameter is *not* :data:`None`, this getter returns the\n partial tuple of *only* type hints directly subscripting both the\n passed generic *and* this passed pseudo-superclass of this generic.\n \n A target pseudo-superclass is passed to deduce whether two generics are\n related according to the :func:`beartype.door.is_subhint` relation. If\n all child type hints in the tuple returned by this getter (when passed\n some generic and its pseudo-superclass) are subhints of all child type\n hints in the tuple returned by this getter passed *only* that\n pseudo-superclass, then that generic is necessarily a subhint of that\n pseudo-superclass. Look. Just go with it, people.\n \n Lastly, note that this getter intentionally ignores *all* child hints\n subscripting this target pseudo-superclass. For search purposes, *any*\n child hints subscripting this target pseudo-superclass are not only\n irrelevant but harmful -- promoting false negatives in higher-level\n functions (e.g., :func:`beartype.door.is_subhint`) internally leveraging\n this lower-level getter. Ignoring these child hints is thus imperative.\n Since deciding child hint compatibility between the passed generic and\n this target pseudo-superclass is a non-trivial decision problem, this\n lower-level getter defers that problem to the caller by unconditionally\n returning the same result regardless of child hints subscripting this\n target pseudo-superclass.\n \n For example, consider the :pep:`484`-compliant :obj:`typing.Any`.\n Clearly, this getter should return the same tuple when passed an\n unsubscripted target pseudo-superclass as when passed a target\n pseudo-superclass subscripted by :obj:`typing.Any`: e.g.,\n \n .. code-block:: pycon\n \n >>> from typing import Any, Generic\n >>> class MuhGeneric[S, T](Generic[S, T]): pass\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[Any])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[S, T])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[int, float])\n (S, T)\n \n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`.BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n Tuple[Hint, ...]\n Tuple of the one or more full child type hints transitively subscripting\n this generic.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * Neither a :pep:`484`- nor :pep:`585`-compliant generic.\n * A :pep:`484`- or :pep:`585`-compliant generic subclassing *no*\n pseudo-superclasses.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.typing import Generic, TypeVar\n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_args_full)\n \n >>> S = TypeVar('S')\n >>> T = TypeVar('T')\n \n >>> class GenericSuperclass(Generic[S], list[T]): pass\n >>> class GenericList(list[complex]): pass\n >>> class GenericSubclass(GenericSuperclass[int, T], GenericList): pass\n \n >>> get_hint_pep484585_generic_args_full(GenericSuperclass)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(GenericSuperclass[int, float])\n (int, float)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass)\n (int, T, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n '''\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception type.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # ....................{ IMPORTS }....................\n # Avoid circular import dependencies.\n from beartype._util.hint.pep.utilpepget import get_hint_pep_args\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic_user)\n \n # ....................{ PREAMBLE }....................\n # If the caller explicitly passed a pseudo-superclass target...\n #\n # Note that this is the common case for this getter and thus tested first.\n if hint_base_target:\n hint_base_target = (\n # If this pseudo-superclass target is this generic, this\n # pseudo-superclass target is effectively meaningless (albeit\n # technically valid). In this case, silently ignore this\n # pseudo-superclass target.\n None\n if hint is hint_base_target else\n # Else, this pseudo-superclass target is *NOT* this generic. In this\n # case, the unsubscripted generic underlying this possibly\n # subscripted target pseudo-superclass generic. See the docstring.\n get_hint_pep484585_generic_type( # pyright: ignore\n hint=hint_base_target,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n )\n # Else, the caller passed *NO* pseudosuperclass target. In this case...\n \n # ....................{ LOCALS }....................\n # Metadata describing the passed generic, used to seed the depth-first\n # search (DFS) below with the first pseudo-superclass to be visited.\n hint_root_data = [\n # This generic.\n hint,\n \n # Metadata describing the direct parent pseudo-superclass of this\n # generic. By definition, this generic is the root of this n-ary tree\n # and thus has *NO* parent (either direct or indirect).\n None,\n ]\n \n # Unvisited pseudo-superclass stack (i.e., efficiently poppable list of\n # metadata describing *ALL* unvisited transitive pseudo-superclasses of this\n # generic, intentionally reordered in reverse order to enable the\n # non-recursive depth-first search (DFS) performed below to both visit and\n # pop these pseudo-superclasses in the expected order), seeded with metadata\n # describing the passed generic.\n #\n # Each item of this stack is a list of metadata describing an unvisited\n # transitive pseudo-superclass of this generic such that this list is\n # either:\n # * If this pseudo-superclass has yet to be visited by this DFS, a 2-list\n # \"(hint, hint_super_data)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is either:\n # * If this pseudo-superclass has a parent pseudo-superclass, the item\n # of this stack describing that parent pseudo-superclass.\n # * Else, this pseudo-superclass is the passed generic. Since this\n # generic has *NO* parent pseudo-superclass, \"None\".\n # * If this pseudo-superclass is itself a user-defined generic (i.e.,\n # defined by a third-party downstream package) that has already been\n # visited by this DFS, a 4-list \"(hint, hint_super_data, hint_args_stack,\n # hint_args_full)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is as defined above.\n # * \"hint_args_stack\" is this pseudo-superclass' direct child hint stack\n # (i.e., list of the zero or more child hints directly subscripting this\n # pseudo-superclass in reverse order, embodying an efficiently poppable\n # stack of these hints), popped off while recursing up from the child\n # pseudo-superclasses of this pseudo-superclass.\n # * \"hint_args_full\" is the list of zero or more child hints transitively\n # subscripting this pseudo-superclass, defined while recursing up from\n # the child pseudo-superclasses of this pseudo-superclass.\n #\n # In short, there be dragons here -- albeit extremely efficient dragons.\n hint_bases_data: _HintBasesData = [hint_root_data]\n \n # Dictionary mapping from each previously observed PEP 484-compliant type\n # variable (i.e., \"typing.TypeVar\" object) subscripting a transitive\n # pseudo-superclass of this generic to the corresponding child hint \"bubbled\n # up\" from a subclass of that pseudo-superclass into that type variable.\n #\n # This dictionary enables the DFS below to reliably \"bubble up\" a single\n # child hint to the same type variable appearing multiple times throughout a\n # generics hierarchy. For example, this dictionary enables the \"int\" child\n # hint subscripting the \"GenericList\" generic to be \"bubbled up\" into the\n # type variable \"T\" subscripting the pseudo-superclasses \"List\" and\n # \"Generic\" of this generic: e.g.,\n # >>> class GenericList[T](List[T], Generic[T]): pass\n # >>> get_hint_pep484585_generic_args_full(GenericList[int])\n # (int, int)\n #\n # For the above call, this contents of this dictionary resemble:\n # typevar_to_hint = {T: int}\n typevar_to_hint: TypeVarToHint = {}\n \n # ....................{ LOCALS ~ target }....................\n # List of zero or more child hints transitively subscripting the passed\n # target pseudo-superclass of this generic if this pseudo-superclass has\n # already been visited by the DFS below *OR* \"None\" otherwise (i.e., if this\n # pseudo-superclass has yet to be visited by this DFS).\n hint_base_target_args_full: Optional[ListHints] = None\n \n # True only if the pseudo-superclass currently visited by the DFS below is\n # still transitively subscripted by one or more PEP 484-compliant type\n # variables (i.e., \"TypeVar\" objects) that have yet to be replaced by\n # concrete hints of a parent pseudo-superclass of that pseudo-superclass.\n is_hint_base_arg_typevar = False\n \n # ....................{ SEARCH }....................\n # Iteration simulating a recursive depth-first search (DFS), efficiently\n # deciding the tuple of all child hints transitively subscripting the\n # desired pseudo-superclass of this generic.\n \n # With at least one transitive pseudo-superclass of this generic remains\n # unvisited...\n while hint_bases_data:\n # Metadata describing the currently visited transitive pseudo-superclass\n # of this generic defined as the top-most item of this stack.\n #\n # Note that we intentionally avoid popping this pseudo-superclass off\n # this stack yet. We only pop a pseudo-superclass off this stack *AFTER*\n # resolving all child pseudo-superclasses of that pseudo-superclass,\n # which simulates the \"backing out\" performed by genuine recursion.\n hint_base_data = hint_bases_data[-1]\n \n # Currently visited transitive pseudo-superclass of this generic.\n hint_base = hint_base_data[_HINT_BASES_INDEX_HINT]\n \n # True only if the metadata describing this pseudo-superclass is still\n # its initial size, implying that this DFS has yet to visit this\n # pseudo-superclass by recursing down into the child pseudo-superclasses\n # of this pseudo-superclass.\n is_hint_base_leaf = len(hint_base_data) == _HINT_BASE_DATA_LEN_LEAF\n \n # If...\n if (\n # This DFS has yet to visit this pseudo-superclass *AND*...\n is_hint_base_leaf and\n # This pseudo-superclass is itself a PEP 484- or 585-compliant\n # user-defined generic. Standard generics (i.e., that are *NOT*\n # user-defined) have *NO* pseudo-superclasses and are thus omitted.\n # Examples of omittable standard generics include:\n # * \"dict[str, U]\".\n # * \"typing.Generic[S, int]\").\n # * \"typing.Protocol[float, T]\").\n #\n # Note that this tester is mildly slower than the prior test and\n # thus intentionally tested later.\n is_hint_pep484585_generic_user(hint_base) # pyright: ignore\n # Then this DFS is currently recursing down into the child\n # pseudo-superclasses of this pseudo-superclass. In this case...\n ):\n # Expand the metadata describing this pseudo-superclass from its\n # current 2-list \"(hint, hint_super_data)\" into the expanded 4-list\n # \"(hint, hint_super_data, hint_args_stack, hint_args_full)\".\n # Specifically, append (in order):\n hint_base_data.extend((\n # Poppable stack of the zero or more child hints directly\n # subscripting this child pseudo-superclass.\n make_stack(get_hint_pep_args(hint_base)),\n # List of the zero or more child hints transitively subscripting\n # this child pseudo-superclass.\n [],\n ))\n \n # Tuple of the one or more child pseudo-superclasses of this\n # pseudo-superclass.\n # print(f'Introspecting generic {hint} unerased bases...')\n hint_child_bases = get_hint_pep484585_generic_bases_unerased(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # print(f'Generic {hint} unerased bases: {hint_child_bases}')\n \n # For each child pseudo-superclass of this pseudo-superclass,\n # intentionally iterated in reverse order so as to ensure that the\n # *FIRST* child pseudo-superclass is the *LAST* item of this stack\n # (and thus the *FIRST* unvisited pseudo-superclass to be visited by\n # this depth-first search (DFS) next).\n #\n # Note that the reversed() builtin is well-known to be the most\n # efficient means of producing a reversed iterable for iteration\n # purposes. See also:\n # https://stackoverflow.com/a/16514411/2809027\n for hint_child_base in reversed(hint_child_bases):\n # Push metadata describing this unvisited child\n # pseudo-superclass onto this stack.\n hint_bases_data.append([\n # This child pseudo-superclass.\n hint_child_base,\n \n # Metadata describing the direct parent\n # pseudo-superclass of this child pseudo-superclass.\n hint_base_data,\n ])\n # Else, either:\n # * This DFS has already visited this pseudo-superclass *OR*...\n # * This pseudo-superclass is a \"terminal\" leaf generic *OR*...\n # * This pseudo-superclass is *NOT* a generic.\n #\n # In any case, this DFS should *NOT* recurse (back) down into this\n # pseudo-superclass. Therefore, this DFS is currently recursing back up\n # out of this pseudo-superclass into its parent pseudo-superclass.\n else:\n # Pop this pseudo-superclass off this stack.\n hint_bases_data.pop()\n # print(f'Resuming generic {hint} pseudo-superclass {hint_base} args {hint_base_args}...')\n \n # List of the zero or more child hints transitively subscripting\n # this pseudo-superclass, defined as either...\n hint_base_args_full: ListHints = ( # pyright: ignore\n # If this is a terminal leaf pseudo-superclass, the tuple of\n # zero or more child hints directly subscripting this\n # pseudo-superclass. Why? Because this pseudo-superclass has\n # *NO* child pseudo-superclass to recurse down into. If this\n # pseudo-superclass had one or more child pseudo-superclasses to\n # recurse down into, then those child pseudo-superclasses would\n # have defined the \"hint_base_data[_HINT_BASES_INDEX_ARGS_FULL]\"\n # list accessed by the next branch, providing the list of zero\n # or more child hints transitively subscripting this\n # pseudo-superclass. Although that list remains undefined, the\n # tuple of zero or more child hints directly subscripting this\n # pseudo-superclass is semantically equivalent to what that list\n # would have been (had that list actually been defined).\n list(get_hint_pep_args(hint_base))\n if is_hint_base_leaf else\n # Else, this is *NOT* a terminal leaf pseudo-superclass. In this\n # case, the list of zero or more child hints transitively\n # subscripting this pseudo-superclass previously defined by\n # child pseudo-superclasses of this pseudo-superclass in\n # lower-level recursion.\n hint_base_data[_HINT_BASES_INDEX_ARGS_FULL]\n )\n \n # Reset this boolean to its default value (i.e., \"False\") *BEFORE*\n # possibly setting this boolean to \"True\" below, facilitating\n # efficient communication between the \"if hint_base_args_full:\" and\n # \"if hint_base_target:\" branches below.\n #\n # Equivalently, record that this pseudo-superclass is transitively\n # subscripted by *NO* type variables. Since the \"if\n # hint_base_args_full:\" branch below works as hard as possible to\n # ensure that this is the case, this default is sensible until\n # proven otherwise below.\n is_hint_base_arg_typevar = False\n \n # If this pseudo-superclass is transitively subscripted by\n # at least one child hint...\n if hint_base_args_full:\n # Metadata describing the direct parent pseudo-superclass of\n # this pseudo-superclass.\n hint_base_super_data = hint_base_data[_HINT_BASES_INDEX_PARENT]\n # print(f'Resuming generic {hint} pseudo {hint_base} parent {hint_base_super_data[0]}...')\n \n # If this pseudo-superclass has a parent pseudo-superclass\n # (i.e., this pseudo-superclass is *NOT* the passed root generic\n # and is thus a transitive child of this generic)...\n if hint_base_super_data:\n # Poppable stack of the zero or more child hints directly\n # subscripting this parent pseudo-superclass.\n hint_base_super_args_stack = hint_base_super_data[ # pyright: ignore\n _HINT_BASES_INDEX_ARGS_STACK]\n \n # For the 0-based index of each child hint transitively\n # subscripting this pseudo-superclass and this hint...\n #\n # Note that this iteration could be fenced behind an \"if\"\n # conditional resembling:\n # if not (\n # hint_base_super_args_stack or\n # typevar_to_hint\n # ):\n #\n # However, doing so would be almost entirely pointless. Why?\n # Because almost *ALL* generics are transitively subscripted\n # by one or more type variables. Ergo, \"typevar_to_hint\" is\n # almost *ALWAYS* non-empty. Ergo, the above \"if\"\n # conditional reduces to \"if True:\" in most cases. We sigh.\n for hint_base_arg_full_index, hint_base_arg_full in (\n enumerate(hint_base_args_full)):\n # If this hint is a type variable...\n if is_hint_pep484_typevar(hint_base_arg_full):\n # If a concrete (i.e., non-type variable) child hint\n # directly subscripting a sibling pseudo-superclass\n # of this pseudo-superclass has already been\n # \"bubbled up\" into this type variable, preserve\n # that bubbling by re-bubbling up the same child\n # hint back into this type variable. <-- lol\n if hint_base_arg_full in typevar_to_hint:\n # print(f'Rebubbling hint {typevar_to_hint[hint_base_arg]} into...')\n # print(f'base {hint_base} typevar {hint_base_arg}!')\n hint_base_args_full[hint_base_arg_full_index] = ( # type: ignore[index]\n typevar_to_hint[hint_base_arg_full])\n # Else, *NO* child hint directly subscripting a\n # sibling pseudo-superclass of this child\n # pseudo-superclass has already been \"bubbled up\"\n # into this type variable.\n #\n # If this parent pseudo-superclass of this child\n # pseudo-superclass is still directly subscripted by\n # one or more child hints that have yet to \"bubble\n # up\" the class hierarchy (i.e., by replacing the\n # first unused type variable transitively\n # subscripting this child pseudo-superclass),\n # \"bubble up\" the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass into the \"empty placeholder\"\n # signified by this type variable in this list of\n # child hints transitively subscripting this child\n # pseudo-superclass. <-- wat\n elif hint_base_super_args_stack:\n # print(f'Bubbling hint {hint_base_super_args_stack[-1]} into...')\n # print(f'base {hint_base} typevar {hint_base_arg}!')\n hint_base_arg_full_new = (\n hint_base_args_full[hint_base_arg_full_index]) = ( # type: ignore[index]\n hint_base_super_args_stack.pop()) # pyright: ignore\n \n # If the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass is itself a type variable,\n # record that this child pseudo-superclass is\n # now known to be subscripted by at least one\n # type variable.\n if is_hint_pep484_typevar(\n hint_base_arg_full_new):\n # print(f'Recording pseudo {hint_base} typevarred args {hint_base_arg_full}...')\n is_hint_base_arg_typevar = True\n # Else, the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass is *NOT* itself a type\n # variable. In this case, record that this child\n # hint has now been \"bubbled up\" into this type\n # variable for subsequent lookup.\n #\n # Note that bubbling up a type variable into\n # another type variable would be entirely\n # pointless. Type variables are only\n # meaningfully replaceable with concrete hints.\n # Moreover, doing so here would erroneously map\n # this type variable to this other type variable\n # in the \"typevar_to_hint\" dictionary -- which\n # would then inhibit this \"if\" conditional from\n # subsequently bubbling up a concrete hint into\n # this type variable. <-- omg\n else:\n # print(f'Recording non-typevar {hint_base_arg_full} -> {hint_base_arg_full_new}...')\n typevar_to_hint[hint_base_arg_full] = ( # pyright: ignore\n hint_base_arg_full_new)\n # Else, all child hints directly subscripting this\n # parent pseudo-superclass have already been\n # \"bubbled up\" the class hierarchy. But this hint is\n # a type variable! Record that this child\n # pseudo-superclass is now known to be subscripted\n # by at least one type variable.\n else:\n is_hint_base_arg_typevar = True\n #print(f'Bubbled up generic {hint} arg {hint_args[hint_args_index_curr]}...')\n #print(f'...into pseudo-superclass {hint_base} args {hint_base_args}!')\n # Else, this hint is *NOT* a type variable. In this\n # case, preserve this hint and continue to the next.\n \n # Parent list of the zero or more child hints transitively\n # subscripting this parent pseudo-superclass of this\n # pseudo-superclass.\n hint_base_super_args_full = hint_base_super_data[ # pyright: ignore\n _HINT_BASES_INDEX_ARGS_FULL]\n \n # Append to this parent list this child list of all child\n # hints transitively subscripting this pseudo-superclass.\n hint_base_super_args_full.extend(hint_base_args_full) # pyright: ignore\n # print(f'Inspected generic {hint} pseudo-superclass {hint_base} args {hint_base_args}!')\n # Else, this pseudo-superclass is the passed root generic.\n # Else, this pseudo-superclass is transitively unsubscripted.\n \n # If searching for a target pseudo-superclass...\n if hint_base_target:\n # Unsubscripted generic underlying this possibly subscripted\n # pseudo-superclass generic. Strip this pseudo-superclass of\n # *ALL* child hints, allowing this unsubscripted current\n # pseudo-superclass to be compared against this\n # unsubscripted target pseudo-superclass.\n hint_base_type = get_hint_pep484585_generic_type(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # If this pseudo-superclass is the desired target...\n if hint_base_type == hint_base_target:\n # If this target pseudo-superclass is no longer subscripted\n # by any type variables requiring subsequent replacement by\n # concrete child hints, this target pseudo-superclass is\n # *ONLY* subscripted by concrete child hints. In this case,\n # immediately return a tuple of these hints.\n #\n # Note that:\n # * This efficiently short-circuits this recursion in the\n # best case and is one of several reasons to prefer a\n # non-recursive algorithm. This algorithm was initially\n # implemented recursively (supposedly for simplicity);\n # doing so introduced significant unforeseen complications\n # by effectively preventing short-circuiting. After all, a\n # recursive algorithm *CANNOT* efficiently short-circuit\n # up out of a deeply nested recursive call stack --\n # without inefficiently raising an exception, which is so\n # inefficient as to defeat the point in most cases.\n # * This recursion *CANNOT* be short-circuited in the worst\n # case, which occurs when the passed root generic is\n # directly subscripted by a concrete child hint that will\n # only be subsequently \"bubbled up\" into a type hint\n # transitively subscripting this target pseudo-superclass\n # *AFTER* this DFS recurses through the tree of all\n # pseudo-superclasses and back up into this generic. In\n # this worst case, the full dictionary of type variable\n # mappings and thus the list of child hints transitively\n # subscripting this target pseudo-superclass is only\n # decidable *AFTER* this DFS fully recurses out.\n #\n # Consider this torturous hierarchy, in which bubbling up\n # the child hint \"complex\" subscripting the root generic\n # \"ListFloat[complex]\" into the child type variable \"U\"\n # subscripting the child pseudo-superclass \"Generic[U]\"\n # requires recursing through the full tree:\n # >>> from typing import Generic\n # >>> class ListTU(list[T], Generic[U]): pass\n # >>> class ListFloat(ListTU[float]): pass\n # >>> get_hint_pep484585_generic_args_full(\n # ... hint=ListFloat[complex],\n # ... hint_base_target=Generic[U],\n # ... )\n # (complex,)\n if not is_hint_base_arg_typevar:\n return tuple(hint_base_args_full)\n # Else, this target pseudo-superclass is still subscripted\n # by one or more type variables requiring subsequent\n # replacement by concrete child hints. In this case,\n # continue \"bubbling up\" child hints into these type\n # variables. Doing so enables final logic below to replace\n # these type variables with these hints *AFTER* recursing\n # through the full entirety of this DFS.\n \n # List of zero or more child hints transitively subscripting\n # this target pseudo-superclass.\n hint_base_target_args_full = hint_base_args_full\n # print(f'Found target {hint_base} args {hint_base_args_full}!')\n # Else, this pseudo-superclass is *NOT* equal to this target.\n # Else, *NO* target pseudo-superclass is being searched for.\n \n # ....................{ RETURN }....................\n # If the caller passed a target pseudo-superclass...\n if hint_base_target:\n # If the DFS above failed to find the list of zero or more child hints\n # transitively subscripting this target, this DFS failed to find this\n # target. Since this implies this target is *NOT* a pseudo-superclass of\n # this generic, raise an exception.\n if hint_base_target_args_full is None:\n raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'pseudo-superclass target {repr(hint_base_target)} not found.'\n )\n # Else, this DFS found the list of zero or more child hints transitively\n # subscripting this target.\n \n # List of the zero or more child hints transitively subscripting this\n # target pseudo-superclass, to be coerced into a tuple and returned.\n hint_args_full = hint_base_target_args_full\n \n # For the 0-based index of each child hint transitively subscripting\n # this target pseudo-superclass and this hint...\n for hint_arg_full_index, hint_arg_full in enumerate(hint_args_full):\n # If this hint is a type variable...\n if is_hint_pep484_typevar(hint_arg_full):\n # Either:\n # * If a child hint directly subscripting a sibling\n # pseudo-superclass of this target pseudo-superclass has\n # already been \"bubbled up\" into this type variable, preserve\n # that bubbling by re-bubbling up the same child hint back\n # into this # type variable. <-- lol\n # * If *NO* child hint directly subscripting a sibling\n # pseudo-superclass of this target pseudo-superclass has\n # already been \"bubbled up\" into this type variable, preserve\n # this type variable as is.\n hint_args_full[hint_arg_full_index] = typevar_to_hint.get( # pyright: ignore\n hint_arg_full, hint_arg_full) # pyright: ignore\n # Else, this hint is *NOT* a type variable.\n # Else, the caller did *NOT* pass a target pseudo-superclass.\n else:\n # If the metadata describing the passed generic is still its initial size,\n # then the above DFS failed to expand this metadata with the\n # \"_HINT_BASES_INDEX_ARGS_FULL\" index accessed below. In turn, this implies\n # that the above DFS failed to recurse down into the child\n # pseudo-superclasses of this generic. However, by definition, *ALL*\n # generics subclass one or more pseudo-superclasses. The above DFS should\n # have recursed down into those pseudo-superclasses. In this case, raise an\n # exception.\n #\n # Note that this should *NEVER* occur.\n if len(hint_root_data) == _HINT_BASE_DATA_LEN_LEAF: # pragma: no cover\n> raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'pseudo-superclasses not found.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep585SequenceU[complex] pseudo-superclasses not found.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_8rq8l1m_/beartype/_util/hint/pep/proposal/pep484/pep484generic.py:381\nError: beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_bases_unerased(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._data.hint.pep.sign.datapepsignset import HINT_SIGNS_GENERIC\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_bases_unerased)\n from beartype._util.hint.pep.utilpeptest import is_hint_pep_type_typing\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # For each PEP-compliant hint to be tested...\n for hint_pep_meta in hints_pep_meta:\n # If this is a generic hint, assert that this getter returns the\n # expected unerased pseudo-superclasses of this generic.\n if hint_pep_meta.pep_sign in HINT_SIGNS_GENERIC:\n> hint_pep_bases = get_hint_pep484585_generic_bases_unerased(\n hint_pep_meta.hint)\n\n> get_hint_pep484_generic_bases_unerased(\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484_generic_bases_unerased(\n # Mandatory parameters.\n hint: Any,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of all unerased :mod:`typing` **pseudo-superclasses** (i.e.,\n :mod:`typing` objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`-compliant\n **generic** (i.e., class subclassing at least one non-class :mod:`typing`\n object).\n \n This getter is memoized for efficiency.\n \n Parameters\n ----------\n hint : object\n Object to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this\n :mod:`typing` generic. Specifically:\n \n * If this generic defines an ``__orig_bases__`` dunder instance\n variable, the value of that variable as is.\n * Else, the value of the ``__mro__`` dunder instance variable stripped\n of all ignorable classes conveying *no* semantic meaning, including:\n \n * This generic itself.\n * The :class:`object` root superclass.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * *Not* a :mod:`typing` generic.\n * A :mod:`typing` generic that erased *none* of its superclasses but\n whose method resolution order (MRO) lists strictly less than four\n classes. Valid :pep:`484`-compliant generics should list at least\n four classes, including (in order):\n \n #. This class itself.\n #. The one or more :mod:`typing` objects directly subclassed by this\n generic.\n #. The :class:`typing.Generic` superclass.\n #. The zero or more non-:mod:`typing` superclasses subsequently\n subclassed by this generic (e.g., :class:`abc.ABC`).\n #. The :class:`object` root superclass.\n \n See Also\n --------\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n Further details.\n '''\n \n #FIXME: This tuple appears to be implemented erroneously -- at least under\n #Python 3.7, anyway. Although this tuple is implemented correctly for the\n #common case of user-defined types directly subclassing \"typing\" types,\n #this tuple probably is *NOT* implemented correctly for the edge case of\n #user-defined types indirectly subclassing \"typing\" types: e.g.,\n #\n # >>> import collections.abc, typing\n # >>> T = typing.TypeVar('T')\n # >>> class Direct(collections.abc.Sized, typing.Generic[T]): pass\n # >>> Direct.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n # >>> class Indirect(collections.abc.Container, Direct): pass\n # >>> Indirect.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n #\n #*THAT'S COMPLETELY INSANE.* Clearly, their naive implementation failed to\n #account for actual real-world use cases.\n #\n #On the bright side, the current implementation prevents us from actually\n #having to perform a breadth-first traversal of all original superclasses\n #of this class in method resolution order (MRO). On the dark side, it's\n #pants-on-fire balls -- but there's not much we can do about that. *sigh*\n #\n #If we ever need to perform that breadth-first traversal, resurrect this:\n #\n # # If this class was *NOT* subject to type erasure, reduce to a noop.\n # if not hint_bases:\n # return hint_bases\n #\n # # Fixed list of all typing super attributes to be returned.\n # superattrs = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based index of the last item of this list.\n # superattrs_index = 0\n #\n # # Fixed list of all transitive superclasses originally listed by this\n # # class iterated in method resolution order (MRO).\n # hint_orig_mro = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based indices of the current and last items of this list.\n # hint_orig_mro_index_curr = 0\n # hint_orig_mro_index_last = 0\n #\n # # Initialize this list with the tuple of all direct superclasses of this\n # # class, which iteration then expands to all transitive superclasses.\n # hint_orig_mro[:len(hint_bases)] = hint_bases\n #\n # # While the heat death of the universe has been temporarily forestalled...\n # while (True):\n # # Currently visited superclass of this class.\n # hint_base = hint_orig_mro[hint_orig_mro_index_curr]\n #\n # # If this superclass is a typing attribute...\n # if is_hint_pep_type_typing(hint_base):\n # # Avoid inserting this attribute into the \"hint_orig_mro\" list.\n # # Most typing attributes are *NOT* actual classes and those that\n # # are have no meaningful public superclass. Ergo, iteration\n # # terminates with typing attributes.\n # #\n # # Insert this attribute at the current item of this list.\n # superattrs[superattrs_index] = hint_base\n #\n # # Increment this index to the next item of this list.\n # superattrs_index += 1\n #\n # # If this class subclasses more than the maximum number of \"typing\"\n # # attributes supported by this function, raise an exception.\n # if superattrs_index >= FIXED_LIST_SIZE_MEDIUM:\n # raise BeartypeDecorHintPep560Exception(\n # '{} PEP type {!r} subclasses more than '\n # '{} \"typing\" types.'.format(\n # exception_prefix,\n # hint,\n # FIXED_LIST_SIZE_MEDIUM))\n # # Else, this superclass is *NOT* a typing attribute. In this case...\n # else:\n # # Tuple of all direct superclasses originally listed by this class\n # # prior to PEP 484 type erasure if any *OR* the empty tuple\n # # otherwise.\n # hint_base_bases = getattr(hint_base, '__orig_bases__')\n #\n # #FIXME: Implement breadth-first traversal here.\n #\n # # Tuple sliced from the prefix of this list assigned to above.\n # superattrs_tuple = tuple(superattrs[:superattrs_index])\n #\n # # Release and nullify this list *AFTER* defining this tuple.\n # release_fixed_list(superattrs)\n # del superattrs\n #\n # # Return this tuple as is.\n # return superattrs_tuple\n #\n #Also resurrect this docstring snippet:\n #\n # Raises\n # ----------\n # BeartypeDecorHintPep560Exception\n # If this object defines the ``__orig_bases__`` dunder attribute but that\n # attribute transitively lists :data:`FIXED_LIST_SIZE_MEDIUM` or more :mod:`typing`\n # attributes.\n #\n #Specifically:\n # * Acquire a fixed list of sufficient size (e.g., 64). We probably want\n # to make this a constant in \"utilcachelistfixedpool\" for reuse\n # everywhere, as this is clearly becoming a common idiom.\n # * Slice-assign \"__orig_bases__\" into this list.\n # * Maintain two simple 0-based indices into this list:\n # * \"bases_index_curr\", the current base being visited.\n # * \"bases_index_last\", the end of this list also serving as the list\n # position to insert newly discovered bases at.\n # * Iterate over this list and keep slice-assigning from either\n # \"__orig_bases__\" (if defined) or \"__mro__\" (otherwise) into\n # \"list[bases_index_last:len(__orig_bases__)]\". Note that this has the\n # unfortunate disadvantage of temporarily iterating over duplicates,\n # but... *WHO CARES.* It still works and we subsequently\n # eliminate duplicates at the end.\n # * Return a frozenset of this list, thus implicitly eliminating\n # duplicate superclasses.\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_type_or_none)\n \n # If this hint is *NOT* a class, reduce this hint to the object originating\n # this hint if any. See is_hint_pep484_generic() for details.\n hint = get_hint_pep484585_generic_type_or_none(hint)\n \n # If this hint is *NOT* a PEP 484- or 544-compliant generic, raise an\n # exception.\n if not is_hint_pep484_generic_unsubscripted(hint):\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} neither '\n f'PEP 484 generic nor PEP 544 protocol.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #12: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #13: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #14: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #15: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.128128000000001, "in_degree": 3, "true_in_degree": 29.720000000000017, "out_degree": 2, "betweenness": 0.00014270643660221395, "pagerank": 0.001307520340021915, "harmonic": 0.008251096491228072, "bidirectional_harmonic": 0.21368341545150796, "degree": 5 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/_pep/pep484/redpep484typevar.py", "function_name": "_get_hint_pep484_typevars_to_hints", "test_info": { "success": false, "failed": 11, "passed": 1119, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_h577frvb/beartype/_check/metadata/metasane.py:124\nError: AssertionError: None not frozen dictionary.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n assert TypeHint(hint_ignorable).is_ignorable is True\n \n # Assert this property:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # Hint to be tested.\n hint = hint_pep_meta.hint\n \n # True only if the @beartype decorator currently ignores this hint.\n hint_is_ignorable = hint_pep_meta.is_ignorable\n \n # If this hint is a type variable...\n #\n # Note that the @beartype decorator and the \"beartype.door\" API\n # currently disagree as to whether type variables are ignorable. From:\n # the perspective of:\n # * The low-level @beartype decorator, they mostly are.\n # * The high-level \"beartype.door\" API, they mostly are *NOT*.\n #\n # Since the \"hint_pep_meta.is_ignorable\" variable reflects the\n # perspective of the @beartype decorator rather than the \"beartype.door\"\n # API, further logic is needed to decide whether this type variable is\n # actually ignorable from the \"beartype.door\" perspective.\n if isinstance(hint, TypeVar):\n # Type hint synthesized from all bounded constraints parametrizing\n # this type variable if any *OR* \"None\" otherwise.\n hint_typevar_bound = get_hint_pep484_typevar_bound_or_none(hint)\n \n # This type hint is ignorable only if either...\n hint_is_ignorable = (\n # This type hint is unconstrained *OR*...\n hint_typevar_bound is None or\n # This type hint is constrained by one or more ignorable\n # constraints.\n sanify_hint_child(hint_typevar_bound) is Any\n )\n # Else, this hint is *NOT* a type variable.\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints. Most of these will be\n #\"BeartypeDoorNonpepException\", but there are some covariant type hints\n #(e.g. numpy.dtype[+ScalarType]) that will raise a \"not invariant\"\n #exception in the \"TypeVarTypeHint\" subclass.\n with suppress(BeartypeDoorException):\n> assert TypeHint(hint).is_ignorable is hint_is_ignorable\n\n> return sanify_hint_child(self._hint) is Any # pyright: ignore\n\n> hint_or_sane = reduce_hint(\n\n> hint_or_sane = _reduce_hint_cached(hint, conf, exception_prefix)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> hint = hint_reducer( # type: ignore[call-arg]\n\n> hint_reduced = reduce_hint_pep484_subscripted_typevar_to_hint(hint)\n\n> hint_or_sane = HintSanifiedData(\n\n> def __init__(\n self,\n \n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n typevar_to_hint: TypeVarToHint = FROZENDICT_EMPTY,\n ) -> None:\n '''\n Initialize this sanified type hint metadata with the passed parameters.\n \n Parameters\n ----------\n hint : Hint\n Type hint sanified (i.e., sanitized) from a possibly insane type\n hint into a hopefully sane type hint by a\n :mod:`beartype._check.convert.convsanify` function.\n typevar_to_hint : TypeVarToHint, optional\n **Type variable lookup table** describing this type hint, defined as\n an immutable dictionary mapping from the :pep:`484`-compliant **type\n variables** (i.e., :class:`typing.TypeVar` objects) originally\n parametrizing the origin of this type hint if any to the\n corresponding child type hints subscripting this type hint. Defaults\n to the empty table.\n '''\n> assert isinstance(typevar_to_hint, FrozenDict), (\n f'{repr(typevar_to_hint)} not frozen dictionary.')\nE AssertionError: None not frozen dictionary.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable\nLocation: /tmp/benchmark_h577frvb/beartype/_check/metadata/metasane.py:124\nError: AssertionError: None not frozen dictionary.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_reduce_hint_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer with\n respect to ignorable hints.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # Defer test-specific imports.\n from beartype.typing import Any\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP_UNIGNORABLE)\n \n # Assert this tester accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n assert reduce_hint(hint_ignorable) is Any\n \n # Assert this tester rejects unignorable PEP-noncompliant type hints.\n for hint_unignorable in HINTS_NONPEP_UNIGNORABLE:\n assert reduce_hint(hint_unignorable) is not Any\n \n # Assert this tester:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # True only if this hint reduces to the ignorable \"Any\" singleton.\n> is_hint_ignorable = reduce_hint(hint_pep_meta.hint) is Any\n\n> hint_or_sane = _reduce_hint_cached(hint, conf, exception_prefix)\n\n> raise exception # pyright: ignore\n\n> result: TResult | None = func()\n\n> lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise\n\n> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)\n\n> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n\n> yield from thread_exception_runtest_hook()\n\n> yield\n\n> yield from unraisable_exception_runtest_hook()\n\n> yield\n\n> yield from self._runtest_for(item, \"call\")\n\n> yield\n\n> return (yield)\n\n> return (yield)\n\n> item.runtest()\n\n> self.ihook.pytest_pyfunc_call(pyfuncitem=self)\n\n> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)\n\n> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n\n> result = testfunction(**testargs)\n\n> assert TypeHint(hint).is_ignorable is hint_is_ignorable\n\n> return sanify_hint_child(self._hint) is Any # pyright: ignore\n\n> hint_or_sane = reduce_hint(\n\n> hint_or_sane = _reduce_hint_cached(hint, conf, exception_prefix)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> hint = hint_reducer( # type: ignore[call-arg]\n\n> hint_reduced = reduce_hint_pep484_subscripted_typevar_to_hint(hint)\n\n> hint_or_sane = HintSanifiedData(\n\n> def __init__(\n self,\n \n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n typevar_to_hint: TypeVarToHint = FROZENDICT_EMPTY,\n ) -> None:\n '''\n Initialize this sanified type hint metadata with the passed parameters.\n \n Parameters\n ----------\n hint : Hint\n Type hint sanified (i.e., sanitized) from a possibly insane type\n hint into a hopefully sane type hint by a\n :mod:`beartype._check.convert.convsanify` function.\n typevar_to_hint : TypeVarToHint, optional\n **Type variable lookup table** describing this type hint, defined as\n an immutable dictionary mapping from the :pep:`484`-compliant **type\n variables** (i.e., :class:`typing.TypeVar` objects) originally\n parametrizing the origin of this type hint if any to the\n corresponding child type hints subscripting this type hint. Defaults\n to the empty table.\n '''\n> assert isinstance(typevar_to_hint, FrozenDict), (\n f'{repr(typevar_to_hint)} not frozen dictionary.')\nE AssertionError: None not frozen dictionary.\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py::test_get_hint_pep484_typevars_to_hints", "Failure #4: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py::test_reduce_hint_pep484_subscripted_typevar_to_hint", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #11: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint_ignorable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 17.083238400000006, "in_degree": 1, "true_in_degree": 1.8, "out_degree": 5, "betweenness": 3.793462238793029e-05, "pagerank": 0.0003000410509031199, "harmonic": 0.02275610902255639, "bidirectional_harmonic": 0.22052598351940475, "degree": 6 }, "line_count": 63, "code_line_count": 63, "cyclomatic": 13, "halstead_volume": 70.32403072095333, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextansi.py", "function_name": "color_attr_name", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_callable\nLocation: /tmp/benchmark_r823pbh7/beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py:123\nError: AssertionError: assert 'like_snakes_that_watch_their_prey' in 'functionNone'\n + where 'like_snakes_that_watch_their_prey' = .__name__\n\nTraceback:\n\n> def test_label_callable() -> None:\n '''\n Test the :func:`beartype._util.text.utiltextlabel.label_callable`\n function.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.text.utiltextlabel import label_callable\n from beartype_test.a00_unit.data.data_type import (\n async_coroutine_factory,\n async_generator_factory,\n sync_generator_factory,\n )\n from beartype_test.a00_unit.data.util.mod.data_utilmodule_line import (\n like_snakes_that_watch_their_prey,\n ozymandias,\n which_yet_survive,\n )\n \n # ....................{ PASS }....................\n # Assert this labeller labels an on-disk lambda function as expected.\n two_vast_and_trunkless_legs_of_stone = label_callable(ozymandias)\n assert isinstance(two_vast_and_trunkless_legs_of_stone, str)\n assert 'lambda' in two_vast_and_trunkless_legs_of_stone\n \n # Assert this labeller labels an in-memory lambda function as expected.\n the_hand_that_mocked_them = label_callable(which_yet_survive)\n assert isinstance(the_hand_that_mocked_them, str)\n assert 'lambda' in the_hand_that_mocked_them\n \n # Assert this labeller labels an on-disk non-lambda callable as expected.\n tell_that_its_sculptor_well_those_passions_read = label_callable(\n like_snakes_that_watch_their_prey)\n assert isinstance(tell_that_its_sculptor_well_those_passions_read, str)\n> assert like_snakes_that_watch_their_prey.__name__ in (\n tell_that_its_sculptor_well_those_passions_read)\nE AssertionError: assert 'like_snakes_that_watch_their_prey' in 'functionNone'\nE + where 'like_snakes_that_watch_their_prey' = .__name__\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype\nLocation: /tmp/benchmark_r823pbh7/beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py:241\nError: assert False\n + where False = ('Function ')\n + where = 'FunctionNone parameter hint_param=[\\'Oboes\u2010obsoleting tines\\', \\'Of language\\'] violates type hint typing.Hashable, as list [\\'Oboes\u2010obsoleting tines\\', \\'Of language\\'] not instance of .'.startswith\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_beartype(iter_hints_piths_meta) -> None:\n '''\n Test the :func:`beartype.beartype` decorator with respect to type-checking\n code dynamically generated by the\n :mod:`beartype._decor.wrap.wrapmain` submodule.\n \n This unit test effectively acts as a functional test and is thus the core\n test exercising decorator functionality from the end user perspective --\n the only perspective that matters in the end. Unsurprisingly, this test is\n mildly more involved than most. *Whatevah.*\n \n This test additionally attempts to avoid similar issues to a `prior issue\n `__ of this decorator induced by repeated\n :func:`beartype.beartype` decorations of different callables annotated by\n one or more of the same PEP-compliant type hints.\n \n .. _issue #5:\n https://github.com/beartype/beartype/issues/5\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintViolation\n from beartype._util.text.utiltextansi import strip_str_ansi\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n # HintPepMetadata,\n HintPithUnsatisfiedMetadata,\n )\n from beartype_test._util.pytroar import raises_uncached\n # from pytest import warns\n # from pytest import deprecated_call\n from re import search\n # from warnings import simplefilter\n \n # ....................{ MAIN }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n # simplefilter('always')\n \n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # ....................{ LOCALS }....................\n # Metadata describing this hint.\n hint_meta = hint_pith_meta.hint_meta\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Object to type-check against this hint.\n pith = hint_pith_meta.pith\n \n # Metadata describing this pith.\n pith_meta = hint_pith_meta.pith_meta\n # print(f'Type-checking PEP type hint {repr(hint_meta.hint)}...')\n \n # Beartype decorator configured specifically for this hint.\n beartype_confed = beartype(conf=hint_meta.conf)\n \n def func_untyped(hint_param: hint) -> hint:\n '''\n Undecorated function both accepting a single parameter and returning\n a value annotated by this hint whose implementation trivially\n reduces to the identity function.\n '''\n \n return hint_param\n \n #FIXME: For unknown and probably uninteresting reasons, the\n #pytest.warns() context manager appears to be broken on our\n #local machine. We have no recourse but to unconditionally\n #ignore this warning at the module level. So much rage!\n #FIXME: It's likely this has something to do with the fact that\n #Python filters deprecation warnings by default. This is almost\n #certainly a pytest issue. Since this has become fairly\n #unctuous, we should probably submit a pytest issue report.\n #FIXME: Actually, pytest now appears to have explicit support for\n #testing that a code block emits a deprecation warning:\n # with pytest.deprecated_call():\n # myfunction(17)\n #See also: https://docs.pytest.org/en/6.2.x/warnings.html#ensuring-code-triggers-a-deprecation-warning\n #FIXME: Fascinatingly, warns() still refuses to capture warnings.\n #Although we certainly could call deprecated_call(), doing so is\n #stymied by the fact that\n #\"BeartypeDecorHintPep585DeprecationWarning\" does *NOT* subclass the\n #standard \"DeprecationWarning\" class. *sigh*\n #FIXME: *NONSENSE*! It's 2024 and we *STILL* can't get this to work.\n #It's been bloody years. It just doesn't work and there's *NO*\n #reasonable means for us to debug why. We've tried literally everything:\n #pytest.deprecated_call(), pytest.warns(), warnings.simplefilter().\n #Nuthin'. Pytest simply refuses to catch deprecation warnings. Kinda fed\n #up with the whole thing, honestly.\n #FIXME: *FASCINATING*. The comparable test_decor_pep613() unit test\n #successfully tests deprecation warnings emitted by the @beartype\n #decorator with the trivial pytest.warns() + warnings.simplefilter()\n #combo. So... why does doing so here fail? Some combination of iteration\n #and closures would seem to be the likely culprit. Notably, \"pylint\"\n #complains this about the above definition of func_untyped():\n # cell-var-from-loop: Cell variable \"hint\" defined in loop\n #\n #It seems likely a similar issue is obstructing testing here.\n #FIXME: ...huh. This is Bizarro World stuff. We tried extricating this\n #logic into the comparable test_door_is_bearable() test, which also\n #iterates but *WITHOUT* defining closures. That test still fails to\n #capture deprecation warnings. So... it's iteration? Really? *OH*. The\n #iter_hints_piths_meta() iterator is itself defined as a closure of a\n #session-scoped fixture. Welp, that's almost certainly it. Something\n #about that fundamentally obstructs capturing of deprecation warnings.\n #Our only recourse now is to try:\n #* Defining a new test_hint_warnings() unit test.\n #* Manually iterating over type hints in that test *WITHOUT* calling\n # iter_hints_piths_meta(). Instead, extricate the import aspects of\n # iter_hints_piths_meta() into a simple \"for\" loop. Avoid anything\n # extraneous (e.g., repetition, context managers).\n #FIXME: *THAT WAS IT*. Our new test_hint_warnings() unit test\n #successfully captures deprecation warnings. So. It's our session-scoped\n #iter_hints_piths_meta() fixture closure, huh? Well, at least that sorta\n #makes sense. This is *DEFINITELY* a pytest issue -- but good luck\n #reducing that one to a minimal-length reproducible working example.\n \n # # @beartype-generated wrapper function type-checking that function.\n # func_typed = None\n #\n # # If this beartype decorator emits a warning for this hint...\n # if hint_meta.warning_type is not None:\n # with deprecated_call():\n # # Decorate that function under a context manager asserting this\n # # decoration to emit the expected warning.\n # # with warns(hint_meta.warning_type):\n # func_typed = beartype_confed(func_untyped)\n # # Else, this beartype decorator emits *NO* warning for this hint. In\n # # this case, decorate this callable as is.\n # else:\n # func_typed = beartype_confed(func_untyped)\n func_typed = beartype_confed(func_untyped)\n \n # ....................{ VIOLATE }....................\n # If this pith violates this hint...\n if isinstance(pith_meta, HintPithUnsatisfiedMetadata):\n # ....................{ EXCEPTION ~ type }....................\n # Assert this wrapper function raises the expected exception when\n # type-checking this pith against this hint.\n with raises_uncached(BeartypeCallHintViolation) as exception_info:\n func_typed(pith)\n \n # Exception captured by the prior call to this wrapper function.\n exception = exception_info.value\n \n # Exception type localized for debuggability. Sadly, the\n # pytest.ExceptionInfo.__repr__() dunder method fails to usefully\n # describe its exception metadata.\n exception_type = exception_info.type\n \n # Assert this exception metadata describes the expected exception\n # as a sanity check against upstream pytest issues and/or issues\n # with our raises_uncached() context manager.\n assert issubclass(exception_type, BeartypeCallHintViolation)\n \n # Assert this exception to be public rather than private. The\n # @beartype decorator should *NEVER* raise a private exception.\n assert exception_type.__name__[0] != '_'\n \n # ....................{ EXCEPTION ~ culprits }....................\n # Tuple of the culprits responsible for this exception, localized to\n # avoid inefficiently recomputing these culprits on each access.\n exception_culprits = exception.culprits\n \n # Assert that this tuple both exists *AND* is non-empty.\n assert isinstance(exception_culprits, tuple)\n assert exception_culprits\n \n # First culprit, which *SHOULD* be either:\n # * If this pith can be weakly referenced, this pith.\n # * Else, this pith *CANNOT* be weakly referenced. In this case,\n # fallback to the truncated representation of this pith.\n culprit_pith = exception_culprits[0]\n \n # If the first culprit is a string...\n if isinstance(culprit_pith, str):\n # Assert that this string is non-empty.\n assert culprit_pith\n # Else, the first culprit is *NOT* a string. In this case...\n else:\n # Assert that the first culprit is this pith.\n assert culprit_pith is pith\n \n # If two or more culprits were responsible...\n if len(exception_culprits) >= 2:\n # For each culprit following the first...\n for culprit_nonpith in exception_culprits[1:]:\n # Assert that this subsequent culprit is *NOT* the pith.\n assert culprit_nonpith is not pith\n \n # ....................{ EXCEPTION ~ message }....................\n # Exception message raised by this wrapper function.\n exception_str = str(exception)\n exception_str = strip_str_ansi(exception_str)\n # print('exception message: {}'.format(exception_str))\n \n # Assert this exception message is prefixed by a substring\n # identifying the decorated callable with a human-readable label.\n> assert exception_str.startswith('Function ')\nE assert False\nE + where False = ('Function ')\nE + where = 'FunctionNone parameter hint_param=[\\'Oboes\u2010obsoleting tines\\', \\'Of language\\'] violates type hint typing.Hashable, as list [\\'Oboes\u2010obsoleting tines\\', \\'Of language\\'] not instance of .'.startswith\n", "Failure #3: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #4: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py", "test_label_callable" ], [ "beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py", "test_beartype" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 2, "true_in_degree": 12.720000000000002, "out_degree": 1, "betweenness": 0.00012735194658805167, "pagerank": 0.000420324609687433, "harmonic": 0.0024671052631578946, "bidirectional_harmonic": 0.21943281499202602, "degree": 3 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 3, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_decor/_decortype.py", "function_name": "beartype_type", "test_info": { "success": false, "failed": 24, "passed": 1106, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic\nLocation: /tmp/benchmark_0kcx6v8r/beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py:54\nError: TypeError: beartype..beartype_confed() missing 1 required positional argument: 'obj'\n\nTraceback:\n\n> def test_decor_type_basic() -> None:\n '''\n Test decoration of user-defined classes by the :func:`beartype.beartype`\n decorator from the perspective of basic usability.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from pytest import raises\n \n # ....................{ CLASSES }....................\n # Intentionally redecorate a class twice by the @beartype decorator,\n # exercising an edge case in class decoration.\n @beartype\n @beartype\n class FromHisInnocuousHand(object):\n '''\n Arbitrary class defining one or more arbitrary annotated methods.\n '''\n \n # ....................{ METHODS }....................\n def his_bloodless_food(self, lured_by_the_gentle_meaning: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(lured_by_the_gentle_meaning)\n \n # ....................{ LOCALS }....................\n # Arbitrary instance of this class.\n> of_his_looks = FromHisInnocuousHand()\nE TypeError: beartype..beartype_confed() missing 1 required positional argument: 'obj'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested\nLocation: /tmp/benchmark_0kcx6v8r/beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py:187\nError: TypeError: beartype..beartype_confed() missing 1 required positional argument: 'obj'\n\nTraceback:\n\n> def test_decor_type_nested() -> None:\n '''\n Test decoration of user-defined classes nested inside user-defined classes\n by the :func:`beartype.beartype` decorator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from pytest import raises\n \n # ....................{ LOCALS }....................\n class ForHisCouch(object):\n '''\n Arbitrary class *not* decorated by :func:`beartype.beartype`.\n '''\n \n def and_stole(self, from_duties_and_repose: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(from_duties_and_repose)\n \n \n # Intentionally redecorate a class twice by the @beartype decorator,\n # exercising an edge case in class decoration.\n @beartype\n @beartype\n class TheThrillingSecretsOf(object):\n '''\n Arbitrary parent class decorated by :func:`beartype.beartype` containing\n an arbitrary nested child class *not* decorated by\n :func:`beartype.beartype`, exercising that the decoration of this parent\n class implicitly decorates this child class.\n '''\n \n # ....................{ CLASS VARIABLES }....................\n from_her_fathers_tent: type = object\n '''\n Class variable whose value is the root :class:`object` superclass.\n \n This variable exercises an edge cases in :func:`beartype.beartype`.\n Previously, :func:`beartype.beartype` erroneously conflated class\n variables whose values are types with nested classes by decorating the\n former as if they were the latter. In the best case, doing so decorated\n external classes *not* intended to be decorated; in the worst case,\n doing so provoked infinite recursion.\n \n This variable exercises that worst case. Notably:\n \n * :class:`enum.Enum` subclasses as follows:\n \n #. *All* :class:`enum.Enum` subclasses define a private\n ``_member_type_`` attribute whose value is the :class:`object`\n superclass, which :func:`beartype.beartype` then decorated.\n #. However, the :class:`object` superclass defines the ``__class__``\n dunder attribute whose value is the :class:`type` superclass, which\n :func:`beartype.beartype` then decorated.\n #. However, the :class:`type` superclass defines the ``__base__``\n dunder attribute whose value is the :class:`object` superclass,\n which :func:`beartype.beartype` then decorated.\n #. **INFINITE FRIGGIN' RECURSION.** Anarchy today.\n '''\n \n \n and_spread_her_matting: type = type\n '''\n Class variable whose value is the root :class:`type` superclass,\n exercising the same edge case as the prior class variable.\n '''\n \n \n to_tend_his_steps: type = ForHisCouch\n '''\n Class variable whose value is a user-defined class that is neither the\n root :class:`object` nor :class:`type` superclasses.\n \n This variable exercises the aforementioned best case: namely, that\n :func:`beartype.beartype` no longer erroneously decorates external\n classes *not* intended to be decorated when those classes are the values\n of class variables.\n '''\n \n # ....................{ METHODS }....................\n def of_the_birth(self, of_time: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(of_time)\n \n # ....................{ NESTED }....................\n class MeanwhileAMaiden(object):\n '''\n Arbitrary nested child class *not* decorated by\n :func:`beartype.beartype`.\n '''\n \n def brought_his_feed(self, her_daily_portion: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(her_daily_portion)\n \n \n # Arbitrary instance of these classes.\n enamoured = ForHisCouch()\n> yet_not_daring = TheThrillingSecretsOf()\nE TypeError: beartype..beartype_confed() missing 1 required positional argument: 'obj'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #19: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #21: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #22: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #23: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #24: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py", "test_decor_type_basic" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py", "test_decor_type_nested" ] ] }, "complexity_info": { "centrality": { "distance_discount": 33.94506547200001, "in_degree": 1, "true_in_degree": 3.8800000000000003, "out_degree": 3, "betweenness": 5.4192317697043266e-05, "pagerank": 0.0004883098366994718, "harmonic": 0.03865392648287383, "bidirectional_harmonic": 0.18343722706387253, "degree": 4 }, "line_count": 39, "code_line_count": 39, "cyclomatic": 10, "halstead_volume": 91.73835003173087, "halstead_difficulty": 2.6923076923076925 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep585.py", "function_name": "is_hint_pep585_generic_unsubscripted", "test_info": { "success": false, "failed": 24, "passed": 1106, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_txfi9j28/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:705\nError: beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic pseudo-superclasses not found.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484585_generic_args_full(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n hint_base_target: Optional[Hint] = None,\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> TupleHints:\n '''\n Tuple of the one or more **full child type hints** (i.e., complete tuple of\n *all* type hints directly subscripting both the passed generic *and*\n one or more pseudo-superclasses of this generic) transitively subscripting\n the passed :pep:`484`- or :pep:`585`-compliant **generic** (i.e., class\n superficially subclassing at least one PEP-compliant type hint that is\n possibly *not* an actual class) if this object is a generic *or* raise an\n exception otherwise (i.e., if this object is not a generic).\n \n This getter greedily replaces in the passed tuple as many abstract\n :pep:`484`-compliant **type variables** (i.e., :class:`typing.TypeVar`\n objects) as there are concrete child type hints directly subscripting the\n passed generic. Doing so effectively \"bubbles up\" these concrete children up\n the class hierarchy into the \"empty placeholders\" established by the type\n variables transitively subscripting all pseudo-superclasses of this generic.\n \n This getter is guaranteed to return a non-empty tuple. By definition, a\n generic subclasses one or more generic superclasses necessarily subscripted\n by one or more child type hints.\n \n This getter is memoized for efficiency.\n \n Caveats\n -------\n **This getter is computationally complex in both space and time.** This\n getter exhibits:\n \n * Amortized :math:`O(1)` constant time complexity, thanks to memoization.\n * Non-amortized worst-case :math:`O(jk)` quadratic time complexity for:\n \n * :math:`j` the largest number of child type hints transitively\n subscripting a pseudo-superclass of this generic.\n * :math:`k` the total number of transitive pseudo-superclasses of this\n generic.\n \n **This getter is currently implemented with recursion.** Doing so yields a\n relatively trivial algorithm at a relatively non-trivial increase in runtime\n overhead, due to overhead associated with function calls in Python.\n \n Parameters\n ----------\n hint : object\n Generic type hint to be inspected.\n hint_base_target : Optional[Hint] = None\n **Target pseudo-superclass** (i.e., erased transitive pseudo-superclass\n of the passed generic to specifically search, filter, and return the\n child type hints of). Defaults to :data:`None`. Specifically:\n \n * If this parameter is :data:`None`, this getter returns the complete\n tuple of *all* type hints directly subscripting both the passed\n generic *and* one or more pseudo-superclasses of this generic.\n * If this parameter is *not* :data:`None`, this getter returns the\n partial tuple of *only* type hints directly subscripting both the\n passed generic *and* this passed pseudo-superclass of this generic.\n \n A target pseudo-superclass is passed to deduce whether two generics are\n related according to the :func:`beartype.door.is_subhint` relation. If\n all child type hints in the tuple returned by this getter (when passed\n some generic and its pseudo-superclass) are subhints of all child type\n hints in the tuple returned by this getter passed *only* that\n pseudo-superclass, then that generic is necessarily a subhint of that\n pseudo-superclass. Look. Just go with it, people.\n \n Lastly, note that this getter intentionally ignores *all* child hints\n subscripting this target pseudo-superclass. For search purposes, *any*\n child hints subscripting this target pseudo-superclass are not only\n irrelevant but harmful -- promoting false negatives in higher-level\n functions (e.g., :func:`beartype.door.is_subhint`) internally leveraging\n this lower-level getter. Ignoring these child hints is thus imperative.\n Since deciding child hint compatibility between the passed generic and\n this target pseudo-superclass is a non-trivial decision problem, this\n lower-level getter defers that problem to the caller by unconditionally\n returning the same result regardless of child hints subscripting this\n target pseudo-superclass.\n \n For example, consider the :pep:`484`-compliant :obj:`typing.Any`.\n Clearly, this getter should return the same tuple when passed an\n unsubscripted target pseudo-superclass as when passed a target\n pseudo-superclass subscripted by :obj:`typing.Any`: e.g.,\n \n .. code-block:: pycon\n \n >>> from typing import Any, Generic\n >>> class MuhGeneric[S, T](Generic[S, T]): pass\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[Any])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[S, T])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[int, float])\n (S, T)\n \n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`.BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n Tuple[Hint, ...]\n Tuple of the one or more full child type hints transitively subscripting\n this generic.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * Neither a :pep:`484`- nor :pep:`585`-compliant generic.\n * A :pep:`484`- or :pep:`585`-compliant generic subclassing *no*\n pseudo-superclasses.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.typing import Generic, TypeVar\n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_args_full)\n \n >>> S = TypeVar('S')\n >>> T = TypeVar('T')\n \n >>> class GenericSuperclass(Generic[S], list[T]): pass\n >>> class GenericList(list[complex]): pass\n >>> class GenericSubclass(GenericSuperclass[int, T], GenericList): pass\n \n >>> get_hint_pep484585_generic_args_full(GenericSuperclass)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(GenericSuperclass[int, float])\n (int, float)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass)\n (int, T, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n '''\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception type.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # ....................{ IMPORTS }....................\n # Avoid circular import dependencies.\n from beartype._util.hint.pep.utilpepget import get_hint_pep_args\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic_user)\n \n # ....................{ PREAMBLE }....................\n # If the caller explicitly passed a pseudo-superclass target...\n #\n # Note that this is the common case for this getter and thus tested first.\n if hint_base_target:\n hint_base_target = (\n # If this pseudo-superclass target is this generic, this\n # pseudo-superclass target is effectively meaningless (albeit\n # technically valid). In this case, silently ignore this\n # pseudo-superclass target.\n None\n if hint is hint_base_target else\n # Else, this pseudo-superclass target is *NOT* this generic. In this\n # case, the unsubscripted generic underlying this possibly\n # subscripted target pseudo-superclass generic. See the docstring.\n get_hint_pep484585_generic_type( # pyright: ignore\n hint=hint_base_target,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n )\n # Else, the caller passed *NO* pseudosuperclass target. In this case...\n \n # ....................{ LOCALS }....................\n # Metadata describing the passed generic, used to seed the depth-first\n # search (DFS) below with the first pseudo-superclass to be visited.\n hint_root_data = [\n # This generic.\n hint,\n \n # Metadata describing the direct parent pseudo-superclass of this\n # generic. By definition, this generic is the root of this n-ary tree\n # and thus has *NO* parent (either direct or indirect).\n None,\n ]\n \n # Unvisited pseudo-superclass stack (i.e., efficiently poppable list of\n # metadata describing *ALL* unvisited transitive pseudo-superclasses of this\n # generic, intentionally reordered in reverse order to enable the\n # non-recursive depth-first search (DFS) performed below to both visit and\n # pop these pseudo-superclasses in the expected order), seeded with metadata\n # describing the passed generic.\n #\n # Each item of this stack is a list of metadata describing an unvisited\n # transitive pseudo-superclass of this generic such that this list is\n # either:\n # * If this pseudo-superclass has yet to be visited by this DFS, a 2-list\n # \"(hint, hint_super_data)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is either:\n # * If this pseudo-superclass has a parent pseudo-superclass, the item\n # of this stack describing that parent pseudo-superclass.\n # * Else, this pseudo-superclass is the passed generic. Since this\n # generic has *NO* parent pseudo-superclass, \"None\".\n # * If this pseudo-superclass is itself a user-defined generic (i.e.,\n # defined by a third-party downstream package) that has already been\n # visited by this DFS, a 4-list \"(hint, hint_super_data, hint_args_stack,\n # hint_args_full)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is as defined above.\n # * \"hint_args_stack\" is this pseudo-superclass' direct child hint stack\n # (i.e., list of the zero or more child hints directly subscripting this\n # pseudo-superclass in reverse order, embodying an efficiently poppable\n # stack of these hints), popped off while recursing up from the child\n # pseudo-superclasses of this pseudo-superclass.\n # * \"hint_args_full\" is the list of zero or more child hints transitively\n # subscripting this pseudo-superclass, defined while recursing up from\n # the child pseudo-superclasses of this pseudo-superclass.\n #\n # In short, there be dragons here -- albeit extremely efficient dragons.\n hint_bases_data: _HintBasesData = [hint_root_data]\n \n # Dictionary mapping from each previously observed PEP 484-compliant type\n # variable (i.e., \"typing.TypeVar\" object) subscripting a transitive\n # pseudo-superclass of this generic to the corresponding child hint \"bubbled\n # up\" from a subclass of that pseudo-superclass into that type variable.\n #\n # This dictionary enables the DFS below to reliably \"bubble up\" a single\n # child hint to the same type variable appearing multiple times throughout a\n # generics hierarchy. For example, this dictionary enables the \"int\" child\n # hint subscripting the \"GenericList\" generic to be \"bubbled up\" into the\n # type variable \"T\" subscripting the pseudo-superclasses \"List\" and\n # \"Generic\" of this generic: e.g.,\n # >>> class GenericList[T](List[T], Generic[T]): pass\n # >>> get_hint_pep484585_generic_args_full(GenericList[int])\n # (int, int)\n #\n # For the above call, this contents of this dictionary resemble:\n # typevar_to_hint = {T: int}\n typevar_to_hint: TypeVarToHint = {}\n \n # ....................{ LOCALS ~ target }....................\n # List of zero or more child hints transitively subscripting the passed\n # target pseudo-superclass of this generic if this pseudo-superclass has\n # already been visited by the DFS below *OR* \"None\" otherwise (i.e., if this\n # pseudo-superclass has yet to be visited by this DFS).\n hint_base_target_args_full: Optional[ListHints] = None\n \n # True only if the pseudo-superclass currently visited by the DFS below is\n # still transitively subscripted by one or more PEP 484-compliant type\n # variables (i.e., \"TypeVar\" objects) that have yet to be replaced by\n # concrete hints of a parent pseudo-superclass of that pseudo-superclass.\n is_hint_base_arg_typevar = False\n \n # ....................{ SEARCH }....................\n # Iteration simulating a recursive depth-first search (DFS), efficiently\n # deciding the tuple of all child hints transitively subscripting the\n # desired pseudo-superclass of this generic.\n \n # With at least one transitive pseudo-superclass of this generic remains\n # unvisited...\n while hint_bases_data:\n # Metadata describing the currently visited transitive pseudo-superclass\n # of this generic defined as the top-most item of this stack.\n #\n # Note that we intentionally avoid popping this pseudo-superclass off\n # this stack yet. We only pop a pseudo-superclass off this stack *AFTER*\n # resolving all child pseudo-superclasses of that pseudo-superclass,\n # which simulates the \"backing out\" performed by genuine recursion.\n hint_base_data = hint_bases_data[-1]\n \n # Currently visited transitive pseudo-superclass of this generic.\n hint_base = hint_base_data[_HINT_BASES_INDEX_HINT]\n \n # True only if the metadata describing this pseudo-superclass is still\n # its initial size, implying that this DFS has yet to visit this\n # pseudo-superclass by recursing down into the child pseudo-superclasses\n # of this pseudo-superclass.\n is_hint_base_leaf = len(hint_base_data) == _HINT_BASE_DATA_LEN_LEAF\n \n # If...\n if (\n # This DFS has yet to visit this pseudo-superclass *AND*...\n is_hint_base_leaf and\n # This pseudo-superclass is itself a PEP 484- or 585-compliant\n # user-defined generic. Standard generics (i.e., that are *NOT*\n # user-defined) have *NO* pseudo-superclasses and are thus omitted.\n # Examples of omittable standard generics include:\n # * \"dict[str, U]\".\n # * \"typing.Generic[S, int]\").\n # * \"typing.Protocol[float, T]\").\n #\n # Note that this tester is mildly slower than the prior test and\n # thus intentionally tested later.\n is_hint_pep484585_generic_user(hint_base) # pyright: ignore\n # Then this DFS is currently recursing down into the child\n # pseudo-superclasses of this pseudo-superclass. In this case...\n ):\n # Expand the metadata describing this pseudo-superclass from its\n # current 2-list \"(hint, hint_super_data)\" into the expanded 4-list\n # \"(hint, hint_super_data, hint_args_stack, hint_args_full)\".\n # Specifically, append (in order):\n hint_base_data.extend((\n # Poppable stack of the zero or more child hints directly\n # subscripting this child pseudo-superclass.\n make_stack(get_hint_pep_args(hint_base)),\n # List of the zero or more child hints transitively subscripting\n # this child pseudo-superclass.\n [],\n ))\n \n # Tuple of the one or more child pseudo-superclasses of this\n # pseudo-superclass.\n # print(f'Introspecting generic {hint} unerased bases...')\n hint_child_bases = get_hint_pep484585_generic_bases_unerased(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # print(f'Generic {hint} unerased bases: {hint_child_bases}')\n \n # For each child pseudo-superclass of this pseudo-superclass,\n # intentionally iterated in reverse order so as to ensure that the\n # *FIRST* child pseudo-superclass is the *LAST* item of this stack\n # (and thus the *FIRST* unvisited pseudo-superclass to be visited by\n # this depth-first search (DFS) next).\n #\n # Note that the reversed() builtin is well-known to be the most\n # efficient means of producing a reversed iterable for iteration\n # purposes. See also:\n # https://stackoverflow.com/a/16514411/2809027\n for hint_child_base in reversed(hint_child_bases):\n # Push metadata describing this unvisited child\n # pseudo-superclass onto this stack.\n hint_bases_data.append([\n # This child pseudo-superclass.\n hint_child_base,\n \n # Metadata describing the direct parent\n # pseudo-superclass of this child pseudo-superclass.\n hint_base_data,\n ])\n # Else, either:\n # * This DFS has already visited this pseudo-superclass *OR*...\n # * This pseudo-superclass is a \"terminal\" leaf generic *OR*...\n # * This pseudo-superclass is *NOT* a generic.\n #\n # In any case, this DFS should *NOT* recurse (back) down into this\n # pseudo-superclass. Therefore, this DFS is currently recursing back up\n # out of this pseudo-superclass into its parent pseudo-superclass.\n else:\n # Pop this pseudo-superclass off this stack.\n hint_bases_data.pop()\n # print(f'Resuming generic {hint} pseudo-superclass {hint_base} args {hint_base_args}...')\n \n # List of the zero or more child hints transitively subscripting\n # this pseudo-superclass, defined as either...\n hint_base_args_full: ListHints = ( # pyright: ignore\n # If this is a terminal leaf pseudo-superclass, the tuple of\n # zero or more child hints directly subscripting this\n # pseudo-superclass. Why? Because this pseudo-superclass has\n # *NO* child pseudo-superclass to recurse down into. If this\n # pseudo-superclass had one or more child pseudo-superclasses to\n # recurse down into, then those child pseudo-superclasses would\n # have defined the \"hint_base_data[_HINT_BASES_INDEX_ARGS_FULL]\"\n # list accessed by the next branch, providing the list of zero\n # or more child hints transitively subscripting this\n # pseudo-superclass. Although that list remains undefined, the\n # tuple of zero or more child hints directly subscripting this\n # pseudo-superclass is semantically equivalent to what that list\n # would have been (had that list actually been defined).\n list(get_hint_pep_args(hint_base))\n if is_hint_base_leaf else\n # Else, this is *NOT* a terminal leaf pseudo-superclass. In this\n # case, the list of zero or more child hints transitively\n # subscripting this pseudo-superclass previously defined by\n # child pseudo-superclasses of this pseudo-superclass in\n # lower-level recursion.\n hint_base_data[_HINT_BASES_INDEX_ARGS_FULL]\n )\n \n # Reset this boolean to its default value (i.e., \"False\") *BEFORE*\n # possibly setting this boolean to \"True\" below, facilitating\n # efficient communication between the \"if hint_base_args_full:\" and\n # \"if hint_base_target:\" branches below.\n #\n # Equivalently, record that this pseudo-superclass is transitively\n # subscripted by *NO* type variables. Since the \"if\n # hint_base_args_full:\" branch below works as hard as possible to\n # ensure that this is the case, this default is sensible until\n # proven otherwise below.\n is_hint_base_arg_typevar = False\n \n # If this pseudo-superclass is transitively subscripted by\n # at least one child hint...\n if hint_base_args_full:\n # Metadata describing the direct parent pseudo-superclass of\n # this pseudo-superclass.\n hint_base_super_data = hint_base_data[_HINT_BASES_INDEX_PARENT]\n # print(f'Resuming generic {hint} pseudo {hint_base} parent {hint_base_super_data[0]}...')\n \n # If this pseudo-superclass has a parent pseudo-superclass\n # (i.e., this pseudo-superclass is *NOT* the passed root generic\n # and is thus a transitive child of this generic)...\n if hint_base_super_data:\n # Poppable stack of the zero or more child hints directly\n # subscripting this parent pseudo-superclass.\n hint_base_super_args_stack = hint_base_super_data[ # pyright: ignore\n _HINT_BASES_INDEX_ARGS_STACK]\n \n # For the 0-based index of each child hint transitively\n # subscripting this pseudo-superclass and this hint...\n #\n # Note that this iteration could be fenced behind an \"if\"\n # conditional resembling:\n # if not (\n # hint_base_super_args_stack or\n # typevar_to_hint\n # ):\n #\n # However, doing so would be almost entirely pointless. Why?\n # Because almost *ALL* generics are transitively subscripted\n # by one or more type variables. Ergo, \"typevar_to_hint\" is\n # almost *ALWAYS* non-empty. Ergo, the above \"if\"\n # conditional reduces to \"if True:\" in most cases. We sigh.\n for hint_base_arg_full_index, hint_base_arg_full in (\n enumerate(hint_base_args_full)):\n # If this hint is a type variable...\n if is_hint_pep484_typevar(hint_base_arg_full):\n # If a concrete (i.e., non-type variable) child hint\n # directly subscripting a sibling pseudo-superclass\n # of this pseudo-superclass has already been\n # \"bubbled up\" into this type variable, preserve\n # that bubbling by re-bubbling up the same child\n # hint back into this type variable. <-- lol\n if hint_base_arg_full in typevar_to_hint:\n # print(f'Rebubbling hint {typevar_to_hint[hint_base_arg]} into...')\n # print(f'base {hint_base} typevar {hint_base_arg}!')\n hint_base_args_full[hint_base_arg_full_index] = ( # type: ignore[index]\n typevar_to_hint[hint_base_arg_full])\n # Else, *NO* child hint directly subscripting a\n # sibling pseudo-superclass of this child\n # pseudo-superclass has already been \"bubbled up\"\n # into this type variable.\n #\n # If this parent pseudo-superclass of this child\n # pseudo-superclass is still directly subscripted by\n # one or more child hints that have yet to \"bubble\n # up\" the class hierarchy (i.e., by replacing the\n # first unused type variable transitively\n # subscripting this child pseudo-superclass),\n # \"bubble up\" the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass into the \"empty placeholder\"\n # signified by this type variable in this list of\n # child hints transitively subscripting this child\n # pseudo-superclass. <-- wat\n elif hint_base_super_args_stack:\n # print(f'Bubbling hint {hint_base_super_args_stack[-1]} into...')\n # print(f'base {hint_base} typevar {hint_base_arg}!')\n hint_base_arg_full_new = (\n hint_base_args_full[hint_base_arg_full_index]) = ( # type: ignore[index]\n hint_base_super_args_stack.pop()) # pyright: ignore\n \n # If the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass is itself a type variable,\n # record that this child pseudo-superclass is\n # now known to be subscripted by at least one\n # type variable.\n if is_hint_pep484_typevar(\n hint_base_arg_full_new):\n # print(f'Recording pseudo {hint_base} typevarred args {hint_base_arg_full}...')\n is_hint_base_arg_typevar = True\n # Else, the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass is *NOT* itself a type\n # variable. In this case, record that this child\n # hint has now been \"bubbled up\" into this type\n # variable for subsequent lookup.\n #\n # Note that bubbling up a type variable into\n # another type variable would be entirely\n # pointless. Type variables are only\n # meaningfully replaceable with concrete hints.\n # Moreover, doing so here would erroneously map\n # this type variable to this other type variable\n # in the \"typevar_to_hint\" dictionary -- which\n # would then inhibit this \"if\" conditional from\n # subsequently bubbling up a concrete hint into\n # this type variable. <-- omg\n else:\n # print(f'Recording non-typevar {hint_base_arg_full} -> {hint_base_arg_full_new}...')\n typevar_to_hint[hint_base_arg_full] = ( # pyright: ignore\n hint_base_arg_full_new)\n # Else, all child hints directly subscripting this\n # parent pseudo-superclass have already been\n # \"bubbled up\" the class hierarchy. But this hint is\n # a type variable! Record that this child\n # pseudo-superclass is now known to be subscripted\n # by at least one type variable.\n else:\n is_hint_base_arg_typevar = True\n #print(f'Bubbled up generic {hint} arg {hint_args[hint_args_index_curr]}...')\n #print(f'...into pseudo-superclass {hint_base} args {hint_base_args}!')\n # Else, this hint is *NOT* a type variable. In this\n # case, preserve this hint and continue to the next.\n \n # Parent list of the zero or more child hints transitively\n # subscripting this parent pseudo-superclass of this\n # pseudo-superclass.\n hint_base_super_args_full = hint_base_super_data[ # pyright: ignore\n _HINT_BASES_INDEX_ARGS_FULL]\n \n # Append to this parent list this child list of all child\n # hints transitively subscripting this pseudo-superclass.\n hint_base_super_args_full.extend(hint_base_args_full) # pyright: ignore\n # print(f'Inspected generic {hint} pseudo-superclass {hint_base} args {hint_base_args}!')\n # Else, this pseudo-superclass is the passed root generic.\n # Else, this pseudo-superclass is transitively unsubscripted.\n \n # If searching for a target pseudo-superclass...\n if hint_base_target:\n # Unsubscripted generic underlying this possibly subscripted\n # pseudo-superclass generic. Strip this pseudo-superclass of\n # *ALL* child hints, allowing this unsubscripted current\n # pseudo-superclass to be compared against this\n # unsubscripted target pseudo-superclass.\n hint_base_type = get_hint_pep484585_generic_type(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # If this pseudo-superclass is the desired target...\n if hint_base_type == hint_base_target:\n # If this target pseudo-superclass is no longer subscripted\n # by any type variables requiring subsequent replacement by\n # concrete child hints, this target pseudo-superclass is\n # *ONLY* subscripted by concrete child hints. In this case,\n # immediately return a tuple of these hints.\n #\n # Note that:\n # * This efficiently short-circuits this recursion in the\n # best case and is one of several reasons to prefer a\n # non-recursive algorithm. This algorithm was initially\n # implemented recursively (supposedly for simplicity);\n # doing so introduced significant unforeseen complications\n # by effectively preventing short-circuiting. After all, a\n # recursive algorithm *CANNOT* efficiently short-circuit\n # up out of a deeply nested recursive call stack --\n # without inefficiently raising an exception, which is so\n # inefficient as to defeat the point in most cases.\n # * This recursion *CANNOT* be short-circuited in the worst\n # case, which occurs when the passed root generic is\n # directly subscripted by a concrete child hint that will\n # only be subsequently \"bubbled up\" into a type hint\n # transitively subscripting this target pseudo-superclass\n # *AFTER* this DFS recurses through the tree of all\n # pseudo-superclasses and back up into this generic. In\n # this worst case, the full dictionary of type variable\n # mappings and thus the list of child hints transitively\n # subscripting this target pseudo-superclass is only\n # decidable *AFTER* this DFS fully recurses out.\n #\n # Consider this torturous hierarchy, in which bubbling up\n # the child hint \"complex\" subscripting the root generic\n # \"ListFloat[complex]\" into the child type variable \"U\"\n # subscripting the child pseudo-superclass \"Generic[U]\"\n # requires recursing through the full tree:\n # >>> from typing import Generic\n # >>> class ListTU(list[T], Generic[U]): pass\n # >>> class ListFloat(ListTU[float]): pass\n # >>> get_hint_pep484585_generic_args_full(\n # ... hint=ListFloat[complex],\n # ... hint_base_target=Generic[U],\n # ... )\n # (complex,)\n if not is_hint_base_arg_typevar:\n return tuple(hint_base_args_full)\n # Else, this target pseudo-superclass is still subscripted\n # by one or more type variables requiring subsequent\n # replacement by concrete child hints. In this case,\n # continue \"bubbling up\" child hints into these type\n # variables. Doing so enables final logic below to replace\n # these type variables with these hints *AFTER* recursing\n # through the full entirety of this DFS.\n \n # List of zero or more child hints transitively subscripting\n # this target pseudo-superclass.\n hint_base_target_args_full = hint_base_args_full\n # print(f'Found target {hint_base} args {hint_base_args_full}!')\n # Else, this pseudo-superclass is *NOT* equal to this target.\n # Else, *NO* target pseudo-superclass is being searched for.\n \n # ....................{ RETURN }....................\n # If the caller passed a target pseudo-superclass...\n if hint_base_target:\n # If the DFS above failed to find the list of zero or more child hints\n # transitively subscripting this target, this DFS failed to find this\n # target. Since this implies this target is *NOT* a pseudo-superclass of\n # this generic, raise an exception.\n if hint_base_target_args_full is None:\n raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'pseudo-superclass target {repr(hint_base_target)} not found.'\n )\n # Else, this DFS found the list of zero or more child hints transitively\n # subscripting this target.\n \n # List of the zero or more child hints transitively subscripting this\n # target pseudo-superclass, to be coerced into a tuple and returned.\n hint_args_full = hint_base_target_args_full\n \n # For the 0-based index of each child hint transitively subscripting\n # this target pseudo-superclass and this hint...\n for hint_arg_full_index, hint_arg_full in enumerate(hint_args_full):\n # If this hint is a type variable...\n if is_hint_pep484_typevar(hint_arg_full):\n # Either:\n # * If a child hint directly subscripting a sibling\n # pseudo-superclass of this target pseudo-superclass has\n # already been \"bubbled up\" into this type variable, preserve\n # that bubbling by re-bubbling up the same child hint back\n # into this # type variable. <-- lol\n # * If *NO* child hint directly subscripting a sibling\n # pseudo-superclass of this target pseudo-superclass has\n # already been \"bubbled up\" into this type variable, preserve\n # this type variable as is.\n hint_args_full[hint_arg_full_index] = typevar_to_hint.get( # pyright: ignore\n hint_arg_full, hint_arg_full) # pyright: ignore\n # Else, this hint is *NOT* a type variable.\n # Else, the caller did *NOT* pass a target pseudo-superclass.\n else:\n # If the metadata describing the passed generic is still its initial size,\n # then the above DFS failed to expand this metadata with the\n # \"_HINT_BASES_INDEX_ARGS_FULL\" index accessed below. In turn, this implies\n # that the above DFS failed to recurse down into the child\n # pseudo-superclasses of this generic. However, by definition, *ALL*\n # generics subclass one or more pseudo-superclasses. The above DFS should\n # have recursed down into those pseudo-superclasses. In this case, raise an\n # exception.\n #\n # Note that this should *NEVER* occur.\n if len(hint_root_data) == _HINT_BASE_DATA_LEN_LEAF: # pragma: no cover\n> raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'pseudo-superclasses not found.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic pseudo-superclasses not found.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_txfi9j28/beartype/_util/hint/pep/proposal/pep484/pep484generic.py:381\nError: beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_bases_unerased(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._data.hint.pep.sign.datapepsignset import HINT_SIGNS_GENERIC\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_bases_unerased)\n from beartype._util.hint.pep.utilpeptest import is_hint_pep_type_typing\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # For each PEP-compliant hint to be tested...\n for hint_pep_meta in hints_pep_meta:\n # If this is a generic hint, assert that this getter returns the\n # expected unerased pseudo-superclasses of this generic.\n if hint_pep_meta.pep_sign in HINT_SIGNS_GENERIC:\n> hint_pep_bases = get_hint_pep484585_generic_bases_unerased(\n hint_pep_meta.hint)\n\n> get_hint_pep484_generic_bases_unerased(\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484_generic_bases_unerased(\n # Mandatory parameters.\n hint: Any,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of all unerased :mod:`typing` **pseudo-superclasses** (i.e.,\n :mod:`typing` objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`-compliant\n **generic** (i.e., class subclassing at least one non-class :mod:`typing`\n object).\n \n This getter is memoized for efficiency.\n \n Parameters\n ----------\n hint : object\n Object to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this\n :mod:`typing` generic. Specifically:\n \n * If this generic defines an ``__orig_bases__`` dunder instance\n variable, the value of that variable as is.\n * Else, the value of the ``__mro__`` dunder instance variable stripped\n of all ignorable classes conveying *no* semantic meaning, including:\n \n * This generic itself.\n * The :class:`object` root superclass.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * *Not* a :mod:`typing` generic.\n * A :mod:`typing` generic that erased *none* of its superclasses but\n whose method resolution order (MRO) lists strictly less than four\n classes. Valid :pep:`484`-compliant generics should list at least\n four classes, including (in order):\n \n #. This class itself.\n #. The one or more :mod:`typing` objects directly subclassed by this\n generic.\n #. The :class:`typing.Generic` superclass.\n #. The zero or more non-:mod:`typing` superclasses subsequently\n subclassed by this generic (e.g., :class:`abc.ABC`).\n #. The :class:`object` root superclass.\n \n See Also\n --------\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n Further details.\n '''\n \n #FIXME: This tuple appears to be implemented erroneously -- at least under\n #Python 3.7, anyway. Although this tuple is implemented correctly for the\n #common case of user-defined types directly subclassing \"typing\" types,\n #this tuple probably is *NOT* implemented correctly for the edge case of\n #user-defined types indirectly subclassing \"typing\" types: e.g.,\n #\n # >>> import collections.abc, typing\n # >>> T = typing.TypeVar('T')\n # >>> class Direct(collections.abc.Sized, typing.Generic[T]): pass\n # >>> Direct.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n # >>> class Indirect(collections.abc.Container, Direct): pass\n # >>> Indirect.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n #\n #*THAT'S COMPLETELY INSANE.* Clearly, their naive implementation failed to\n #account for actual real-world use cases.\n #\n #On the bright side, the current implementation prevents us from actually\n #having to perform a breadth-first traversal of all original superclasses\n #of this class in method resolution order (MRO). On the dark side, it's\n #pants-on-fire balls -- but there's not much we can do about that. *sigh*\n #\n #If we ever need to perform that breadth-first traversal, resurrect this:\n #\n # # If this class was *NOT* subject to type erasure, reduce to a noop.\n # if not hint_bases:\n # return hint_bases\n #\n # # Fixed list of all typing super attributes to be returned.\n # superattrs = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based index of the last item of this list.\n # superattrs_index = 0\n #\n # # Fixed list of all transitive superclasses originally listed by this\n # # class iterated in method resolution order (MRO).\n # hint_orig_mro = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based indices of the current and last items of this list.\n # hint_orig_mro_index_curr = 0\n # hint_orig_mro_index_last = 0\n #\n # # Initialize this list with the tuple of all direct superclasses of this\n # # class, which iteration then expands to all transitive superclasses.\n # hint_orig_mro[:len(hint_bases)] = hint_bases\n #\n # # While the heat death of the universe has been temporarily forestalled...\n # while (True):\n # # Currently visited superclass of this class.\n # hint_base = hint_orig_mro[hint_orig_mro_index_curr]\n #\n # # If this superclass is a typing attribute...\n # if is_hint_pep_type_typing(hint_base):\n # # Avoid inserting this attribute into the \"hint_orig_mro\" list.\n # # Most typing attributes are *NOT* actual classes and those that\n # # are have no meaningful public superclass. Ergo, iteration\n # # terminates with typing attributes.\n # #\n # # Insert this attribute at the current item of this list.\n # superattrs[superattrs_index] = hint_base\n #\n # # Increment this index to the next item of this list.\n # superattrs_index += 1\n #\n # # If this class subclasses more than the maximum number of \"typing\"\n # # attributes supported by this function, raise an exception.\n # if superattrs_index >= FIXED_LIST_SIZE_MEDIUM:\n # raise BeartypeDecorHintPep560Exception(\n # '{} PEP type {!r} subclasses more than '\n # '{} \"typing\" types.'.format(\n # exception_prefix,\n # hint,\n # FIXED_LIST_SIZE_MEDIUM))\n # # Else, this superclass is *NOT* a typing attribute. In this case...\n # else:\n # # Tuple of all direct superclasses originally listed by this class\n # # prior to PEP 484 type erasure if any *OR* the empty tuple\n # # otherwise.\n # hint_base_bases = getattr(hint_base, '__orig_bases__')\n #\n # #FIXME: Implement breadth-first traversal here.\n #\n # # Tuple sliced from the prefix of this list assigned to above.\n # superattrs_tuple = tuple(superattrs[:superattrs_index])\n #\n # # Release and nullify this list *AFTER* defining this tuple.\n # release_fixed_list(superattrs)\n # del superattrs\n #\n # # Return this tuple as is.\n # return superattrs_tuple\n #\n #Also resurrect this docstring snippet:\n #\n # Raises\n # ----------\n # BeartypeDecorHintPep560Exception\n # If this object defines the ``__orig_bases__`` dunder attribute but that\n # attribute transitively lists :data:`FIXED_LIST_SIZE_MEDIUM` or more :mod:`typing`\n # attributes.\n #\n #Specifically:\n # * Acquire a fixed list of sufficient size (e.g., 64). We probably want\n # to make this a constant in \"utilcachelistfixedpool\" for reuse\n # everywhere, as this is clearly becoming a common idiom.\n # * Slice-assign \"__orig_bases__\" into this list.\n # * Maintain two simple 0-based indices into this list:\n # * \"bases_index_curr\", the current base being visited.\n # * \"bases_index_last\", the end of this list also serving as the list\n # position to insert newly discovered bases at.\n # * Iterate over this list and keep slice-assigning from either\n # \"__orig_bases__\" (if defined) or \"__mro__\" (otherwise) into\n # \"list[bases_index_last:len(__orig_bases__)]\". Note that this has the\n # unfortunate disadvantage of temporarily iterating over duplicates,\n # but... *WHO CARES.* It still works and we subsequently\n # eliminate duplicates at the end.\n # * Return a frozenset of this list, thus implicitly eliminating\n # duplicate superclasses.\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_type_or_none)\n \n # If this hint is *NOT* a class, reduce this hint to the object originating\n # this hint if any. See is_hint_pep484_generic() for details.\n hint = get_hint_pep484585_generic_type_or_none(hint)\n \n # If this hint is *NOT* a PEP 484- or 544-compliant generic, raise an\n # exception.\n if not is_hint_pep484_generic_unsubscripted(hint):\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} neither '\n f'PEP 484 generic nor PEP 544 protocol.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #17: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #18: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #19: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #20: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #21: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #22: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #23: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #24: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.581760000000001, "in_degree": 5, "true_in_degree": 33.64000000000002, "out_degree": 2, "betweenness": 0.0003057349923408191, "pagerank": 0.002092176435936285, "harmonic": 0.008607456140350878, "bidirectional_harmonic": 0.23383731582744763, "degree": 7 }, "line_count": 19, "code_line_count": 19, "cyclomatic": 7, "halstead_volume": 31.699250014423125, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/_pep/pep484585/redpep484585generic.py", "function_name": "reduce_hint_pep484585_generic_subscripted", "test_info": { "success": false, "failed": 11, "passed": 1119, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_v47f6uso/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:409\nError: AssertionError: assert False is True\n + where False = GenericTypeHint(typing.Generic[~S, ~T]).is_ignorable\n + where GenericTypeHint(typing.Generic[~S, ~T]) = (typing.Generic[~S, ~T])\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n> assert TypeHint(hint_ignorable).is_ignorable is True\nE AssertionError: assert False is True\nE + where False = GenericTypeHint(typing.Generic[~S, ~T]).is_ignorable\nE + where GenericTypeHint(typing.Generic[~S, ~T]) = (typing.Generic[~S, ~T])\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable\nLocation: /tmp/benchmark_v47f6uso/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:186\nError: AssertionError: assert is typing.Any\n + where = (typing.Generic[~S, ~T])\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_reduce_hint_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer with\n respect to ignorable hints.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # Defer test-specific imports.\n from beartype.typing import Any\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP_UNIGNORABLE)\n \n # Assert this tester accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n> assert reduce_hint(hint_ignorable) is Any\nE AssertionError: assert is typing.Any\nE + where = (typing.Generic[~S, ~T])\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #11: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint_ignorable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 23.21304576, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 3, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.0276374530075188, "bidirectional_harmonic": 0.19373249648743118, "degree": 3 }, "line_count": 14, "code_line_count": 14, "cyclomatic": 3, "halstead_volume": 15.509775004326936, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/utilpepget.py", "function_name": "get_hint_pep_origin_type_isinstanceable", "test_info": { "success": false, "failed": 25, "passed": 1105, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable\nLocation: /tmp/benchmark_d0lckend/beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py:195\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_get_hint_pep_type_isinstanceable(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.utilpepget.get_hint_pep_origin_type_isinstanceable`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._util.hint.pep.utilpepget import (\n get_hint_pep_origin_type_isinstanceable)\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # Assert this getter...\n for hint_pep_meta in hints_pep_meta:\n # Returns the expected type origin for all PEP-compliant type hints\n # originating from an origin type.\n if hint_pep_meta.isinstanceable_type is not None:\n assert get_hint_pep_origin_type_isinstanceable(hint_pep_meta.hint) is (\n hint_pep_meta.isinstanceable_type)\n # Raises the expected exception for all other hints.\n else:\n> with raises(BeartypeDecorHintPepException):\nE Failed: DID NOT RAISE \n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_d0lckend/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:119\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n> with warns(hint_meta.warning_type):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #18: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #19: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #20: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #21: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #22: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #23: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #24: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #25: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py", "test_get_hint_pep_type_isinstanceable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ] ] }, "complexity_info": { "centrality": { "distance_discount": 11.144448, "in_degree": 2, "true_in_degree": 5.68, "out_degree": 1, "betweenness": 2.9805774733373798e-05, "pagerank": 0.00031084560293513966, "harmonic": 0.012719298245614035, "bidirectional_harmonic": 0.23585336447178545, "degree": 3 }, "line_count": 10, "code_line_count": 10, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncframe.py", "function_name": "iter_frames", "test_info": { "success": false, "failed": 19, "passed": 1111, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/test_utilfuncframe.py::test_iter_frames\nLocation: /tmp/benchmark_m_p7hhii/beartype_test/a00_unit/a20_util/func/test_utilfuncframe.py:128\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_iter_frames() -> None:\n '''\n Test the\n :func:`beartype._util.func.utilfuncframe.iter_frames` iterator.\n '''\n \n # Defer test-specific imports.\n from beartype._util.func.utilfunccodeobj import get_func_codeobj\n from beartype._util.func.utilfuncframe import iter_frames\n \n # For each stack frame on the current call stack iterated by this\n # iterator...\n> for frame in iter_frames():\nE TypeError: 'NoneType' object is not iterable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py::test_is_func_nested\nLocation: /tmp/benchmark_m_p7hhii/beartype/_util/func/utilfuncscope.py:424\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_is_func_nested() -> None:\n '''\n Test the\n :func:`beartype._util.func.utilfuncscope.is_func_nested` tester.\n '''\n \n # Defer test-specific imports.\n from beartype._util.func.utilfunctest import is_func_nested\n \n # Nested callable returned by the above callable.\n when_the_ash_and_oak_and_the_birch_and_yew = (\n> when_in_the_springtime_of_the_year())\n\n> @attach_func_locals(func_stack_frames_ignore=1)\n\n> func.func_locals = get_func_locals(func=func, **kwargs)\n\n> def get_func_locals(\n # Mandatory parameters.\n func: Callable,\n \n # Optional parameters.\n func_scope_names_ignore: int = 0,\n func_stack_frames_ignore: int = 0,\n exception_cls: TypeException = _BeartypeUtilCallableScopeException,\n ) -> LexicalScope:\n '''\n **Local scope** for the passed callable.\n \n This getter returns either:\n \n * If that callable is **nested** (i.e., is a method *or* is a non-method\n callable declared in the body of another callable), a dictionary mapping\n from the name to value of each **locally scoped attribute** (i.e., local\n attribute declared by a parent callable transitively declaring that\n callable) accessible to that callable.\n * Else, the empty dictionary otherwise (i.e., if that callable is a\n function directly declared by a module).\n \n This getter transparently supports methods, which in Python are lexically\n nested in the scope encapsulating all previously declared **class\n variables** (i.e., variables declared from class scope and thus accessible\n as type hints when annotating the methods of that class). When declaring a\n class, Python creates a stack frame for the declaration of that class whose\n local scope is the set of all class-scoped attributes declared in the body\n of that class -- including class variables, class methods, static methods,\n and instance methods. When passed any method, this getter finds and returns\n that local scope. When passed the ``MuhClass.muh_method` method declared by\n the following example, for example, this getter returns the local scope\n containing the key ``'muh_class_var'`` with value ``int``:\n \n .. code-block:: pycon\n \n >>> from typing import ClassVar\n >>> class MuhClass(object):\n ... # Class variable declared in class scope.\n ... muh_class_var: ClassVar[type] = int\n ... # Instance method annotated by this class variable.\n ... def muh_method(self) -> muh_class_var: return 42\n \n However, note that this getter's transparent support for methods does *not*\n extend to methods of the currently decorated class. Why? Because that class\n has yet to be declared and thus added to the call stack.\n \n Caveats\n -------\n **This high-level getter requires the private low-level**\n :func:`sys._getframe` **getter.** If that getter is undefined, this getter\n unconditionally treats the passed callable as module-scoped by returning the\n empty dictionary rather than raising an exception. Since all standard\n Python implementations (e.g., CPython, PyPy) define that getter, this\n should typically *not* be a real-world concern.\n \n **This high-level getter is inefficient and should thus only be called if\n absolutely necessary.** Specifically, deciding the local scope for any\n callable exhibits worst-case linear time complexity :math:`O(k)` for the\n distance :math:`k` in call stack frames from the call of the current\n function to the call of the top-most parent scope transitively declaring the\n passed callable in its submodule. Ergo, this decision problem should be\n deferred as long as feasible to minimize space and time consumption.\n \n Parameters\n ----------\n func : Callable\n Callable to be inspected.\n func_scope_names_ignore : int, optional\n Number of parent lexical scopes in the fully-qualified name of that\n callable to be ignored (i.e., silently incremented past), such that the\n next non-ignored lexical scope preceding the first ignored lexical scope\n is that of the parent callable or module directly declaring the passed\n callable. This parameter is typically used to ignore the parent lexical\n scopes of parent classes lexically nesting that callable that have yet\n to be fully declared and thus encapsulated by stack frames on the call\n stack (e.g., due to being currently decorated by\n :func:`beartype.beartype`). See the :mod:`beartype._decor._pep.pep563`\n submodule for the standard use case. Defaults to 0.\n func_stack_frames_ignore : int, optional\n Number of frames on the call stack to be ignored (i.e., silently\n incremented past), such that the next non-ignored frame following the\n last ignored frame is the parent callable or module directly declaring\n the passed callable. Defaults to 0.\n exception_cls : Type[Exception], optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableScopeException`.\n \n Returns\n -------\n LexicalScope\n Local scope for this callable.\n \n Raises\n ------\n exception_cls\n If the next non-ignored frame following the last ignored frame is *not*\n the parent callable or module directly declaring the passed callable.\n _BeartypeUtilCallableScopeNotFoundException\n If this lexical scope cannot be found (i.e., if this getter found the\n lexical scope of the module declaring the passed callable *before* that\n of the parent callable or class declaring that callable), enabling\n callers to identify this common edge case.\n '''\n assert callable(func), f'{repr(func)} not callable.'\n assert isinstance(func_scope_names_ignore, int), (\n f'{func_scope_names_ignore} not integer.')\n assert func_scope_names_ignore >= 0, (\n f'{func_scope_names_ignore} negative.')\n assert isinstance(func_stack_frames_ignore, int), (\n f'{func_stack_frames_ignore} not integer.')\n assert func_stack_frames_ignore >= 0, (\n f'{func_stack_frames_ignore} negative.')\n # print(f'\\n--------- Capturing nested {func.__qualname__}() local scope...')\n \n # ..................{ IMPORTS }..................\n # Avoid circular import dependencies.\n from beartype._util.func.utilfunccodeobj import get_func_codeobj_or_none\n from beartype._util.func.utilfuncframe import iter_frames\n from beartype._util.func.utilfunctest import is_func_nested\n from beartype._util.module.utilmodget import get_object_module_name_or_none\n \n # ..................{ NOOP }..................\n # Note that we intentionally return the local scope for this wrapper rather\n # than wrappee callable, as a local scope can *ONLY* be obtained by\n # dynamically inspecting local attributes bound to call frames on the\n # current call stack. However, this wrapper was called at a higher call\n # frame than this wrappee. All local attributes declared within the body of\n # this wrapper callable are irrelevant to this wrappee callable, as Python\n # syntactically parsed the latter at a later time than the former. If we\n # returned the local scope for this wrappee rather than wrapper callable,\n # we would erroneously return local attributes that this wrappee callable\n # originally had no lexical access to. That's bad. So, we don't do that.\n \n # Fully-qualified name of the module declaring the passed callable if that\n # callable was physically declared by an on-disk module *OR* \"None\"\n # otherwise (i.e., if that callable was dynamically declared in-memory).\n func_module_name = get_object_module_name_or_none(func)\n \n # If either...\n if (\n # The passed callable is dynamically declared in-memory...\n func_module_name is None or\n # The passed callable is module-scoped rather than nested *OR*...\n not is_func_nested(func)\n # Then silently reduce to a noop by treating this nested callable as\n # module-scoped by preserving \"func_locals\" as the empty dictionary.\n ):\n return FROZENDICT_EMPTY\n # Else, all of the following constraints hold:\n # * The passed callable is physically declared on-disk.\n # * The passed callable is nested.\n \n # ..................{ LOCALS ~ scope }..................\n # Local scope of the passed callable to be returned.\n func_scope: LexicalScope = {}\n \n # ..................{ LOCALS ~ scope : name }..................\n # Unqualified name of this nested callable.\n func_name_unqualified = func.__name__\n \n # Fully-qualified name of this nested callable. If this nested callable is\n # a non-method, this name contains one or more meaningless placeholders\n # \"\" -- each identifying one parent callable lexically containing\n # this nested callable: e.g.,\n # >>> def muh_func():\n # ... def muh_closure(): pass\n # ... return muh_closure()\n # >>> muh_func().__qualname__\n # 'muh_func..muh_closure'\n func_name_qualified = get_object_basename_scoped(func)\n \n # Non-empty list of the unqualified names of all parent callables lexically\n # containing that nested callable (including that nested callable itself).\n #\n # Note that:\n # * The set of all callables embodied by the current runtime call stack is a\n # (usually proper) superset of the set of all callables embodied by the\n # lexical scopes encapsulating this nested callable. Ergo:\n # * Some stack frames have no corresponding lexical scopes (e.g., stack\n # frames embodying callables defined by different modules).\n # * *ALL* lexical scopes have a corresponding stack frame.\n # * Stack frames are only efficiently accessible relative to the initial\n # stack frame embodying this nested callable, which resides at the end of\n # the call stack. This implies we *MUST* iteratively search up the call\n # stack for frames with relevant lexical scopes and ignore intervening\n # frames with irrelevant lexical scopes, starting at the stack top (end).\n func_scope_names = func_name_qualified.rsplit(sep='.')\n \n # Number of lexical scopes encapsulating that callable.\n func_scope_names_len = len(func_scope_names)\n \n # If that nested callable is *NOT* encapsulated by at least two lexical\n # scopes identifying at least that nested callable and the parent callable\n # or class declaring that nested callable, raise an exception.\n #\n # You are probably now contemplating to yourself in the special darkness of\n # your own personal computer cave: \"But @leycec, isn't this condition\n # *ALWAYS* the case? The above `not is_func_nested()` check already ignored\n # non-nested callables.\"\n #\n # Allow me to now explicate. By the check above, that callable is nested...\n # By the check below, however, only one lexical scope encapsulates that\n # callable. This is not a contradiction. This is just a malicious caller.\n # The get_object_basename_scoped() getter called above silently removed all\n # \".\" placeholders from this list of lexical scopes, because those\n # \".\" placeholders convey no meaningful semantics. But the\n # is_func_nested() tester detects nested callables by searching for those\n # \".\" placeholders. It follows that the caller triggered this\n # condition by maliciously renaming the \"__qualname__\" dunder attribute of\n # the passed callable to be erroneously prefixed by \"\". Curiously,\n # Python permits such manhandling: e.g.,\n # # Python thinks this is fine.\n # >>> def muh_func(): pass\n # >>> muh_func.__qualname__ = '.muh_func' # <-- curse you!\n if func_scope_names_len < 2:\n raise exception_cls(\n f'{func_name_unqualified}() fully-qualified name '\n f'{func.__qualname__}() invalid (e.g., placeholder substring '\n f'\"\" not preceded by parent callable name).'\n )\n # Else, that nested callable is encapsulated by at least two lexical\n # scopes identifying at least that nested callable and the parent callable\n # or class declaring that nested callable.\n #\n # If the unqualified basename of the last parent callable lexically\n # containing the passed callable is *NOT* that callable itself, the caller\n # maliciously renamed one but *NOT* both of \"__qualname__\" and \"__name__\".\n # In this case, raise an exception. Again, Python permits this. *sigh*\n elif func_scope_names[-1] != func_name_unqualified:\n raise exception_cls(\n f'{func_name_unqualified}() fully-qualified name '\n f'{func.__qualname__}() invalid (i.e., last lexical scope '\n f'\"{func_scope_names[-1]}\" != unqualified name '\n f'\"{func_name_unqualified}\").'\n )\n # Else, the unqualified basename of the last parent callable lexically\n # containing the passed callable is that callable itself.\n \n # 1-based negative index of the unqualified basename of the parent callable\n # or module directly lexically containing the passed callable in the list of\n # all unqualified basenames encapsulating that callable. By the above\n # validation, this index is guaranteed to begin at the second-to-last\n # basename in this list.\n func_scope_names_index = -2 - func_scope_names_ignore\n \n # Number of unignorable lexical scopes encapsulating that callable,\n # magically adding 1 to account for the fact that \"func_scope_names_index\"\n # is a 1-based negative index rather than 0-based positive index.\n func_scope_names_search_len = (\n func_scope_names_len + func_scope_names_index + 1)\n \n # If exactly *ZERO* unignorable lexical scopes encapsulate that callable,\n # all lexical scopes encapsulating that callable are exactly ignorable,\n # implying that there is *NO* parent lexical scope to search for. In this\n # case, silently reduce to a noop by returning the empty dictionary.\n if func_scope_names_search_len == 0:\n return FROZENDICT_EMPTY\n # If a *NEGATIVE* number of unignorable lexical scopes encapsulate that\n # callable, the caller erroneously insists that there exist more ignorable\n # lexical scopes encapsulating that callable than there actually exist\n # lexical scopes encapsulating that callable. The caller is profoundly\n # mistaken. Whereas the prior branch is a non-erroneous condition that\n # commonly occurs, this current branch is an erroneous condition that should\n # *NEVER* occur. In this case...\n elif func_scope_names_search_len < 0:\n # Number of parent lexical scopes containing that callable.\n func_scope_parents_len = func_scope_names_len - 1\n \n # Raise an exception.\n raise exception_cls(\n f'Callable name \"{func_name_qualified}\" contains only '\n f'{func_scope_parents_len} parent lexical scope(s) but '\n f'\"func_scope_names_ignore\" parameter ignores '\n f'{func_scope_names_ignore} parent lexical scope(s), leaving '\n f'{func_scope_names_search_len} parent lexical scope(s) to be '\n f'searched for {func_name_qualified}() locals.'\n )\n # Else, there are one or more unignorable lexical scopes to be searched.\n \n # Unqualified basename of the parent callable or module directly lexically\n # containing the passed callable.\n #\n # Note that that the parent callable's local runtime scope transitively\n # contains *ALL* local variables accessible to this nested callable\n # (including the local variables directly contained in the body of that\n # parent callable as well as the local variables directly contained in the\n # bodies of all parent callables of that callable in the same lexical\n # scope). Since that parent callable's local runtime scope is exactly the\n # dictionary to be returned, iteration below searches up the runtime call\n # stack for a stack frame embodying that parent callable and no further.\n func_scope_name = func_scope_names[func_scope_names_index]\n # print(f'Searching for parent {func_scope_name}() local scope...')\n \n # ..................{ LOCALS ~ frame }..................\n # Code object underlying the parent callable associated with the current\n # stack frame if that callable is pure-Python *OR* \"None\".\n func_frame_codeobj: Optional[CodeType] = None\n \n # Fully-qualified name of the module defining that callable if any *OR*\n # \"None\" (i.e., if that callable is defined outside a module).\n func_frame_module_name: Optional[str] = ''\n \n # Unqualified name of that callable.\n func_frame_name = ''\n \n # ..................{ SEARCH }..................\n # While at least one frame remains on the call stack, iteratively search up\n # the call stack for a stack frame embodying the parent callable directly\n # declaring this nested callable, whereupon that parent callable's local\n # runtime scope is returned as is.\n #\n # Note this also implicitly skips past all other decorators applied *AFTER*\n # @beartype (and thus residing lexically above @beartype) in caller code to\n # this nested callable: e.g.,\n # @the_way_of_kings <--- skipped past\n # @words_of_radiance <--- skipped past\n # @oathbringer <--- skipped past\n # @rhythm_of_war <--- skipped past\n # @beartype\n # def the_stormlight_archive(bruh: str) -> str:\n # return bruh\n> for func_frame in iter_frames(\n # 0-based index of the first non-ignored frame following the last\n # ignored frame, ignoring an additional frame embodying the current call\n # to this getter.\n func_stack_frames_ignore=func_stack_frames_ignore + 1,\n ):\nE TypeError: 'NoneType' object is not iterable\n", "Failure #3: beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py::test_get_func_locals", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #15: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/test_utilfuncframe.py", "test_iter_frames" ], [ "beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py", "test_is_func_nested" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 4.880000000000001, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0005525205302620803, "harmonic": 0.0, "bidirectional_harmonic": 0.18236613076251293, "degree": 2 }, "line_count": 22, "code_line_count": 22, "cyclomatic": 7, "halstead_volume": 41.51317942364757, "halstead_difficulty": 2.2857142857142856 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextrepr.py", "function_name": "represent_object", "test_info": { "success": false, "failed": 55, "passed": 1075, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/py/test_utilpyweakref.py::test_get_weakref_obj_or_repr\nLocation: /tmp/benchmark__fb921v5/beartype/_util/py/utilpyweakref.py:146\nError: AssertionError: None not string.\n\nTraceback:\n\n> def test_get_weakref_obj_or_repr() -> None:\n '''\n Test the :func:`beartype._util.py.utilpyweakref.get_weakref_obj_or_repr`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilPythonWeakrefException\n from beartype._util.py.utilpyweakref import (\n get_weakref_obj_or_repr,\n make_obj_weakref_and_repr,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Iterable of objects that *CAN* be weakly referenced (e.g., due to *NOT*\n # being C-based containers).\n _WEAKREFABLES = (None, _IN_THESE_SOLITUDES)\n \n # Iterable of objects that *CANNOT* be weakly referenced (e.g., due to being\n # C-based containers).\n _NON_WEAKREFABLES = (_WINDS_CONTEND, _ITS_HOME)\n \n # ....................{ PASS }....................\n # For each object that *CAN* be weakly referenced...\n for weakrefable in _WEAKREFABLES:\n # Weak reference to and representation of this object.\n weakrefable_weakref, weakrefable_repr = make_obj_weakref_and_repr(\n weakrefable)\n \n # Strong reference to the same object accessed via this weak reference.\n> weakrefable_new = get_weakref_obj_or_repr(\n weakrefable_weakref, weakrefable_repr)\n\n> def get_weakref_obj_or_repr(obj_weakref: object, obj_repr: str) -> object:\n '''\n Object weakly referred to by the passed object if this object is indeed a\n weak reference to another existing object *or* the passed machine-readable\n representation otherwise (i.e., if this object is either ``None`` *or* is a\n weak reference to a dead garbage-collected object).\n \n This function is typically passed the pair of objects returned by a prior\n call to the companion :func:`make_obj_weakref_and_repr` function.\n \n Parameters\n ----------\n obj_weakref : object\n Either:\n \n * If the **referent** (i.e., target object being weakly referred to) is\n the ``None`` singleton, the :data:`_WEAKREF_NONE` placeholder.\n * Else if the referent supports weak references, a **weak reference**\n (i.e., :class:`weakref.ref` instance) to that object.\n * Else, ``None``.\n obj_repr : str\n Machine-readable representation of that object, typically truncated to\n some number of characters to avoid worst-case space consumption.\n \n Returns\n ----------\n object\n Either:\n \n * If this weak reference is the :data:`_WEAKREF_NONE` placeholder, the\n ``None`` singleton.\n * Else if this referent support weak references, either:\n \n * If this referent is still alive (i.e., has yet to be\n garbage-collected), this referent.\n * Else, this referent is now dead (i.e., has already been\n garbage-collected). In this case, the passed representation.\n \n * Else, this referent does *not* support weak references (i.e., this\n weak reference is ``None``). In this case, the passed representation.\n \n Raises\n ----------\n _BeartypeUtilPythonWeakrefException\n If ``obj_weakref`` is invalid: i.e., neither ``None``,\n :data:`_WEAKREF_NONE`, nor a weak reference.\n '''\n> assert isinstance(obj_repr, str), f'{repr(obj_repr)} not string.'\nE AssertionError: None not string.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_object\nLocation: /tmp/benchmark__fb921v5/beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py:51\nError: assert None == \"b'Higher still and higher'\"\n + where None = (b'Higher still and higher')\n + and \"b'Higher still and higher'\" = repr(b'Higher still and higher')\n\nTraceback:\n\n> def test_represent_object() -> None:\n '''\n Test the :func:`beartype._util.text.utiltextrepr.represent_object`\n function.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.text.utiltextrepr import represent_object\n \n # ....................{ CLASSES }....................\n # Arbitrary class defining an unpunctuated representation (i.e.,\n # representation *NOT* already suffixed by punctuation).\n class ToASkylark(object):\n def __repr__(self):\n return 'Like a cloud of fire;'\n \n # Arbitrary class defining an empty representation.\n class ThouDostFloatAndRun(object):\n def __repr__(self):\n return ''\n \n # ....................{ LOCALS }....................\n # Arbitrary object whose representation is both length *AND* contains one\n # or more newlines.\n THE_EVERLASTING_UNIVERSE_OF_THINGS = (\n 'And singing still dost soar,\\nand soaring ever singest.')\n \n # ....................{ ASSERTS }....................\n # Assert this representer preserves the representations of terse objects\n # already suffixed by punctuation as is.\n> assert represent_object(b'Higher still and higher') == repr(\n b'Higher still and higher')\nE assert None == \"b'Higher still and higher'\"\nE + where None = (b'Higher still and higher')\nE + and \"b'Higher still and higher'\" = repr(b'Higher still and higher')\n", "Failure #3: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_pith", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #8: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #9: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #10: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #45: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #46: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #47: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #48: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #49: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #50: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #51: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #52: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #53: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #54: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #55: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/py/test_utilpyweakref.py", "test_get_weakref_obj_or_repr" ], [ "beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py", "test_represent_object" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 18, "true_in_degree": 60.71999999999999, "out_degree": 1, "betweenness": 0.0002682519726003642, "pagerank": 0.006101262900664677, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.2919851712614868, "degree": 19 }, "line_count": 22, "code_line_count": 22, "cyclomatic": 7, "halstead_volume": 46.604512509375034, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/cls/utilclsmake.py", "function_name": "make_type", "test_info": { "success": false, "failed": 30, "passed": 1100, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/cls/test_utilclsmake.py::test_make_type\nLocation: /tmp/benchmark_8s0bd55x/beartype_test/a00_unit/a20_util/cls/test_utilclsmake.py:42\nError: assert False\n + where False = isinstance(None, type)\n\nTraceback:\n\n> def test_make_type() -> None:\n '''\n Test the :func:`beartype._util.cls.utilclsmake.make_type` tester.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilTypeException\n from beartype._util.cls.utilclsmake import make_type\n from beartype._util.cls.utilclstest import is_type_subclass\n from pytest import raises\n \n # ....................{ LOCALS }....................\n class TooEnamouredOfThatVoice(object):\n '''\n Arbitrary base class from which to subclass classes defined below.\n '''\n \n # ....................{ PASS }....................\n # Assert this factory creates and returns the expected class when the passed\n # name is a valid unqualified Python identifier.\n AndSilence = make_type(type_name='AndSilence')\n> assert isinstance(AndSilence, type)\nE assert False\nE + where False = isinstance(None, type)\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py::test_iter_hint_pep695_forwardrefs\nLocation: /tmp/benchmark_8s0bd55x/beartype/_check/forward/reference/fwdrefmake.py:195\nError: AttributeError: 'NoneType' object has no attribute '__name_beartype__'\n\nTraceback:\n\n> def test_iter_hint_pep695_forwardrefs() -> None:\n '''\n Test the private\n :mod:`beartype._util.hint.pep.proposal.pep695.iter_hint_pep695_unsubscripted_forwardrefs`\n iterator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep695Exception\n from beartype._util.hint.pep.proposal.pep695 import (\n iter_hint_pep695_unsubscripted_forwardrefs)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_12\n from pytest import raises\n \n # If the active Python interpreter targets Python >= 3.12 and thus supports\n # PEP 695...\n if IS_PYTHON_AT_LEAST_3_12:\n # Defer version-specific imports.\n from beartype_test.a00_unit.data.pep.pep695.data_pep695util import (\n unit_test_iter_hint_pep695_forwardrefs)\n \n # Perform this test.\n> unit_test_iter_hint_pep695_forwardrefs()\n\n> the_warm_light_of = next(and_saw_by)\n\n> hint_ref = make_forwardref_indexable_subtype(\n\n> return _make_forwardref_subtype( # type: ignore[return-value]\n\n> def _make_forwardref_subtype(\n scope_name: Optional[str],\n hint_name: str,\n type_bases: TupleTypes,\n ) -> BeartypeForwardRef:\n '''\n Create and return a new **forward reference subclass** (i.e., concrete\n subclass of the passed abstract base class (ABC) deferring the resolution of\n the type hint with the passed name transparently).\n \n This factory is internally memoized for efficiency.\n \n Parameters\n ----------\n scope_name : Optional[str]\n Possibly ignored lexical scope name. See\n :func:`.make_forwardref_indexable_subtype` for further details.\n hint_name : str\n Absolute (i.e., fully-qualified) or relative (i.e., unqualified) name of\n the type hint referenced by this forward reference subclass.\n type_bases : Tuple[type, ...]\n Tuple of all base classes to be inherited by this forward reference\n subclass. For simplicity, this *must* be a 1-tuple ``(type_base,)``\n where ``type_base`` is a :class:`._BeartypeForwardRefIndexableABC`\n subclass.\n \n Returns\n -------\n BeartypeForwardRef\n Forward reference subclass referencing this type hint.\n \n Raises\n ------\n BeartypeDecorHintForwardRefException\n If either:\n \n * ``hint_name`` is *not* a syntactically valid Python identifier.\n * ``scope_name`` is neither:\n \n * A syntactically valid Python identifier.\n * :data:`None`.\n '''\n \n # Tuple of all passed parameters (in arbitrary order).\n args: BeartypeForwardRefArgs = (scope_name, hint_name, type_bases)\n \n # Forward reference proxy previously created and returned by a prior call to\n # this function passed these parameters if any *OR* \"None\" otherwise (i.e.,\n # if this is the first call to this function passed these parameters).\n # forwardref_subtype: Optional[BeartypeForwardRef] = (\n forwardref_subtype = _forwardref_args_to_forwardref.get(args, None)\n \n # If this proxy has already been created, reuse and return this proxy as is.\n if forwardref_subtype is not None:\n return forwardref_subtype\n # Else, this proxy has yet to be created.\n \n assert isinstance(scope_name, NoneTypeOr[str]), (\n f'{repr(scope_name)} neither string nor \"None\".')\n assert isinstance(hint_name, str), f'{repr(hint_name)} not string.'\n assert len(type_bases) == 1, (\n f'{repr(type_bases)} not 1-tuple of a single superclass.')\n \n # If this attribute name is *NOT* a syntactically valid Python identifier,\n # raise an exception.\n die_unless_identifier(\n text=hint_name,\n exception_cls=BeartypeDecorHintForwardRefException,\n exception_prefix='Forward reference ',\n )\n # Else, this attribute name is a syntactically valid Python identifier.\n \n # Possibly empty fully-qualified module name and unqualified basename of the\n # type referred to by this forward reference.\n type_module_name, _, type_name = hint_name.rpartition('.')\n \n # If this module name is empty, fallback to the passed module name if any.\n #\n # Note that we intentionally perform *NO* additional validation. Why?\n # Builtin types. Notably, it is valid to pass an unqualified \"hint_name\"\n # and a \"scope_name\" that is \"None\" only if \"hint_name\" is the name of a\n # builtin type (e.g., \"int\", \"str\"). Since validating this edge case is\n # non-trivial, we defer this validation to subsequent importation logic.\n if not type_module_name:\n type_module_name = scope_name\n # Else, this module name is non-empty.\n \n # Forward reference proxy to be returned.\n forwardref_subtype = make_type(\n type_name=type_name,\n type_module_name=type_module_name,\n type_bases=type_bases,\n exception_cls=BeartypeDecorHintForwardRefException,\n exception_prefix='Forward reference ',\n )\n \n # Classify passed parameters with this proxy.\n> forwardref_subtype.__name_beartype__ = hint_name # pyright: ignore\nE AttributeError: 'NoneType' object has no attribute '__name_beartype__'\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #4: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_add_func_scope_types", "Failure #5: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_express_func_scope_type_ref", "Failure #6: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py::test_make_forwardref_indexable_subtype", "Failure #7: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdreftest.py::test_is_forwardref", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #12: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #13: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #26: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #27: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #28: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #29: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #30: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/cls/test_utilclsmake.py", "test_make_type" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py", "test_iter_hint_pep695_forwardrefs" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 2, "true_in_degree": 6.8000000000000025, "out_degree": 1, "betweenness": 5.419231769704327e-06, "pagerank": 0.0008218937881092202, "harmonic": 0.0024671052631578946, "bidirectional_harmonic": 0.18333208732057496, "degree": 3 }, "line_count": 32, "code_line_count": 32, "cyclomatic": 9, "halstead_volume": 20.67970000576925, "halstead_difficulty": 1.25 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncscope.py", "function_name": "get_func_globals", "test_info": { "success": false, "failed": 21, "passed": 1109, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563\nLocation: /tmp/benchmark_l1q7wn1r/beartype/_check/forward/fwdmain.py:581\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_resolve_pep563() -> None:\n '''\n Test the :func:`beartype.peps.resolve_pep563` resolver.\n '''\n \n # .....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.peps import resolve_pep563\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n BeartypePep563Exception,\n )\n from beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve import (\n ToAvariceOrPride,\n FrequentWith,\n their_starry_domes,\n )\n from pytest import raises\n \n # .....................{ LOCALS }....................\n # Arbitrary instance of the generic accepted by the function called below.\n numberless_and_immeasurable_halls = ToAvariceOrPride()\n \n # Arbitrary instance of the class defining various problematic methods\n # called below.\n and_thrones_radiant_with_chrysolite = FrequentWith()\n \n # .....................{ PASS }....................\n # Assert that this function unsuccessfully raises the expected exception\n # *BEFORE* resolving all PEP 563-postponed type hints annotating these\n # callables.\n with raises(BeartypeDecorHintForwardRefException):\n their_starry_domes(numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.until_the_doves(\n numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.crystal_column(\n 'Nor had that scene of ampler majesty')\n \n # Resolve all PEP 563-postponed type hints annotating these callables.\n> resolve_pep563(their_starry_domes)\n\n> arg_name_to_hint[arg_name] = resolve_hint(\n\n> _resolve_func_scope_forward(\n\n> def _resolve_func_scope_forward(\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> None:\n '''\n Resolve the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) for that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n '''\n \n # ..................{ LOCALS }..................\n # Decorated callable and metadata associated with that callable, localized\n # to improve both readability and negligible efficiency when accessed below.\n func = decor_meta.func_wrappee_wrappee\n cls_stack = decor_meta.cls_stack\n \n # ..................{ NESTED }..................\n # If the decorated callable is nested (rather than global) and thus\n # *MAY* have a non-empty local nested scope...\n if decor_meta.func_wrappee_is_nested:\n # Attempt to...\n try:\n # Local scope of the decorated callable, localized to improve\n # readability and negligible efficiency when accessed below.\n func_locals = get_func_locals(\n func=func,\n \n # Ignore all lexical scopes in the fully-qualified name of the\n # decorated callable corresponding to parent classes lexically\n # nesting the current decorated class containing that callable\n # (including that class). Why? Because these classes are *ALL*\n # currently being decorated and thus have yet to be encapsulated\n # by new stack frames on the call stack. If these lexical scopes\n # are *NOT* ignored, this call to get_func_locals() will fail to\n # find the parent lexical scope of the decorated callable and\n # then raise an unexpected exception.\n #\n # Consider, for example, this nested class decoration of a\n # fully-qualified \"muh_package.Outer\" class:\n # @beartype\n # class Outer(object):\n # class Middle(object):\n # class Inner(object):\n # def muh_method(self) -> str:\n # return 'Painful API is painful.'\n #\n # When @beartype finally recurses into decorating the nested\n # muh_package.Outer.Middle.Inner.muh_method() method, this call\n # to get_func_locals() if *NOT* passed this parameter would\n # naively assume that the parent lexical scope of the current\n # muh_method() method on the call stack is named \"Inner\".\n # Instead, the parent lexical scope of that method on the call\n # stack is named \"muh_package\" -- the first lexical scope\n # enclosing that method that exists on the call stack. The\n # non-existent \"Outer\", \"Middle\", and \"Inner\" lexical scopes\n # must *ALL* be silently ignored.\n func_scope_names_ignore=(\n 0 if cls_stack is None else len(cls_stack)),\n \n #FIXME: Consider dynamically calculating exactly how many\n #additional @beartype-specific frames are ignorable on the\n #first call to this function, caching that number, and then\n #reusing that cached number on all subsequent calls to this\n #function. The current approach employed below of naively\n #hard-coding a number of frames to ignore was incredibly\n #fragile and had to be effectively disabled, which hampers\n #runtime efficiency.\n \n # Ignore additional frames on the call stack embodying:\n # * The current call to this function.\n #\n # Note that, for safety, we currently avoid ignoring additional\n # frames that we could technically ignore. These include:\n # * The call to the parent\n # beartype._check.metadata.metadecor.BeartypeDecorMeta.reinit() method.\n # * The call to the parent @beartype.beartype() decorator.\n #\n # Why? Because the @beartype codebase has been sufficiently\n # refactored so as to render any such attempts non-trivial,\n # fragile, and frankly dangerous.\n func_stack_frames_ignore=1,\n exception_cls=exception_cls,\n )\n # If this local scope cannot be found (i.e., if this getter found the\n # lexical scope of the module declaring the decorated callable *BEFORE*\n # that of the parent callable or class declaring that callable), then\n # this resolve_hint() function was called *AFTER* rather than *DURING*\n # the declaration of the decorated callable. This implies that that\n # callable is not, in fact, currently being decorated. Instead, that\n # callable was *NEVER* decorated by @beartype but has instead\n # subsequently been passed to this resolve_hint() function after its\n # initial declaration -- typically due to an external caller passing\n # that callable to our public beartype.peps.resolve_pep563() function.\n #\n # In this case, the call stack frame providing this local scope has\n # (almost certainly) already been deleted and is no longer accessible.\n # We have no recourse but to default to the empty frozen dictionary.\n except _BeartypeUtilCallableScopeNotFoundException:\n func_locals = FROZENDICT_EMPTY\n \n # If the decorated callable is a method transitively defined by a root\n # decorated class, add a pair of local attributes exposing:\n #\n # * The unqualified basename of the root decorated class. Why? Because\n # this class may be recursively referenced in postponed type hints and\n # *MUST* thus be exposed to *ALL* postponed type hints. However, this\n # class is currently being decorated and thus has yet to be defined in\n # either:\n # * If this class is module-scoped, the global attribute dictionary of\n # that module and thus the \"func_globals\" dictionary.\n # * If this class is closure-scoped, the local attribute dictionary of\n # that closure and thus the \"func_locals\" dictionary.\n # * The unqualified basename of the current decorated class. Why? For\n # similar reasons. Since the current decorated class may be lexically\n # nested in the root decorated class, the current decorated class is\n # *NOT* already accessible as either a global or local. Exposing the\n # current decorated class to a stringified\n # type hint referencing that class thus requires adding a local\n # attribute exposing that class.\n #\n # Note that:\n # * *ALL* intermediary classes (i.e., excluding the root decorated\n # class) lexically nesting the current decorated class are irrelevant.\n # Intermediary classes are neither module-scoped nor closure-scoped\n # and thus inaccessible as either globals or locals in the nested\n # lexical scope of the current decorated class: e.g.,\n # # This raises a parser error and is thus *NOT* fine:\n # # NameError: name 'muh_type' is not defined\n # class Outer(object):\n # class Middle(object):\n # muh_type = str\n #\n # class Inner(object):\n # def muh_method(self) -> muh_type:\n # return 'Dumpster fires are all I see.'\n # * This implicitly overrides any previously declared locals of the same\n # name. Although non-ideal, this constitutes syntactically valid\n # Python and is thus *NOT* worth emitting even a non-fatal warning\n # over: e.g.,\n # # This is fine... technically.\n # from beartype import beartype\n # def muh_closure() -> None:\n # MuhClass = 'This is horrible, yet fine.'\n #\n # @beartype\n # class MuhClass(object):\n # def muh_method(self) -> str:\n # return 'Look away and cringe, everyone!'\n if cls_stack:\n # Root and current decorated classes.\n cls_root = cls_stack[0]\n cls_curr = cls_stack[-1]\n \n # If this local scope is the empty frozen dictionary, mutate this\n # local scope into a new mutable dictionary to enable new locals to\n # be added to this scope below.\n if func_locals is FROZENDICT_EMPTY:\n func_locals = {}\n # Else, this local scope is *NOT* the empty frozen dictionary.\n # Presumably, this implies this scope to be a mutable dictionary.\n \n # Add new locals exposing these classes to type hints, overwriting\n # any locals of the same names in the higher-level local scope for\n # any closure declaring this class if any. These classes are\n # currently being decorated and thus guaranteed to be the most\n # recent declarations of these attributes.\n #\n # Note that the current class assumes lexical precedence over the\n # root class and is thus added *AFTER* the latter.\n func_locals[cls_root.__name__] = cls_root\n func_locals[cls_curr.__name__] = cls_curr\n \n # Local scope for the class directly defining this method.\n #\n # Note that callables *ONLY* have direct access to attributes\n # declared by the classes directly defining those callables. Ergo,\n # the local scopes for parent classes of this class (including the\n # root decorated class) are irrelevant.\n cls_curr_locals = get_type_locals(\n cls=cls_curr, exception_cls=exception_cls)\n \n # Forcefully merge this local scope into the current local\n # scope, implicitly overwriting any locals of the same name.\n # Class locals necessarily assume lexical precedence over:\n # * These classes themselves.\n # * Locals defined by higher-level parent classes.\n # * Locals defined by closures defining these classes.\n func_locals.update(cls_curr_locals)\n # Else, the decorated callable is *NOT* a method transitively\n # declared by a root decorated class.\n # Else, the decorated callable is global and thus guaranteed to have an\n # empty local scope. In this case, default to the empty frozen dictionary.\n else:\n func_locals = FROZENDICT_EMPTY\n \n # ..................{ SCOPE }..................\n # Fully-qualified name of the module declaring the decorated callable if\n # that callable defines the \"__module__\" dunder attribute *OR* \"None\"\n # (i.e., if that callable fails to define that attribute).\n func_module_name = get_object_module_name_or_none(func) # type: ignore[operator]\n \n # Global scope of the decorated callable.\n func_globals = get_func_globals(func=func, exception_cls=exception_cls)\n \n # Forward scope compositing this global and local scope of the decorated\n # callable as well as dynamically replacing each unresolved attribute of\n # this stringified type hint with a forward reference proxy resolving\n # this attribute on the first attempt to pass this attribute as the\n # second parameter to an isinstance()-based runtime type-check: e.g.,\n # from beartype import beartype\n # from beartype.typing import Dict, Generic, TypeVar\n #\n # T = TypeVar('T')\n #\n # # @beartype resolves this stringified type hint as follows:\n # # * The \"Dict\", \"str\", and \"int\" attributes are globals and thus\n # # trivially resolved to those objects via the \"func_globals\"\n # # scope decided above.\n # # * The \"MuhGeneric\" attribute is neither a global nor local and\n # # thus remains unresolved. This forward scope replaces this\n # # unresolved attribute with a forward reference proxy.\n # @beartype\n # def muh_func(muh_arg: 'Dict[str, MuhGeneric[int]]') -> None: ...\n #\n # class MuhGeneric(Generic[T]): ...\n #\n # Initialize this forward scope to the set of all builtin attributes\n # (e.g., \"str\", \"Exception\"). Although the eval() builtin does, of\n # course, implicitly evaluate this stringified type hint against all\n # builtin attributes, it does so only *AFTER* invoking the\n # BeartypeForwardScope.__missing__() dunder method with each such\n # builtin attribute referenced in this hint. Since handling that\n # eccentricity would be less efficient and trivial than simply\n # initializing this forward scope with all builtin attributes, we prefer\n # the current (admittedly sus af) approach. Do not squint at this.\n \n #FIXME: [SPEED] Optimize away the repeated access to the\n #\"decor_meta.func_wrappee_scope_forward\" instance variable above, here,\n #and below with a local variable, please. *sigh*\n decor_meta.func_wrappee_scope_forward = BeartypeForwardScope(\n scope_dict=func_builtins, scope_name=func_module_name) # type: ignore[arg-type]\n \n # Composite this global and local scope into this forward scope (in that\n # order), implicitly overwriting first each builtin attribute and then\n # each global attribute previously copied into this forward scope with\n # each global and then local attribute of the same name. Since locals\n # *ALWAYS* assume precedence over globals *ALWAYS* assume precedence\n # over builtins, order of operations is *EXTREMELY* significant here.\n> decor_meta.func_wrappee_scope_forward.update(func_globals)\nE TypeError: 'NoneType' object is not iterable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487\nLocation: /tmp/benchmark_l1q7wn1r/beartype/_check/forward/fwdmain.py:581\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_decor_type_descriptor_custom_pep487() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on :pep:`487`-compliant\n **custom pure-Python method descriptors** (i.e., methods decorated by\n pure-Python types satisfying the :pep:`487`-compliant descriptor protocol by\n declaring at least the ``__set_name__()`` dunder method).\n \n This unit test exercises an inscrutable `edge case`_ induced by\n :func:`beartype.beartype`-decorated classes defining at least two kinds of\n seemingly unrelated methods that nonetheless *could* interact harmfully:\n \n * A method decorated by a :pep:`487`-compliant custom pure-Python method\n descriptor declaring at least the ``__set_name__()`` dunder method.\n * A method annotated by a stringified forward reference to a currently\n undefined type, which :func:`beartype.beartype` then internally coerces\n into a **forward reference proxy** (i.e.,\n :class:`beartype._check.forward.reference.fwdrefabc.BeartypeForwardRefABC`\n subclass) encapsulating that undefined type.\n \n For obscure reasons that are difficult to fully explain within the expected\n lifetime of the Universe, this interaction causes the ``__set_name__()``\n dunder method of the descriptor decorating the first method to be\n erroneously called multiple times with erroneous owners. Although seemingly\n innocuous, this issue is indicative of an explosive increase in the space\n and time complexity associated with forward reference proxies. Ergo, this\n issue is actually quite serious. It is imperative this *never* happen again.\n \n .. _edge case:\n https://github.com/beartype/beartype/issues/488#issuecomment-2650865299\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.typing import Optional\n from collections.abc import Callable\n \n # ....................{ DESCRIPTORS }....................\n class setname_descriptor(object):\n '''\n **Setname method descriptor** (i.e., pure-Python object whose\n :pep:`487`-compliant :meth:`__set_name__` dunder method raises an\n exception when called more than once as a regression check against this\n issue silently reverting).\n \n Attributes\n ----------\n _is_set_name_called : bool\n :data:`True` only if Python has already called the\n :pep:`487`-compliant :meth:`__set_name__` dunder method.\n '''\n \n def __init__(self, func: Callable) -> None:\n '''\n Initialize this method descriptor by doing... absolutely nothing.\n '''\n \n # Record that Python has yet to call __set_name__().\n self._is_set_name_called = False\n \n \n def __call__(self) -> None:\n '''\n Call this method descriptor by doing... absolutely nothing.\n '''\n \n # Doing nothing never felt so good, so right, so... clean.\n pass\n \n \n def __set_name__(self, owner: type, name: str) -> None:\n '''\n :pep:`487`-compliant callback called by Python itself with metadata\n describing the current decoration of an external method by this\n descriptor.\n \n Parameters\n ----------\n owner : type\n Parent class declaring that external method.\n name : str\n Unqualified basename of that external method.\n '''\n \n # If Python has already called this dunder method, this issue has\n # reverted. In this case, raise an exception.\n if self._is_set_name_called:\n raise ValueError(\n 'PEP 487 setname_descriptor.__set_name__() dunder method '\n 'already called.'\n )\n # Else, this is Python's first call of this dunder method.\n \n # Record that Python has already called this dunder method.\n self._is_set_name_called = True\n \n # ....................{ CLASSES }....................\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_type(obj, **kwargs) # type: ignore[return-value]\n\n> attr_value_beartyped = beartype_object( # type: ignore[type-var]\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> hint_or_sane = sanify_hint_root_func(\n\n> hint = decor_meta.func_arg_name_to_hint[pith_name] = coerce_func_hint_root(\n\n> hint = resolve_hint( # pyright: ignore\n\n> _resolve_func_scope_forward(\n\n> def _resolve_func_scope_forward(\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> None:\n '''\n Resolve the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) for that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n '''\n \n # ..................{ LOCALS }..................\n # Decorated callable and metadata associated with that callable, localized\n # to improve both readability and negligible efficiency when accessed below.\n func = decor_meta.func_wrappee_wrappee\n cls_stack = decor_meta.cls_stack\n \n # ..................{ NESTED }..................\n # If the decorated callable is nested (rather than global) and thus\n # *MAY* have a non-empty local nested scope...\n if decor_meta.func_wrappee_is_nested:\n # Attempt to...\n try:\n # Local scope of the decorated callable, localized to improve\n # readability and negligible efficiency when accessed below.\n func_locals = get_func_locals(\n func=func,\n \n # Ignore all lexical scopes in the fully-qualified name of the\n # decorated callable corresponding to parent classes lexically\n # nesting the current decorated class containing that callable\n # (including that class). Why? Because these classes are *ALL*\n # currently being decorated and thus have yet to be encapsulated\n # by new stack frames on the call stack. If these lexical scopes\n # are *NOT* ignored, this call to get_func_locals() will fail to\n # find the parent lexical scope of the decorated callable and\n # then raise an unexpected exception.\n #\n # Consider, for example, this nested class decoration of a\n # fully-qualified \"muh_package.Outer\" class:\n # @beartype\n # class Outer(object):\n # class Middle(object):\n # class Inner(object):\n # def muh_method(self) -> str:\n # return 'Painful API is painful.'\n #\n # When @beartype finally recurses into decorating the nested\n # muh_package.Outer.Middle.Inner.muh_method() method, this call\n # to get_func_locals() if *NOT* passed this parameter would\n # naively assume that the parent lexical scope of the current\n # muh_method() method on the call stack is named \"Inner\".\n # Instead, the parent lexical scope of that method on the call\n # stack is named \"muh_package\" -- the first lexical scope\n # enclosing that method that exists on the call stack. The\n # non-existent \"Outer\", \"Middle\", and \"Inner\" lexical scopes\n # must *ALL* be silently ignored.\n func_scope_names_ignore=(\n 0 if cls_stack is None else len(cls_stack)),\n \n #FIXME: Consider dynamically calculating exactly how many\n #additional @beartype-specific frames are ignorable on the\n #first call to this function, caching that number, and then\n #reusing that cached number on all subsequent calls to this\n #function. The current approach employed below of naively\n #hard-coding a number of frames to ignore was incredibly\n #fragile and had to be effectively disabled, which hampers\n #runtime efficiency.\n \n # Ignore additional frames on the call stack embodying:\n # * The current call to this function.\n #\n # Note that, for safety, we currently avoid ignoring additional\n # frames that we could technically ignore. These include:\n # * The call to the parent\n # beartype._check.metadata.metadecor.BeartypeDecorMeta.reinit() method.\n # * The call to the parent @beartype.beartype() decorator.\n #\n # Why? Because the @beartype codebase has been sufficiently\n # refactored so as to render any such attempts non-trivial,\n # fragile, and frankly dangerous.\n func_stack_frames_ignore=1,\n exception_cls=exception_cls,\n )\n # If this local scope cannot be found (i.e., if this getter found the\n # lexical scope of the module declaring the decorated callable *BEFORE*\n # that of the parent callable or class declaring that callable), then\n # this resolve_hint() function was called *AFTER* rather than *DURING*\n # the declaration of the decorated callable. This implies that that\n # callable is not, in fact, currently being decorated. Instead, that\n # callable was *NEVER* decorated by @beartype but has instead\n # subsequently been passed to this resolve_hint() function after its\n # initial declaration -- typically due to an external caller passing\n # that callable to our public beartype.peps.resolve_pep563() function.\n #\n # In this case, the call stack frame providing this local scope has\n # (almost certainly) already been deleted and is no longer accessible.\n # We have no recourse but to default to the empty frozen dictionary.\n except _BeartypeUtilCallableScopeNotFoundException:\n func_locals = FROZENDICT_EMPTY\n \n # If the decorated callable is a method transitively defined by a root\n # decorated class, add a pair of local attributes exposing:\n #\n # * The unqualified basename of the root decorated class. Why? Because\n # this class may be recursively referenced in postponed type hints and\n # *MUST* thus be exposed to *ALL* postponed type hints. However, this\n # class is currently being decorated and thus has yet to be defined in\n # either:\n # * If this class is module-scoped, the global attribute dictionary of\n # that module and thus the \"func_globals\" dictionary.\n # * If this class is closure-scoped, the local attribute dictionary of\n # that closure and thus the \"func_locals\" dictionary.\n # * The unqualified basename of the current decorated class. Why? For\n # similar reasons. Since the current decorated class may be lexically\n # nested in the root decorated class, the current decorated class is\n # *NOT* already accessible as either a global or local. Exposing the\n # current decorated class to a stringified\n # type hint referencing that class thus requires adding a local\n # attribute exposing that class.\n #\n # Note that:\n # * *ALL* intermediary classes (i.e., excluding the root decorated\n # class) lexically nesting the current decorated class are irrelevant.\n # Intermediary classes are neither module-scoped nor closure-scoped\n # and thus inaccessible as either globals or locals in the nested\n # lexical scope of the current decorated class: e.g.,\n # # This raises a parser error and is thus *NOT* fine:\n # # NameError: name 'muh_type' is not defined\n # class Outer(object):\n # class Middle(object):\n # muh_type = str\n #\n # class Inner(object):\n # def muh_method(self) -> muh_type:\n # return 'Dumpster fires are all I see.'\n # * This implicitly overrides any previously declared locals of the same\n # name. Although non-ideal, this constitutes syntactically valid\n # Python and is thus *NOT* worth emitting even a non-fatal warning\n # over: e.g.,\n # # This is fine... technically.\n # from beartype import beartype\n # def muh_closure() -> None:\n # MuhClass = 'This is horrible, yet fine.'\n #\n # @beartype\n # class MuhClass(object):\n # def muh_method(self) -> str:\n # return 'Look away and cringe, everyone!'\n if cls_stack:\n # Root and current decorated classes.\n cls_root = cls_stack[0]\n cls_curr = cls_stack[-1]\n \n # If this local scope is the empty frozen dictionary, mutate this\n # local scope into a new mutable dictionary to enable new locals to\n # be added to this scope below.\n if func_locals is FROZENDICT_EMPTY:\n func_locals = {}\n # Else, this local scope is *NOT* the empty frozen dictionary.\n # Presumably, this implies this scope to be a mutable dictionary.\n \n # Add new locals exposing these classes to type hints, overwriting\n # any locals of the same names in the higher-level local scope for\n # any closure declaring this class if any. These classes are\n # currently being decorated and thus guaranteed to be the most\n # recent declarations of these attributes.\n #\n # Note that the current class assumes lexical precedence over the\n # root class and is thus added *AFTER* the latter.\n func_locals[cls_root.__name__] = cls_root\n func_locals[cls_curr.__name__] = cls_curr\n \n # Local scope for the class directly defining this method.\n #\n # Note that callables *ONLY* have direct access to attributes\n # declared by the classes directly defining those callables. Ergo,\n # the local scopes for parent classes of this class (including the\n # root decorated class) are irrelevant.\n cls_curr_locals = get_type_locals(\n cls=cls_curr, exception_cls=exception_cls)\n \n # Forcefully merge this local scope into the current local\n # scope, implicitly overwriting any locals of the same name.\n # Class locals necessarily assume lexical precedence over:\n # * These classes themselves.\n # * Locals defined by higher-level parent classes.\n # * Locals defined by closures defining these classes.\n func_locals.update(cls_curr_locals)\n # Else, the decorated callable is *NOT* a method transitively\n # declared by a root decorated class.\n # Else, the decorated callable is global and thus guaranteed to have an\n # empty local scope. In this case, default to the empty frozen dictionary.\n else:\n func_locals = FROZENDICT_EMPTY\n \n # ..................{ SCOPE }..................\n # Fully-qualified name of the module declaring the decorated callable if\n # that callable defines the \"__module__\" dunder attribute *OR* \"None\"\n # (i.e., if that callable fails to define that attribute).\n func_module_name = get_object_module_name_or_none(func) # type: ignore[operator]\n \n # Global scope of the decorated callable.\n func_globals = get_func_globals(func=func, exception_cls=exception_cls)\n \n # Forward scope compositing this global and local scope of the decorated\n # callable as well as dynamically replacing each unresolved attribute of\n # this stringified type hint with a forward reference proxy resolving\n # this attribute on the first attempt to pass this attribute as the\n # second parameter to an isinstance()-based runtime type-check: e.g.,\n # from beartype import beartype\n # from beartype.typing import Dict, Generic, TypeVar\n #\n # T = TypeVar('T')\n #\n # # @beartype resolves this stringified type hint as follows:\n # # * The \"Dict\", \"str\", and \"int\" attributes are globals and thus\n # # trivially resolved to those objects via the \"func_globals\"\n # # scope decided above.\n # # * The \"MuhGeneric\" attribute is neither a global nor local and\n # # thus remains unresolved. This forward scope replaces this\n # # unresolved attribute with a forward reference proxy.\n # @beartype\n # def muh_func(muh_arg: 'Dict[str, MuhGeneric[int]]') -> None: ...\n #\n # class MuhGeneric(Generic[T]): ...\n #\n # Initialize this forward scope to the set of all builtin attributes\n # (e.g., \"str\", \"Exception\"). Although the eval() builtin does, of\n # course, implicitly evaluate this stringified type hint against all\n # builtin attributes, it does so only *AFTER* invoking the\n # BeartypeForwardScope.__missing__() dunder method with each such\n # builtin attribute referenced in this hint. Since handling that\n # eccentricity would be less efficient and trivial than simply\n # initializing this forward scope with all builtin attributes, we prefer\n # the current (admittedly sus af) approach. Do not squint at this.\n \n #FIXME: [SPEED] Optimize away the repeated access to the\n #\"decor_meta.func_wrappee_scope_forward\" instance variable above, here,\n #and below with a local variable, please. *sigh*\n decor_meta.func_wrappee_scope_forward = BeartypeForwardScope(\n scope_dict=func_builtins, scope_name=func_module_name) # type: ignore[arg-type]\n \n # Composite this global and local scope into this forward scope (in that\n # order), implicitly overwriting first each builtin attribute and then\n # each global attribute previously copied into this forward scope with\n # each global and then local attribute of the same name. Since locals\n # *ALWAYS* assume precedence over globals *ALWAYS* assume precedence\n # over builtins, order of operations is *EXTREMELY* significant here.\n> decor_meta.func_wrappee_scope_forward.update(func_globals)\nE TypeError: 'NoneType' object is not iterable\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #17: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #21: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py", "test_resolve_pep563" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py", "test_decor_type_descriptor_custom_pep487" ] ] }, "complexity_info": { "centrality": { "distance_discount": 8.660480000000005, "in_degree": 1, "true_in_degree": 3.0800000000000005, "out_degree": 2, "betweenness": 7.541764212838521e-05, "pagerank": 0.00028725369805818646, "harmonic": 0.011156798245614035, "bidirectional_harmonic": 0.2118538533834593, "degree": 3 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/_pep/pep484/redpep484.py", "function_name": "reduce_hint_pep484_deprecated", "test_info": { "success": false, "failed": 25, "passed": 1105, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_twbpozwu/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:119\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n> with warns(hint_meta.warning_type):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: <@beartype(__beartype_checker_1) at 0x2c819540>:21\nError: beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value \"Oh, importunate \u0398 Fortuna'd afforded\" violates type hint typing.Hashable, as str \"Oh, importunate \u0398 Fortuna'd afforded\" not instance of .\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> > ???\nE beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value \"Oh, importunate \u0398 Fortuna'd afforded\" violates type hint typing.Hashable, as str \"Oh, importunate \u0398 Fortuna'd afforded\" not instance of .\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #19: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #20: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #21: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #22: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #23: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #24: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #25: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.6, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 2, "betweenness": 5.419231769704327e-06, "pagerank": 0.00031609195402298854, "harmonic": 0.003289473684210526, "bidirectional_harmonic": 0.21889827551834168, "degree": 3 }, "line_count": 23, "code_line_count": 23, "cyclomatic": 3, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_conf/confoverrides.py", "function_name": "beartype_hint_overrides_pep484_tower", "test_info": { "success": false, "failed": 44, "passed": 1049, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_cvgxd5d3/beartype/_util/kind/map/utilmapfrozen.py:142\nError: beartype.roar.BeartypeKindFrozenDictException: Non-dictionary None not addable to immutable dictionary BeartypeHintOverrides({}).\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> conf=BeartypeConf(is_pep484_tower=True),\n\n> default_conf_kwargs_after(conf_kwargs)\n\n> hint_overrides | BEARTYPE_HINT_OVERRIDES_PEP484_TOWER) # type: ignore[assignment]\n\n> def __or__(self, other: Mapping) -> 'FrozenDict':\n '''\n Create and return a new immutable dictionary containing all key-value\n pairs contained in both the current and passed immutable dictionaries.\n \n Parameters\n ----------\n other: Mapping\n Possibly mutable dictionary to be added to this immutable\n dictionary.\n \n Returns\n -------\n FrozenDict\n Immutable dictionary adding the current and passed dictionaries.\n \n Raises\n ------\n BeartypeKindFrozenDictException\n If the passed dictionary is *not* actually a dictionary.\n '''\n \n # If the passed dictionary is *NOT* a dictionary, raise an exception.\n if not isinstance(other, Mapping):\n> raise BeartypeKindFrozenDictException(\n f'Non-dictionary {repr(other)} not addable to '\n f'immutable dictionary {repr(self)}.'\n )\nE beartype.roar.BeartypeKindFrozenDictException: Non-dictionary None not addable to immutable dictionary BeartypeHintOverrides({}).\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none\nLocation: /tmp/benchmark_cvgxd5d3/beartype/_util/kind/map/utilmapfrozen.py:142\nError: beartype.roar.BeartypeKindFrozenDictException: Non-dictionary None not addable to immutable dictionary BeartypeHintOverrides({}).\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> conf=BeartypeConf(is_pep484_tower=True),\n\n> default_conf_kwargs_after(conf_kwargs)\n\n> hint_overrides | BEARTYPE_HINT_OVERRIDES_PEP484_TOWER) # type: ignore[assignment]\n\n> def __or__(self, other: Mapping) -> 'FrozenDict':\n '''\n Create and return a new immutable dictionary containing all key-value\n pairs contained in both the current and passed immutable dictionaries.\n \n Parameters\n ----------\n other: Mapping\n Possibly mutable dictionary to be added to this immutable\n dictionary.\n \n Returns\n -------\n FrozenDict\n Immutable dictionary adding the current and passed dictionaries.\n \n Raises\n ------\n BeartypeKindFrozenDictException\n If the passed dictionary is *not* actually a dictionary.\n '''\n \n # If the passed dictionary is *NOT* a dictionary, raise an exception.\n if not isinstance(other, Mapping):\n> raise BeartypeKindFrozenDictException(\n f'Non-dictionary {repr(other)} not addable to '\n f'immutable dictionary {repr(self)}.'\n )\nE beartype.roar.BeartypeKindFrozenDictException: Non-dictionary None not addable to immutable dictionary BeartypeHintOverrides({}).\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #25: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #29: beartype_test/a00_unit/a40_api/conf/test_confcls.py::test_conf_dataclass", "Failure #30: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #31: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #32: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #33: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #34: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #35: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #36: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #38: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #39: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #40: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #41: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #42: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #43: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #44: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_type_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 12.066047999999999, "in_degree": 1, "true_in_degree": 4.360000000000001, "out_degree": 1, "betweenness": 0.00013548079424260818, "pagerank": 0.0005769877127110273, "harmonic": 0.013678728070175438, "bidirectional_harmonic": 0.1971485294676091, "degree": 2 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep585.py", "function_name": "is_hint_pep585_builtin_subscripted", "test_info": { "success": false, "failed": 28, "passed": 1102, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_eomok0lu/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:705\nError: beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic pseudo-superclasses not found.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484585_generic_args_full(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n hint_base_target: Optional[Hint] = None,\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> TupleHints:\n '''\n Tuple of the one or more **full child type hints** (i.e., complete tuple of\n *all* type hints directly subscripting both the passed generic *and*\n one or more pseudo-superclasses of this generic) transitively subscripting\n the passed :pep:`484`- or :pep:`585`-compliant **generic** (i.e., class\n superficially subclassing at least one PEP-compliant type hint that is\n possibly *not* an actual class) if this object is a generic *or* raise an\n exception otherwise (i.e., if this object is not a generic).\n \n This getter greedily replaces in the passed tuple as many abstract\n :pep:`484`-compliant **type variables** (i.e., :class:`typing.TypeVar`\n objects) as there are concrete child type hints directly subscripting the\n passed generic. Doing so effectively \"bubbles up\" these concrete children up\n the class hierarchy into the \"empty placeholders\" established by the type\n variables transitively subscripting all pseudo-superclasses of this generic.\n \n This getter is guaranteed to return a non-empty tuple. By definition, a\n generic subclasses one or more generic superclasses necessarily subscripted\n by one or more child type hints.\n \n This getter is memoized for efficiency.\n \n Caveats\n -------\n **This getter is computationally complex in both space and time.** This\n getter exhibits:\n \n * Amortized :math:`O(1)` constant time complexity, thanks to memoization.\n * Non-amortized worst-case :math:`O(jk)` quadratic time complexity for:\n \n * :math:`j` the largest number of child type hints transitively\n subscripting a pseudo-superclass of this generic.\n * :math:`k` the total number of transitive pseudo-superclasses of this\n generic.\n \n **This getter is currently implemented with recursion.** Doing so yields a\n relatively trivial algorithm at a relatively non-trivial increase in runtime\n overhead, due to overhead associated with function calls in Python.\n \n Parameters\n ----------\n hint : object\n Generic type hint to be inspected.\n hint_base_target : Optional[Hint] = None\n **Target pseudo-superclass** (i.e., erased transitive pseudo-superclass\n of the passed generic to specifically search, filter, and return the\n child type hints of). Defaults to :data:`None`. Specifically:\n \n * If this parameter is :data:`None`, this getter returns the complete\n tuple of *all* type hints directly subscripting both the passed\n generic *and* one or more pseudo-superclasses of this generic.\n * If this parameter is *not* :data:`None`, this getter returns the\n partial tuple of *only* type hints directly subscripting both the\n passed generic *and* this passed pseudo-superclass of this generic.\n \n A target pseudo-superclass is passed to deduce whether two generics are\n related according to the :func:`beartype.door.is_subhint` relation. If\n all child type hints in the tuple returned by this getter (when passed\n some generic and its pseudo-superclass) are subhints of all child type\n hints in the tuple returned by this getter passed *only* that\n pseudo-superclass, then that generic is necessarily a subhint of that\n pseudo-superclass. Look. Just go with it, people.\n \n Lastly, note that this getter intentionally ignores *all* child hints\n subscripting this target pseudo-superclass. For search purposes, *any*\n child hints subscripting this target pseudo-superclass are not only\n irrelevant but harmful -- promoting false negatives in higher-level\n functions (e.g., :func:`beartype.door.is_subhint`) internally leveraging\n this lower-level getter. Ignoring these child hints is thus imperative.\n Since deciding child hint compatibility between the passed generic and\n this target pseudo-superclass is a non-trivial decision problem, this\n lower-level getter defers that problem to the caller by unconditionally\n returning the same result regardless of child hints subscripting this\n target pseudo-superclass.\n \n For example, consider the :pep:`484`-compliant :obj:`typing.Any`.\n Clearly, this getter should return the same tuple when passed an\n unsubscripted target pseudo-superclass as when passed a target\n pseudo-superclass subscripted by :obj:`typing.Any`: e.g.,\n \n .. code-block:: pycon\n \n >>> from typing import Any, Generic\n >>> class MuhGeneric[S, T](Generic[S, T]): pass\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[Any])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[S, T])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[int, float])\n (S, T)\n \n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`.BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n Tuple[Hint, ...]\n Tuple of the one or more full child type hints transitively subscripting\n this generic.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * Neither a :pep:`484`- nor :pep:`585`-compliant generic.\n * A :pep:`484`- or :pep:`585`-compliant generic subclassing *no*\n pseudo-superclasses.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.typing import Generic, TypeVar\n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_args_full)\n \n >>> S = TypeVar('S')\n >>> T = TypeVar('T')\n \n >>> class GenericSuperclass(Generic[S], list[T]): pass\n >>> class GenericList(list[complex]): pass\n >>> class GenericSubclass(GenericSuperclass[int, T], GenericList): pass\n \n >>> get_hint_pep484585_generic_args_full(GenericSuperclass)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(GenericSuperclass[int, float])\n (int, float)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass)\n (int, T, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n '''\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception type.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # ....................{ IMPORTS }....................\n # Avoid circular import dependencies.\n from beartype._util.hint.pep.utilpepget import get_hint_pep_args\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic_user)\n \n # ....................{ PREAMBLE }....................\n # If the caller explicitly passed a pseudo-superclass target...\n #\n # Note that this is the common case for this getter and thus tested first.\n if hint_base_target:\n hint_base_target = (\n # If this pseudo-superclass target is this generic, this\n # pseudo-superclass target is effectively meaningless (albeit\n # technically valid). In this case, silently ignore this\n # pseudo-superclass target.\n None\n if hint is hint_base_target else\n # Else, this pseudo-superclass target is *NOT* this generic. In this\n # case, the unsubscripted generic underlying this possibly\n # subscripted target pseudo-superclass generic. See the docstring.\n get_hint_pep484585_generic_type( # pyright: ignore\n hint=hint_base_target,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n )\n # Else, the caller passed *NO* pseudosuperclass target. In this case...\n \n # ....................{ LOCALS }....................\n # Metadata describing the passed generic, used to seed the depth-first\n # search (DFS) below with the first pseudo-superclass to be visited.\n hint_root_data = [\n # This generic.\n hint,\n \n # Metadata describing the direct parent pseudo-superclass of this\n # generic. By definition, this generic is the root of this n-ary tree\n # and thus has *NO* parent (either direct or indirect).\n None,\n ]\n \n # Unvisited pseudo-superclass stack (i.e., efficiently poppable list of\n # metadata describing *ALL* unvisited transitive pseudo-superclasses of this\n # generic, intentionally reordered in reverse order to enable the\n # non-recursive depth-first search (DFS) performed below to both visit and\n # pop these pseudo-superclasses in the expected order), seeded with metadata\n # describing the passed generic.\n #\n # Each item of this stack is a list of metadata describing an unvisited\n # transitive pseudo-superclass of this generic such that this list is\n # either:\n # * If this pseudo-superclass has yet to be visited by this DFS, a 2-list\n # \"(hint, hint_super_data)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is either:\n # * If this pseudo-superclass has a parent pseudo-superclass, the item\n # of this stack describing that parent pseudo-superclass.\n # * Else, this pseudo-superclass is the passed generic. Since this\n # generic has *NO* parent pseudo-superclass, \"None\".\n # * If this pseudo-superclass is itself a user-defined generic (i.e.,\n # defined by a third-party downstream package) that has already been\n # visited by this DFS, a 4-list \"(hint, hint_super_data, hint_args_stack,\n # hint_args_full)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is as defined above.\n # * \"hint_args_stack\" is this pseudo-superclass' direct child hint stack\n # (i.e., list of the zero or more child hints directly subscripting this\n # pseudo-superclass in reverse order, embodying an efficiently poppable\n # stack of these hints), popped off while recursing up from the child\n # pseudo-superclasses of this pseudo-superclass.\n # * \"hint_args_full\" is the list of zero or more child hints transitively\n # subscripting this pseudo-superclass, defined while recursing up from\n # the child pseudo-superclasses of this pseudo-superclass.\n #\n # In short, there be dragons here -- albeit extremely efficient dragons.\n hint_bases_data: _HintBasesData = [hint_root_data]\n \n # Dictionary mapping from each previously observed PEP 484-compliant type\n # variable (i.e., \"typing.TypeVar\" object) subscripting a transitive\n # pseudo-superclass of this generic to the corresponding child hint \"bubbled\n # up\" from a subclass of that pseudo-superclass into that type variable.\n #\n # This dictionary enables the DFS below to reliably \"bubble up\" a single\n # child hint to the same type variable appearing multiple times throughout a\n # generics hierarchy. For example, this dictionary enables the \"int\" child\n # hint subscripting the \"GenericList\" generic to be \"bubbled up\" into the\n # type variable \"T\" subscripting the pseudo-superclasses \"List\" and\n # \"Generic\" of this generic: e.g.,\n # >>> class GenericList[T](List[T], Generic[T]): pass\n # >>> get_hint_pep484585_generic_args_full(GenericList[int])\n # (int, int)\n #\n # For the above call, this contents of this dictionary resemble:\n # typevar_to_hint = {T: int}\n typevar_to_hint: TypeVarToHint = {}\n \n # ....................{ LOCALS ~ target }....................\n # List of zero or more child hints transitively subscripting the passed\n # target pseudo-superclass of this generic if this pseudo-superclass has\n # already been visited by the DFS below *OR* \"None\" otherwise (i.e., if this\n # pseudo-superclass has yet to be visited by this DFS).\n hint_base_target_args_full: Optional[ListHints] = None\n \n # True only if the pseudo-superclass currently visited by the DFS below is\n # still transitively subscripted by one or more PEP 484-compliant type\n # variables (i.e., \"TypeVar\" objects) that have yet to be replaced by\n # concrete hints of a parent pseudo-superclass of that pseudo-superclass.\n is_hint_base_arg_typevar = False\n \n # ....................{ SEARCH }....................\n # Iteration simulating a recursive depth-first search (DFS), efficiently\n # deciding the tuple of all child hints transitively subscripting the\n # desired pseudo-superclass of this generic.\n \n # With at least one transitive pseudo-superclass of this generic remains\n # unvisited...\n while hint_bases_data:\n # Metadata describing the currently visited transitive pseudo-superclass\n # of this generic defined as the top-most item of this stack.\n #\n # Note that we intentionally avoid popping this pseudo-superclass off\n # this stack yet. We only pop a pseudo-superclass off this stack *AFTER*\n # resolving all child pseudo-superclasses of that pseudo-superclass,\n # which simulates the \"backing out\" performed by genuine recursion.\n hint_base_data = hint_bases_data[-1]\n \n # Currently visited transitive pseudo-superclass of this generic.\n hint_base = hint_base_data[_HINT_BASES_INDEX_HINT]\n \n # True only if the metadata describing this pseudo-superclass is still\n # its initial size, implying that this DFS has yet to visit this\n # pseudo-superclass by recursing down into the child pseudo-superclasses\n # of this pseudo-superclass.\n is_hint_base_leaf = len(hint_base_data) == _HINT_BASE_DATA_LEN_LEAF\n \n # If...\n if (\n # This DFS has yet to visit this pseudo-superclass *AND*...\n is_hint_base_leaf and\n # This pseudo-superclass is itself a PEP 484- or 585-compliant\n # user-defined generic. Standard generics (i.e., that are *NOT*\n # user-defined) have *NO* pseudo-superclasses and are thus omitted.\n # Examples of omittable standard generics include:\n # * \"dict[str, U]\".\n # * \"typing.Generic[S, int]\").\n # * \"typing.Protocol[float, T]\").\n #\n # Note that this tester is mildly slower than the prior test and\n # thus intentionally tested later.\n is_hint_pep484585_generic_user(hint_base) # pyright: ignore\n # Then this DFS is currently recursing down into the child\n # pseudo-superclasses of this pseudo-superclass. In this case...\n ):\n # Expand the metadata describing this pseudo-superclass from its\n # current 2-list \"(hint, hint_super_data)\" into the expanded 4-list\n # \"(hint, hint_super_data, hint_args_stack, hint_args_full)\".\n # Specifically, append (in order):\n hint_base_data.extend((\n # Poppable stack of the zero or more child hints directly\n # subscripting this child pseudo-superclass.\n make_stack(get_hint_pep_args(hint_base)),\n # List of the zero or more child hints transitively subscripting\n # this child pseudo-superclass.\n [],\n ))\n \n # Tuple of the one or more child pseudo-superclasses of this\n # pseudo-superclass.\n # print(f'Introspecting generic {hint} unerased bases...')\n hint_child_bases = get_hint_pep484585_generic_bases_unerased(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # print(f'Generic {hint} unerased bases: {hint_child_bases}')\n \n # For each child pseudo-superclass of this pseudo-superclass,\n # intentionally iterated in reverse order so as to ensure that the\n # *FIRST* child pseudo-superclass is the *LAST* item of this stack\n # (and thus the *FIRST* unvisited pseudo-superclass to be visited by\n # this depth-first search (DFS) next).\n #\n # Note that the reversed() builtin is well-known to be the most\n # efficient means of producing a reversed iterable for iteration\n # purposes. See also:\n # https://stackoverflow.com/a/16514411/2809027\n for hint_child_base in reversed(hint_child_bases):\n # Push metadata describing this unvisited child\n # pseudo-superclass onto this stack.\n hint_bases_data.append([\n # This child pseudo-superclass.\n hint_child_base,\n \n # Metadata describing the direct parent\n # pseudo-superclass of this child pseudo-superclass.\n hint_base_data,\n ])\n # Else, either:\n # * This DFS has already visited this pseudo-superclass *OR*...\n # * This pseudo-superclass is a \"terminal\" leaf generic *OR*...\n # * This pseudo-superclass is *NOT* a generic.\n #\n # In any case, this DFS should *NOT* recurse (back) down into this\n # pseudo-superclass. Therefore, this DFS is currently recursing back up\n # out of this pseudo-superclass into its parent pseudo-superclass.\n else:\n # Pop this pseudo-superclass off this stack.\n hint_bases_data.pop()\n # print(f'Resuming generic {hint} pseudo-superclass {hint_base} args {hint_base_args}...')\n \n # List of the zero or more child hints transitively subscripting\n # this pseudo-superclass, defined as either...\n hint_base_args_full: ListHints = ( # pyright: ignore\n # If this is a terminal leaf pseudo-superclass, the tuple of\n # zero or more child hints directly subscripting this\n # pseudo-superclass. Why? Because this pseudo-superclass has\n # *NO* child pseudo-superclass to recurse down into. If this\n # pseudo-superclass had one or more child pseudo-superclasses to\n # recurse down into, then those child pseudo-superclasses would\n # have defined the \"hint_base_data[_HINT_BASES_INDEX_ARGS_FULL]\"\n # list accessed by the next branch, providing the list of zero\n # or more child hints transitively subscripting this\n # pseudo-superclass. Although that list remains undefined, the\n # tuple of zero or more child hints directly subscripting this\n # pseudo-superclass is semantically equivalent to what that list\n # would have been (had that list actually been defined).\n list(get_hint_pep_args(hint_base))\n if is_hint_base_leaf else\n # Else, this is *NOT* a terminal leaf pseudo-superclass. In this\n # case, the list of zero or more child hints transitively\n # subscripting this pseudo-superclass previously defined by\n # child pseudo-superclasses of this pseudo-superclass in\n # lower-level recursion.\n hint_base_data[_HINT_BASES_INDEX_ARGS_FULL]\n )\n \n # Reset this boolean to its default value (i.e., \"False\") *BEFORE*\n # possibly setting this boolean to \"True\" below, facilitating\n # efficient communication between the \"if hint_base_args_full:\" and\n # \"if hint_base_target:\" branches below.\n #\n # Equivalently, record that this pseudo-superclass is transitively\n # subscripted by *NO* type variables. Since the \"if\n # hint_base_args_full:\" branch below works as hard as possible to\n # ensure that this is the case, this default is sensible until\n # proven otherwise below.\n is_hint_base_arg_typevar = False\n \n # If this pseudo-superclass is transitively subscripted by\n # at least one child hint...\n if hint_base_args_full:\n # Metadata describing the direct parent pseudo-superclass of\n # this pseudo-superclass.\n hint_base_super_data = hint_base_data[_HINT_BASES_INDEX_PARENT]\n # print(f'Resuming generic {hint} pseudo {hint_base} parent {hint_base_super_data[0]}...')\n \n # If this pseudo-superclass has a parent pseudo-superclass\n # (i.e., this pseudo-superclass is *NOT* the passed root generic\n # and is thus a transitive child of this generic)...\n if hint_base_super_data:\n # Poppable stack of the zero or more child hints directly\n # subscripting this parent pseudo-superclass.\n hint_base_super_args_stack = hint_base_super_data[ # pyright: ignore\n _HINT_BASES_INDEX_ARGS_STACK]\n \n # For the 0-based index of each child hint transitively\n # subscripting this pseudo-superclass and this hint...\n #\n # Note that this iteration could be fenced behind an \"if\"\n # conditional resembling:\n # if not (\n # hint_base_super_args_stack or\n # typevar_to_hint\n # ):\n #\n # However, doing so would be almost entirely pointless. Why?\n # Because almost *ALL* generics are transitively subscripted\n # by one or more type variables. Ergo, \"typevar_to_hint\" is\n # almost *ALWAYS* non-empty. Ergo, the above \"if\"\n # conditional reduces to \"if True:\" in most cases. We sigh.\n for hint_base_arg_full_index, hint_base_arg_full in (\n enumerate(hint_base_args_full)):\n # If this hint is a type variable...\n if is_hint_pep484_typevar(hint_base_arg_full):\n # If a concrete (i.e., non-type variable) child hint\n # directly subscripting a sibling pseudo-superclass\n # of this pseudo-superclass has already been\n # \"bubbled up\" into this type variable, preserve\n # that bubbling by re-bubbling up the same child\n # hint back into this type variable. <-- lol\n if hint_base_arg_full in typevar_to_hint:\n # print(f'Rebubbling hint {typevar_to_hint[hint_base_arg]} into...')\n # print(f'base {hint_base} typevar {hint_base_arg}!')\n hint_base_args_full[hint_base_arg_full_index] = ( # type: ignore[index]\n typevar_to_hint[hint_base_arg_full])\n # Else, *NO* child hint directly subscripting a\n # sibling pseudo-superclass of this child\n # pseudo-superclass has already been \"bubbled up\"\n # into this type variable.\n #\n # If this parent pseudo-superclass of this child\n # pseudo-superclass is still directly subscripted by\n # one or more child hints that have yet to \"bubble\n # up\" the class hierarchy (i.e., by replacing the\n # first unused type variable transitively\n # subscripting this child pseudo-superclass),\n # \"bubble up\" the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass into the \"empty placeholder\"\n # signified by this type variable in this list of\n # child hints transitively subscripting this child\n # pseudo-superclass. <-- wat\n elif hint_base_super_args_stack:\n # print(f'Bubbling hint {hint_base_super_args_stack[-1]} into...')\n # print(f'base {hint_base} typevar {hint_base_arg}!')\n hint_base_arg_full_new = (\n hint_base_args_full[hint_base_arg_full_index]) = ( # type: ignore[index]\n hint_base_super_args_stack.pop()) # pyright: ignore\n \n # If the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass is itself a type variable,\n # record that this child pseudo-superclass is\n # now known to be subscripted by at least one\n # type variable.\n if is_hint_pep484_typevar(\n hint_base_arg_full_new):\n # print(f'Recording pseudo {hint_base} typevarred args {hint_base_arg_full}...')\n is_hint_base_arg_typevar = True\n # Else, the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass is *NOT* itself a type\n # variable. In this case, record that this child\n # hint has now been \"bubbled up\" into this type\n # variable for subsequent lookup.\n #\n # Note that bubbling up a type variable into\n # another type variable would be entirely\n # pointless. Type variables are only\n # meaningfully replaceable with concrete hints.\n # Moreover, doing so here would erroneously map\n # this type variable to this other type variable\n # in the \"typevar_to_hint\" dictionary -- which\n # would then inhibit this \"if\" conditional from\n # subsequently bubbling up a concrete hint into\n # this type variable. <-- omg\n else:\n # print(f'Recording non-typevar {hint_base_arg_full} -> {hint_base_arg_full_new}...')\n typevar_to_hint[hint_base_arg_full] = ( # pyright: ignore\n hint_base_arg_full_new)\n # Else, all child hints directly subscripting this\n # parent pseudo-superclass have already been\n # \"bubbled up\" the class hierarchy. But this hint is\n # a type variable! Record that this child\n # pseudo-superclass is now known to be subscripted\n # by at least one type variable.\n else:\n is_hint_base_arg_typevar = True\n #print(f'Bubbled up generic {hint} arg {hint_args[hint_args_index_curr]}...')\n #print(f'...into pseudo-superclass {hint_base} args {hint_base_args}!')\n # Else, this hint is *NOT* a type variable. In this\n # case, preserve this hint and continue to the next.\n \n # Parent list of the zero or more child hints transitively\n # subscripting this parent pseudo-superclass of this\n # pseudo-superclass.\n hint_base_super_args_full = hint_base_super_data[ # pyright: ignore\n _HINT_BASES_INDEX_ARGS_FULL]\n \n # Append to this parent list this child list of all child\n # hints transitively subscripting this pseudo-superclass.\n hint_base_super_args_full.extend(hint_base_args_full) # pyright: ignore\n # print(f'Inspected generic {hint} pseudo-superclass {hint_base} args {hint_base_args}!')\n # Else, this pseudo-superclass is the passed root generic.\n # Else, this pseudo-superclass is transitively unsubscripted.\n \n # If searching for a target pseudo-superclass...\n if hint_base_target:\n # Unsubscripted generic underlying this possibly subscripted\n # pseudo-superclass generic. Strip this pseudo-superclass of\n # *ALL* child hints, allowing this unsubscripted current\n # pseudo-superclass to be compared against this\n # unsubscripted target pseudo-superclass.\n hint_base_type = get_hint_pep484585_generic_type(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # If this pseudo-superclass is the desired target...\n if hint_base_type == hint_base_target:\n # If this target pseudo-superclass is no longer subscripted\n # by any type variables requiring subsequent replacement by\n # concrete child hints, this target pseudo-superclass is\n # *ONLY* subscripted by concrete child hints. In this case,\n # immediately return a tuple of these hints.\n #\n # Note that:\n # * This efficiently short-circuits this recursion in the\n # best case and is one of several reasons to prefer a\n # non-recursive algorithm. This algorithm was initially\n # implemented recursively (supposedly for simplicity);\n # doing so introduced significant unforeseen complications\n # by effectively preventing short-circuiting. After all, a\n # recursive algorithm *CANNOT* efficiently short-circuit\n # up out of a deeply nested recursive call stack --\n # without inefficiently raising an exception, which is so\n # inefficient as to defeat the point in most cases.\n # * This recursion *CANNOT* be short-circuited in the worst\n # case, which occurs when the passed root generic is\n # directly subscripted by a concrete child hint that will\n # only be subsequently \"bubbled up\" into a type hint\n # transitively subscripting this target pseudo-superclass\n # *AFTER* this DFS recurses through the tree of all\n # pseudo-superclasses and back up into this generic. In\n # this worst case, the full dictionary of type variable\n # mappings and thus the list of child hints transitively\n # subscripting this target pseudo-superclass is only\n # decidable *AFTER* this DFS fully recurses out.\n #\n # Consider this torturous hierarchy, in which bubbling up\n # the child hint \"complex\" subscripting the root generic\n # \"ListFloat[complex]\" into the child type variable \"U\"\n # subscripting the child pseudo-superclass \"Generic[U]\"\n # requires recursing through the full tree:\n # >>> from typing import Generic\n # >>> class ListTU(list[T], Generic[U]): pass\n # >>> class ListFloat(ListTU[float]): pass\n # >>> get_hint_pep484585_generic_args_full(\n # ... hint=ListFloat[complex],\n # ... hint_base_target=Generic[U],\n # ... )\n # (complex,)\n if not is_hint_base_arg_typevar:\n return tuple(hint_base_args_full)\n # Else, this target pseudo-superclass is still subscripted\n # by one or more type variables requiring subsequent\n # replacement by concrete child hints. In this case,\n # continue \"bubbling up\" child hints into these type\n # variables. Doing so enables final logic below to replace\n # these type variables with these hints *AFTER* recursing\n # through the full entirety of this DFS.\n \n # List of zero or more child hints transitively subscripting\n # this target pseudo-superclass.\n hint_base_target_args_full = hint_base_args_full\n # print(f'Found target {hint_base} args {hint_base_args_full}!')\n # Else, this pseudo-superclass is *NOT* equal to this target.\n # Else, *NO* target pseudo-superclass is being searched for.\n \n # ....................{ RETURN }....................\n # If the caller passed a target pseudo-superclass...\n if hint_base_target:\n # If the DFS above failed to find the list of zero or more child hints\n # transitively subscripting this target, this DFS failed to find this\n # target. Since this implies this target is *NOT* a pseudo-superclass of\n # this generic, raise an exception.\n if hint_base_target_args_full is None:\n raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'pseudo-superclass target {repr(hint_base_target)} not found.'\n )\n # Else, this DFS found the list of zero or more child hints transitively\n # subscripting this target.\n \n # List of the zero or more child hints transitively subscripting this\n # target pseudo-superclass, to be coerced into a tuple and returned.\n hint_args_full = hint_base_target_args_full\n \n # For the 0-based index of each child hint transitively subscripting\n # this target pseudo-superclass and this hint...\n for hint_arg_full_index, hint_arg_full in enumerate(hint_args_full):\n # If this hint is a type variable...\n if is_hint_pep484_typevar(hint_arg_full):\n # Either:\n # * If a child hint directly subscripting a sibling\n # pseudo-superclass of this target pseudo-superclass has\n # already been \"bubbled up\" into this type variable, preserve\n # that bubbling by re-bubbling up the same child hint back\n # into this # type variable. <-- lol\n # * If *NO* child hint directly subscripting a sibling\n # pseudo-superclass of this target pseudo-superclass has\n # already been \"bubbled up\" into this type variable, preserve\n # this type variable as is.\n hint_args_full[hint_arg_full_index] = typevar_to_hint.get( # pyright: ignore\n hint_arg_full, hint_arg_full) # pyright: ignore\n # Else, this hint is *NOT* a type variable.\n # Else, the caller did *NOT* pass a target pseudo-superclass.\n else:\n # If the metadata describing the passed generic is still its initial size,\n # then the above DFS failed to expand this metadata with the\n # \"_HINT_BASES_INDEX_ARGS_FULL\" index accessed below. In turn, this implies\n # that the above DFS failed to recurse down into the child\n # pseudo-superclasses of this generic. However, by definition, *ALL*\n # generics subclass one or more pseudo-superclasses. The above DFS should\n # have recursed down into those pseudo-superclasses. In this case, raise an\n # exception.\n #\n # Note that this should *NEVER* occur.\n if len(hint_root_data) == _HINT_BASE_DATA_LEN_LEAF: # pragma: no cover\n> raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'pseudo-superclasses not found.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic pseudo-superclasses not found.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_eomok0lu/beartype/_util/hint/pep/proposal/pep484/pep484generic.py:381\nError: beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_bases_unerased(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._data.hint.pep.sign.datapepsignset import HINT_SIGNS_GENERIC\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_bases_unerased)\n from beartype._util.hint.pep.utilpeptest import is_hint_pep_type_typing\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # For each PEP-compliant hint to be tested...\n for hint_pep_meta in hints_pep_meta:\n # If this is a generic hint, assert that this getter returns the\n # expected unerased pseudo-superclasses of this generic.\n if hint_pep_meta.pep_sign in HINT_SIGNS_GENERIC:\n> hint_pep_bases = get_hint_pep484585_generic_bases_unerased(\n hint_pep_meta.hint)\n\n> get_hint_pep484_generic_bases_unerased(\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484_generic_bases_unerased(\n # Mandatory parameters.\n hint: Any,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of all unerased :mod:`typing` **pseudo-superclasses** (i.e.,\n :mod:`typing` objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`-compliant\n **generic** (i.e., class subclassing at least one non-class :mod:`typing`\n object).\n \n This getter is memoized for efficiency.\n \n Parameters\n ----------\n hint : object\n Object to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this\n :mod:`typing` generic. Specifically:\n \n * If this generic defines an ``__orig_bases__`` dunder instance\n variable, the value of that variable as is.\n * Else, the value of the ``__mro__`` dunder instance variable stripped\n of all ignorable classes conveying *no* semantic meaning, including:\n \n * This generic itself.\n * The :class:`object` root superclass.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * *Not* a :mod:`typing` generic.\n * A :mod:`typing` generic that erased *none* of its superclasses but\n whose method resolution order (MRO) lists strictly less than four\n classes. Valid :pep:`484`-compliant generics should list at least\n four classes, including (in order):\n \n #. This class itself.\n #. The one or more :mod:`typing` objects directly subclassed by this\n generic.\n #. The :class:`typing.Generic` superclass.\n #. The zero or more non-:mod:`typing` superclasses subsequently\n subclassed by this generic (e.g., :class:`abc.ABC`).\n #. The :class:`object` root superclass.\n \n See Also\n --------\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n Further details.\n '''\n \n #FIXME: This tuple appears to be implemented erroneously -- at least under\n #Python 3.7, anyway. Although this tuple is implemented correctly for the\n #common case of user-defined types directly subclassing \"typing\" types,\n #this tuple probably is *NOT* implemented correctly for the edge case of\n #user-defined types indirectly subclassing \"typing\" types: e.g.,\n #\n # >>> import collections.abc, typing\n # >>> T = typing.TypeVar('T')\n # >>> class Direct(collections.abc.Sized, typing.Generic[T]): pass\n # >>> Direct.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n # >>> class Indirect(collections.abc.Container, Direct): pass\n # >>> Indirect.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n #\n #*THAT'S COMPLETELY INSANE.* Clearly, their naive implementation failed to\n #account for actual real-world use cases.\n #\n #On the bright side, the current implementation prevents us from actually\n #having to perform a breadth-first traversal of all original superclasses\n #of this class in method resolution order (MRO). On the dark side, it's\n #pants-on-fire balls -- but there's not much we can do about that. *sigh*\n #\n #If we ever need to perform that breadth-first traversal, resurrect this:\n #\n # # If this class was *NOT* subject to type erasure, reduce to a noop.\n # if not hint_bases:\n # return hint_bases\n #\n # # Fixed list of all typing super attributes to be returned.\n # superattrs = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based index of the last item of this list.\n # superattrs_index = 0\n #\n # # Fixed list of all transitive superclasses originally listed by this\n # # class iterated in method resolution order (MRO).\n # hint_orig_mro = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based indices of the current and last items of this list.\n # hint_orig_mro_index_curr = 0\n # hint_orig_mro_index_last = 0\n #\n # # Initialize this list with the tuple of all direct superclasses of this\n # # class, which iteration then expands to all transitive superclasses.\n # hint_orig_mro[:len(hint_bases)] = hint_bases\n #\n # # While the heat death of the universe has been temporarily forestalled...\n # while (True):\n # # Currently visited superclass of this class.\n # hint_base = hint_orig_mro[hint_orig_mro_index_curr]\n #\n # # If this superclass is a typing attribute...\n # if is_hint_pep_type_typing(hint_base):\n # # Avoid inserting this attribute into the \"hint_orig_mro\" list.\n # # Most typing attributes are *NOT* actual classes and those that\n # # are have no meaningful public superclass. Ergo, iteration\n # # terminates with typing attributes.\n # #\n # # Insert this attribute at the current item of this list.\n # superattrs[superattrs_index] = hint_base\n #\n # # Increment this index to the next item of this list.\n # superattrs_index += 1\n #\n # # If this class subclasses more than the maximum number of \"typing\"\n # # attributes supported by this function, raise an exception.\n # if superattrs_index >= FIXED_LIST_SIZE_MEDIUM:\n # raise BeartypeDecorHintPep560Exception(\n # '{} PEP type {!r} subclasses more than '\n # '{} \"typing\" types.'.format(\n # exception_prefix,\n # hint,\n # FIXED_LIST_SIZE_MEDIUM))\n # # Else, this superclass is *NOT* a typing attribute. In this case...\n # else:\n # # Tuple of all direct superclasses originally listed by this class\n # # prior to PEP 484 type erasure if any *OR* the empty tuple\n # # otherwise.\n # hint_base_bases = getattr(hint_base, '__orig_bases__')\n #\n # #FIXME: Implement breadth-first traversal here.\n #\n # # Tuple sliced from the prefix of this list assigned to above.\n # superattrs_tuple = tuple(superattrs[:superattrs_index])\n #\n # # Release and nullify this list *AFTER* defining this tuple.\n # release_fixed_list(superattrs)\n # del superattrs\n #\n # # Return this tuple as is.\n # return superattrs_tuple\n #\n #Also resurrect this docstring snippet:\n #\n # Raises\n # ----------\n # BeartypeDecorHintPep560Exception\n # If this object defines the ``__orig_bases__`` dunder attribute but that\n # attribute transitively lists :data:`FIXED_LIST_SIZE_MEDIUM` or more :mod:`typing`\n # attributes.\n #\n #Specifically:\n # * Acquire a fixed list of sufficient size (e.g., 64). We probably want\n # to make this a constant in \"utilcachelistfixedpool\" for reuse\n # everywhere, as this is clearly becoming a common idiom.\n # * Slice-assign \"__orig_bases__\" into this list.\n # * Maintain two simple 0-based indices into this list:\n # * \"bases_index_curr\", the current base being visited.\n # * \"bases_index_last\", the end of this list also serving as the list\n # position to insert newly discovered bases at.\n # * Iterate over this list and keep slice-assigning from either\n # \"__orig_bases__\" (if defined) or \"__mro__\" (otherwise) into\n # \"list[bases_index_last:len(__orig_bases__)]\". Note that this has the\n # unfortunate disadvantage of temporarily iterating over duplicates,\n # but... *WHO CARES.* It still works and we subsequently\n # eliminate duplicates at the end.\n # * Return a frozenset of this list, thus implicitly eliminating\n # duplicate superclasses.\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_type_or_none)\n \n # If this hint is *NOT* a class, reduce this hint to the object originating\n # this hint if any. See is_hint_pep484_generic() for details.\n hint = get_hint_pep484585_generic_type_or_none(hint)\n \n # If this hint is *NOT* a PEP 484- or 544-compliant generic, raise an\n # exception.\n if not is_hint_pep484_generic_unsubscripted(hint):\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} neither '\n f'PEP 484 generic nor PEP 544 protocol.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #16: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #17: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #18: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #19: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #20: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #21: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #22: beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py::test_coerce_hint_any", "Failure #23: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #24: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #25: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #26: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #27: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #28: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 7.379200000000003, "in_degree": 4, "true_in_degree": 59.68000000000004, "out_degree": 1, "betweenness": 0.0004457318130581809, "pagerank": 0.0021270051593236996, "harmonic": 0.00932017543859649, "bidirectional_harmonic": 0.2449497322852587, "degree": 5 }, "line_count": 9, "code_line_count": 9, "cyclomatic": 2, "halstead_volume": 11.60964047443681, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/metadata/metadecor.py", "function_name": "make_beartype_call", "test_info": { "success": false, "failed": 92, "passed": 1038, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_abs141g5/beartype/_decor/wrap/_wrapargs.py:100\nError: AssertionError: None not beartype call.\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_params = _code_check_args(decor_meta)\n\n> def code_check_args(decor_meta: BeartypeDecorMeta) -> str:\n '''\n Generate a Python code snippet type-checking all annotated parameters of the\n decorated callable if any *or* the empty string otherwise (i.e., if these\n parameters are unannotated).\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to be type-checked.\n \n Returns\n -------\n str\n Code type-checking all annotated parameters of the decorated callable.\n \n Raises\n ------\n BeartypeDecorParamNameException\n If the name of any parameter declared on this callable is prefixed by\n the reserved substring ``__bear``.\n BeartypeDecorHintNonpepException\n If any type hint annotating any parameter of this callable is neither:\n \n * A PEP-noncompliant type hint.\n * A supported PEP-compliant type hint.\n '''\n> assert isinstance(decor_meta, BeartypeDecorMeta), (\n f'{repr(decor_meta)} not beartype call.')\nE AssertionError: None not beartype call.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark_abs141g5/beartype/_decor/wrap/_wrapargs.py:100\nError: AssertionError: None not beartype call.\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_params = _code_check_args(decor_meta)\n\n> def code_check_args(decor_meta: BeartypeDecorMeta) -> str:\n '''\n Generate a Python code snippet type-checking all annotated parameters of the\n decorated callable if any *or* the empty string otherwise (i.e., if these\n parameters are unannotated).\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to be type-checked.\n \n Returns\n -------\n str\n Code type-checking all annotated parameters of the decorated callable.\n \n Raises\n ------\n BeartypeDecorParamNameException\n If the name of any parameter declared on this callable is prefixed by\n the reserved substring ``__bear``.\n BeartypeDecorHintNonpepException\n If any type hint annotating any parameter of this callable is neither:\n \n * A PEP-noncompliant type hint.\n * A supported PEP-compliant type hint.\n '''\n> assert isinstance(decor_meta, BeartypeDecorMeta), (\n f'{repr(decor_meta)} not beartype call.')\nE AssertionError: None not beartype call.\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep435", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep663", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #83: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #84: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #85: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #86: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #87: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #88: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #89: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #90: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #91: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #92: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 2, "true_in_degree": 8.239999999999998, "out_degree": 1, "betweenness": 4.064423827278245e-05, "pagerank": 0.00044067349169312777, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.22093188700919, "degree": 3 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/error/_errtype.py", "function_name": "find_cause_instance_type", "test_info": { "success": false, "failed": 44, "passed": 1086, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_850qyd3h/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_850qyd3h/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #35: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #36: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #37: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #38: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #39: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #40: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #41: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #42: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #43: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #44: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 29.905920000000034, "in_degree": 3, "true_in_degree": 6.199999999999999, "out_degree": 4, "betweenness": 0.0003689593629873696, "pagerank": 0.0005622930350301041, "harmonic": 0.03618421052631578, "bidirectional_harmonic": 0.23493305397088332, "degree": 7 }, "line_count": 39, "code_line_count": 39, "cyclomatic": 6, "halstead_volume": 12.0, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextidentifier.py", "function_name": "die_unless_identifier", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/cls/test_utilclsmake.py::test_make_type\nLocation: /tmp/benchmark_zjaegwih/beartype_test/a00_unit/a20_util/cls/test_utilclsmake.py:93\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_make_type() -> None:\n '''\n Test the :func:`beartype._util.cls.utilclsmake.make_type` tester.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilTypeException\n from beartype._util.cls.utilclsmake import make_type\n from beartype._util.cls.utilclstest import is_type_subclass\n from pytest import raises\n \n # ....................{ LOCALS }....................\n class TooEnamouredOfThatVoice(object):\n '''\n Arbitrary base class from which to subclass classes defined below.\n '''\n \n # ....................{ PASS }....................\n # Assert this factory creates and returns the expected class when the passed\n # name is a valid unqualified Python identifier.\n AndSilence = make_type(type_name='AndSilence')\n assert isinstance(AndSilence, type)\n assert AndSilence.__name__ == 'AndSilence'\n \n # Assert this factory creates and returns the expected class when passed a\n # tuple of one or more base classes.\n BySolemnVision = make_type(\n type_name='BySolemnVision', type_bases=(TooEnamouredOfThatVoice,))\n assert is_type_subclass(BySolemnVision, TooEnamouredOfThatVoice)\n \n # Assert this factory creates and returns the expected class when passed a\n # dictionary of one or more class attributes.\n BrightSilverDream = make_type(type_name='BrightSilverDream', type_scope={\n 'every_sight': 'His infancy was nurtured.',\n 'and_sound': lambda self: self.every_sight,\n })\n assert (\n BrightSilverDream.every_sight ==\n BrightSilverDream().and_sound() == 'His infancy was nurtured.'\n )\n \n # Assert this factory creates and returns the expected class when the passed\n # module name is a valid Python identifier.\n SentToHisHeart = make_type(\n type_name='SentToHisHeart', type_module_name='its_choicest.impulses')\n assert SentToHisHeart.__module__ == 'its_choicest.impulses'\n \n # Assert this factory creates and returns the expected class when passed a\n # docstring.\n TheFountains = make_type(\n type_name='TheFountains', type_doc='of divine philosophy')\n assert TheFountains.__doc__ == 'of divine philosophy'\n \n # ....................{ FAIL }....................\n # Assert this factory raises the expected exception when the passed name is\n # the empty string.\n with raises(_BeartypeUtilTypeException):\n make_type('')\n \n # Assert this factory raises the expected exception when the passed name is\n # *NOT* a valid Python identifier.\n with raises(_BeartypeUtilTypeException):\n make_type('And wasted for fond love of his wild eyes.')\n \n # Assert this factory raises the expected exception when the passed name is\n # a valid Python identifier that is fully-qualified (i.e., contains one or\n # more \".\" characters).\n with raises(_BeartypeUtilTypeException):\n make_type('The_fire.of.those_soft_orbs.has_ceased.to_burn')\n \n # Assert this factory raises the expected exception when the passed module\n # name is the empty string.\n> with raises(_BeartypeUtilTypeException):\nE Failed: DID NOT RAISE \n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/module/test_utilmodimport.py::test_import_module_attr_or_sentinel\nLocation: /tmp/benchmark_zjaegwih/beartype/_util/module/utilmodimport.py:386\nError: TypeError: a bytes-like object is required, not 'str'\n\nTraceback:\n\n> def test_import_module_attr_or_sentinel() -> None:\n '''\n Test the\n :func:`beartype._util.module.utilmodget.import_module_attr_or_sentinel`\n importer.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeModuleUnimportableWarning\n from beartype.roar._roarexc import _BeartypeUtilModuleException\n from beartype._util.module.utilmodimport import (\n import_module_attr_or_sentinel)\n from beartype._util.utilobject import SENTINEL\n from pytest import (\n raises,\n warns,\n )\n \n # ....................{ LOCALS }....................\n # Fully-qualified name of a test-specific module defining attributes\n # intended to be dynamically imported below.\n MODULE_NAME = 'beartype_test.a00_unit.data.util.mod.data_utilmodule_good'\n \n # ....................{ PASS }....................\n # Assert that passing this importer an arbitrary attribute name of an\n # unimportable module returns the sentinel.\n assert import_module_attr_or_sentinel(\n attr_name='Hides_its_dead_eye', module_name='from.the_detested.day',\n ) is SENTINEL\n \n # Assert that passing this importer the unqualified name of an existing\n # builtin type returns that type as is.\n assert import_module_attr_or_sentinel('int') is int\n \n # Assert that passing this importer the unqualified name of a non-existent\n # builtin type returns the sentinel.\n assert import_module_attr_or_sentinel(\n 'Where_every_shade_which_the_foul_grave_exhales') is SENTINEL\n \n # Assert that passing this importer the fully-qualified name of an\n # existing attribute of an importable module returns that attribute as is.\n attr_good = import_module_attr_or_sentinel(f'{MODULE_NAME}.attrgood')\n assert isinstance(attr_good, str)\n assert attr_good.startswith(\n 'I started to see human beings as little')\n \n # Assert that passing this importer the fully-qualified name of a\n # non-existent attribute of an importable module which is also the\n # unqualified name of a builtin type returns that type.\n assert import_module_attr_or_sentinel(\n 'str', module_name=MODULE_NAME) is str\n \n # Assert that passing this importer the fully-qualified name of a\n # non-existent attribute of an importable module which is *NOT* also the\n # unqualified name of a builtin type returns the sentinel.\n assert import_module_attr_or_sentinel(\n 'attrbad', module_name=MODULE_NAME) is SENTINEL\n \n # ....................{ FAIL }....................\n # Assert this function emits the expected warning when passed the\n # syntactically valid fully-qualified name of a non-existent attribute of an\n # unimportable module.\n with warns(BeartypeModuleUnimportableWarning):\n bad_module_attr = import_module_attr_or_sentinel(\n 'beartype_test.a00_unit.data.util.mod.data_utilmodule_bad.attrbad')\n assert bad_module_attr is SENTINEL\n \n # Assert this function raises the expected exception when passed a\n # non-string.\n with raises(_BeartypeUtilModuleException):\n> import_module_attr_or_sentinel(\n b'In far countries little men have closely studied your longing '\n b'to be an indiscriminate slave.'\n )\n\n> def import_module_attr_or_sentinel(\n # Mandatory parameters.\n attr_name: str,\n \n # Optional parameters.\n module_name: Optional[str] = None,\n exception_cls: TypeException = _BeartypeUtilModuleException,\n exception_prefix: str = 'Module attribute ',\n ) -> Any:\n '''\n Dynamically import and return the **module attribute** (i.e., object\n declared at module scope) with the passed possibly unqualified name from\n the module with the passed fully-qualified name if importable *or* the\n placeholder :data:`.SENTINEL` otherwise.\n \n This importer expects this attribute name to be either:\n \n * **Fully-qualified** (i.e., contain one or more ``.`` delimiters), in which\n case this module name is silently ignored and may thus be :data:`None` or\n the empty string *or*...\n * **Unqualified** (i.e., contain *no* ``.`` delimiters), in which case\n either:\n \n * This module name *must* be a non-empty string *or*...\n * This unqualified attribute name *must* be that of a **builtin type**\n (e.g., ``\"int\"``, ``\"str\"``).\n \n Parameters\n ----------\n attr_name : str\n Possibly unqualified name of the module attribute to be imported.\n module_name: Optional[str]\n Either:\n \n * If this attribute name is unqualified (i.e., contains *no* ``.``\n delimiters), the fully-qualified name of the module declaring this\n attribute.\n * Else, this parameter is silently ignored.\n \n Defaults to :data:`None`, in which case ``attr_name`` must be either\n fully-qualified *or* the unqualified name of a builtin type.\n exception_cls : Type[Exception]\n Type of exception to be raised by this function. Defaults to\n :class:`._BeartypeUtilModuleException`.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to the empty string.\n \n Returns\n -------\n object\n Either:\n \n * If *no* module with this name exists, :data:`.SENTINEL`.\n * If a module with by this name exists *but* that module declares no\n attribute by this name, :data:`.SENTINEL`.\n * Else, the module attribute with this fully-qualified name.\n \n Raises\n ------\n exception_cls\n If this name is syntactically invalid.\n \n Warns\n -----\n BeartypeModuleUnimportableWarning\n If a module prefixed by this name exists *but* that module is\n unimportable due to module-scoped side effects at importation time.\n '''\n assert isinstance(module_name, NoneTypeOr[str]), (\n f'{repr(module_name)} neither string nor \"None\".')\n \n # If this attribute name is *NOT* a syntactically valid Python identifier,\n # raise an exception.\n die_unless_identifier(\n text=attr_name,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # Else, this attribute name is a syntactically valid Python identifier.\n \n # True only if this attribute name contains *NO* \".\" characters and is thus\n # an unqualified basename relative to this module name.\n> is_attr_name_unqualified = '.' not in attr_name\nE TypeError: a bytes-like object is required, not 'str'\n", "Failure #3: beartype_test/a00_unit/a20_util/module/test_utilmodtest.py::test_die_unless_module_attr_name", "Failure #4: beartype_test/a00_unit/a20_util/text/test_utiltextidentifier.py::test_die_unless_identifier", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/cls/test_utilclsmake.py", "test_make_type" ], [ "beartype_test/a00_unit/a20_util/module/test_utilmodimport.py", "test_import_module_attr_or_sentinel" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 8, "true_in_degree": 25.280000000000015, "out_degree": 1, "betweenness": 0.0001544481054365733, "pagerank": 0.0032458828639357535, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.2047716948621562, "degree": 9 }, "line_count": 14, "code_line_count": 14, "cyclomatic": 5, "halstead_volume": 11.60964047443681, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncwrap.py", "function_name": "unwrap_func_boundmethod_once", "test_info": { "success": false, "failed": 47, "passed": 1046, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py::test_iter_func_args\nLocation: /tmp/benchmark_8yt3fnoy/beartype/_util/func/utilfunctest.py:121\nError: beartype.roar._BeartypeUtilCallableException: > not pure-Python function.\n\nTraceback:\n\n> def test_iter_func_args() -> None:\n '''\n Test the\n :func:`beartype._util.func.arg.utilfuncargtest.iter_func_args` generator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype._util.func.arg.utilfuncargiter import (\n ArgKind,\n ArgMandatory,\n iter_func_args,\n )\n from beartype_test.a00_unit.data.func.data_func import (\n ClassOfMethods,\n func_args_0,\n func_args_1_flex_mandatory,\n func_args_1_varpos,\n func_args_1_kwonly_mandatory,\n func_args_2_flex_mandatory,\n func_args_2_kwonly_mixed,\n func_args_3_flex_mandatory_optional_varkw,\n func_args_5_flex_mandatory_varpos_kwonly_varkw,\n )\n from beartype_test.a00_unit.data.func.data_pep570 import (\n func_args_2_posonly_mixed,\n func_args_10_all_except_flex_mandatory,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Instance of an arbitrary class defining various kinds of methods, which\n # due to this instantiation have now been implicitly coerced into bound\n # method descriptors, which this iterator explicitly supports.\n object_of_methods = ClassOfMethods()\n \n # ....................{ PASS }....................\n # Assert this iterator returns the empty generator for an argumentless\n # callable, explicitly coerced into a tuple to trivialize testing.\n assert len(tuple(iter_func_args(func_args_0))) == 0\n \n # Assert this iterator returns the expected generator for argumentative\n # callables accepting multiple kinds of parameters.\n assert tuple(iter_func_args(func_args_1_flex_mandatory)) == (\n (ArgKind.POSITIONAL_OR_KEYWORD, 'had_one_fair_daughter', ArgMandatory,),\n )\n assert tuple(iter_func_args(func_args_1_varpos)) == (\n (ArgKind.VARIADIC_POSITIONAL, 'and_in_her_his_one_delight', ArgMandatory,),\n )\n assert tuple(iter_func_args(func_args_1_kwonly_mandatory)) == (\n (ArgKind.KEYWORD_ONLY, 'when_can_I_take_you_from_this_place', ArgMandatory,),\n )\n assert tuple(iter_func_args(func_args_2_flex_mandatory)) == (\n (ArgKind.POSITIONAL_OR_KEYWORD, 'thick_with_wet_woods', ArgMandatory,),\n (ArgKind.POSITIONAL_OR_KEYWORD, 'and_many_a_beast_therein', ArgMandatory,),\n )\n assert tuple(iter_func_args(func_args_2_kwonly_mixed)) == (\n (ArgKind.KEYWORD_ONLY, 'white_summer', 'So far I have gone to see you again.',),\n (ArgKind.KEYWORD_ONLY, 'hiding_your_face_in_the_palm_of_your_hands', ArgMandatory,),\n )\n assert tuple(iter_func_args(func_args_3_flex_mandatory_optional_varkw)) == (\n (ArgKind.POSITIONAL_OR_KEYWORD, 'and_the_wolf_tracks_her_there', ArgMandatory,),\n (ArgKind.POSITIONAL_OR_KEYWORD, 'how_hideously', \"Its shapes are heap'd around!\",),\n (ArgKind.VARIADIC_KEYWORD, 'rude_bare_and_high', ArgMandatory,),\n )\n assert tuple(iter_func_args(func_args_5_flex_mandatory_varpos_kwonly_varkw)) == (\n (ArgKind.POSITIONAL_OR_KEYWORD, 'we_are_selfish_men', ArgMandatory,),\n (ArgKind.POSITIONAL_OR_KEYWORD, 'oh_raise_us_up', ArgMandatory,),\n (ArgKind.VARIADIC_POSITIONAL, 'and_give_us', ArgMandatory,),\n (ArgKind.KEYWORD_ONLY, 'return_to_us_again', 'Of inward happiness.',),\n (ArgKind.VARIADIC_KEYWORD, 'manners_virtue_freedom_power', ArgMandatory,),\n )\n \n # Assert this iterator returns the expected generator for argumentative\n # bound method descriptors accepting multiple kinds of parameters. Note that\n # this generator intentionally omits the first \"self\" parameters passed by\n # these descriptors to the unbound methods they encapsulate.\n> assert tuple(iter_func_args(\n object_of_methods.meth_args_6_flex_mandatory_varpos_kwonly_varkw)) == (\n (ArgKind.POSITIONAL_OR_KEYWORD, 'calm_and_rejoicing', ArgMandatory,),\n (ArgKind.POSITIONAL_OR_KEYWORD, 'in_the_fearful_war', ArgMandatory,),\n (ArgKind.VARIADIC_POSITIONAL, 'of_wave_ruining_on_wave', ArgMandatory,),\n (ArgKind.KEYWORD_ONLY, 'and_blast_on_blast', 'Descending,',),\n (ArgKind.VARIADIC_KEYWORD, 'and_black_flood', ArgMandatory,),\n )\n\n> ) = get_func_args_lens(\n\n> func_codeobj = get_func_codeobj(\n\n> die_unless_func_python(\n\n> def die_unless_func_python(\n # Mandatory parameters.\n func: Codeobjable,\n \n # Optional parameters.\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> None:\n '''\n Raise an exception if the passed callable is **C-based** (i.e., implemented\n in C as either a builtin bundled with the active Python interpreter *or*\n third-party C extension function).\n \n Equivalently, this validator raises an exception unless the passed function\n is **pure-Python** (i.e., implemented in Python as either a function or\n method).\n \n Parameters\n ----------\n func : Codeobjable\n Callable to be inspected.\n exception_cls : TypeException, optional\n Type of exception to be raised. Defaults to\n :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to the empty string.\n \n Raises\n ------\n exception_cls\n If the passed callable is C-based.\n \n See Also\n --------\n :func:`.is_func_codeobjable`\n Further details.\n '''\n \n # If that callable is *NOT* pure-Python, raise an exception.\n if not is_func_codeobjable(func):\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not class.')\n assert issubclass(exception_cls, Exception), (\n f'{repr(exception_cls)} not exception subclass.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # If that callable is uncallable, raise an appropriate exception.\n if not callable(func):\n raise exception_cls(f'{exception_prefix}{repr(func)} not callable.')\n # Else, that callable is callable.\n \n # Raise a human-readable exception.\n> raise exception_cls(\n f'{exception_prefix}{repr(func)} not pure-Python function.')\nE beartype.roar._BeartypeUtilCallableException: > not pure-Python function.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py::test_get_func_args_len_flexible\nLocation: /tmp/benchmark_8yt3fnoy/beartype/_util/func/arg/utilfuncarglen.py:365\nError: beartype.roar._BeartypeUtilCallableException: None uncallable.\n\nTraceback:\n\n> def test_get_func_args_len_flexible() -> None:\n '''\n Test the\n :func:`beartype._util.func.arg.utilfuncarglen.get_func_args_flexible_len`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype._util.func.arg.utilfuncarglen import (\n get_func_args_flexible_len)\n from beartype_test.a00_unit.data.data_type import (\n ClassCallable,\n function_partial,\n function_partial_bad,\n )\n from beartype_test.a00_unit.data.func.data_func import (\n func_args_0,\n func_args_1_flex_mandatory,\n func_args_1_varpos,\n func_args_2_flex_mandatory,\n func_args_0_wrapped,\n func_args_1_flex_mandatory_wrapped,\n func_args_1_varpos_wrapped,\n func_args_2_flex_mandatory_wrapped,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Callable object whose class defines the __call__() dunder method.\n callable_object = ClassCallable()\n \n # ....................{ PASS }....................\n # Assert this getter returns the expected lengths of unwrapped callables.\n assert get_func_args_flexible_len(func_args_0) == 0\n assert get_func_args_flexible_len(func_args_1_varpos) == 0\n assert get_func_args_flexible_len(func_args_1_flex_mandatory) == 1\n assert get_func_args_flexible_len(func_args_2_flex_mandatory) == 2\n \n # Assert this getter returns the expected lengths of wrapped callables.\n assert get_func_args_flexible_len(func_args_0_wrapped) == 0\n assert get_func_args_flexible_len(func_args_1_varpos_wrapped) == 0\n assert get_func_args_flexible_len(func_args_1_flex_mandatory_wrapped) == 1\n assert get_func_args_flexible_len(func_args_2_flex_mandatory_wrapped) == 2\n \n # Assert this getter returns the expected length of a partial callable.\n assert get_func_args_flexible_len(function_partial) == 0\n \n # Assert this getter returns the expected length of a callable object.\n> assert get_func_args_flexible_len(callable_object) == 0\n\n> return _get_func_boundmethod_args_flexible_len(\n\n> wrappee_args_flexible_len = get_func_args_flexible_len(\n\n> def get_func_args_flexible_len(\n # Mandatory parameters.\n func: Codeobjable,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> int:\n '''\n Number of **flexible parameters** (i.e., parameters passable as either\n positional or keyword arguments but *not* positional-only, keyword-only,\n variadic, or other more constrained kinds of parameters) accepted by the\n passed pure-Python callable.\n \n This getter transparently handles all of the following:\n \n * Conventional pure-Python callables.\n * If ``is_unwrap`` is :data:`True`:\n \n * Pure-Python **partials** (i.e., pure-Python callable\n :class:`functools.partial` objects directly wrapping pure-Python\n callables). If a partial is passed, this getter transparently returns\n the total number of flexible parameters accepted by the lower-level\n callable wrapped by this partial minus the number of flexible parameters\n partialized away by this partial.\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n is_unwrap: bool, optional\n :data:`True` only if this getter implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function.\n Defaults to :data:`True` for safety. See :func:`.get_func_codeobj` for\n further commentary.\n exception_cls : type, optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the message of any exception raised in\n the event of a fatal error. Defaults to the empty string.\n \n Returns\n -------\n int\n Number of flexible parameters accepted by this callable.\n \n Raises\n ------\n exception_cls\n If that callable is *not* pure-Python.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.api.standard.utilfunctools import (\n get_func_functools_partial_args_flexible_len,\n is_func_functools_partial,\n )\n from beartype._util.func.utilfunctest import is_func_codeobjable\n \n # If the passed callable is pure-Python...\n if is_func_codeobjable(func):\n # Number of various kinds of parameters accepted by that callable.\n func_args_lens = get_func_args_lens(\n func=func,\n is_unwrap=is_unwrap,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # Number of all non-keyword-only parameters (i.e., both optional and\n # mandatory positional-only, positional, and keyword parameters)\n # accepted by that callable.\n return func_args_lens[ARGS_LENS_INDEX_POSONLY_OR_FLEX]\n # Else, that callable has *NO* code object.\n #\n # If that callable is *NOT* actually callable, raise an exception.\n elif not callable(func):\n> raise exception_cls(f'{exception_prefix}{repr(func)} uncallable.')\nE beartype.roar._BeartypeUtilCallableException: None uncallable.\n", "Failure #3: beartype_test/a00_unit/a20_util/func/test_utilfunccodeobj.py::test_get_func_codeobj", "Failure #4: beartype_test/a00_unit/a20_util/func/test_utilfunccodeobj.py::test_get_func_codeobj_or_none", "Failure #5: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_wrapper_isomorphic", "Failure #6: beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py::test_unwrap_func_all_isomorphic", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #24: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #25: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #26: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #27: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #28: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #29: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #30: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #31: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #32: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #33: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #34: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #35: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_beartypeable_kind", "Failure #36: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #37: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #38: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #39: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #40: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #41: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #42: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #43: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #44: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #45: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #47: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py", "test_iter_func_args" ], [ "beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py", "test_get_func_args_len_flexible" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 4, "true_in_degree": 27.840000000000014, "out_degree": 1, "betweenness": 0.0002885740917367554, "pagerank": 0.002367658957710005, "harmonic": 0.0024671052631578946, "bidirectional_harmonic": 0.1978090348978514, "degree": 5 }, "line_count": 14, "code_line_count": 14, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484585/pep484585.py", "function_name": "get_hint_pep484585_args", "test_info": { "success": false, "failed": 19, "passed": 1111, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585.py::test_get_hint_pep484585_args\nLocation: /tmp/benchmark_hq6myms8/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585.py:70\nError: AssertionError: assert None == bool\n + where None = (hint=list[bool], args_len=1, exception_prefix='')\n\nTraceback:\n\n> def test_get_hint_pep484585_args() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585.get_hint_pep484585_args`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep585Exception\n from beartype.typing import (\n Dict,\n List,\n )\n from beartype._util.hint.pep.proposal.pep484585.pep484585 import (\n get_hint_pep484585_args)\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this getter returns the expected child type hint for a PEP 484-\n # and 585-compliant type hint properly subscripted by one child type hint.\n> assert get_hint_pep484585_args(\n hint=List[bool], args_len=1, exception_prefix='') == bool\nE AssertionError: assert None == bool\nE + where None = (hint=list[bool], args_len=1, exception_prefix='')\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_hq6myms8/beartype/_util/hint/pep/proposal/pep484585/pep484585container.py:68\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n assert TypeHint(hint_ignorable).is_ignorable is True\n \n # Assert this property:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # Hint to be tested.\n hint = hint_pep_meta.hint\n \n # True only if the @beartype decorator currently ignores this hint.\n hint_is_ignorable = hint_pep_meta.is_ignorable\n \n # If this hint is a type variable...\n #\n # Note that the @beartype decorator and the \"beartype.door\" API\n # currently disagree as to whether type variables are ignorable. From:\n # the perspective of:\n # * The low-level @beartype decorator, they mostly are.\n # * The high-level \"beartype.door\" API, they mostly are *NOT*.\n #\n # Since the \"hint_pep_meta.is_ignorable\" variable reflects the\n # perspective of the @beartype decorator rather than the \"beartype.door\"\n # API, further logic is needed to decide whether this type variable is\n # actually ignorable from the \"beartype.door\" perspective.\n if isinstance(hint, TypeVar):\n # Type hint synthesized from all bounded constraints parametrizing\n # this type variable if any *OR* \"None\" otherwise.\n hint_typevar_bound = get_hint_pep484_typevar_bound_or_none(hint)\n \n # This type hint is ignorable only if either...\n hint_is_ignorable = (\n # This type hint is unconstrained *OR*...\n hint_typevar_bound is None or\n # This type hint is constrained by one or more ignorable\n # constraints.\n sanify_hint_child(hint_typevar_bound) is Any\n )\n # Else, this hint is *NOT* a type variable.\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints. Most of these will be\n #\"BeartypeDoorNonpepException\", but there are some covariant type hints\n #(e.g. numpy.dtype[+ScalarType]) that will raise a \"not invariant\"\n #exception in the \"TypeVarTypeHint\" subclass.\n with suppress(BeartypeDoorException):\n> assert TypeHint(hint).is_ignorable is hint_is_ignorable\n\n> return sanify_hint_child(self._hint) is Any # pyright: ignore\n\n> hint_or_sane = reduce_hint(\n\n> hint_or_sane = _reduce_hint_cached(hint, conf, exception_prefix)\n\n> return func(*args)\n\n> hint = hint_reducer( # type: ignore[call-arg]\n\n> def reduce_hint_pep484585_itemsview(\n hint: Hint, exception_prefix: str, **kwargs) -> Hint:\n '''\n Reduce the passed :pep:`484`- or :pep:`585`-compliant **items view type\n hint** (i.e., of the form ``(collections.abc|typing).ItemsView[{hint_key},\n {hint_value}]``) to a more suitable type hint better supported by\n :mod:`beartype`.\n \n This reducer is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as reducers cannot be memoized.\n \n Parameters\n ----------\n hint : Hint\n Items view type hint to be reduced.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this hint in\n exception messages raised by this reducer.\n \n All remaining passed arguments are silently ignored.\n \n Returns\n -------\n Hint\n More suitable type hint better supported by :mod:`beartype`.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.pep484585 import (\n get_hint_pep484585_args)\n from beartype._util.hint.pep.utilpeptest import is_hint_pep_subscripted\n \n # Reduced hint to be returned, defaulting to the abstract base class (ABC)\n # of *ALL* items views.\n hint_reduced: Hint = ItemsViewABC # pyright: ignore\n \n # If this hint is subscripted by one or more child type hints...\n if is_hint_pep_subscripted(hint):\n # Defer heavyweight imports.\n from beartype.vale import IsInstance\n \n # Child key and value type hints subscripting this parent type hint.\n> hint_key, hint_value = get_hint_pep484585_args( # type: ignore[misc]\n hint=hint, args_len=2, exception_prefix=exception_prefix)\nE TypeError: cannot unpack non-iterable NoneType object\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #18: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #19: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585.py", "test_get_hint_pep484585_args" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 4, "true_in_degree": 10.08, "out_degree": 1, "betweenness": 1.2193271481834736e-05, "pagerank": 0.0007338003438343011, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.2531054791334395, "degree": 5 }, "line_count": 23, "code_line_count": 23, "cyclomatic": 7, "halstead_volume": 31.019550008653873, "halstead_difficulty": 4.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_convcoerce.py", "function_name": "coerce_hint_any", "test_info": { "success": false, "failed": 90, "passed": 1040, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals\nLocation: /tmp/benchmark_4ox80jth/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:185\nError: assert False is True\n\nTraceback:\n\n> def test_door_typehint_equals(\n door_cases_equality: 'Iterable[Tuple[object, object, bool]]') -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.__equals__` dunder method.\n \n Parameters\n ----------\n door_cases_equality : Iterable[Tuple[object, object, bool]]\n Iterable of one or more 3-tuples ``(hint_a, hint_b, is_equal)``,\n declared by the :func:`hint_subhint_cases` fixture.\n '''\n \n # Defer test-specific imports.\n from beartype.door import TypeHint\n \n # Intentionally import from \"typing\" rather than \"beartype.typing\" to\n # guarantee PEP 484-compliant type hints.\n from typing import (\n Generator,\n Union,\n )\n \n # Arbitrary hint guaranteed to be unequal to every other hint listed in the\n # \"hint_equality_cases\" iterable.\n typehint_unequal = TypeHint(Generator[Union[list, str], str, None])\n \n # Arbitrary non-hint object. Note that strings are valid type hints!\n nonhint = b'Of insects, beasts, and birds, becomes its spoil;'\n \n # For each equality relation to be tested...\n for hint_a, hint_b, IS_EQUAL in door_cases_equality:\n # \"TypeHint\" instances encapsulating these hints.\n typehint_a = TypeHint(hint_a)\n typehint_b = TypeHint(hint_b)\n \n # Assert this tester returns the expected boolean for these hints.\n is_equal = (typehint_a == typehint_b)\n> assert is_equal is IS_EQUAL\nE assert False is True\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail\nLocation: /tmp/benchmark_4ox80jth/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:217\nError: assert CallableTypeHint(collections.abc.Callable[[], list]) <= CallableTypeHint(collections.abc.Callable[..., collections.abc.Sequence[typing.Any]])\n\nTraceback:\n\n> def test_door_typehint_compare_fail() -> None:\n '''\n Test unsuccessful usage the rich comparison dunder methods defined by the\n :class:`beartype.door.TypeHint` class.\n '''\n \n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.typing import (\n Any,\n Callable,\n Sequence,\n )\n from pytest import raises\n \n a = TypeHint(Callable[[], list])\n b = TypeHint(Callable[..., Sequence[Any]])\n \n> assert a <= b\nE assert CallableTypeHint(collections.abc.Callable[[], list]) <= CallableTypeHint(collections.abc.Callable[..., collections.abc.Sequence[typing.Any]])\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #4: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #5: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #6: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #7: beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py::test_coerce_func_hint_root", "Failure #8: beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py::test_coerce_hint_any", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #12: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #13: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #14: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #15: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #16: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #83: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #84: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #85: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #86: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #87: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #88: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #89: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #90: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_equals" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_compare_fail" ] ] }, "complexity_info": { "centrality": { "distance_discount": 10.888704000000008, "in_degree": 2, "true_in_degree": 13.520000000000003, "out_degree": 2, "betweenness": 0.00034276640943379865, "pagerank": 0.0008307760780813737, "harmonic": 0.013267543859649122, "bidirectional_harmonic": 0.20510337159185899, "degree": 4 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/_pep/pep484585/redpep484585type.py", "function_name": "reduce_hint_pep484585_type", "test_info": { "success": false, "failed": 9, "passed": 1121, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_t98f6cev/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:119\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n> with warns(hint_meta.warning_type):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: <@beartype(__beartype_checker_241) at 0x1f2dd300>:23\nError: beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value violates type hint typing.Type, as type not instance of .\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> > ???\nE beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value violates type hint typing.Type, as type not instance of .\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #9: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 14.043166720000004, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 3, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.017904135338345867, "bidirectional_harmonic": 0.2012460720931122, "degree": 3 }, "line_count": 17, "code_line_count": 17, "cyclomatic": 3, "halstead_volume": 13.931568569324174, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484/pep484typevar.py", "function_name": "get_hint_pep484_typevar_bound_or_none", "test_info": { "success": false, "failed": 11, "passed": 1119, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484/test_utilpep484typevar.py::test_get_hint_pep484_typevar_bound_or_none\nLocation: /tmp/benchmark_la01_wzi/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484/test_utilpep484typevar.py:44\nError: assert None is int\n + where None = (~T_int)\n\nTraceback:\n\n> def test_get_hint_pep484_typevar_bound_or_none() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484.pep484typevar.get_hint_pep484_typevar_bound_or_none`\n tester.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484Exception\n from beartype._data.hint.datahinttyping import T\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from beartype_test.a00_unit.data.hint.pep.proposal.data_pep484 import (\n T_int,\n T_str_or_bytes,\n )\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this getter returns \"None\" for unbounded type variables.\n assert get_hint_pep484_typevar_bound_or_none(T) is None\n \n # Assert this getter reduces bounded type variables to their upper bound.\n> assert get_hint_pep484_typevar_bound_or_none(T_int) is int\nE assert None is int\nE + where None = (~T_int)\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_la01_wzi/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:454\nError: AssertionError: assert False is True\n + where False = TypeVarTypeHint(~AnyStr).is_ignorable\n + where TypeVarTypeHint(~AnyStr) = (~AnyStr)\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n assert TypeHint(hint_ignorable).is_ignorable is True\n \n # Assert this property:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # Hint to be tested.\n hint = hint_pep_meta.hint\n \n # True only if the @beartype decorator currently ignores this hint.\n hint_is_ignorable = hint_pep_meta.is_ignorable\n \n # If this hint is a type variable...\n #\n # Note that the @beartype decorator and the \"beartype.door\" API\n # currently disagree as to whether type variables are ignorable. From:\n # the perspective of:\n # * The low-level @beartype decorator, they mostly are.\n # * The high-level \"beartype.door\" API, they mostly are *NOT*.\n #\n # Since the \"hint_pep_meta.is_ignorable\" variable reflects the\n # perspective of the @beartype decorator rather than the \"beartype.door\"\n # API, further logic is needed to decide whether this type variable is\n # actually ignorable from the \"beartype.door\" perspective.\n if isinstance(hint, TypeVar):\n # Type hint synthesized from all bounded constraints parametrizing\n # this type variable if any *OR* \"None\" otherwise.\n hint_typevar_bound = get_hint_pep484_typevar_bound_or_none(hint)\n \n # This type hint is ignorable only if either...\n hint_is_ignorable = (\n # This type hint is unconstrained *OR*...\n hint_typevar_bound is None or\n # This type hint is constrained by one or more ignorable\n # constraints.\n sanify_hint_child(hint_typevar_bound) is Any\n )\n # Else, this hint is *NOT* a type variable.\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints. Most of these will be\n #\"BeartypeDoorNonpepException\", but there are some covariant type hints\n #(e.g. numpy.dtype[+ScalarType]) that will raise a \"not invariant\"\n #exception in the \"TypeVarTypeHint\" subclass.\n with suppress(BeartypeDoorException):\n> assert TypeHint(hint).is_ignorable is hint_is_ignorable\nE AssertionError: assert False is True\nE + where False = TypeVarTypeHint(~AnyStr).is_ignorable\nE + where TypeVarTypeHint(~AnyStr) = (~AnyStr)\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #4: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py::test_get_hint_pep484_typevars_to_hints", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #11: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484/test_utilpep484typevar.py", "test_get_hint_pep484_typevar_bound_or_none" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.6, "in_degree": 2, "true_in_degree": 3.44, "out_degree": 2, "betweenness": 1.3548079424260817e-05, "pagerank": 0.0004019922003284073, "harmonic": 0.003289473684210526, "bidirectional_harmonic": 0.19397001025290572, "degree": 4 }, "line_count": 16, "code_line_count": 16, "cyclomatic": 4, "halstead_volume": 11.60964047443681, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/error/errcause.py", "function_name": "ViolationCause.__init__", "test_info": { "success": false, "failed": 51, "passed": 1079, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_82xtdca8/beartype/_check/error/errcause.py:398\nError: AttributeError: 'ViolationCause' object has no attribute 'hint'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> def find_cause(self) -> 'ViolationCause':\n '''\n Output cause describing whether the pith of this input cause either\n satisfies or violates the type hint of this input cause.\n \n Design\n ------\n This method is intentionally generalized to support objects both\n satisfying and *not* satisfying hints as equally valid use cases. While\n the parent\n :func:`beartype._check.error.errget.get_func_pith_violation` function\n calling this method is *always* passed an object *not* satisfying the\n passed hint, this method is under no such constraints. Why? Because this\n method is also called to find which of an arbitrary number of objects\n transitively nested in the object passed to\n :func:`beartype._check.error.errget.get_func_pith_violation` fails to\n satisfy the corresponding hint transitively nested in the hint passed to\n that function.\n \n For example, consider the type hint ``List[Union[int, str]]`` describing\n a list whose items are either integers or strings and the list\n ``list(range(256)) + [False,]`` consisting of the integers 0 through 255\n followed by boolean :data:`False`. Since that list is a sequence, the\n :func:`._peperrorsequence.find_cause_sequence_args_1` function must\n decide the cause of this list's failure to comply with this hint by\n finding the list item that is neither an integer nor a string,\n implemented by by iteratively passing each list item to the\n :func:`._peperrorunion.find_cause_pep484604_union` function. Since the\n first 256 items of this list are integers satisfying this hint,\n :func:`._peperrorunion.find_cause_pep484604_union` returns a dataclass\n instance whose :attr:`cause` field is :data:`None` up to\n :func:`._peperrorsequence.find_cause_sequence_args_1` before finally\n finding the non-compliant boolean item and returning its cause.\n \n Returns\n -------\n ViolationCause\n Output cause type-checking this pith against this type hint.\n \n Raises\n ------\n _BeartypeCallHintPepRaiseException\n If this type hint is either:\n \n * PEP-noncompliant (e.g., tuple union).\n * PEP-compliant but no getter function has been implemented to\n handle this category of PEP-compliant type hint yet.\n '''\n \n # If this hint is ignorable, all possible objects satisfy this hint.\n # Since this hint *CANNOT* (by definition) be the cause of this failure,\n # return the same cause as is.\n> if self.hint is Any:\nE AttributeError: 'ViolationCause' object has no attribute 'hint'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_82xtdca8/beartype/_check/error/errcause.py:398\nError: AttributeError: 'ViolationCause' object has no attribute 'hint'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> def find_cause(self) -> 'ViolationCause':\n '''\n Output cause describing whether the pith of this input cause either\n satisfies or violates the type hint of this input cause.\n \n Design\n ------\n This method is intentionally generalized to support objects both\n satisfying and *not* satisfying hints as equally valid use cases. While\n the parent\n :func:`beartype._check.error.errget.get_func_pith_violation` function\n calling this method is *always* passed an object *not* satisfying the\n passed hint, this method is under no such constraints. Why? Because this\n method is also called to find which of an arbitrary number of objects\n transitively nested in the object passed to\n :func:`beartype._check.error.errget.get_func_pith_violation` fails to\n satisfy the corresponding hint transitively nested in the hint passed to\n that function.\n \n For example, consider the type hint ``List[Union[int, str]]`` describing\n a list whose items are either integers or strings and the list\n ``list(range(256)) + [False,]`` consisting of the integers 0 through 255\n followed by boolean :data:`False`. Since that list is a sequence, the\n :func:`._peperrorsequence.find_cause_sequence_args_1` function must\n decide the cause of this list's failure to comply with this hint by\n finding the list item that is neither an integer nor a string,\n implemented by by iteratively passing each list item to the\n :func:`._peperrorunion.find_cause_pep484604_union` function. Since the\n first 256 items of this list are integers satisfying this hint,\n :func:`._peperrorunion.find_cause_pep484604_union` returns a dataclass\n instance whose :attr:`cause` field is :data:`None` up to\n :func:`._peperrorsequence.find_cause_sequence_args_1` before finally\n finding the non-compliant boolean item and returning its cause.\n \n Returns\n -------\n ViolationCause\n Output cause type-checking this pith against this type hint.\n \n Raises\n ------\n _BeartypeCallHintPepRaiseException\n If this type hint is either:\n \n * PEP-noncompliant (e.g., tuple union).\n * PEP-compliant but no getter function has been implemented to\n handle this category of PEP-compliant type hint yet.\n '''\n \n # If this hint is ignorable, all possible objects satisfy this hint.\n # Since this hint *CANNOT* (by definition) be the cause of this failure,\n # return the same cause as is.\n> if self.hint is Any:\nE AttributeError: 'ViolationCause' object has no attribute 'hint'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #42: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #43: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #44: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #45: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #46: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #47: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #48: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #49: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #50: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #51: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 23.67675392000002, "in_degree": 1, "true_in_degree": 1.8, "out_degree": 7, "betweenness": 3.522500650307812e-05, "pagerank": 0.00028151589789520825, "harmonic": 0.03217418546365915, "bidirectional_harmonic": 0.27479583190931894, "degree": 8 }, "line_count": 79, "code_line_count": 79, "cyclomatic": 16, "halstead_volume": 68.53238859703687, "halstead_difficulty": 2.4 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/claw/_clawstate.py", "function_name": "BeartypeClawState._reinit_safe", "test_info": { "success": false, "failed": 8, "passed": 1114, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a90_claw/a00_core/test_claw_api.py::test_claw_api\nLocation: /tmp/benchmark_cj5uiltm/beartype/claw/_package/clawpkgtrie.py:431\nError: AttributeError: 'BeartypeClawState' object has no attribute 'packages_trie_whitelist'. Did you mean: 'packages_trie_blacklist'?\n\nTraceback:\n\n> @fixture(autouse=True, scope='function')\n def clean_claws() -> None: # <-- heh. get it... clean *CLAWS*? it is punny.\n '''\n Permanently, silently, and recursively remove all **bytecode files** (i.e.,\n pure-Python bytecode compiled to platform-dependent temporary files residing\n in temporary ``__pycache__/`` subdirectories) of the test-specific\n :mod:`beartype_test.a00_unit.data` subpackage and all subsubpackages of that\n subpackage regardless of depth.\n \n Note that this unit test-scoped fixture is implicitly performed *before*\n each unit test transitively defined in sibling and child submodules of the\n subpackage directly containing this submodule. Why? Because failing to do so\n would invite subtle but easily reproducible desynchronization woes between\n those files and more recent changes to the implementation of the\n :mod:`beartype.claw` subpackage in the main codebase.\n \n See Also\n --------\n :func:`beartype._util.path.utilpathremove.remove_package_bytecode_files`\n Further details.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype.claw._package.clawpkgcontext import packages_trie_cleared\n from beartype._util.module.utilmodget import get_module_dir\n from beartype._util.path.utilpathremove import (\n remove_package_bytecode_files)\n from beartype_test.a00_unit.data import claw\n \n # ....................{ PATHS }....................\n # Path encapsulating the absolute dirname of the \"beartype.claw\" subpackage.\n #\n # Note that we intentionally avoid importing any subsubpackages (e.g.,\n # \"beartype_test.a00_unit.data.claw.intraprocess.hookable_package.beartype_this_package\")\n # above. Why? Because doing so would implicitly install the exact beartype\n # import hook which calling unit tests are attempting to subsequently\n # exercise and which *MUST* be confined to a context manager for test\n # idempotency.\n claw_dir = get_module_dir(claw)\n \n # Recursively remove *ALL* previously compiled bytecode files from both this\n # subdirectory *and* *ALL* subsubdirectories of this subdirectory.\n remove_package_bytecode_files(claw_dir)\n \n # ....................{ HOOKS }....................\n # With a context manager guaranteeably reverting *ALL* beartype import hooks\n # transitively installed in the body of this context manager, defer to the\n # parent unit test implicitly invoking this fixture.\n> with packages_trie_cleared():\n\n> return next(self.gen)\n\n> die_if_packages_trie()\n\n> if is_packages_trie():\n\n> def is_packages_trie() -> bool:\n '''\n :data:`True` only if one or more packages have been registered by a prior\n call to the :func:`beartype.claw._package.clawpkghook.hook_packages` function.\n \n Returns\n -------\n bool\n :data:`True` only if one or more packages have been registered.\n '''\n \n # Avoid circular import dependencies.\n from beartype.claw._clawstate import claw_state\n \n # Return true only if either...\n return (\n # A global configuration has been added by a prior call to the public\n # beartype.claw.beartype_all() function *OR*...\n> claw_state.packages_trie_whitelist.conf_if_hooked is not None or\n # One or more package-specific configurations have been added by prior\n # calls to public beartype.claw.beartype_*() functions.\n bool(claw_state.packages_trie_whitelist)\n )\nE AttributeError: 'BeartypeClawState' object has no attribute 'packages_trie_whitelist'. Did you mean: 'packages_trie_blacklist'?\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_extraprocess.py::test_claw_extraprocess_executable_submodule\nLocation: /tmp/benchmark_cj5uiltm/beartype/claw/_package/clawpkgtrie.py:431\nError: AttributeError: 'BeartypeClawState' object has no attribute 'packages_trie_whitelist'. Did you mean: 'packages_trie_blacklist'?\n\nTraceback:\n\n> @fixture(autouse=True, scope='function')\n def clean_claws() -> None: # <-- heh. get it... clean *CLAWS*? it is punny.\n '''\n Permanently, silently, and recursively remove all **bytecode files** (i.e.,\n pure-Python bytecode compiled to platform-dependent temporary files residing\n in temporary ``__pycache__/`` subdirectories) of the test-specific\n :mod:`beartype_test.a00_unit.data` subpackage and all subsubpackages of that\n subpackage regardless of depth.\n \n Note that this unit test-scoped fixture is implicitly performed *before*\n each unit test transitively defined in sibling and child submodules of the\n subpackage directly containing this submodule. Why? Because failing to do so\n would invite subtle but easily reproducible desynchronization woes between\n those files and more recent changes to the implementation of the\n :mod:`beartype.claw` subpackage in the main codebase.\n \n See Also\n --------\n :func:`beartype._util.path.utilpathremove.remove_package_bytecode_files`\n Further details.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype.claw._package.clawpkgcontext import packages_trie_cleared\n from beartype._util.module.utilmodget import get_module_dir\n from beartype._util.path.utilpathremove import (\n remove_package_bytecode_files)\n from beartype_test.a00_unit.data import claw\n \n # ....................{ PATHS }....................\n # Path encapsulating the absolute dirname of the \"beartype.claw\" subpackage.\n #\n # Note that we intentionally avoid importing any subsubpackages (e.g.,\n # \"beartype_test.a00_unit.data.claw.intraprocess.hookable_package.beartype_this_package\")\n # above. Why? Because doing so would implicitly install the exact beartype\n # import hook which calling unit tests are attempting to subsequently\n # exercise and which *MUST* be confined to a context manager for test\n # idempotency.\n claw_dir = get_module_dir(claw)\n \n # Recursively remove *ALL* previously compiled bytecode files from both this\n # subdirectory *and* *ALL* subsubdirectories of this subdirectory.\n remove_package_bytecode_files(claw_dir)\n \n # ....................{ HOOKS }....................\n # With a context manager guaranteeably reverting *ALL* beartype import hooks\n # transitively installed in the body of this context manager, defer to the\n # parent unit test implicitly invoking this fixture.\n> with packages_trie_cleared():\n\n> return next(self.gen)\n\n> die_if_packages_trie()\n\n> if is_packages_trie():\n\n> def is_packages_trie() -> bool:\n '''\n :data:`True` only if one or more packages have been registered by a prior\n call to the :func:`beartype.claw._package.clawpkghook.hook_packages` function.\n \n Returns\n -------\n bool\n :data:`True` only if one or more packages have been registered.\n '''\n \n # Avoid circular import dependencies.\n from beartype.claw._clawstate import claw_state\n \n # Return true only if either...\n return (\n # A global configuration has been added by a prior call to the public\n # beartype.claw.beartype_all() function *OR*...\n> claw_state.packages_trie_whitelist.conf_if_hooked is not None or\n # One or more package-specific configurations have been added by prior\n # calls to public beartype.claw.beartype_*() functions.\n bool(claw_state.packages_trie_whitelist)\n )\nE AttributeError: 'BeartypeClawState' object has no attribute 'packages_trie_whitelist'. Did you mean: 'packages_trie_blacklist'?\n", "Failure #3: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_extraprocess.py::test_claw_extraprocess_executable_package", "Failure #4: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #8: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a90_claw/a00_core/test_claw_api.py", "test_claw_api" ], [ "beartype_test/a00_unit/a90_claw/a90_hook/test_claw_extraprocess.py", "test_claw_extraprocess_executable_submodule" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.24, "in_degree": 2, "true_in_degree": 2.8, "out_degree": 2, "betweenness": 1.8967311193965145e-05, "pagerank": 0.0005801176792556103, "harmonic": 0.004111842105263158, "bidirectional_harmonic": 0.17286314745196388, "degree": 4 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/kind/map/utilmapset.py", "function_name": "merge_mappings_two", "test_info": { "success": false, "failed": 44, "passed": 1049, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_b80avttr/beartype/vale/_core/_valecore.py:214\nError: beartype.roar.BeartypeValeSubscriptionException: Validator locals \"None\" not dictionary.\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n\n> return BeartypeValidatorConjunction(\n\n> super().__init__(\n\n> super().__init__(\n\n> def __init__(\n self,\n *,\n \n # Mandatory keyword-only parameters.\n is_valid: BeartypeValidatorTester,\n is_valid_code: str,\n is_valid_code_locals: LexicalScope,\n get_repr: BeartypeValidatorRepresenter,\n ) -> None:\n '''\n Initialize this validator from the passed metadata.\n \n Parameters\n ----------\n is_valid : BeartypeValidatorTester\n **Validator tester** (i.e., caller-defined callable accepting a\n single arbitrary object and returning either ``True`` if that object\n satisfies an arbitrary constraint *or* ``False`` otherwise).\n is_valid_code : str\n **Validator code** (i.e., Python code snippet validating the\n previously localized parameter or return value against the same\n validation performed by the :func:`is_valid` function). This code:\n \n * *Must* contain one or more ``\"{obj}\"`` substrings, which external\n code generators (e.g., the :func:`beartype.beartype` decorator)\n will globally replace at evaluation time with the actual test\n subject object to be validated by this code.\n * *May* contain one or more ``\"{indent}\"`` substrings, which such\n code generators will globally replace at evaluation time with the\n line-oriented indentation required to generate a\n valid Python statement embedding this code. For consistency with\n :pep:`8`-compliant and well-established Python style guides, any\n additional indentation hard-coded into this code should be\n aligned to **four-space indentation.**\n is_valid_code_locals : LexicalScope\n **Validator code local scope** (i.e., dictionary mapping from the\n name to value of each local attribute referenced in\n :attr:`is_valid_code` code) required to dynamically compile this\n validator code into byte code at runtime.\n get_repr : BeartypeValidatorRepresenter\n **Representer** (i.e., either a string *or* caller-defined callable\n accepting no arguments returning a machine-readable representation\n of this validator). See the :data:`BeartypeValidatorRepresenter`\n type hint for further details.\n \n Raises\n ------\n beartype.roar.BeartypeValeSubscriptionException\n If either:\n \n * ``is_valid`` is either:\n \n * *Not* callable.\n * A C-based rather than pure-Python callable.\n * A pure-Python callable accepting two or more arguments.\n \n * ``is_valid_code`` is either:\n \n * *Not* a string.\n * A string either:\n \n * Empty.\n * Non-empty but **invalid** (i.e., *not* containing the test\n subject substring ``{obj}``).\n \n * ``is_valid_locals`` is *not* a dictionary.\n * ``get_repr`` is either:\n \n * *Not* callable.\n * A C-based rather than pure-Python callable.\n * A pure-Python callable accepting one or more arguments.\n * The empty string.\n '''\n \n # Avoid circular import dependencies.\n from beartype.vale._is._valeisabc import _BeartypeValidatorFactoryABC\n \n # If that callable is *NOT* a validator tester, raise an exception.\n die_unless_validator_tester(is_valid)\n # Else, that callable is a validator tester.\n \n # If this code is *NOT* a string, raise an exception.\n if not isinstance(is_valid_code, str):\n raise BeartypeValeSubscriptionException(\n f'Validator code not string:\\n'\n f'{represent_object(is_valid_code)}'\n )\n # Else, this code is a string.\n #\n # If this code is the empty string, raise an exception.\n elif not is_valid_code:\n raise BeartypeValeSubscriptionException('Validator code empty.')\n # Else, this code is a non-empty string.\n #\n # If this code does *NOT* contain the test subject substring\n # \"{obj}\" and is invalid, raise an exception.\n elif '{obj}' not in is_valid_code:\n raise BeartypeValeSubscriptionException(\n f'Validator code invalid '\n f'(i.e., test subject substring \"{{obj}}\" not found):\\n'\n f'{is_valid_code}'\n )\n # Else, this code is hopefully valid.\n #\n # If this code is *NOT* explicitly prefixed by \"(\" and suffixed by\n # \")\", do so to ensure this code remains safely evaluable when\n # embedded in parent expressions.\n elif not (\n is_valid_code[ 0] == '(' and\n is_valid_code[-1] == ')'\n ):\n is_valid_code = f'({is_valid_code})'\n # Else, this code is explicitly prefixed by \"(\" and suffixed by \")\".\n \n # If this dictionary of code locals is *NOT* a dictionary, raise an\n # exception.\n if not isinstance(is_valid_code_locals, dict):\n> raise BeartypeValeSubscriptionException(\n f'Validator locals '\n f'{represent_object(is_valid_code_locals)} not dictionary.'\n )\nE beartype.roar.BeartypeValeSubscriptionException: Validator locals \"None\" not dictionary.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none\nLocation: /tmp/benchmark_b80avttr/beartype/vale/_core/_valecore.py:214\nError: beartype.roar.BeartypeValeSubscriptionException: Validator locals \"None\" not dictionary.\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n\n> return BeartypeValidatorConjunction(\n\n> super().__init__(\n\n> super().__init__(\n\n> def __init__(\n self,\n *,\n \n # Mandatory keyword-only parameters.\n is_valid: BeartypeValidatorTester,\n is_valid_code: str,\n is_valid_code_locals: LexicalScope,\n get_repr: BeartypeValidatorRepresenter,\n ) -> None:\n '''\n Initialize this validator from the passed metadata.\n \n Parameters\n ----------\n is_valid : BeartypeValidatorTester\n **Validator tester** (i.e., caller-defined callable accepting a\n single arbitrary object and returning either ``True`` if that object\n satisfies an arbitrary constraint *or* ``False`` otherwise).\n is_valid_code : str\n **Validator code** (i.e., Python code snippet validating the\n previously localized parameter or return value against the same\n validation performed by the :func:`is_valid` function). This code:\n \n * *Must* contain one or more ``\"{obj}\"`` substrings, which external\n code generators (e.g., the :func:`beartype.beartype` decorator)\n will globally replace at evaluation time with the actual test\n subject object to be validated by this code.\n * *May* contain one or more ``\"{indent}\"`` substrings, which such\n code generators will globally replace at evaluation time with the\n line-oriented indentation required to generate a\n valid Python statement embedding this code. For consistency with\n :pep:`8`-compliant and well-established Python style guides, any\n additional indentation hard-coded into this code should be\n aligned to **four-space indentation.**\n is_valid_code_locals : LexicalScope\n **Validator code local scope** (i.e., dictionary mapping from the\n name to value of each local attribute referenced in\n :attr:`is_valid_code` code) required to dynamically compile this\n validator code into byte code at runtime.\n get_repr : BeartypeValidatorRepresenter\n **Representer** (i.e., either a string *or* caller-defined callable\n accepting no arguments returning a machine-readable representation\n of this validator). See the :data:`BeartypeValidatorRepresenter`\n type hint for further details.\n \n Raises\n ------\n beartype.roar.BeartypeValeSubscriptionException\n If either:\n \n * ``is_valid`` is either:\n \n * *Not* callable.\n * A C-based rather than pure-Python callable.\n * A pure-Python callable accepting two or more arguments.\n \n * ``is_valid_code`` is either:\n \n * *Not* a string.\n * A string either:\n \n * Empty.\n * Non-empty but **invalid** (i.e., *not* containing the test\n subject substring ``{obj}``).\n \n * ``is_valid_locals`` is *not* a dictionary.\n * ``get_repr`` is either:\n \n * *Not* callable.\n * A C-based rather than pure-Python callable.\n * A pure-Python callable accepting one or more arguments.\n * The empty string.\n '''\n \n # Avoid circular import dependencies.\n from beartype.vale._is._valeisabc import _BeartypeValidatorFactoryABC\n \n # If that callable is *NOT* a validator tester, raise an exception.\n die_unless_validator_tester(is_valid)\n # Else, that callable is a validator tester.\n \n # If this code is *NOT* a string, raise an exception.\n if not isinstance(is_valid_code, str):\n raise BeartypeValeSubscriptionException(\n f'Validator code not string:\\n'\n f'{represent_object(is_valid_code)}'\n )\n # Else, this code is a string.\n #\n # If this code is the empty string, raise an exception.\n elif not is_valid_code:\n raise BeartypeValeSubscriptionException('Validator code empty.')\n # Else, this code is a non-empty string.\n #\n # If this code does *NOT* contain the test subject substring\n # \"{obj}\" and is invalid, raise an exception.\n elif '{obj}' not in is_valid_code:\n raise BeartypeValeSubscriptionException(\n f'Validator code invalid '\n f'(i.e., test subject substring \"{{obj}}\" not found):\\n'\n f'{is_valid_code}'\n )\n # Else, this code is hopefully valid.\n #\n # If this code is *NOT* explicitly prefixed by \"(\" and suffixed by\n # \")\", do so to ensure this code remains safely evaluable when\n # embedded in parent expressions.\n elif not (\n is_valid_code[ 0] == '(' and\n is_valid_code[-1] == ')'\n ):\n is_valid_code = f'({is_valid_code})'\n # Else, this code is explicitly prefixed by \"(\" and suffixed by \")\".\n \n # If this dictionary of code locals is *NOT* a dictionary, raise an\n # exception.\n if not isinstance(is_valid_code_locals, dict):\n> raise BeartypeValeSubscriptionException(\n f'Validator locals '\n f'{represent_object(is_valid_code_locals)} not dictionary.'\n )\nE beartype.roar.BeartypeValeSubscriptionException: Validator locals \"None\" not dictionary.\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #25: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #29: beartype_test/a00_unit/a20_util/kind/map/test_utilmapset.py::test_merge_mappings_two", "Failure #30: beartype_test/a00_unit/a20_util/kind/map/test_utilmapset.py::test_merge_mappings_three", "Failure #31: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #32: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #33: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #34: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #35: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass", "Failure #36: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_pass", "Failure #37: beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py::test_api_vale_isequal_pass", "Failure #38: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #39: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #40: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #41: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #42: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #43: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #44: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_type_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 3, "true_in_degree": 3.0, "out_degree": 1, "betweenness": 8.12884765455649e-06, "pagerank": 0.0007095135467980295, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.18346262199058327, "degree": 4 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 3, "halstead_volume": 14.0, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/checkmake.py", "function_name": "_make_func_checker", "test_info": { "success": false, "failed": 14, "passed": 1116, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_v7wyfeqm/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:119\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n> with warns(hint_meta.warning_type):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_v7wyfeqm/beartype/door/_func/doorcheck.py:137\nError: TypeError: 'NoneType' object is not callable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> def die_if_unbearable(\n # Mandatory flexible parameters.\n obj: object,\n \n #FIXME: Uncomment *AFTER* the third-party \"typing_extensions\" module releases\n #a new stable release.\n # hint: Hint,\n hint: object,\n \n # Optional keyword-only parameters.\n *,\n conf: BeartypeConf = BEARTYPE_CONF_DEFAULT,\n exception_prefix: str = 'die_if_unbearable() ',\n ) -> None:\n '''\n Raise an exception if the passed arbitrary object violates the passed type\n hint under the passed beartype configuration.\n \n To configure the type of violation exception raised by this function, set\n the :attr:`.BeartypeConf.violation_door_type` option of the passed ``conf``\n parameter accordingly.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this hint.\n hint : Hint\n Type hint to type-check this object against.\n conf : BeartypeConf, optional\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object). Defaults\n to ``BeartypeConf()``, the default :math:`O(1)` constant-time\n configuration.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to a reasonably sensible string.\n \n Raises\n ------\n ``conf.violation_door_type``\n If this object violates this hint.\n beartype.roar.BeartypeDecorHintNonpepException\n If this hint is *not* PEP-compliant (i.e., complies with *no* Python\n Enhancement Proposals (PEPs) currently supported by :mod:`beartype`).\n beartype.roar.BeartypeDecorHintPepUnsupportedException\n If this hint is currently unsupported by :mod:`beartype`.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.door import die_if_unbearable\n >>> die_if_unbearable(['And', 'what', 'rough', 'beast,'], list[str])\n >>> die_if_unbearable(['its', 'hour', 'come', 'round'], list[int])\n beartype.roar.BeartypeDoorHintViolation: Object ['its', 'hour', 'come',\n 'round'] violates type hint list[int], as list index 0 item 'its' not\n instance of int.\n '''\n # conf._is_debug = True\n \n # Memoized low-level type-checking raiser function either raising an\n # exception or emitting a warning only if the passed object passed violates\n # the type hint passed to this high-level type-checking raiser function.\n #\n # Note that parameters are intentionally passed positionally for efficiency.\n # Since make_func_raiser() is memoized, passing parameters by keyword would\n # raise a non-fatal\n # \"_BeartypeUtilCallableCachedKwargsWarning\" warning.\n func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n \n # Either raise an exception or emit a warning only if the passed object\n # violates this hint.\n> func_raiser(obj) # pyright: ignore\nE TypeError: 'NoneType' object is not callable\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #9: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #10: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #11: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #12: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #13: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #14: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 46.55459328000001, "in_degree": 2, "true_in_degree": 4.880000000000001, "out_degree": 7, "betweenness": 0.00031296063470042485, "pagerank": 0.0011974086617405582, "harmonic": 0.05596608709273182, "bidirectional_harmonic": 0.24160994341915387, "degree": 9 }, "line_count": 50, "code_line_count": 50, "cyclomatic": 6, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/cache/pool/utilcachepoolinstance.py", "function_name": "acquire_instance", "test_info": { "success": false, "failed": 100, "passed": 1030, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoolinstance.py::test_utilcachepool_instance\nLocation: /tmp/benchmark_re4jhmrt/beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoolinstance.py:64\nError: AttributeError: 'NoneType' object has no attribute 'update'\n\nTraceback:\n\n> def test_utilcachepool_instance() -> None:\n '''\n Test successful usage of the\n :mod:`beartype._util.cache.pool.utilcachepoolinstance` submodule.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.cache.pool.utilcachepoolinstance import (\n acquire_instance,\n release_instance,\n )\n \n # ....................{ CONSTANTS }....................\n # Culturally relevant Clash lyrics to be tested below.\n PUBLIC_SERVICE_ANNOUNCEMENT = '\\n'.join((\n 'You have the right not to be killed.',\n 'Murder is a crime,',\n 'Unless it was done',\n 'By a policeman',\n 'Or an aristocrat.',\n ))\n KNOW_YOUR_RIGHTS = '\\n'.join((\n 'You have the right to food money --',\n 'Providing, of course, you',\n \"Don't mind a little\",\n 'Investigation, humiliation,',\n 'And (if you cross your fingers)',\n 'Rehabilitation.',\n ))\n \n # ....................{ PASS ~ container }....................\n # Repeat this test twice, thus asserting that builtin mutable containers are\n # necessarily cleared by the acquire_instance() function.\n for _ in range(2):\n # Acquire an arbitrary dictionary.\n look_up = acquire_instance(dict)\n \n # Assert this dictionary to be empty.\n assert not look_up\n \n # Add arbitrary key-value pairs to this dictionary.\n> look_up.update({\n 'Look up,': 'and let me see our doom in it;',\n 'Look up, and': 'tell me if this feeble shape.',\n })\nE AttributeError: 'NoneType' object has no attribute 'update'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_re4jhmrt/beartype/_check/metadata/metadecor.py:806\nError: AttributeError: 'NoneType' object has no attribute 'reinit'\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> decor_meta = make_beartype_call(\n\n> def make_beartype_call(**kwargs) -> BeartypeDecorMeta:\n '''\n **Beartype call metadata** (i.e., object encapsulating *all* metadata for\n the passed user-defined callable, typically currently being decorated by the\n :func:`beartype.beartype` decorator).\n \n Caveats\n -------\n **This higher-level factory function should always be called in lieu of\n instantiating the** :class:`.BeartypeDecorMeta` **class directly.** Why?\n Brute-force efficiency. This factory efficiently reuses previously\n instantiated :class:`.BeartypeDecorMeta` objects rather than inefficiently\n instantiating new :class:`.BeartypeDecorMeta` objects.\n \n **The caller must pass the metadata returned by this factory back to the**\n :func:`beartype._util.cache.pool.utilcachepoolinstance.release_instance`\n **function.** If accidentally omitted, this metadata will simply be\n garbage-collected rather than available for efficient reuse by this factory.\n Although hardly a worst-case outcome, omitting that explicit call largely\n defeats the purpose of calling this factory in the first place.\n \n Parameters\n ----------\n All keyword parameters are passed as is to the :meth:`.BeartypeDecorMeta.reinit`\n method.\n \n Returns\n -------\n BeartypeDecorMeta\n Beartype call metadata describing this callable.\n '''\n \n # Acquire previously cached beartype call metadata from its object pool.\n decor_meta = acquire_instance(BeartypeDecorMeta)\n \n # Reinitialize this metadata with the passed keyword parameters.\n> decor_meta.reinit(**kwargs)\nE AttributeError: 'NoneType' object has no attribute 'reinit'\n", "Failure #3: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #4: beartype_test/a00_unit/a60_check/a20_code/test_codemake.py::test_make_check_code_decoration", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep435", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep663", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #83: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #84: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #85: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #86: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #89: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #90: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #91: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #92: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #93: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #94: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #95: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #96: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #97: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #98: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #99: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #100: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoolinstance.py", "test_utilcachepool_instance" ], [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 5, "true_in_degree": 16.200000000000006, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0007657488075070362, "harmonic": 0.0, "bidirectional_harmonic": 0.25125052213867993, "degree": 5 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 3, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextrepr.py", "function_name": "represent_pith", "test_info": { "success": false, "failed": 21, "passed": 1109, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_pith\nLocation: /tmp/benchmark_0dp5zw47/beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py:139\nError: TypeError: argument of type 'NoneType' is not iterable\n\nTraceback:\n\n> def test_represent_pith() -> None:\n '''\n Test the\n Test the :func:`beartype._util.text.utiltextrepr.represent_pith` function.\n '''\n \n # Defer test-specific imports.\n from beartype._util.text.utiltextrepr import represent_pith\n \n # Custom type to be represented below.\n class CustomType(object):\n def __repr__(self) -> str: return (\n 'Collaborator\u2010ily brambling unspiritually')\n \n # Assert this representer represents builtin types in the expected way.\n repr_builtin = represent_pith(42)\n> assert 'int' in repr_builtin\nE TypeError: argument of type 'NoneType' is not iterable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_0dp5zw47/beartype/_check/error/_pep/errpep484604.py:70\nError: TypeError: object of type 'NoneType' has no len()\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> return cause_finder(self)\n\n> def find_cause_pep484604_union(cause: ViolationCause) -> ViolationCause:\n '''\n Output cause describing whether the pith of the passed input cause either\n satisfies or violates the PEP-compliant union type hint of that cause.\n \n Parameters\n ----------\n cause : ViolationCause\n Input cause providing this data.\n \n Returns\n -------\n ViolationCause\n Output cause type-checking this data.\n '''\n assert isinstance(cause, ViolationCause), f'{repr(cause)} not cause.'\n assert cause.hint_sign in HINT_SIGNS_UNION, (\n f'{repr(cause.hint)} not union sign.')\n \n # Indentation preceding each line of the strings returned by child getter\n # functions called by this parent getter function, offset to visually\n # demarcate child from parent causes in multiline strings.\n CAUSE_INDENT_CHILD = cause.cause_indent + ' '\n \n # List of all human-readable strings describing the failure of this pith to\n # satisfy each of these child hints.\n cause_strs = []\n \n # Subset of all classes shallowly associated with these child hints (i.e.,\n # by being either these child hints in the case of non-\"typing\" classes\n # *OR* the classes originating these child hints in the case of\n # PEP-compliant type hints) that this pith fails to shallowly satisfy.\n hint_types_violated = set()\n \n # Truncated object representation of this pith.\n pith_repr = represent_pith(cause.pith)\n \n # 0-based index of the first non-whitespace character following this\n # representation in violation causes collected below. Look. Just accept it.\n> PITH_REPR_INDEX = len(pith_repr) + 1\nE TypeError: object of type 'NoneType' has no len()\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #15: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #16: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #21: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py", "test_represent_pith" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 12.617256960000002, "in_degree": 9, "true_in_degree": 12.040000000000003, "out_degree": 2, "betweenness": 0.00012193271481834735, "pagerank": 0.0007577603952859881, "harmonic": 0.015372415413533833, "bidirectional_harmonic": 0.25216112012987, "degree": 11 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncfile.py", "function_name": "get_func_filename_or_none", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/test_utilfunccode.py::test_get_func_code_or_none\nLocation: /tmp/benchmark_dei5b8dv/beartype_test/a00_unit/a20_util/func/test_utilfunccode.py:54\nError: assert None == \"def will_be_the_dome():\\n '''\\n Arbitrary non-lambda function physically declared by this submodule.\\n '''\\n\\n return 'of a vast sepulchre'\\n\"\n + where None = ()\n\nTraceback:\n\n> def test_get_func_code_or_none() -> None:\n '''\n Test usage of the\n :func:`beartype._util.func.utilfunccode.get_func_code_or_none`\n function.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype.roar._roarwarn import _BeartypeUtilCallableWarning\n from beartype._util.func.utilfunccode import get_func_code_or_none\n from beartype._util.py.utilpyversion import (\n IS_PYTHON_AT_LEAST_3_11,\n )\n from beartype_test.a00_unit.data.util.func.data_utilfunccode import (\n of_vapours,\n will_be_the_dome,\n thou_dirge,\n yellow,\n )\n from collections.abc import Callable\n from pytest import warns\n from re import escape, search\n \n # ..................{ NON-LAMBDA }..................\n # Assert this getter accepts C-based callables with \"None\"\n assert get_func_code_or_none(iter) is None\n \n # Assert this getter accepts a dynamically declared callable with \"None\".\n assert get_func_code_or_none(of_vapours) is None\n \n # Assert this getter accepts a physically declared pure-Python non-lambda\n # callable with the full definition of that callable.\n> assert get_func_code_or_none(will_be_the_dome) == \"\"\"def will_be_the_dome():\n '''\n Arbitrary non-lambda function physically declared by this submodule.\n '''\n \n return 'of a vast sepulchre'\n \"\"\"\nE assert None == \"def will_be_the_dome():\\n '''\\n Arbitrary non-lambda function physically declared by this submodule.\\n '''\\n\\n return 'of a vast sepulchre'\\n\"\nE + where None = ()\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py::test_is_func_file\nLocation: /tmp/benchmark_dei5b8dv/beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py:38\nError: assert False is True\n + where False = (.but_now_thy_youngest_dearest_one_has_perished at 0x7d33279891c0>)\n\nTraceback:\n\n> def test_is_func_file() -> None:\n '''\n Test the\n :func:`beartype._util.func.utilfuncfile.is_func_file` tester.\n '''\n \n # Defer test-specific imports.\n from beartype._util.func.utilfuncfile import is_func_file\n \n # Arbitrary pure-Python callable declared on-disk.\n def but_now_thy_youngest_dearest_one_has_perished():\n return 'The nursling of thy widowhood, who grew,'\n \n # Arbitrary pure-Python callable declared in-memory *WITHOUT* being cached\n # by the standard \"linecache\" module.\n like_a_pale_flower = eval('lambda: \"by some sad maiden cherished,\"')\n \n # Assert this tester accepts pure-Python callables declared on-disk.\n> assert is_func_file(but_now_thy_youngest_dearest_one_has_perished) is True\nE assert False is True\nE + where False = (.but_now_thy_youngest_dearest_one_has_perished at 0x7d33279891c0>)\n", "Failure #3: beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py::test_get_func_filename_or_none", "Failure #4: beartype_test/a00_unit/a20_util/test_utilobject.py::test_get_object_filename_or_none", "Failure #5: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #6: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/test_utilfunccode.py", "test_get_func_code_or_none" ], [ "beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py", "test_is_func_file" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.232, "in_degree": 3, "true_in_degree": 7.32, "out_degree": 1, "betweenness": 9.483655596982572e-06, "pagerank": 0.0007718158064341053, "harmonic": 0.004660087719298246, "bidirectional_harmonic": 0.19680522328548725, "degree": 4 }, "line_count": 14, "code_line_count": 14, "cyclomatic": 6, "halstead_volume": 93.45440529575887, "halstead_difficulty": 3.230769230769231 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484/pep484generic.py", "function_name": "is_hint_pep484_generic_unsubscripted", "test_info": { "success": false, "failed": 32, "passed": 1098, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_nu3qttvz/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:705\nError: beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic pseudo-superclasses not found.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484585_generic_args_full(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n hint_base_target: Optional[Hint] = None,\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> TupleHints:\n '''\n Tuple of the one or more **full child type hints** (i.e., complete tuple of\n *all* type hints directly subscripting both the passed generic *and*\n one or more pseudo-superclasses of this generic) transitively subscripting\n the passed :pep:`484`- or :pep:`585`-compliant **generic** (i.e., class\n superficially subclassing at least one PEP-compliant type hint that is\n possibly *not* an actual class) if this object is a generic *or* raise an\n exception otherwise (i.e., if this object is not a generic).\n \n This getter greedily replaces in the passed tuple as many abstract\n :pep:`484`-compliant **type variables** (i.e., :class:`typing.TypeVar`\n objects) as there are concrete child type hints directly subscripting the\n passed generic. Doing so effectively \"bubbles up\" these concrete children up\n the class hierarchy into the \"empty placeholders\" established by the type\n variables transitively subscripting all pseudo-superclasses of this generic.\n \n This getter is guaranteed to return a non-empty tuple. By definition, a\n generic subclasses one or more generic superclasses necessarily subscripted\n by one or more child type hints.\n \n This getter is memoized for efficiency.\n \n Caveats\n -------\n **This getter is computationally complex in both space and time.** This\n getter exhibits:\n \n * Amortized :math:`O(1)` constant time complexity, thanks to memoization.\n * Non-amortized worst-case :math:`O(jk)` quadratic time complexity for:\n \n * :math:`j` the largest number of child type hints transitively\n subscripting a pseudo-superclass of this generic.\n * :math:`k` the total number of transitive pseudo-superclasses of this\n generic.\n \n **This getter is currently implemented with recursion.** Doing so yields a\n relatively trivial algorithm at a relatively non-trivial increase in runtime\n overhead, due to overhead associated with function calls in Python.\n \n Parameters\n ----------\n hint : object\n Generic type hint to be inspected.\n hint_base_target : Optional[Hint] = None\n **Target pseudo-superclass** (i.e., erased transitive pseudo-superclass\n of the passed generic to specifically search, filter, and return the\n child type hints of). Defaults to :data:`None`. Specifically:\n \n * If this parameter is :data:`None`, this getter returns the complete\n tuple of *all* type hints directly subscripting both the passed\n generic *and* one or more pseudo-superclasses of this generic.\n * If this parameter is *not* :data:`None`, this getter returns the\n partial tuple of *only* type hints directly subscripting both the\n passed generic *and* this passed pseudo-superclass of this generic.\n \n A target pseudo-superclass is passed to deduce whether two generics are\n related according to the :func:`beartype.door.is_subhint` relation. If\n all child type hints in the tuple returned by this getter (when passed\n some generic and its pseudo-superclass) are subhints of all child type\n hints in the tuple returned by this getter passed *only* that\n pseudo-superclass, then that generic is necessarily a subhint of that\n pseudo-superclass. Look. Just go with it, people.\n \n Lastly, note that this getter intentionally ignores *all* child hints\n subscripting this target pseudo-superclass. For search purposes, *any*\n child hints subscripting this target pseudo-superclass are not only\n irrelevant but harmful -- promoting false negatives in higher-level\n functions (e.g., :func:`beartype.door.is_subhint`) internally leveraging\n this lower-level getter. Ignoring these child hints is thus imperative.\n Since deciding child hint compatibility between the passed generic and\n this target pseudo-superclass is a non-trivial decision problem, this\n lower-level getter defers that problem to the caller by unconditionally\n returning the same result regardless of child hints subscripting this\n target pseudo-superclass.\n \n For example, consider the :pep:`484`-compliant :obj:`typing.Any`.\n Clearly, this getter should return the same tuple when passed an\n unsubscripted target pseudo-superclass as when passed a target\n pseudo-superclass subscripted by :obj:`typing.Any`: e.g.,\n \n .. code-block:: pycon\n \n >>> from typing import Any, Generic\n >>> class MuhGeneric[S, T](Generic[S, T]): pass\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[Any])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[S, T])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[int, float])\n (S, T)\n \n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`.BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n Tuple[Hint, ...]\n Tuple of the one or more full child type hints transitively subscripting\n this generic.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * Neither a :pep:`484`- nor :pep:`585`-compliant generic.\n * A :pep:`484`- or :pep:`585`-compliant generic subclassing *no*\n pseudo-superclasses.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.typing import Generic, TypeVar\n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_args_full)\n \n >>> S = TypeVar('S')\n >>> T = TypeVar('T')\n \n >>> class GenericSuperclass(Generic[S], list[T]): pass\n >>> class GenericList(list[complex]): pass\n >>> class GenericSubclass(GenericSuperclass[int, T], GenericList): pass\n \n >>> get_hint_pep484585_generic_args_full(GenericSuperclass)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(GenericSuperclass[int, float])\n (int, float)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass)\n (int, T, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n '''\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception type.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # ....................{ IMPORTS }....................\n # Avoid circular import dependencies.\n from beartype._util.hint.pep.utilpepget import get_hint_pep_args\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic_user)\n \n # ....................{ PREAMBLE }....................\n # If the caller explicitly passed a pseudo-superclass target...\n #\n # Note that this is the common case for this getter and thus tested first.\n if hint_base_target:\n hint_base_target = (\n # If this pseudo-superclass target is this generic, this\n # pseudo-superclass target is effectively meaningless (albeit\n # technically valid). In this case, silently ignore this\n # pseudo-superclass target.\n None\n if hint is hint_base_target else\n # Else, this pseudo-superclass target is *NOT* this generic. In this\n # case, the unsubscripted generic underlying this possibly\n # subscripted target pseudo-superclass generic. See the docstring.\n get_hint_pep484585_generic_type( # pyright: ignore\n hint=hint_base_target,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n )\n # Else, the caller passed *NO* pseudosuperclass target. In this case...\n \n # ....................{ LOCALS }....................\n # Metadata describing the passed generic, used to seed the depth-first\n # search (DFS) below with the first pseudo-superclass to be visited.\n hint_root_data = [\n # This generic.\n hint,\n \n # Metadata describing the direct parent pseudo-superclass of this\n # generic. By definition, this generic is the root of this n-ary tree\n # and thus has *NO* parent (either direct or indirect).\n None,\n ]\n \n # Unvisited pseudo-superclass stack (i.e., efficiently poppable list of\n # metadata describing *ALL* unvisited transitive pseudo-superclasses of this\n # generic, intentionally reordered in reverse order to enable the\n # non-recursive depth-first search (DFS) performed below to both visit and\n # pop these pseudo-superclasses in the expected order), seeded with metadata\n # describing the passed generic.\n #\n # Each item of this stack is a list of metadata describing an unvisited\n # transitive pseudo-superclass of this generic such that this list is\n # either:\n # * If this pseudo-superclass has yet to be visited by this DFS, a 2-list\n # \"(hint, hint_super_data)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is either:\n # * If this pseudo-superclass has a parent pseudo-superclass, the item\n # of this stack describing that parent pseudo-superclass.\n # * Else, this pseudo-superclass is the passed generic. Since this\n # generic has *NO* parent pseudo-superclass, \"None\".\n # * If this pseudo-superclass is itself a user-defined generic (i.e.,\n # defined by a third-party downstream package) that has already been\n # visited by this DFS, a 4-list \"(hint, hint_super_data, hint_args_stack,\n # hint_args_full)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is as defined above.\n # * \"hint_args_stack\" is this pseudo-superclass' direct child hint stack\n # (i.e., list of the zero or more child hints directly subscripting this\n # pseudo-superclass in reverse order, embodying an efficiently poppable\n # stack of these hints), popped off while recursing up from the child\n # pseudo-superclasses of this pseudo-superclass.\n # * \"hint_args_full\" is the list of zero or more child hints transitively\n # subscripting this pseudo-superclass, defined while recursing up from\n # the child pseudo-superclasses of this pseudo-superclass.\n #\n # In short, there be dragons here -- albeit extremely efficient dragons.\n hint_bases_data: _HintBasesData = [hint_root_data]\n \n # Dictionary mapping from each previously observed PEP 484-compliant type\n # variable (i.e., \"typing.TypeVar\" object) subscripting a transitive\n # pseudo-superclass of this generic to the corresponding child hint \"bubbled\n # up\" from a subclass of that pseudo-superclass into that type variable.\n #\n # This dictionary enables the DFS below to reliably \"bubble up\" a single\n # child hint to the same type variable appearing multiple times throughout a\n # generics hierarchy. For example, this dictionary enables the \"int\" child\n # hint subscripting the \"GenericList\" generic to be \"bubbled up\" into the\n # type variable \"T\" subscripting the pseudo-superclasses \"List\" and\n # \"Generic\" of this generic: e.g.,\n # >>> class GenericList[T](List[T], Generic[T]): pass\n # >>> get_hint_pep484585_generic_args_full(GenericList[int])\n # (int, int)\n #\n # For the above call, this contents of this dictionary resemble:\n # typevar_to_hint = {T: int}\n typevar_to_hint: TypeVarToHint = {}\n \n # ....................{ LOCALS ~ target }....................\n # List of zero or more child hints transitively subscripting the passed\n # target pseudo-superclass of this generic if this pseudo-superclass has\n # already been visited by the DFS below *OR* \"None\" otherwise (i.e., if this\n # pseudo-superclass has yet to be visited by this DFS).\n hint_base_target_args_full: Optional[ListHints] = None\n \n # True only if the pseudo-superclass currently visited by the DFS below is\n # still transitively subscripted by one or more PEP 484-compliant type\n # variables (i.e., \"TypeVar\" objects) that have yet to be replaced by\n # concrete hints of a parent pseudo-superclass of that pseudo-superclass.\n is_hint_base_arg_typevar = False\n \n # ....................{ SEARCH }....................\n # Iteration simulating a recursive depth-first search (DFS), efficiently\n # deciding the tuple of all child hints transitively subscripting the\n # desired pseudo-superclass of this generic.\n \n # With at least one transitive pseudo-superclass of this generic remains\n # unvisited...\n while hint_bases_data:\n # Metadata describing the currently visited transitive pseudo-superclass\n # of this generic defined as the top-most item of this stack.\n #\n # Note that we intentionally avoid popping this pseudo-superclass off\n # this stack yet. We only pop a pseudo-superclass off this stack *AFTER*\n # resolving all child pseudo-superclasses of that pseudo-superclass,\n # which simulates the \"backing out\" performed by genuine recursion.\n hint_base_data = hint_bases_data[-1]\n \n # Currently visited transitive pseudo-superclass of this generic.\n hint_base = hint_base_data[_HINT_BASES_INDEX_HINT]\n \n # True only if the metadata describing this pseudo-superclass is still\n # its initial size, implying that this DFS has yet to visit this\n # pseudo-superclass by recursing down into the child pseudo-superclasses\n # of this pseudo-superclass.\n is_hint_base_leaf = len(hint_base_data) == _HINT_BASE_DATA_LEN_LEAF\n \n # If...\n if (\n # This DFS has yet to visit this pseudo-superclass *AND*...\n is_hint_base_leaf and\n # This pseudo-superclass is itself a PEP 484- or 585-compliant\n # user-defined generic. Standard generics (i.e., that are *NOT*\n # user-defined) have *NO* pseudo-superclasses and are thus omitted.\n # Examples of omittable standard generics include:\n # * \"dict[str, U]\".\n # * \"typing.Generic[S, int]\").\n # * \"typing.Protocol[float, T]\").\n #\n # Note that this tester is mildly slower than the prior test and\n # thus intentionally tested later.\n is_hint_pep484585_generic_user(hint_base) # pyright: ignore\n # Then this DFS is currently recursing down into the child\n # pseudo-superclasses of this pseudo-superclass. In this case...\n ):\n # Expand the metadata describing this pseudo-superclass from its\n # current 2-list \"(hint, hint_super_data)\" into the expanded 4-list\n # \"(hint, hint_super_data, hint_args_stack, hint_args_full)\".\n # Specifically, append (in order):\n hint_base_data.extend((\n # Poppable stack of the zero or more child hints directly\n # subscripting this child pseudo-superclass.\n make_stack(get_hint_pep_args(hint_base)),\n # List of the zero or more child hints transitively subscripting\n # this child pseudo-superclass.\n [],\n ))\n \n # Tuple of the one or more child pseudo-superclasses of this\n # pseudo-superclass.\n # print(f'Introspecting generic {hint} unerased bases...')\n hint_child_bases = get_hint_pep484585_generic_bases_unerased(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # print(f'Generic {hint} unerased bases: {hint_child_bases}')\n \n # For each child pseudo-superclass of this pseudo-superclass,\n # intentionally iterated in reverse order so as to ensure that the\n # *FIRST* child pseudo-superclass is the *LAST* item of this stack\n # (and thus the *FIRST* unvisited pseudo-superclass to be visited by\n # this depth-first search (DFS) next).\n #\n # Note that the reversed() builtin is well-known to be the most\n # efficient means of producing a reversed iterable for iteration\n # purposes. See also:\n # https://stackoverflow.com/a/16514411/2809027\n for hint_child_base in reversed(hint_child_bases):\n # Push metadata describing this unvisited child\n # pseudo-superclass onto this stack.\n hint_bases_data.append([\n # This child pseudo-superclass.\n hint_child_base,\n \n # Metadata describing the direct parent\n # pseudo-superclass of this child pseudo-superclass.\n hint_base_data,\n ])\n # Else, either:\n # * This DFS has already visited this pseudo-superclass *OR*...\n # * This pseudo-superclass is a \"terminal\" leaf generic *OR*...\n # * This pseudo-superclass is *NOT* a generic.\n #\n # In any case, this DFS should *NOT* recurse (back) down into this\n # pseudo-superclass. Therefore, this DFS is currently recursing back up\n # out of this pseudo-superclass into its parent pseudo-superclass.\n else:\n # Pop this pseudo-superclass off this stack.\n hint_bases_data.pop()\n # print(f'Resuming generic {hint} pseudo-superclass {hint_base} args {hint_base_args}...')\n \n # List of the zero or more child hints transitively subscripting\n # this pseudo-superclass, defined as either...\n hint_base_args_full: ListHints = ( # pyright: ignore\n # If this is a terminal leaf pseudo-superclass, the tuple of\n # zero or more child hints directly subscripting this\n # pseudo-superclass. Why? Because this pseudo-superclass has\n # *NO* child pseudo-superclass to recurse down into. If this\n # pseudo-superclass had one or more child pseudo-superclasses to\n # recurse down into, then those child pseudo-superclasses would\n # have defined the \"hint_base_data[_HINT_BASES_INDEX_ARGS_FULL]\"\n # list accessed by the next branch, providing the list of zero\n # or more child hints transitively subscripting this\n # pseudo-superclass. Although that list remains undefined, the\n # tuple of zero or more child hints directly subscripting this\n # pseudo-superclass is semantically equivalent to what that list\n # would have been (had that list actually been defined).\n list(get_hint_pep_args(hint_base))\n if is_hint_base_leaf else\n # Else, this is *NOT* a terminal leaf pseudo-superclass. In this\n # case, the list of zero or more child hints transitively\n # subscripting this pseudo-superclass previously defined by\n # child pseudo-superclasses of this pseudo-superclass in\n # lower-level recursion.\n hint_base_data[_HINT_BASES_INDEX_ARGS_FULL]\n )\n \n # Reset this boolean to its default value (i.e., \"False\") *BEFORE*\n # possibly setting this boolean to \"True\" below, facilitating\n # efficient communication between the \"if hint_base_args_full:\" and\n # \"if hint_base_target:\" branches below.\n #\n # Equivalently, record that this pseudo-superclass is transitively\n # subscripted by *NO* type variables. Since the \"if\n # hint_base_args_full:\" branch below works as hard as possible to\n # ensure that this is the case, this default is sensible until\n # proven otherwise below.\n is_hint_base_arg_typevar = False\n \n # If this pseudo-superclass is transitively subscripted by\n # at least one child hint...\n if hint_base_args_full:\n # Metadata describing the direct parent pseudo-superclass of\n # this pseudo-superclass.\n hint_base_super_data = hint_base_data[_HINT_BASES_INDEX_PARENT]\n # print(f'Resuming generic {hint} pseudo {hint_base} parent {hint_base_super_data[0]}...')\n \n # If this pseudo-superclass has a parent pseudo-superclass\n # (i.e., this pseudo-superclass is *NOT* the passed root generic\n # and is thus a transitive child of this generic)...\n if hint_base_super_data:\n # Poppable stack of the zero or more child hints directly\n # subscripting this parent pseudo-superclass.\n hint_base_super_args_stack = hint_base_super_data[ # pyright: ignore\n _HINT_BASES_INDEX_ARGS_STACK]\n \n # For the 0-based index of each child hint transitively\n # subscripting this pseudo-superclass and this hint...\n #\n # Note that this iteration could be fenced behind an \"if\"\n # conditional resembling:\n # if not (\n # hint_base_super_args_stack or\n # typevar_to_hint\n # ):\n #\n # However, doing so would be almost entirely pointless. Why?\n # Because almost *ALL* generics are transitively subscripted\n # by one or more type variables. Ergo, \"typevar_to_hint\" is\n # almost *ALWAYS* non-empty. Ergo, the above \"if\"\n # conditional reduces to \"if True:\" in most cases. We sigh.\n for hint_base_arg_full_index, hint_base_arg_full in (\n enumerate(hint_base_args_full)):\n # If this hint is a type variable...\n if is_hint_pep484_typevar(hint_base_arg_full):\n # If a concrete (i.e., non-type variable) child hint\n # directly subscripting a sibling pseudo-superclass\n # of this pseudo-superclass has already been\n # \"bubbled up\" into this type variable, preserve\n # that bubbling by re-bubbling up the same child\n # hint back into this type variable. <-- lol\n if hint_base_arg_full in typevar_to_hint:\n # print(f'Rebubbling hint {typevar_to_hint[hint_base_arg]} into...')\n # print(f'base {hint_base} typevar {hint_base_arg}!')\n hint_base_args_full[hint_base_arg_full_index] = ( # type: ignore[index]\n typevar_to_hint[hint_base_arg_full])\n # Else, *NO* child hint directly subscripting a\n # sibling pseudo-superclass of this child\n # pseudo-superclass has already been \"bubbled up\"\n # into this type variable.\n #\n # If this parent pseudo-superclass of this child\n # pseudo-superclass is still directly subscripted by\n # one or more child hints that have yet to \"bubble\n # up\" the class hierarchy (i.e., by replacing the\n # first unused type variable transitively\n # subscripting this child pseudo-superclass),\n # \"bubble up\" the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass into the \"empty placeholder\"\n # signified by this type variable in this list of\n # child hints transitively subscripting this child\n # pseudo-superclass. <-- wat\n elif hint_base_super_args_stack:\n # print(f'Bubbling hint {hint_base_super_args_stack[-1]} into...')\n # print(f'base {hint_base} typevar {hint_base_arg}!')\n hint_base_arg_full_new = (\n hint_base_args_full[hint_base_arg_full_index]) = ( # type: ignore[index]\n hint_base_super_args_stack.pop()) # pyright: ignore\n \n # If the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass is itself a type variable,\n # record that this child pseudo-superclass is\n # now known to be subscripted by at least one\n # type variable.\n if is_hint_pep484_typevar(\n hint_base_arg_full_new):\n # print(f'Recording pseudo {hint_base} typevarred args {hint_base_arg_full}...')\n is_hint_base_arg_typevar = True\n # Else, the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass is *NOT* itself a type\n # variable. In this case, record that this child\n # hint has now been \"bubbled up\" into this type\n # variable for subsequent lookup.\n #\n # Note that bubbling up a type variable into\n # another type variable would be entirely\n # pointless. Type variables are only\n # meaningfully replaceable with concrete hints.\n # Moreover, doing so here would erroneously map\n # this type variable to this other type variable\n # in the \"typevar_to_hint\" dictionary -- which\n # would then inhibit this \"if\" conditional from\n # subsequently bubbling up a concrete hint into\n # this type variable. <-- omg\n else:\n # print(f'Recording non-typevar {hint_base_arg_full} -> {hint_base_arg_full_new}...')\n typevar_to_hint[hint_base_arg_full] = ( # pyright: ignore\n hint_base_arg_full_new)\n # Else, all child hints directly subscripting this\n # parent pseudo-superclass have already been\n # \"bubbled up\" the class hierarchy. But this hint is\n # a type variable! Record that this child\n # pseudo-superclass is now known to be subscripted\n # by at least one type variable.\n else:\n is_hint_base_arg_typevar = True\n #print(f'Bubbled up generic {hint} arg {hint_args[hint_args_index_curr]}...')\n #print(f'...into pseudo-superclass {hint_base} args {hint_base_args}!')\n # Else, this hint is *NOT* a type variable. In this\n # case, preserve this hint and continue to the next.\n \n # Parent list of the zero or more child hints transitively\n # subscripting this parent pseudo-superclass of this\n # pseudo-superclass.\n hint_base_super_args_full = hint_base_super_data[ # pyright: ignore\n _HINT_BASES_INDEX_ARGS_FULL]\n \n # Append to this parent list this child list of all child\n # hints transitively subscripting this pseudo-superclass.\n hint_base_super_args_full.extend(hint_base_args_full) # pyright: ignore\n # print(f'Inspected generic {hint} pseudo-superclass {hint_base} args {hint_base_args}!')\n # Else, this pseudo-superclass is the passed root generic.\n # Else, this pseudo-superclass is transitively unsubscripted.\n \n # If searching for a target pseudo-superclass...\n if hint_base_target:\n # Unsubscripted generic underlying this possibly subscripted\n # pseudo-superclass generic. Strip this pseudo-superclass of\n # *ALL* child hints, allowing this unsubscripted current\n # pseudo-superclass to be compared against this\n # unsubscripted target pseudo-superclass.\n hint_base_type = get_hint_pep484585_generic_type(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # If this pseudo-superclass is the desired target...\n if hint_base_type == hint_base_target:\n # If this target pseudo-superclass is no longer subscripted\n # by any type variables requiring subsequent replacement by\n # concrete child hints, this target pseudo-superclass is\n # *ONLY* subscripted by concrete child hints. In this case,\n # immediately return a tuple of these hints.\n #\n # Note that:\n # * This efficiently short-circuits this recursion in the\n # best case and is one of several reasons to prefer a\n # non-recursive algorithm. This algorithm was initially\n # implemented recursively (supposedly for simplicity);\n # doing so introduced significant unforeseen complications\n # by effectively preventing short-circuiting. After all, a\n # recursive algorithm *CANNOT* efficiently short-circuit\n # up out of a deeply nested recursive call stack --\n # without inefficiently raising an exception, which is so\n # inefficient as to defeat the point in most cases.\n # * This recursion *CANNOT* be short-circuited in the worst\n # case, which occurs when the passed root generic is\n # directly subscripted by a concrete child hint that will\n # only be subsequently \"bubbled up\" into a type hint\n # transitively subscripting this target pseudo-superclass\n # *AFTER* this DFS recurses through the tree of all\n # pseudo-superclasses and back up into this generic. In\n # this worst case, the full dictionary of type variable\n # mappings and thus the list of child hints transitively\n # subscripting this target pseudo-superclass is only\n # decidable *AFTER* this DFS fully recurses out.\n #\n # Consider this torturous hierarchy, in which bubbling up\n # the child hint \"complex\" subscripting the root generic\n # \"ListFloat[complex]\" into the child type variable \"U\"\n # subscripting the child pseudo-superclass \"Generic[U]\"\n # requires recursing through the full tree:\n # >>> from typing import Generic\n # >>> class ListTU(list[T], Generic[U]): pass\n # >>> class ListFloat(ListTU[float]): pass\n # >>> get_hint_pep484585_generic_args_full(\n # ... hint=ListFloat[complex],\n # ... hint_base_target=Generic[U],\n # ... )\n # (complex,)\n if not is_hint_base_arg_typevar:\n return tuple(hint_base_args_full)\n # Else, this target pseudo-superclass is still subscripted\n # by one or more type variables requiring subsequent\n # replacement by concrete child hints. In this case,\n # continue \"bubbling up\" child hints into these type\n # variables. Doing so enables final logic below to replace\n # these type variables with these hints *AFTER* recursing\n # through the full entirety of this DFS.\n \n # List of zero or more child hints transitively subscripting\n # this target pseudo-superclass.\n hint_base_target_args_full = hint_base_args_full\n # print(f'Found target {hint_base} args {hint_base_args_full}!')\n # Else, this pseudo-superclass is *NOT* equal to this target.\n # Else, *NO* target pseudo-superclass is being searched for.\n \n # ....................{ RETURN }....................\n # If the caller passed a target pseudo-superclass...\n if hint_base_target:\n # If the DFS above failed to find the list of zero or more child hints\n # transitively subscripting this target, this DFS failed to find this\n # target. Since this implies this target is *NOT* a pseudo-superclass of\n # this generic, raise an exception.\n if hint_base_target_args_full is None:\n raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'pseudo-superclass target {repr(hint_base_target)} not found.'\n )\n # Else, this DFS found the list of zero or more child hints transitively\n # subscripting this target.\n \n # List of the zero or more child hints transitively subscripting this\n # target pseudo-superclass, to be coerced into a tuple and returned.\n hint_args_full = hint_base_target_args_full\n \n # For the 0-based index of each child hint transitively subscripting\n # this target pseudo-superclass and this hint...\n for hint_arg_full_index, hint_arg_full in enumerate(hint_args_full):\n # If this hint is a type variable...\n if is_hint_pep484_typevar(hint_arg_full):\n # Either:\n # * If a child hint directly subscripting a sibling\n # pseudo-superclass of this target pseudo-superclass has\n # already been \"bubbled up\" into this type variable, preserve\n # that bubbling by re-bubbling up the same child hint back\n # into this # type variable. <-- lol\n # * If *NO* child hint directly subscripting a sibling\n # pseudo-superclass of this target pseudo-superclass has\n # already been \"bubbled up\" into this type variable, preserve\n # this type variable as is.\n hint_args_full[hint_arg_full_index] = typevar_to_hint.get( # pyright: ignore\n hint_arg_full, hint_arg_full) # pyright: ignore\n # Else, this hint is *NOT* a type variable.\n # Else, the caller did *NOT* pass a target pseudo-superclass.\n else:\n # If the metadata describing the passed generic is still its initial size,\n # then the above DFS failed to expand this metadata with the\n # \"_HINT_BASES_INDEX_ARGS_FULL\" index accessed below. In turn, this implies\n # that the above DFS failed to recurse down into the child\n # pseudo-superclasses of this generic. However, by definition, *ALL*\n # generics subclass one or more pseudo-superclasses. The above DFS should\n # have recursed down into those pseudo-superclasses. In this case, raise an\n # exception.\n #\n # Note that this should *NEVER* occur.\n if len(hint_root_data) == _HINT_BASE_DATA_LEN_LEAF: # pragma: no cover\n> raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'pseudo-superclasses not found.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic pseudo-superclasses not found.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_nu3qttvz/beartype/_util/hint/pep/proposal/pep484/pep484generic.py:306\nError: beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_bases_unerased(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._data.hint.pep.sign.datapepsignset import HINT_SIGNS_GENERIC\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_bases_unerased)\n from beartype._util.hint.pep.utilpeptest import is_hint_pep_type_typing\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # For each PEP-compliant hint to be tested...\n for hint_pep_meta in hints_pep_meta:\n # If this is a generic hint, assert that this getter returns the\n # expected unerased pseudo-superclasses of this generic.\n if hint_pep_meta.pep_sign in HINT_SIGNS_GENERIC:\n> hint_pep_bases = get_hint_pep484585_generic_bases_unerased(\n hint_pep_meta.hint)\n\n> get_hint_pep484_generic_bases_unerased(\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484_generic_bases_unerased(\n # Mandatory parameters.\n hint: Any,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of all unerased :mod:`typing` **pseudo-superclasses** (i.e.,\n :mod:`typing` objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`-compliant\n **generic** (i.e., class subclassing at least one non-class :mod:`typing`\n object).\n \n This getter is memoized for efficiency.\n \n Parameters\n ----------\n hint : object\n Object to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this\n :mod:`typing` generic. Specifically:\n \n * If this generic defines an ``__orig_bases__`` dunder instance\n variable, the value of that variable as is.\n * Else, the value of the ``__mro__`` dunder instance variable stripped\n of all ignorable classes conveying *no* semantic meaning, including:\n \n * This generic itself.\n * The :class:`object` root superclass.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * *Not* a :mod:`typing` generic.\n * A :mod:`typing` generic that erased *none* of its superclasses but\n whose method resolution order (MRO) lists strictly less than four\n classes. Valid :pep:`484`-compliant generics should list at least\n four classes, including (in order):\n \n #. This class itself.\n #. The one or more :mod:`typing` objects directly subclassed by this\n generic.\n #. The :class:`typing.Generic` superclass.\n #. The zero or more non-:mod:`typing` superclasses subsequently\n subclassed by this generic (e.g., :class:`abc.ABC`).\n #. The :class:`object` root superclass.\n \n See Also\n --------\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n Further details.\n '''\n \n #FIXME: This tuple appears to be implemented erroneously -- at least under\n #Python 3.7, anyway. Although this tuple is implemented correctly for the\n #common case of user-defined types directly subclassing \"typing\" types,\n #this tuple probably is *NOT* implemented correctly for the edge case of\n #user-defined types indirectly subclassing \"typing\" types: e.g.,\n #\n # >>> import collections.abc, typing\n # >>> T = typing.TypeVar('T')\n # >>> class Direct(collections.abc.Sized, typing.Generic[T]): pass\n # >>> Direct.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n # >>> class Indirect(collections.abc.Container, Direct): pass\n # >>> Indirect.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n #\n #*THAT'S COMPLETELY INSANE.* Clearly, their naive implementation failed to\n #account for actual real-world use cases.\n #\n #On the bright side, the current implementation prevents us from actually\n #having to perform a breadth-first traversal of all original superclasses\n #of this class in method resolution order (MRO). On the dark side, it's\n #pants-on-fire balls -- but there's not much we can do about that. *sigh*\n #\n #If we ever need to perform that breadth-first traversal, resurrect this:\n #\n # # If this class was *NOT* subject to type erasure, reduce to a noop.\n # if not hint_bases:\n # return hint_bases\n #\n # # Fixed list of all typing super attributes to be returned.\n # superattrs = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based index of the last item of this list.\n # superattrs_index = 0\n #\n # # Fixed list of all transitive superclasses originally listed by this\n # # class iterated in method resolution order (MRO).\n # hint_orig_mro = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based indices of the current and last items of this list.\n # hint_orig_mro_index_curr = 0\n # hint_orig_mro_index_last = 0\n #\n # # Initialize this list with the tuple of all direct superclasses of this\n # # class, which iteration then expands to all transitive superclasses.\n # hint_orig_mro[:len(hint_bases)] = hint_bases\n #\n # # While the heat death of the universe has been temporarily forestalled...\n # while (True):\n # # Currently visited superclass of this class.\n # hint_base = hint_orig_mro[hint_orig_mro_index_curr]\n #\n # # If this superclass is a typing attribute...\n # if is_hint_pep_type_typing(hint_base):\n # # Avoid inserting this attribute into the \"hint_orig_mro\" list.\n # # Most typing attributes are *NOT* actual classes and those that\n # # are have no meaningful public superclass. Ergo, iteration\n # # terminates with typing attributes.\n # #\n # # Insert this attribute at the current item of this list.\n # superattrs[superattrs_index] = hint_base\n #\n # # Increment this index to the next item of this list.\n # superattrs_index += 1\n #\n # # If this class subclasses more than the maximum number of \"typing\"\n # # attributes supported by this function, raise an exception.\n # if superattrs_index >= FIXED_LIST_SIZE_MEDIUM:\n # raise BeartypeDecorHintPep560Exception(\n # '{} PEP type {!r} subclasses more than '\n # '{} \"typing\" types.'.format(\n # exception_prefix,\n # hint,\n # FIXED_LIST_SIZE_MEDIUM))\n # # Else, this superclass is *NOT* a typing attribute. In this case...\n # else:\n # # Tuple of all direct superclasses originally listed by this class\n # # prior to PEP 484 type erasure if any *OR* the empty tuple\n # # otherwise.\n # hint_base_bases = getattr(hint_base, '__orig_bases__')\n #\n # #FIXME: Implement breadth-first traversal here.\n #\n # # Tuple sliced from the prefix of this list assigned to above.\n # superattrs_tuple = tuple(superattrs[:superattrs_index])\n #\n # # Release and nullify this list *AFTER* defining this tuple.\n # release_fixed_list(superattrs)\n # del superattrs\n #\n # # Return this tuple as is.\n # return superattrs_tuple\n #\n #Also resurrect this docstring snippet:\n #\n # Raises\n # ----------\n # BeartypeDecorHintPep560Exception\n # If this object defines the ``__orig_bases__`` dunder attribute but that\n # attribute transitively lists :data:`FIXED_LIST_SIZE_MEDIUM` or more :mod:`typing`\n # attributes.\n #\n #Specifically:\n # * Acquire a fixed list of sufficient size (e.g., 64). We probably want\n # to make this a constant in \"utilcachelistfixedpool\" for reuse\n # everywhere, as this is clearly becoming a common idiom.\n # * Slice-assign \"__orig_bases__\" into this list.\n # * Maintain two simple 0-based indices into this list:\n # * \"bases_index_curr\", the current base being visited.\n # * \"bases_index_last\", the end of this list also serving as the list\n # position to insert newly discovered bases at.\n # * Iterate over this list and keep slice-assigning from either\n # \"__orig_bases__\" (if defined) or \"__mro__\" (otherwise) into\n # \"list[bases_index_last:len(__orig_bases__)]\". Note that this has the\n # unfortunate disadvantage of temporarily iterating over duplicates,\n # but... *WHO CARES.* It still works and we subsequently\n # eliminate duplicates at the end.\n # * Return a frozenset of this list, thus implicitly eliminating\n # duplicate superclasses.\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_type_or_none)\n \n # If this hint is *NOT* a class, reduce this hint to the object originating\n # this hint if any. See is_hint_pep484_generic() for details.\n hint = get_hint_pep484585_generic_type_or_none(hint)\n \n # If this hint is *NOT* a PEP 484- or 544-compliant generic, raise an\n # exception.\n if not is_hint_pep484_generic_unsubscripted(hint):\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} neither '\n f'PEP 484 generic nor PEP 544 protocol.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_base_in_module_first", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #14: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #15: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #16: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #17: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #18: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #19: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #20: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #21: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #22: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #23: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #24: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #25: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #26: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #32: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.6, "in_degree": 4, "true_in_degree": 26.720000000000013, "out_degree": 2, "betweenness": 0.00016618977427093268, "pagerank": 0.0014388191409986542, "harmonic": 0.003289473684210526, "bidirectional_harmonic": 0.24133914331282771, "degree": 6 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 3, "halstead_volume": 11.60964047443681, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_decor/_decornontype.py", "function_name": "beartype_nontype", "test_info": { "success": false, "failed": 90, "passed": 1040, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_fsuyr2o6/beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py:50\nError: assert False is True\n + where False = (None)\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n @beartype\n def where_that_or() -> str:\n '''\n Arbitrary callable decorated by the :func:`beartype.beartype` decorator\n intentionally annotated by one or more arbitrary unignorable type hints\n to prevent that decorator from silently reducing to a noop.\n '''\n \n return 'In the still cave of the witch Poesy,'\n \n def thou_art_no_unbidden_guest() -> str:\n '''\n Arbitrary callable *not* decorated by the :func:`beartype.beartype`\n decorator intentionally annotated by one or more arbitrary unignorable\n type hints for parity with the prior callable.\n '''\n \n return 'Seeking among the shadows that pass by'\n \n # Assert this tester returns the expected results for these callables.\n> assert is_func_beartyped(where_that_or) is True\nE assert False is True\nE + where False = (None)\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark_fsuyr2o6/beartype/_util/func/arg/utilfuncarglen.py:365\nError: beartype.roar.BeartypeValeSubscriptionException: None uncallable.\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n @beartype\n def _is_exclamatory(text: str):\n return '!' in text\n \n # Dynamically generated lambda function. To exercise in-memory validators\n # dynamically defined outside of a standard on-disk module (e.g., \"smart\"\n # REPLs like IPython), this function's code is intentionally cached with\n # the standard \"linecache\" module.\n _is_commentary = make_func(\n func_name='_is_commentary',\n func_code=(\n \"\"\"_is_commentary = lambda text: text and text[-1] == ','\"\"\"),\n is_debug=True,\n )\n \n # ....................{ VALIDATORS }....................\n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined physically in this on-disk module.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined dynamically in-memory.\n IsCommentary = Is[_is_commentary]\n \n # Validator produced by subscripting this factory with non-lambda functions\n # satisfying the expected API.\n IsQuoted = Is[_is_quoted]\n> IsExclamatory = Is[_is_exclamatory]\n\n> die_unless_validator_tester(is_valid)\n\n> die_unless_func_args_len_flexible_equal(\n\n> func_args_len_flexible_actual = get_func_args_flexible_len(\n\n> def get_func_args_flexible_len(\n # Mandatory parameters.\n func: Codeobjable,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> int:\n '''\n Number of **flexible parameters** (i.e., parameters passable as either\n positional or keyword arguments but *not* positional-only, keyword-only,\n variadic, or other more constrained kinds of parameters) accepted by the\n passed pure-Python callable.\n \n This getter transparently handles all of the following:\n \n * Conventional pure-Python callables.\n * If ``is_unwrap`` is :data:`True`:\n \n * Pure-Python **partials** (i.e., pure-Python callable\n :class:`functools.partial` objects directly wrapping pure-Python\n callables). If a partial is passed, this getter transparently returns\n the total number of flexible parameters accepted by the lower-level\n callable wrapped by this partial minus the number of flexible parameters\n partialized away by this partial.\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n is_unwrap: bool, optional\n :data:`True` only if this getter implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function.\n Defaults to :data:`True` for safety. See :func:`.get_func_codeobj` for\n further commentary.\n exception_cls : type, optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the message of any exception raised in\n the event of a fatal error. Defaults to the empty string.\n \n Returns\n -------\n int\n Number of flexible parameters accepted by this callable.\n \n Raises\n ------\n exception_cls\n If that callable is *not* pure-Python.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.api.standard.utilfunctools import (\n get_func_functools_partial_args_flexible_len,\n is_func_functools_partial,\n )\n from beartype._util.func.utilfunctest import is_func_codeobjable\n \n # If the passed callable is pure-Python...\n if is_func_codeobjable(func):\n # Number of various kinds of parameters accepted by that callable.\n func_args_lens = get_func_args_lens(\n func=func,\n is_unwrap=is_unwrap,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # Number of all non-keyword-only parameters (i.e., both optional and\n # mandatory positional-only, positional, and keyword parameters)\n # accepted by that callable.\n return func_args_lens[ARGS_LENS_INDEX_POSONLY_OR_FLEX]\n # Else, that callable has *NO* code object.\n #\n # If that callable is *NOT* actually callable, raise an exception.\n elif not callable(func):\n> raise exception_cls(f'{exception_prefix}{repr(func)} uncallable.')\nE beartype.roar.BeartypeValeSubscriptionException: None uncallable.\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_no_type_check", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_type_fail", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #81: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #82: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #83: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #84: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #85: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #86: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #87: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #88: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #89: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #90: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 26.001920000000023, "in_degree": 1, "true_in_degree": 4.5200000000000005, "out_degree": 6, "betweenness": 0.0002777356281973467, "pagerank": 0.0004883098366994718, "harmonic": 0.03407346491228069, "bidirectional_harmonic": 0.23554530265056586, "degree": 7 }, "line_count": 25, "code_line_count": 25, "cyclomatic": 8, "halstead_volume": 25.26619429851844, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484/pep484newtype.py", "function_name": "get_hint_pep484_newtype_alias", "test_info": { "success": false, "failed": 9, "passed": 1121, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_n_ucb6pg/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:409\nError: AssertionError: assert False is True\n + where False = UnionTypeHint(typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType]).is_ignorable\n + where UnionTypeHint(typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType]) = (typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType])\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n> assert TypeHint(hint_ignorable).is_ignorable is True\nE AssertionError: assert False is True\nE + where False = UnionTypeHint(typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType]).is_ignorable\nE + where UnionTypeHint(typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType]) = (typing.Union[str, list[int], beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.MetaType])\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint\nLocation: /tmp/benchmark_n_ucb6pg/beartype/door/_cls/pep/pep484/doorpep484class.py:92\nError: TypeError: issubclass() arg 1 must be a class\n\nTraceback:\n\n> def test_door_is_subhint(\n door_cases_is_subhint: 'Iterable[Tuple[object, object, bool]]') -> None:\n '''\n Test the :func:`beartype.door.is_subhint` tester.\n \n Parameters\n ----------\n door_cases_is_subhint : Iterable[Tuple[object, object, bool]]\n Iterable of **type subhint cases** (i.e., 3-tuples ``(subhint,\n superhint, is_subhint)`` describing the subhint relations between two\n type hints).\n '''\n \n # Defer test-specific imports.\n from beartype.door import is_subhint\n \n # For each type subhint case to be tested...\n for subhint, superhint, IS_SUBHINT in door_cases_is_subhint:\n # Assert this tester returns the expected boolean for these hints.\n> assert is_subhint(subhint, superhint) is IS_SUBHINT\n\n> return TypeHint(subhint).is_subhint(TypeHint(superhint))\n\n> return func(self_or_cls, arg)\n\n> self._is_subhint(other)\n\n> self._is_subhint_branch(other_branch)\n\n> def _is_subhint_branch(self, branch: TypeHint) -> bool:\n # print(f'Entering ClassTypeHint._is_subhint_branch({self}, {branch})...')\n # print(f'{branch}._is_args_ignorable: {branch._is_args_ignorable}')\n # print(f'{self}._origin: {self._origin}')\n # print(f'{branch}._origin: {branch._origin}')\n \n # print(f'{self}._hint: {self._hint}')\n # print(f'{branch}._hint: {branch._hint}')\n # # print(f'{repr(self)}._origin.__args__: {self._origin.__args__}')\n # print(f'{repr(self)}._origin.__parameters__: {self._origin.__parameters__}')\n # # print(f'{repr(branch)}._origin.__args__: {branch._origin.__args__}')\n # print(f'{repr(branch)}._origin.__parameters__: {branch._origin.__parameters__}')\n # print(f'{repr(self)}._is_args_ignorable: {self._is_args_ignorable}')\n \n #FIXME: Actually, let's avoid the implicit numeric tower for now.\n #Explicit is better than implicit and we really strongly disagree with\n #this subsection of PEP 484, which does more real-world harm than good.\n # # Numeric tower:\n # # https://peps.python.org/pep-0484/#the-numeric-tower\n # if self._origin is float and branch._origin in {float, int}:\n # return True\n # if self._origin is complex and branch._origin in {complex, float, int}:\n # return True\n \n # Return true only if...\n return (\n # That class is unsubscripted (and thus *NOT* a subscripted generic)\n # *AND*...\n branch._is_args_ignorable and\n # The unsubscripted type originating this class is a subclass of the\n # unsubscripted type originating that class.\n> issubclass(self._origin, branch._origin)\n )\nE TypeError: issubclass() arg 1 must be a class\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #9: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ], [ "beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py", "test_door_is_subhint" ] ] }, "complexity_info": { "centrality": { "distance_discount": 16.593408000000007, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 2, "betweenness": 2.1676927078817306e-05, "pagerank": 0.000560344827586207, "harmonic": 0.020504385964912282, "bidirectional_harmonic": 0.2370471633629531, "degree": 4 }, "line_count": 18, "code_line_count": 18, "cyclomatic": 4, "halstead_volume": 12.0, "halstead_difficulty": 0.6666666666666666 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/vale/_is/_valeis.py", "function_name": "_IsFactory.__getitem__", "test_info": { "success": false, "failed": 42, "passed": 1051, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_joflhhlh/beartype_test/a00_unit/data/hint/pep/proposal/_data_pep593.py:106\nError: TypeError: bad operand type for unary ~: 'NoneType'\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> def hints_pep593_meta() -> 'List[HintPepMetadata]':\n '''\n Session-scoped fixture returning a list of :pep:`593`-compliant **type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances describing test-specific :pep:`593`-compliant sample type hints\n with metadata generically leveraged by various PEP-agnostic unit tests).\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype.typing import (\n List,\n Sequence,\n TypeVar,\n Union,\n )\n from beartype.vale import (\n Is,\n IsAttr,\n IsEqual,\n IsInstance,\n IsSubclass,\n )\n from beartype._data.hint.pep.sign.datapepsigns import (\n HintSignAnnotated,\n HintSignList,\n HintSignUnion,\n )\n from beartype._util.api.standard.utiltyping import get_typing_attrs\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n Class,\n Subclass,\n SubclassSubclass,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata,\n HintPithSatisfiedMetadata,\n HintPithUnsatisfiedMetadata,\n )\n from functools import partial\n \n # ..................{ CLASSES }..................\n class TruthSeeker(object):\n def __call__(self, obj: object) -> bool:\n '''\n Tester method returning :data:`True` only if the passed object\n evaluates to :data:`True` when coerced into a boolean and whose\n first parameter is ignorable.\n '''\n \n return bool(obj)\n \n # ..................{ CALLABLES }..................\n def is_true(ignorable_arg, obj):\n '''\n Tester function returning :data:`True` only if the passed object\n evaluates to :data:`True` when coerced into a boolean and whose first\n parameter is ignorable.\n '''\n \n return bool(obj)\n \n \n # Partial of the is_true() tester defined above, effectively ignoring the\n # \"ignorable_arg\" parameter accepted by that tester.\n is_true_partial = partial(\n is_true, 'Drank its inspiring radiance, and the wind')\n \n # ..................{ VALIDATORS ~ is }..................\n # PEP 484-compliant union of all builtin scalar types.\n Number = Union[int, float, complex]\n \n # Generic beartype validators defined as lambda functions.\n IsNonEmpty = Is[lambda obj: bool(obj)]\n \n # Numeric beartype validators defined as lambda functions.\n IsNonNegative = Is[lambda number: number >= 0]\n IsIntNonZero = Is[lambda number: isinstance(number, int) and number != 0]\n \n # Textual beartype validators defined as lambda functions.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Textual beartype validators defined as non-lambda functions.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n def _is_exceptional(obj):\n raise ValueError(f'Colonial. {repr(obj)}')\n IsQuoted = Is[_is_quoted]\n IsExceptional = Is[_is_exceptional]\n \n # Textual beartype validator synthesized from the above validators via the\n # domain-specific language (DSL) implemented by those validators.\n> IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\nE TypeError: bad operand type for unary ~: 'NoneType'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none\nLocation: /tmp/benchmark_joflhhlh/beartype_test/a00_unit/data/hint/pep/proposal/_data_pep593.py:106\nError: TypeError: bad operand type for unary ~: 'NoneType'\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> def hints_pep593_meta() -> 'List[HintPepMetadata]':\n '''\n Session-scoped fixture returning a list of :pep:`593`-compliant **type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances describing test-specific :pep:`593`-compliant sample type hints\n with metadata generically leveraged by various PEP-agnostic unit tests).\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype.typing import (\n List,\n Sequence,\n TypeVar,\n Union,\n )\n from beartype.vale import (\n Is,\n IsAttr,\n IsEqual,\n IsInstance,\n IsSubclass,\n )\n from beartype._data.hint.pep.sign.datapepsigns import (\n HintSignAnnotated,\n HintSignList,\n HintSignUnion,\n )\n from beartype._util.api.standard.utiltyping import get_typing_attrs\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n Class,\n Subclass,\n SubclassSubclass,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata,\n HintPithSatisfiedMetadata,\n HintPithUnsatisfiedMetadata,\n )\n from functools import partial\n \n # ..................{ CLASSES }..................\n class TruthSeeker(object):\n def __call__(self, obj: object) -> bool:\n '''\n Tester method returning :data:`True` only if the passed object\n evaluates to :data:`True` when coerced into a boolean and whose\n first parameter is ignorable.\n '''\n \n return bool(obj)\n \n # ..................{ CALLABLES }..................\n def is_true(ignorable_arg, obj):\n '''\n Tester function returning :data:`True` only if the passed object\n evaluates to :data:`True` when coerced into a boolean and whose first\n parameter is ignorable.\n '''\n \n return bool(obj)\n \n \n # Partial of the is_true() tester defined above, effectively ignoring the\n # \"ignorable_arg\" parameter accepted by that tester.\n is_true_partial = partial(\n is_true, 'Drank its inspiring radiance, and the wind')\n \n # ..................{ VALIDATORS ~ is }..................\n # PEP 484-compliant union of all builtin scalar types.\n Number = Union[int, float, complex]\n \n # Generic beartype validators defined as lambda functions.\n IsNonEmpty = Is[lambda obj: bool(obj)]\n \n # Numeric beartype validators defined as lambda functions.\n IsNonNegative = Is[lambda number: number >= 0]\n IsIntNonZero = Is[lambda number: isinstance(number, int) and number != 0]\n \n # Textual beartype validators defined as lambda functions.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Textual beartype validators defined as non-lambda functions.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n def _is_exceptional(obj):\n raise ValueError(f'Colonial. {repr(obj)}')\n IsQuoted = Is[_is_quoted]\n IsExceptional = Is[_is_exceptional]\n \n # Textual beartype validator synthesized from the above validators via the\n # domain-specific language (DSL) implemented by those validators.\n> IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\nE TypeError: bad operand type for unary ~: 'NoneType'\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #25: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #29: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #30: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #31: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #32: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #33: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_fail", "Failure #34: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #35: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #36: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #38: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #39: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #42: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_type_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 25.802854400000022, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 6, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.03237390350877193, "bidirectional_harmonic": 0.2338555906812488, "degree": 6 }, "line_count": 46, "code_line_count": 46, "cyclomatic": 1, "halstead_volume": 2.0, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/arg/utilfuncargiter.py", "function_name": "iter_func_args", "test_info": { "success": false, "failed": 90, "passed": 1040, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py::test_iter_func_args\nLocation: /tmp/benchmark_f6yhnl6i/beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py:60\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_iter_func_args() -> None:\n '''\n Test the\n :func:`beartype._util.func.arg.utilfuncargtest.iter_func_args` generator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype._util.func.arg.utilfuncargiter import (\n ArgKind,\n ArgMandatory,\n iter_func_args,\n )\n from beartype_test.a00_unit.data.func.data_func import (\n ClassOfMethods,\n func_args_0,\n func_args_1_flex_mandatory,\n func_args_1_varpos,\n func_args_1_kwonly_mandatory,\n func_args_2_flex_mandatory,\n func_args_2_kwonly_mixed,\n func_args_3_flex_mandatory_optional_varkw,\n func_args_5_flex_mandatory_varpos_kwonly_varkw,\n )\n from beartype_test.a00_unit.data.func.data_pep570 import (\n func_args_2_posonly_mixed,\n func_args_10_all_except_flex_mandatory,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Instance of an arbitrary class defining various kinds of methods, which\n # due to this instantiation have now been implicitly coerced into bound\n # method descriptors, which this iterator explicitly supports.\n object_of_methods = ClassOfMethods()\n \n # ....................{ PASS }....................\n # Assert this iterator returns the empty generator for an argumentless\n # callable, explicitly coerced into a tuple to trivialize testing.\n> assert len(tuple(iter_func_args(func_args_0))) == 0\nE TypeError: 'NoneType' object is not iterable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_positional\nLocation: /tmp/benchmark_f6yhnl6i/beartype/_util/func/arg/utilfuncargget.py:96\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_is_func_arg_name_is_func_arg_name_variadic_positional() -> None:\n '''\n Test the\n :func:`beartype._util.func.arg.utilfuncargtest.is_func_arg_name_variadic_positional`\n tester.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.func.arg.utilfuncargtest import (\n is_func_arg_name_variadic_positional)\n from beartype_test.a00_unit.data.func.data_func import (\n func_args_3_flex_mandatory_optional_varkw_wrapped)\n from beartype_test.a00_unit.data.func.data_pep570 import (\n func_args_10_all_except_flex_mandatory)\n \n # ....................{ ASSERTS }....................\n # Assert that this tester rejects a callable accepting a parameter with the\n # passed name that is *NOT* a variadic positional parameter.\n assert is_func_arg_name_variadic_positional(\n func=func_args_3_flex_mandatory_optional_varkw_wrapped,\n arg_name='rude_bare_and_high',\n ) is False\n \n # Assert that this tester rejects a callable accepting a variadic positional\n # parameter with a different name than that of the passed name.\n> assert is_func_arg_name_variadic_positional(\n func=func_args_10_all_except_flex_mandatory,\n arg_name='rain_is_pouring_down',\n ) is False\n\n> arg_meta = get_func_arg_meta_variadic_positional_or_none(*args, **kwargs)\n\n> def get_func_arg_meta_variadic_positional_or_none(\n *args, **kwargs) -> Optional[ArgMeta]:\n '''\n Callable parameter metadata describing the variadic positional parameter\n accepted by the passed pure-Python callable if that callable accepts a\n variadic positional parameter *or* :data:`None` otherwise (i.e., if that\n callable accepts no variadic positional parameter).\n \n Caveats\n -------\n **This getter exhibits worst-case linear-time complexity** :math:`O(n)`\n **for** :math:`O(n)` **the total number of parameters accepted by that\n callable** due to unavoidably performing a linear search for a variadic\n positional parameter with this name is this callable's parameter list. This\n getter should thus be called sparingly.\n \n Parameters\n ----------\n All remaining parameters are passed as is to the lower-level\n :func:`beartype._util.func.utilfunccodeobj.get_func_codeobj` getter.\n \n Returns\n -------\n Optional[ArgMeta]\n Either:\n \n * If that callable accepts a variadic positional parameter, callable\n parameter metadata describing that parameter.\n * Else, :data:`None`.\n \n Raises\n ------\n exception_cls\n If the passed callable is *not* pure-Python.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.func.arg.utilfuncargtest import (\n is_func_arg_variadic_positional)\n \n # If the passed callable accepts *NO* variadic positional parameter,\n # silently reduce to a noop.\n if not is_func_arg_variadic_positional(*args, **kwargs):\n return None\n # Else, that callable accepts a variadic positional parameter.\n \n # For metadata describing each parameter accepted by that callable...\n> for arg_meta in iter_func_args(*args, **kwargs):\nE TypeError: 'NoneType' object is not iterable\n", "Failure #3: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_keyword", "Failure #4: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #5: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep435", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep663", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #82: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #83: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #84: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #85: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #86: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #87: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #88: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #89: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #90: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py", "test_iter_func_args" ], [ "beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py", "test_is_func_arg_name_is_func_arg_name_variadic_positional" ] ] }, "complexity_info": { "centrality": { "distance_discount": 9.881600000000004, "in_degree": 4, "true_in_degree": 7.68, "out_degree": 4, "betweenness": 0.00010702982745166045, "pagerank": 0.0005976620869252875, "harmonic": 0.014391447368421052, "bidirectional_harmonic": 0.2473821865269232, "degree": 8 }, "line_count": 125, "code_line_count": 125, "cyclomatic": 23, "halstead_volume": 302.6636471615072, "halstead_difficulty": 5.384615384615385 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncframe.py", "function_name": "is_frame_caller_beartype", "test_info": { "success": false, "failed": 12, "passed": 1118, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563\nLocation: /tmp/benchmark_3sc4ldrj/beartype/_check/forward/fwdmain.py:855\nError: beartype.roar.BeartypePep563Exception: Stringified type hint 'OfPearl' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_3sc4ldrj/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \n File \"/tmp/benchmark_3sc4ldrj/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\n raise AttributeError(f'{exception_message}not found')\nAttributeError: Forward reference scope \"beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve\" attribute \"OfPearl\" via third-party module \"beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve\" not found\n\nTraceback:\n\n> def test_resolve_pep563() -> None:\n '''\n Test the :func:`beartype.peps.resolve_pep563` resolver.\n '''\n \n # .....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.peps import resolve_pep563\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n BeartypePep563Exception,\n )\n from beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve import (\n ToAvariceOrPride,\n FrequentWith,\n their_starry_domes,\n )\n from pytest import raises\n \n # .....................{ LOCALS }....................\n # Arbitrary instance of the generic accepted by the function called below.\n numberless_and_immeasurable_halls = ToAvariceOrPride()\n \n # Arbitrary instance of the class defining various problematic methods\n # called below.\n and_thrones_radiant_with_chrysolite = FrequentWith()\n \n # .....................{ PASS }....................\n # Assert that this function unsuccessfully raises the expected exception\n # *BEFORE* resolving all PEP 563-postponed type hints annotating these\n # callables.\n with raises(BeartypeDecorHintForwardRefException):\n their_starry_domes(numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.until_the_doves(\n numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.crystal_column(\n 'Nor had that scene of ampler majesty')\n \n # Resolve all PEP 563-postponed type hints annotating these callables.\n resolve_pep563(their_starry_domes)\n resolve_pep563(FrequentWith.until_the_doves)\n> resolve_pep563(FrequentWith.crystal_column)\n\n> arg_name_to_hint[arg_name] = resolve_hint(\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypePep563Exception: Stringified type hint 'OfPearl' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_3sc4ldrj/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE File \"/tmp/benchmark_3sc4ldrj/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\nE raise AttributeError(f'{exception_message}not found')\nE AttributeError: Forward reference scope \"beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve\" attribute \"OfPearl\" via third-party module \"beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve\" not found\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487\nLocation: /tmp/benchmark_3sc4ldrj/beartype/_check/forward/fwdmain.py:855\nError: beartype.roar.BeartypeDecorHintForwardRefException: Method a00_type.test_decortype_descriptor.test_decor_type_descriptor_custom_pep487.AndAllThoseActs.doth_ease_its() return stringified type hint 'Optional[HeartOfLove]' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_3sc4ldrj/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \n File \"/tmp/benchmark_3sc4ldrj/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\n raise AttributeError(f'{exception_message}not found')\nAttributeError: Forward reference scope \"a00_type.test_decortype_descriptor\" attribute \"HeartOfLove\" via third-party module \"a00_type.test_decortype_descriptor\" not found\n\nTraceback:\n\n> def test_decor_type_descriptor_custom_pep487() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on :pep:`487`-compliant\n **custom pure-Python method descriptors** (i.e., methods decorated by\n pure-Python types satisfying the :pep:`487`-compliant descriptor protocol by\n declaring at least the ``__set_name__()`` dunder method).\n \n This unit test exercises an inscrutable `edge case`_ induced by\n :func:`beartype.beartype`-decorated classes defining at least two kinds of\n seemingly unrelated methods that nonetheless *could* interact harmfully:\n \n * A method decorated by a :pep:`487`-compliant custom pure-Python method\n descriptor declaring at least the ``__set_name__()`` dunder method.\n * A method annotated by a stringified forward reference to a currently\n undefined type, which :func:`beartype.beartype` then internally coerces\n into a **forward reference proxy** (i.e.,\n :class:`beartype._check.forward.reference.fwdrefabc.BeartypeForwardRefABC`\n subclass) encapsulating that undefined type.\n \n For obscure reasons that are difficult to fully explain within the expected\n lifetime of the Universe, this interaction causes the ``__set_name__()``\n dunder method of the descriptor decorating the first method to be\n erroneously called multiple times with erroneous owners. Although seemingly\n innocuous, this issue is indicative of an explosive increase in the space\n and time complexity associated with forward reference proxies. Ergo, this\n issue is actually quite serious. It is imperative this *never* happen again.\n \n .. _edge case:\n https://github.com/beartype/beartype/issues/488#issuecomment-2650865299\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.typing import Optional\n from collections.abc import Callable\n \n # ....................{ DESCRIPTORS }....................\n class setname_descriptor(object):\n '''\n **Setname method descriptor** (i.e., pure-Python object whose\n :pep:`487`-compliant :meth:`__set_name__` dunder method raises an\n exception when called more than once as a regression check against this\n issue silently reverting).\n \n Attributes\n ----------\n _is_set_name_called : bool\n :data:`True` only if Python has already called the\n :pep:`487`-compliant :meth:`__set_name__` dunder method.\n '''\n \n def __init__(self, func: Callable) -> None:\n '''\n Initialize this method descriptor by doing... absolutely nothing.\n '''\n \n # Record that Python has yet to call __set_name__().\n self._is_set_name_called = False\n \n \n def __call__(self) -> None:\n '''\n Call this method descriptor by doing... absolutely nothing.\n '''\n \n # Doing nothing never felt so good, so right, so... clean.\n pass\n \n \n def __set_name__(self, owner: type, name: str) -> None:\n '''\n :pep:`487`-compliant callback called by Python itself with metadata\n describing the current decoration of an external method by this\n descriptor.\n \n Parameters\n ----------\n owner : type\n Parent class declaring that external method.\n name : str\n Unqualified basename of that external method.\n '''\n \n # If Python has already called this dunder method, this issue has\n # reverted. In this case, raise an exception.\n if self._is_set_name_called:\n raise ValueError(\n 'PEP 487 setname_descriptor.__set_name__() dunder method '\n 'already called.'\n )\n # Else, this is Python's first call of this dunder method.\n \n # Record that Python has already called this dunder method.\n self._is_set_name_called = True\n \n # ....................{ CLASSES }....................\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_type(obj, **kwargs) # type: ignore[return-value]\n\n> attr_value_beartyped = beartype_object( # type: ignore[type-var]\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> hint_or_sane = sanify_hint_root_func(\n\n> hint = decor_meta.func_arg_name_to_hint[pith_name] = coerce_func_hint_root(\n\n> hint = resolve_hint( # pyright: ignore\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypeDecorHintForwardRefException: Method a00_type.test_decortype_descriptor.test_decor_type_descriptor_custom_pep487.AndAllThoseActs.doth_ease_its() return stringified type hint 'Optional[HeartOfLove]' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_3sc4ldrj/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE File \"/tmp/benchmark_3sc4ldrj/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\nE raise AttributeError(f'{exception_message}not found')\nE AttributeError: Forward reference scope \"a00_type.test_decortype_descriptor\" attribute \"HeartOfLove\" via third-party module \"a00_type.test_decortype_descriptor\" not found\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #8: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #10: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #11: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #12: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py", "test_resolve_pep563" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py", "test_decor_type_descriptor_custom_pep487" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.08, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 1, "betweenness": 0.0, "pagerank": 0.0002986453201970444, "harmonic": 0.003289473684210526, "bidirectional_harmonic": 0.15535666818561586, "degree": 2 }, "line_count": 22, "code_line_count": 22, "cyclomatic": 6, "halstead_volume": 57.110323830864054, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484585/pep484585tuple.py", "function_name": "is_hint_pep484585_tuple_empty", "test_info": { "success": false, "failed": 10, "passed": 1120, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585.py::test_is_hint_pep484585_tuple_empty\nLocation: /tmp/benchmark_esz32riv/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585.py:34\nError: assert None is True\n + where None = (typing.Tuple[()])\n\nTraceback:\n\n> def test_is_hint_pep484585_tuple_empty() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585tuple.is_hint_pep484585_tuple_empty`\n tester.\n '''\n \n # Defer test-specific imports.\n from beartype._util.hint.pep.proposal.pep484585.pep484585tuple import (\n is_hint_pep484585_tuple_empty)\n from typing import Tuple # <-- intentionally import the PEP 484 variant\n \n # Assert this tester returns true for PEP 484-compliant empty tuple type\n # hints.\n> assert is_hint_pep484585_tuple_empty(Tuple[()]) is True\nE assert None is True\nE + where None = (typing.Tuple[()])\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool\nLocation: /tmp/benchmark_esz32riv/beartype/door/_cls/util/doorclsget.py:120\nError: beartype.roar.BeartypeDoorNonpepException: Type hint () currently unsupported by \"beartype.door.TypeHint\".\n\nTraceback:\n\n> def test_door_typehint_bool() -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.__len__` dunder method.\n '''\n \n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.typing import (\n Tuple,\n Union,\n )\n \n # Assert that various type hints evaluate to the expected booleans.\n> assert bool(TypeHint(Tuple[()])) is False\n\n> return bool(self._args_wrapped_tuple)\n\n> ???\n\n> return tuple(TypeHint(hint_child) for hint_child in self._args)\n\n> return tuple(TypeHint(hint_child) for hint_child in self._args)\n\n> _HINT_KEY_TO_WRAPPER.cache_or_get_cached_func_return_passed_arg( # type: ignore[attr-defined]\n\n> value = value_factory(arg)\n\n> wrapper_subclass = get_typehint_subclass(hint) # pyright: ignore\n\n> def get_typehint_subclass(hint: Hint) -> Type[TypeHint]:\n '''\n Concrete :class:`TypeHint` subclass handling the passed low-level unwrapped\n PEP-compliant type hint if any *or* raise an exception otherwise.\n \n Parameters\n ----------\n hint : Hint\n Low-level type hint to be inspected.\n \n Returns\n -------\n Type[TypeHint]\n Concrete subclass of the abstract :mod:`TypeHint` superclass handling\n this hint.\n \n Raises\n ------\n beartype.roar.BeartypeDoorNonpepException\n If this API does *not* currently support the passed hint.\n beartype.roar.BeartypeDecorHintPepSignException\n If the passed hint is *not* actually a PEP-compliant type hint.\n '''\n \n # ..................{ SUBCLASS }..................\n # Sign uniquely identifying this hint if any *OR* \"None\" otherwise (i.e., if\n # this hint is a PEP-noncompliant class).\n hint_sign = get_hint_pep_sign_or_none(hint)\n \n #FIXME: [SPEED] As a negligible optimization, globalize the\n #_HINT_SIGN_TO_TYPEHINT_CLS.get() method to avoid repeated lookups here.\n # Private concrete subclass of this ABC handling this hint if any *OR*\n # \"None\" otherwise (i.e., if no such subclass has been authored yet).\n wrapper_subclass = _HINT_SIGN_TO_TYPEHINT_CLS.get(hint_sign) # type: ignore[arg-type]\n # print(f'Mapping hint {hint} sign {hint_sign} to subclass {wrapper_subclass}...')\n \n # If this hint appears to be currently unsupported...\n if wrapper_subclass is None:\n # If either...\n if (\n # This hint is a PEP-noncompliant isinstanceable class *OR*...\n isinstance(hint, type) or\n \n #FIXME: This condition is kinda intense. Should we really be\n #conflating typing attributes that aren't types with objects that\n #are types? Let's investigate exactly which kinds of type hints\n #require this and contemplate something considerably more elegant.\n # An unsupported kind of PEP-compliant type hint (e.g.,\n # \"typing.TypedDict\" instance)...\n is_hint_pep_typing(hint)\n # Return the concrete \"TypeHint\" subclass handling all such classes.\n ):\n wrapper_subclass = ClassTypeHint\n # print(f'[type fallback] hint: {repr(hint)}; sign: {repr(hint_sign)}; wrapper: {repr(wrapper_subclass)}')\n # Else, raise an exception.\n else:\n> raise BeartypeDoorNonpepException(\n f'Type hint {repr(hint)} '\n f'currently unsupported by \"beartype.door.TypeHint\".'\n )\nE beartype.roar.BeartypeDoorNonpepException: Type hint () currently unsupported by \"beartype.door.TypeHint\".\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #4: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #10: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585.py", "test_is_hint_pep484585_tuple_empty" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_bool" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 3, "true_in_degree": 6.68, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0005099328760718848, "harmonic": 0.0, "bidirectional_harmonic": 0.2361888385737069, "degree": 3 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 2, "halstead_volume": 25.26619429851844, "halstead_difficulty": 1.2 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextprefix.py", "function_name": "prefix_callable_arg_name", "test_info": { "success": false, "failed": 17, "passed": 1113, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail\nLocation: /tmp/benchmark_a7jxurlx/beartype/_util/error/utilerrraise.py:108\nError: AssertionError: None not string.\n\nTraceback:\n\n> def test_nonpep_param_hint_invalid_fail() -> None:\n '''\n Test type-checking for a function with a parameter annotated with a type\n hint that is neither PEP-compliant *nor* PEP-noncompliant.\n '''\n \n # Import this decorator.\n from beartype import beartype\n from beartype.roar import BeartypeDecorHintNonpepException\n from beartype_test._util.pytroar import raises_uncached\n \n # Assert that type-checking a function with an integer parameter annotation\n # raises the expected exception.\n with raises_uncached(BeartypeDecorHintNonpepException):\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_params = _code_check_args(decor_meta)\n\n> reraise_exception_placeholder(\n\n> def reraise_exception_placeholder(\n # Mandatory parameters.\n exception: Exception,\n target_str: str,\n \n # Optional parameters.\n source_str: str = EXCEPTION_PLACEHOLDER,\n ) -> None:\n '''\n Reraise the passed exception in a safe manner preserving both this exception\n object *and* the original traceback associated with this exception object,\n but globally replacing all instances of the passed source substring\n hard-coded into this exception's message with the passed target substring.\n \n Parameters\n ----------\n exception : Exception\n Exception to be reraised.\n target_str : str\n Target human-readable format substring to replace the passed source\n substring previously hard-coded into this exception's message.\n source_str : Optional[str]\n Source non-human-readable substring previously hard-coded into this\n exception's message to be replaced by the passed target substring.\n Defaults to :data:`.EXCEPTION_PLACEHOLDER`.\n \n Raises\n ------\n exception\n The passed exception, globally replacing all instances of this source\n substring in this exception's message with this target substring.\n \n See Also\n --------\n :data:`.EXCEPTION_PLACEHOLDER`\n Further commentary on usage and motivation.\n https://stackoverflow.com/a/62662138/2809027\n StackOverflow answer mildly inspiring this implementation.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.roar import BeartypeDecorHintPepException\n >>> from beartype._util.cache.utilcachecall import callable_cached\n >>> from beartype._util.error.utilerrraise import (\n ... reraise_exception_placeholder, EXCEPTION_PLACEHOLDER)\n >>> from random import getrandbits\n >>> @callable_cached\n ... def portend_low_level_winter(is_winter_coming: bool) -> str:\n ... if is_winter_coming:\n ... raise BeartypeDecorHintPepException(\n ... '{} intimates that winter is coming.'.format(\n ... EXCEPTION_PLACEHOLDER))\n ... else:\n ... return 'PRAISE THE SUN'\n >>> def portend_high_level_winter() -> None:\n ... try:\n ... print(portend_low_level_winter(is_winter_coming=False))\n ... print(portend_low_level_winter(is_winter_coming=True))\n ... except BeartypeDecorHintPepException as exception:\n ... reraise_exception_placeholder(\n ... exception=exception,\n ... target_str=(\n ... 'Random \"Song of Fire and Ice\" spoiler' if getrandbits(1) else\n ... 'Random \"Dark Souls\" plaintext meme'\n ... ))\n >>> portend_high_level_winter()\n PRAISE THE SUN\n Traceback (most recent call last):\n File \"\", line 30, in \n portend_high_level_winter()\n File \"\", line 27, in portend_high_level_winter\n 'Random \"Dark Souls\" plaintext meme'\n File \"/home/leycec/py/beartype/beartype._util.error.utilerrraise.py\", line 225, in reraise_exception_placeholder\n raise exception.with_traceback(exception.__traceback__)\n File \"\", line 20, in portend_high_level_winter\n print(portend_low_level_winter(is_winter_coming=True))\n File \"/home/leycec/py/beartype/beartype/_util/cache/utilcachecall.py\", line 296, in _callable_cached\n raise exception\n File \"/home/leycec/py/beartype/beartype/_util/cache/utilcachecall.py\", line 289, in _callable_cached\n *args, **kwargs)\n File \"\", line 13, in portend_low_level_winter\n EXCEPTION_PLACEHOLDER))\n beartype.roar.BeartypeDecorHintPepException: Random \"Song of Fire and Ice\" spoiler intimates that winter is coming.\n '''\n assert isinstance(exception, Exception), (\n f'{repr(exception)} not exception.')\n assert isinstance(source_str, str), f'{repr(source_str)} not string.'\n> assert isinstance(target_str, str), f'{repr(target_str)} not string.'\nE AssertionError: None not string.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn\nLocation: /tmp/benchmark_a7jxurlx/beartype/_util/error/utilerrraise.py:108\nError: AssertionError: None not string.\n\nTraceback:\n\n> def test_decor_pep484_hint_noreturn() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on synchronous callables\n against all edge cases of the :pep:`484`-compliant :attr:`typing.NoReturn`\n type hint, which is valid *only* as an unsubscripted return annotation.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import (\n BeartypeCallHintViolation,\n BeartypeDecorHintPep484Exception,\n )\n from beartype.typing import (\n NoReturn,\n Union,\n )\n from beartype_test._util.pytroar import raises_uncached\n \n # ..................{ LOCALS }..................\n # Exception guaranteed to be raised *ONLY* by the mending_wall() function.\n class BeforeIBuiltAWallIdAskToKnow(Exception): pass\n \n # Synchronous callable unconditionally raising an exception correctly\n # annotating its return as \"NoReturn\".\n @beartype\n def mending_wall() -> NoReturn:\n raise BeforeIBuiltAWallIdAskToKnow(\n \"Something there is that doesn't love a wall,\")\n \n # Callable explicitly returning a value incorrectly annotating its return\n # as \"NoReturn\".\n @beartype\n def frozen_ground_swell() -> NoReturn:\n return 'That sends the frozen-ground-swell under it,'\n \n # Callable implicitly returning a value incorrectly annotating its return\n # as \"NoReturn\".\n @beartype\n def we_do_not_need_the_wall() -> NoReturn:\n 'There where it is we do not need the wall:'\n \n # ..................{ PASS }..................\n # Assert this callable raises the expected exception when called.\n with raises_uncached(BeforeIBuiltAWallIdAskToKnow):\n mending_wall()\n \n # Assert this callable raises the expected exception when called.\n with raises_uncached(BeartypeCallHintViolation):\n frozen_ground_swell()\n \n # Assert this callable raises the expected exception when called.\n with raises_uncached(BeartypeCallHintViolation):\n we_do_not_need_the_wall()\n \n # ..................{ FAIL }..................\n # Assert this decorator raises the expected exception when decorating a\n # synchronous callable returning a value incorrectly annotating its return\n # as \"NoReturn\".\n with raises_uncached(BeartypeDecorHintPep484Exception):\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_params = _code_check_args(decor_meta)\n\n> reraise_exception_placeholder(\n\n> def reraise_exception_placeholder(\n # Mandatory parameters.\n exception: Exception,\n target_str: str,\n \n # Optional parameters.\n source_str: str = EXCEPTION_PLACEHOLDER,\n ) -> None:\n '''\n Reraise the passed exception in a safe manner preserving both this exception\n object *and* the original traceback associated with this exception object,\n but globally replacing all instances of the passed source substring\n hard-coded into this exception's message with the passed target substring.\n \n Parameters\n ----------\n exception : Exception\n Exception to be reraised.\n target_str : str\n Target human-readable format substring to replace the passed source\n substring previously hard-coded into this exception's message.\n source_str : Optional[str]\n Source non-human-readable substring previously hard-coded into this\n exception's message to be replaced by the passed target substring.\n Defaults to :data:`.EXCEPTION_PLACEHOLDER`.\n \n Raises\n ------\n exception\n The passed exception, globally replacing all instances of this source\n substring in this exception's message with this target substring.\n \n See Also\n --------\n :data:`.EXCEPTION_PLACEHOLDER`\n Further commentary on usage and motivation.\n https://stackoverflow.com/a/62662138/2809027\n StackOverflow answer mildly inspiring this implementation.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.roar import BeartypeDecorHintPepException\n >>> from beartype._util.cache.utilcachecall import callable_cached\n >>> from beartype._util.error.utilerrraise import (\n ... reraise_exception_placeholder, EXCEPTION_PLACEHOLDER)\n >>> from random import getrandbits\n >>> @callable_cached\n ... def portend_low_level_winter(is_winter_coming: bool) -> str:\n ... if is_winter_coming:\n ... raise BeartypeDecorHintPepException(\n ... '{} intimates that winter is coming.'.format(\n ... EXCEPTION_PLACEHOLDER))\n ... else:\n ... return 'PRAISE THE SUN'\n >>> def portend_high_level_winter() -> None:\n ... try:\n ... print(portend_low_level_winter(is_winter_coming=False))\n ... print(portend_low_level_winter(is_winter_coming=True))\n ... except BeartypeDecorHintPepException as exception:\n ... reraise_exception_placeholder(\n ... exception=exception,\n ... target_str=(\n ... 'Random \"Song of Fire and Ice\" spoiler' if getrandbits(1) else\n ... 'Random \"Dark Souls\" plaintext meme'\n ... ))\n >>> portend_high_level_winter()\n PRAISE THE SUN\n Traceback (most recent call last):\n File \"\", line 30, in \n portend_high_level_winter()\n File \"\", line 27, in portend_high_level_winter\n 'Random \"Dark Souls\" plaintext meme'\n File \"/home/leycec/py/beartype/beartype._util.error.utilerrraise.py\", line 225, in reraise_exception_placeholder\n raise exception.with_traceback(exception.__traceback__)\n File \"\", line 20, in portend_high_level_winter\n print(portend_low_level_winter(is_winter_coming=True))\n File \"/home/leycec/py/beartype/beartype/_util/cache/utilcachecall.py\", line 296, in _callable_cached\n raise exception\n File \"/home/leycec/py/beartype/beartype/_util/cache/utilcachecall.py\", line 289, in _callable_cached\n *args, **kwargs)\n File \"\", line 13, in portend_low_level_winter\n EXCEPTION_PLACEHOLDER))\n beartype.roar.BeartypeDecorHintPepException: Random \"Song of Fire and Ice\" spoiler intimates that winter is coming.\n '''\n assert isinstance(exception, Exception), (\n f'{repr(exception)} not exception.')\n assert isinstance(source_str, str), f'{repr(source_str)} not string.'\n> assert isinstance(target_str, str), f'{repr(target_str)} not string.'\nE AssertionError: None not string.\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #14: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #15: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py", "test_nonpep_param_hint_invalid_fail" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py", "test_decor_pep484_hint_noreturn" ] ] }, "complexity_info": { "centrality": { "distance_discount": 28.18201600000002, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 2, "betweenness": 2.0322119136391226e-05, "pagerank": 0.0003719211822660099, "harmonic": 0.03119125939849623, "bidirectional_harmonic": 0.21149363702817742, "degree": 4 }, "line_count": 14, "code_line_count": 14, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/vale/_core/_valecorebinary.py", "function_name": "BeartypeValidatorConjunction.__init__", "test_info": { "success": false, "failed": 39, "passed": 1054, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_c4m5w538/beartype/vale/_core/_valecorebinary.py:321\nError: AttributeError: 'BeartypeValidatorConjunction' object has no attribute '_is_valid_code'\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n\n> return BeartypeValidatorDisjunction(\n\n> def __init__(\n self,\n validator_operand_1: BeartypeValidator,\n validator_operand_2: BeartypeValidator,\n ) -> None:\n '''\n Initialize this higher-level validator from the passed validators.\n \n Parameters\n ----------\n validator_operand_1 : BeartypeValidator\n First validator operated upon by this higher-level validator.\n validator_operand_2 : BeartypeValidator\n Second validator operated upon by this higher-level validator.\n \n Raises\n ----------\n BeartypeValeSubscriptionException\n If either of these operands are *not* beartype validators.\n '''\n \n # Validate the passed operands as sane.\n _validate_operands(self, validator_operand_1, validator_operand_2)\n \n # Initialize our superclass with all remaining parameters.\n super().__init__(\n validator_operand_1=validator_operand_1,\n validator_operand_2=validator_operand_2,\n # Lambda function disjunctively performing both validations.\n is_valid=lambda obj: (\n validator_operand_1.is_valid(obj) or\n validator_operand_2.is_valid(obj)\n ),\n # Code expression disjunctively performing both validations.\n is_valid_code=(\n f'({validator_operand_1._is_valid_code} or '\n> f'{validator_operand_2._is_valid_code})'\n ),\n )\nE AttributeError: 'BeartypeValidatorConjunction' object has no attribute '_is_valid_code'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none\nLocation: /tmp/benchmark_c4m5w538/beartype/vale/_core/_valecorebinary.py:321\nError: AttributeError: 'BeartypeValidatorConjunction' object has no attribute '_is_valid_code'\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n\n> return BeartypeValidatorDisjunction(\n\n> def __init__(\n self,\n validator_operand_1: BeartypeValidator,\n validator_operand_2: BeartypeValidator,\n ) -> None:\n '''\n Initialize this higher-level validator from the passed validators.\n \n Parameters\n ----------\n validator_operand_1 : BeartypeValidator\n First validator operated upon by this higher-level validator.\n validator_operand_2 : BeartypeValidator\n Second validator operated upon by this higher-level validator.\n \n Raises\n ----------\n BeartypeValeSubscriptionException\n If either of these operands are *not* beartype validators.\n '''\n \n # Validate the passed operands as sane.\n _validate_operands(self, validator_operand_1, validator_operand_2)\n \n # Initialize our superclass with all remaining parameters.\n super().__init__(\n validator_operand_1=validator_operand_1,\n validator_operand_2=validator_operand_2,\n # Lambda function disjunctively performing both validations.\n is_valid=lambda obj: (\n validator_operand_1.is_valid(obj) or\n validator_operand_2.is_valid(obj)\n ),\n # Code expression disjunctively performing both validations.\n is_valid_code=(\n f'({validator_operand_1._is_valid_code} or '\n> f'{validator_operand_2._is_valid_code})'\n ),\n )\nE AttributeError: 'BeartypeValidatorConjunction' object has no attribute '_is_valid_code'\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #25: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #29: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #30: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #31: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #32: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_fail", "Failure #33: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #34: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #35: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #36: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #38: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #39: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_type_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.7520000000000002, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 2, "betweenness": 8.12884765455649e-06, "pagerank": 0.0004556650246305419, "harmonic": 0.004660087719298245, "bidirectional_harmonic": 0.18539263642059758, "degree": 3 }, "line_count": 20, "code_line_count": 20, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/vale/_is/_valeisobj.py", "function_name": "_IsAttrFactory.__getitem__", "test_info": { "success": false, "failed": 7, "passed": 1123, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_pass\nLocation: /tmp/benchmark_7t4dcitz/beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py:145\nError: AssertionError: assert False\n + where False = isinstance(None, )\n\nTraceback:\n\n> def test_api_vale_isattr_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.IsAttr` factory.\n '''\n \n # Defer test-specific imports.\n from beartype.vale import IsAttr, IsEqual\n from beartype.vale._core._valecore import BeartypeValidator\n \n # Instances of valid test classes declared above.\n from_rainbow_clouds = AllTheEarthAndAir()\n drops_so_bright_to_see = WhatThouArtWeKnowNot()\n \n # Instances of invalid test classes declared above.\n like_a_glow_worm_golden = InAPalaceTower()\n like_a_high_born_maiden = TillTheWorldIsWrought()\n scattering_unbeholden = InADellOfDew()\n \n # Validator produced by subscripting this factory with the name of an\n # attribute defined by the former class and that attribute's value.\n IsInTheLightOfThought = IsAttr[\n 'with_thy_voice_is_loud', IsEqual[AS_WHEN_NIGHT_IS_BARE]]\n \n # Validator produced by subscripting this factory with the name of an\n # attribute defined by the latter class and the prior validator.\n IsSingingHymnsUnbidden = IsAttr[\n 'what_is_most_like_thee', IsInTheLightOfThought]\n \n # Assert these validators satisfy the expected API.\n> assert isinstance(IsInTheLightOfThought, BeartypeValidator)\nE AssertionError: assert False\nE + where False = isinstance(None, )\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_fail\nLocation: /tmp/benchmark_7t4dcitz/beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py:206\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_api_vale_isattr_fail() -> None:\n '''\n Test unsuccessful usage of the :mod:`beartype.vale.IsAttr` factory.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeValeSubscriptionException\n from beartype.vale import IsAttr, IsEqual\n from pytest import raises\n \n # Assert that subscripting this factory with the empty tuple raises the\n # expected exception.\n> with raises(BeartypeValeSubscriptionException):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #7: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py", "test_api_vale_isattr_pass" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py", "test_api_vale_isattr_fail" ] ] }, "complexity_info": { "centrality": { "distance_discount": 12.622243840000001, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 5, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.01799420426065163, "bidirectional_harmonic": 0.24118434106098582, "degree": 5 }, "line_count": 83, "code_line_count": 83, "cyclomatic": 8, "halstead_volume": 80.0, "halstead_difficulty": 2.727272727272727 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/_pep/pep484585/redpep484585generic.py", "function_name": "_reduce_hint_pep484585_generic_io", "test_info": { "success": false, "failed": 16, "passed": 1114, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint\nLocation: /tmp/benchmark_v94d5p3e/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:116\nError: AssertionError: assert (False or False)\n + where False = ()\n + and False = issubclass(, )\n\nTraceback:\n\n> def test_reduce_hint() -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintNonpepNumpyException\n from beartype.typing import (\n Annotated,\n )\n from beartype.vale import IsEqual\n from beartype._cave._cavefast import NoneType\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype._conf.confcls import BeartypeConf\n from beartype._conf.confcommon import BEARTYPE_CONF_DEFAULT\n from beartype._data.cls.datacls import TYPES_PEP484_GENERIC_IO\n from beartype._data.hint.datahinttyping import (\n Pep484TowerComplex,\n Pep484TowerFloat,\n )\n from beartype._data.hint.pep.sign.datapepsigns import HintSignAnnotated\n from beartype._util.hint.pep.proposal.pep593 import is_hint_pep593\n from beartype._util.hint.pep.utilpepget import get_hint_pep_sign\n # from beartype_test.a00_unit.data.hint.pep.proposal.data_pep484 import (\n # T_int,\n # T_str_or_bytes,\n # )\n from beartype_test._util.module.pytmodtest import is_package_numpy\n from dataclasses import InitVar\n from pytest import raises\n \n # Intentionally import PEP 484-specific type hint factories.\n from typing import Protocol\n \n # ..................{ LOCALS }..................\n # Keyword arguments to be passed to all calls to reduce_hints() below.\n kwargs = {\n 'conf': BEARTYPE_CONF_DEFAULT,\n }\n \n # ..................{ CORE }..................\n # Assert this reducer preserves an isinstanceable type as is.\n assert reduce_hint(hint=int, **kwargs) is int\n \n # Assert this reducer reduces \"None\" to \"type(None)\".\n assert reduce_hint(hint=None, **kwargs) is NoneType\n \n # ..................{ PEP 484 ~ tower }..................\n # Assert this reducer expands the builtin \"float\" and \"complex\" types to\n # their corresponding numeric towers when configured to do so.\n assert reduce_hint(\n hint=float,\n conf=BeartypeConf(is_pep484_tower=True),\n ) is Pep484TowerFloat\n assert reduce_hint(\n hint=complex,\n conf=BeartypeConf(is_pep484_tower=True),\n ) is Pep484TowerComplex\n \n # Assert this reducer preserves the builtin \"float\" and \"complex\" types as\n # is when configured to disable the implicit numeric tower.\n assert reduce_hint(\n hint=float,\n conf=BeartypeConf(is_pep484_tower=False),\n ) is float\n assert reduce_hint(\n hint=complex,\n conf=BeartypeConf(is_pep484_tower=False),\n ) is complex\n \n #FIXME: Excise us up, please. We no longer reduce type variables. *sigh*\n # # ..................{ PEP 484 ~ typevar }..................\n # # Assert this reducer preserves unbounded type variables as is.\n # assert reduce_hint(hint=T, **kwargs) is T\n #\n # # Assert this reducer reduces bounded type variables to their upper bound.\n # assert reduce_hint(hint=T_int, **kwargs) is int\n #\n # # Union of all constraints parametrizing a constrained type variable,\n # # reduced from that type variable.\n # typevar_constraints_union = reduce_hint(hint=T_str_or_bytes, **kwargs)\n #\n # # Assert this union contains all constraints parametrizing this variable.\n # assert str in typevar_constraints_union.__args__\n # assert bytes in typevar_constraints_union.__args__\n \n # ..................{ PEP 544 }..................\n # For each PEP 484-compliant \"typing\" IO generic superclass...\n for pep484_generic_io in TYPES_PEP484_GENERIC_IO:\n # Equivalent protocol reduced from this generic.\n pep544_protocol_io = reduce_hint(hint=pep484_generic_io, **kwargs)\n \n # Assert this protocol is either...\n> assert (\n # A PEP 593-compliant type metahint generalizing a protocol\n # *OR*...\n is_hint_pep593(pep544_protocol_io) or\n # A PEP 544-compliant protocol.\n issubclass(pep544_protocol_io, Protocol)\n )\nE AssertionError: assert (False or False)\nE + where False = ()\nE + and False = issubclass(, )\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_v94d5p3e/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:119\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n> with warns(hint_meta.warning_type):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #16: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ] ] }, "complexity_info": { "centrality": { "distance_discount": 12.10853376, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 2, "betweenness": 3.793462238793029e-05, "pagerank": 0.0005254515599343187, "harmonic": 0.014918154761904764, "bidirectional_harmonic": 0.17351522746259646, "degree": 4 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_decor/decorcore.py", "function_name": "beartype_object", "test_info": { "success": false, "failed": 90, "passed": 1040, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_w5mcijhv/beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py:50\nError: assert False is True\n + where False = (None)\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n @beartype\n def where_that_or() -> str:\n '''\n Arbitrary callable decorated by the :func:`beartype.beartype` decorator\n intentionally annotated by one or more arbitrary unignorable type hints\n to prevent that decorator from silently reducing to a noop.\n '''\n \n return 'In the still cave of the witch Poesy,'\n \n def thou_art_no_unbidden_guest() -> str:\n '''\n Arbitrary callable *not* decorated by the :func:`beartype.beartype`\n decorator intentionally annotated by one or more arbitrary unignorable\n type hints for parity with the prior callable.\n '''\n \n return 'Seeking among the shadows that pass by'\n \n # Assert this tester returns the expected results for these callables.\n> assert is_func_beartyped(where_that_or) is True\nE assert False is True\nE + where False = (None)\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark_w5mcijhv/beartype/_util/func/arg/utilfuncarglen.py:365\nError: beartype.roar.BeartypeValeSubscriptionException: None uncallable.\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n @beartype\n def _is_exclamatory(text: str):\n return '!' in text\n \n # Dynamically generated lambda function. To exercise in-memory validators\n # dynamically defined outside of a standard on-disk module (e.g., \"smart\"\n # REPLs like IPython), this function's code is intentionally cached with\n # the standard \"linecache\" module.\n _is_commentary = make_func(\n func_name='_is_commentary',\n func_code=(\n \"\"\"_is_commentary = lambda text: text and text[-1] == ','\"\"\"),\n is_debug=True,\n )\n \n # ....................{ VALIDATORS }....................\n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined physically in this on-disk module.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined dynamically in-memory.\n IsCommentary = Is[_is_commentary]\n \n # Validator produced by subscripting this factory with non-lambda functions\n # satisfying the expected API.\n IsQuoted = Is[_is_quoted]\n> IsExclamatory = Is[_is_exclamatory]\n\n> die_unless_validator_tester(is_valid)\n\n> die_unless_func_args_len_flexible_equal(\n\n> func_args_len_flexible_actual = get_func_args_flexible_len(\n\n> def get_func_args_flexible_len(\n # Mandatory parameters.\n func: Codeobjable,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> int:\n '''\n Number of **flexible parameters** (i.e., parameters passable as either\n positional or keyword arguments but *not* positional-only, keyword-only,\n variadic, or other more constrained kinds of parameters) accepted by the\n passed pure-Python callable.\n \n This getter transparently handles all of the following:\n \n * Conventional pure-Python callables.\n * If ``is_unwrap`` is :data:`True`:\n \n * Pure-Python **partials** (i.e., pure-Python callable\n :class:`functools.partial` objects directly wrapping pure-Python\n callables). If a partial is passed, this getter transparently returns\n the total number of flexible parameters accepted by the lower-level\n callable wrapped by this partial minus the number of flexible parameters\n partialized away by this partial.\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n is_unwrap: bool, optional\n :data:`True` only if this getter implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function.\n Defaults to :data:`True` for safety. See :func:`.get_func_codeobj` for\n further commentary.\n exception_cls : type, optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the message of any exception raised in\n the event of a fatal error. Defaults to the empty string.\n \n Returns\n -------\n int\n Number of flexible parameters accepted by this callable.\n \n Raises\n ------\n exception_cls\n If that callable is *not* pure-Python.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.api.standard.utilfunctools import (\n get_func_functools_partial_args_flexible_len,\n is_func_functools_partial,\n )\n from beartype._util.func.utilfunctest import is_func_codeobjable\n \n # If the passed callable is pure-Python...\n if is_func_codeobjable(func):\n # Number of various kinds of parameters accepted by that callable.\n func_args_lens = get_func_args_lens(\n func=func,\n is_unwrap=is_unwrap,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # Number of all non-keyword-only parameters (i.e., both optional and\n # mandatory positional-only, positional, and keyword parameters)\n # accepted by that callable.\n return func_args_lens[ARGS_LENS_INDEX_POSONLY_OR_FLEX]\n # Else, that callable has *NO* code object.\n #\n # If that callable is *NOT* actually callable, raise an exception.\n elif not callable(func):\n> raise exception_cls(f'{exception_prefix}{repr(func)} uncallable.')\nE beartype.roar.BeartypeValeSubscriptionException: None uncallable.\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_no_type_check", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_type_fail", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #81: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #82: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #83: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #84: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #85: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #86: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #87: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #88: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #89: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #90: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 40.41693184000002, "in_degree": 3, "true_in_degree": 4.4399999999999995, "out_degree": 2, "betweenness": 5.4192317697043266e-05, "pagerank": 0.0005940195165504146, "harmonic": 0.04436481829573933, "bidirectional_harmonic": 0.19838338744588835, "degree": 5 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/error/_pep/pep484585/errpep484585container.py", "function_name": "find_cause_container_args_1", "test_info": { "success": false, "failed": 15, "passed": 1115, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_3wognctt/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_3wognctt/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #8: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #9: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #10: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #11: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #12: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #13: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #14: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #15: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 29.143255040000017, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 5, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.035032894736842075, "bidirectional_harmonic": 0.21088073567514398, "degree": 5 }, "line_count": 41, "code_line_count": 41, "cyclomatic": 11, "halstead_volume": 94.01164534875782, "halstead_difficulty": 3.125 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/utilobjmake.py", "function_name": "permute_object", "test_info": { "success": false, "failed": 52, "passed": 1078, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_lcrjhkij/beartype/_check/error/_errtype.py:88\nError: AssertionError: None not cause.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> return cause_finder(self)\n\n> return find_cause_instance_type(cause.permute(hint=hint_type))\n\n> def find_cause_instance_type(cause: ViolationCause) -> ViolationCause:\n '''\n Output cause describing whether the pith of the passed input cause either is\n or is not an instance of the isinstanceable class of that cause.\n \n Parameters\n ----------\n cause : ViolationCause\n Input cause providing this data.\n \n Returns\n -------\n BeartypePlugInstancecheckStrException\n If the metaclass of this isinstanceable class defines the\n :mod:`beartype`-specific ``__instancecheck_str__()`` dunder method but\n either:\n \n * This method is *not* a pure-Python callable.\n * This method is a pure-Python callable with an unexpected signature\n that differs from the expected API:\n \n .. code-block:: python\n \n def __instancecheck_str__(cls, obj: typing.Any) -> str:\n \n * This method is a pure-Python callable with the expected signature that\n returns either:\n \n * An object that is *not* a string.\n * The empty string.\n ViolationCause\n Output cause type-checking this data.\n '''\n> assert isinstance(cause, ViolationCause), f'{repr(cause)} not cause.'\nE AssertionError: None not cause.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_lcrjhkij/beartype/_check/error/_errtype.py:88\nError: AssertionError: None not cause.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> return cause_finder(self)\n\n> return find_cause_instance_type(cause.permute(hint=hint_type))\n\n> def find_cause_instance_type(cause: ViolationCause) -> ViolationCause:\n '''\n Output cause describing whether the pith of the passed input cause either is\n or is not an instance of the isinstanceable class of that cause.\n \n Parameters\n ----------\n cause : ViolationCause\n Input cause providing this data.\n \n Returns\n -------\n BeartypePlugInstancecheckStrException\n If the metaclass of this isinstanceable class defines the\n :mod:`beartype`-specific ``__instancecheck_str__()`` dunder method but\n either:\n \n * This method is *not* a pure-Python callable.\n * This method is a pure-Python callable with an unexpected signature\n that differs from the expected API:\n \n .. code-block:: python\n \n def __instancecheck_str__(cls, obj: typing.Any) -> str:\n \n * This method is a pure-Python callable with the expected signature that\n returns either:\n \n * An object that is *not* a string.\n * The empty string.\n ViolationCause\n Output cause type-checking this data.\n '''\n> assert isinstance(cause, ViolationCause), f'{repr(cause)} not cause.'\nE AssertionError: None not cause.\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #8: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #43: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #44: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #45: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #46: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #47: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #48: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #49: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #50: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #51: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #52: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0006650246305418719, "harmonic": 0.0, "bidirectional_harmonic": 0.003289473684210526, "degree": 2 }, "line_count": 27, "code_line_count": 27, "cyclomatic": 9, "halstead_volume": 25.26619429851844, "halstead_difficulty": 1.2 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextmunge.py", "function_name": "uppercase_str_char_first", "test_info": { "success": false, "failed": 57, "passed": 1073, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/error/test_utilerrwarn.py::test_reissue_warnings_placeholder\nLocation: /tmp/benchmark_f2sh49xl/beartype_test/a00_unit/a20_util/error/test_utilerrwarn.py:139\nError: AssertionError: assert 'None' == 'With his still soul. The sky'\n \n - With his still soul. The sky\n + None\n\nTraceback:\n\n> def test_reissue_warnings_placeholder() -> None:\n '''\n Test the\n :func:`beartype._util.error.utilerrwarn.reissue_warnings_placeholder`\n function.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.error.utilerrwarn import (\n issue_warning,\n reissue_warnings_placeholder,\n )\n from pytest import warns\n from warnings import catch_warnings\n \n # ....................{ CLASSES }....................\n class TheSkyWarning(UserWarning):\n '''\n Arbitrary warning issued below with messages containing placeholder\n substrings replaced by :func:`.reissue_warnings_placeholder`.\n '''\n \n pass\n \n \n class ThePoetWarning(UserWarning):\n '''\n Arbitrary warning issued below with messages containing placeholder\n substrings replaced by :func:`.reissue_warnings_placeholder`.\n '''\n \n pass\n \n # ....................{ LOCALS }....................\n # Source substring to be hard-coded into the messages of all warnings\n # issued by the low-level callable defined below.\n TEST_SOURCE_STR = '{its_got_bro}'\n \n # Target substring to globally replace this source substring with.\n TEST_TARGET_STR = 'With his still soul. '\n \n # ....................{ CALLABLES }....................\n def portend_his_brain() -> None:\n '''\n Low-level callable issuing two or more possibly unreadable warnings.\n '''\n \n # Issue an arbitrary warning message containing one source substring.\n issue_warning(\n cls=TheSkyWarning,\n message=f'{TEST_SOURCE_STR}The sky',\n )\n \n # Issue an arbitrary warning message containing *NO* source substring.\n issue_warning(\n cls=ThePoetWarning,\n message='the Poet kept mute conference',\n )\n \n # Issue an empty warning message.\n issue_warning(cls=TheSkyWarning, message='')\n \n # Issue a non-string warning message. While an unlikely edge case, the\n # standard low-level warnings.warn() function permissively permits this.\n # Moreover, this behaviour coincides with similar permissiveness in\n # exception messages (which are also allowed to be non-strings): e.g.,\n # >>> from warnings import warn\n # >>> warn(0xCAFE, UserWarning)\n # UserWarning: 51966\n # warn(0xCAFE, UserWarning)\n issue_warning(cls=ThePoetWarning, message=0xBEEFDEAD)\n \n \n def portend_while_daylight() -> None:\n '''\n High-level callable calling the low-level callable and reissuing\n unreadable warnings issued by the latter with equivalent readable\n warnings.\n '''\n \n # With a context manager \"catching\" *ALL* non-fatal warnings emitted\n # during this logic for subsequent \"playrback\" below...\n with catch_warnings(record=True) as warnings_issued:\n # Call this low-level callable to emit multiple warnings.\n portend_his_brain()\n \n # If one or more warnings were issued, reissue these warnings with each\n # placeholder substring replaced by an arbitrary substring.\n if warnings_issued:\n reissue_warnings_placeholder(\n warnings=warnings_issued,\n source_str=TEST_SOURCE_STR,\n target_str=TEST_TARGET_STR,\n )\n # Else, *NO* warnings were issued.\n \n # ....................{ ASSERT }....................\n # Assert this high-level non-memoized callable raises the same type of\n # exception raised by this low-level memoized callable and preserve this\n # exception for subsequent assertion.\n #\n # Note that passing nothing to warns() enables undocumented edge-case\n # behaviour in which warns() captures warnings issued by this block\n # *WITHOUT* validating the types of these warnings. See also:\n # https://docs.pytest.org/en/4.6.x/warnings.html#recwarn\n with warns() as warnings_info:\n portend_while_daylight()\n \n # Assert that the expected number of warnings were issued.\n assert len(warnings_info) == 4\n \n # Assert that the expected types of warnings were issued.\n assert issubclass(warnings_info[0].category, TheSkyWarning)\n assert issubclass(warnings_info[1].category, ThePoetWarning)\n assert issubclass(warnings_info[2].category, TheSkyWarning)\n assert issubclass(warnings_info[3].category, ThePoetWarning)\n \n # Assert that the expected warning messages were issued.\n> assert str(warnings_info[0].message) == f'{TEST_TARGET_STR}The sky'\nE AssertionError: assert 'None' == 'With his still soul. The sky'\nE \nE - With his still soul. The sky\nE + None\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py::test_uppercase_str_char_first\nLocation: /tmp/benchmark_f2sh49xl/beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py:31\nError: AssertionError: assert None == 'BeArTyPe'\n + where None = (text='beArTyPe')\n\nTraceback:\n\n> def test_uppercase_str_char_first():\n '''\n Test the :func:`beartype._util.text.utiltextmunge.uppercase_str_char_first`\n function.\n '''\n \n # Defer test-specific imports.\n from beartype._util.text.utiltextmunge import uppercase_str_char_first\n from pytest import raises\n \n # Assert this munger returns the expected string when passed a string.\n> assert uppercase_str_char_first(text='beArTyPe') == \"BeArTyPe\"\nE AssertionError: assert None == 'BeArTyPe'\nE + where None = (text='beArTyPe')\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #8: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #9: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #48: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #49: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #50: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #51: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #52: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #53: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #54: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #55: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #56: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #57: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/error/test_utilerrwarn.py", "test_reissue_warnings_placeholder" ], [ "beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py", "test_uppercase_str_char_first" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 5, "true_in_degree": 12.200000000000003, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0007459540001160257, "harmonic": 0.0, "bidirectional_harmonic": 0.23490704744816596, "degree": 5 }, "line_count": 10, "code_line_count": 10, "cyclomatic": 4, "halstead_volume": 15.509775004326936, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep585.py", "function_name": "is_hint_pep585_generic", "test_info": { "success": false, "failed": 14, "passed": 1116, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark__0jgefni/beartype/_util/hint/pep/proposal/pep484/pep484generic.py:381\nError: beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> hint_child_bases = get_hint_pep484585_generic_bases_unerased(\n\n> get_hint_pep484_generic_bases_unerased(\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484_generic_bases_unerased(\n # Mandatory parameters.\n hint: Any,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of all unerased :mod:`typing` **pseudo-superclasses** (i.e.,\n :mod:`typing` objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`-compliant\n **generic** (i.e., class subclassing at least one non-class :mod:`typing`\n object).\n \n This getter is memoized for efficiency.\n \n Parameters\n ----------\n hint : object\n Object to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this\n :mod:`typing` generic. Specifically:\n \n * If this generic defines an ``__orig_bases__`` dunder instance\n variable, the value of that variable as is.\n * Else, the value of the ``__mro__`` dunder instance variable stripped\n of all ignorable classes conveying *no* semantic meaning, including:\n \n * This generic itself.\n * The :class:`object` root superclass.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * *Not* a :mod:`typing` generic.\n * A :mod:`typing` generic that erased *none* of its superclasses but\n whose method resolution order (MRO) lists strictly less than four\n classes. Valid :pep:`484`-compliant generics should list at least\n four classes, including (in order):\n \n #. This class itself.\n #. The one or more :mod:`typing` objects directly subclassed by this\n generic.\n #. The :class:`typing.Generic` superclass.\n #. The zero or more non-:mod:`typing` superclasses subsequently\n subclassed by this generic (e.g., :class:`abc.ABC`).\n #. The :class:`object` root superclass.\n \n See Also\n --------\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n Further details.\n '''\n \n #FIXME: This tuple appears to be implemented erroneously -- at least under\n #Python 3.7, anyway. Although this tuple is implemented correctly for the\n #common case of user-defined types directly subclassing \"typing\" types,\n #this tuple probably is *NOT* implemented correctly for the edge case of\n #user-defined types indirectly subclassing \"typing\" types: e.g.,\n #\n # >>> import collections.abc, typing\n # >>> T = typing.TypeVar('T')\n # >>> class Direct(collections.abc.Sized, typing.Generic[T]): pass\n # >>> Direct.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n # >>> class Indirect(collections.abc.Container, Direct): pass\n # >>> Indirect.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n #\n #*THAT'S COMPLETELY INSANE.* Clearly, their naive implementation failed to\n #account for actual real-world use cases.\n #\n #On the bright side, the current implementation prevents us from actually\n #having to perform a breadth-first traversal of all original superclasses\n #of this class in method resolution order (MRO). On the dark side, it's\n #pants-on-fire balls -- but there's not much we can do about that. *sigh*\n #\n #If we ever need to perform that breadth-first traversal, resurrect this:\n #\n # # If this class was *NOT* subject to type erasure, reduce to a noop.\n # if not hint_bases:\n # return hint_bases\n #\n # # Fixed list of all typing super attributes to be returned.\n # superattrs = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based index of the last item of this list.\n # superattrs_index = 0\n #\n # # Fixed list of all transitive superclasses originally listed by this\n # # class iterated in method resolution order (MRO).\n # hint_orig_mro = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based indices of the current and last items of this list.\n # hint_orig_mro_index_curr = 0\n # hint_orig_mro_index_last = 0\n #\n # # Initialize this list with the tuple of all direct superclasses of this\n # # class, which iteration then expands to all transitive superclasses.\n # hint_orig_mro[:len(hint_bases)] = hint_bases\n #\n # # While the heat death of the universe has been temporarily forestalled...\n # while (True):\n # # Currently visited superclass of this class.\n # hint_base = hint_orig_mro[hint_orig_mro_index_curr]\n #\n # # If this superclass is a typing attribute...\n # if is_hint_pep_type_typing(hint_base):\n # # Avoid inserting this attribute into the \"hint_orig_mro\" list.\n # # Most typing attributes are *NOT* actual classes and those that\n # # are have no meaningful public superclass. Ergo, iteration\n # # terminates with typing attributes.\n # #\n # # Insert this attribute at the current item of this list.\n # superattrs[superattrs_index] = hint_base\n #\n # # Increment this index to the next item of this list.\n # superattrs_index += 1\n #\n # # If this class subclasses more than the maximum number of \"typing\"\n # # attributes supported by this function, raise an exception.\n # if superattrs_index >= FIXED_LIST_SIZE_MEDIUM:\n # raise BeartypeDecorHintPep560Exception(\n # '{} PEP type {!r} subclasses more than '\n # '{} \"typing\" types.'.format(\n # exception_prefix,\n # hint,\n # FIXED_LIST_SIZE_MEDIUM))\n # # Else, this superclass is *NOT* a typing attribute. In this case...\n # else:\n # # Tuple of all direct superclasses originally listed by this class\n # # prior to PEP 484 type erasure if any *OR* the empty tuple\n # # otherwise.\n # hint_base_bases = getattr(hint_base, '__orig_bases__')\n #\n # #FIXME: Implement breadth-first traversal here.\n #\n # # Tuple sliced from the prefix of this list assigned to above.\n # superattrs_tuple = tuple(superattrs[:superattrs_index])\n #\n # # Release and nullify this list *AFTER* defining this tuple.\n # release_fixed_list(superattrs)\n # del superattrs\n #\n # # Return this tuple as is.\n # return superattrs_tuple\n #\n #Also resurrect this docstring snippet:\n #\n # Raises\n # ----------\n # BeartypeDecorHintPep560Exception\n # If this object defines the ``__orig_bases__`` dunder attribute but that\n # attribute transitively lists :data:`FIXED_LIST_SIZE_MEDIUM` or more :mod:`typing`\n # attributes.\n #\n #Specifically:\n # * Acquire a fixed list of sufficient size (e.g., 64). We probably want\n # to make this a constant in \"utilcachelistfixedpool\" for reuse\n # everywhere, as this is clearly becoming a common idiom.\n # * Slice-assign \"__orig_bases__\" into this list.\n # * Maintain two simple 0-based indices into this list:\n # * \"bases_index_curr\", the current base being visited.\n # * \"bases_index_last\", the end of this list also serving as the list\n # position to insert newly discovered bases at.\n # * Iterate over this list and keep slice-assigning from either\n # \"__orig_bases__\" (if defined) or \"__mro__\" (otherwise) into\n # \"list[bases_index_last:len(__orig_bases__)]\". Note that this has the\n # unfortunate disadvantage of temporarily iterating over duplicates,\n # but... *WHO CARES.* It still works and we subsequently\n # eliminate duplicates at the end.\n # * Return a frozenset of this list, thus implicitly eliminating\n # duplicate superclasses.\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_type_or_none)\n \n # If this hint is *NOT* a class, reduce this hint to the object originating\n # this hint if any. See is_hint_pep484_generic() for details.\n hint = get_hint_pep484585_generic_type_or_none(hint)\n \n # If this hint is *NOT* a PEP 484- or 544-compliant generic, raise an\n # exception.\n if not is_hint_pep484_generic_unsubscripted(hint):\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} neither '\n f'PEP 484 generic nor PEP 544 protocol.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark__0jgefni/beartype/_util/hint/pep/proposal/pep484/pep484generic.py:381\nError: beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_bases_unerased(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._data.hint.pep.sign.datapepsignset import HINT_SIGNS_GENERIC\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_bases_unerased)\n from beartype._util.hint.pep.utilpeptest import is_hint_pep_type_typing\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # For each PEP-compliant hint to be tested...\n for hint_pep_meta in hints_pep_meta:\n # If this is a generic hint, assert that this getter returns the\n # expected unerased pseudo-superclasses of this generic.\n if hint_pep_meta.pep_sign in HINT_SIGNS_GENERIC:\n> hint_pep_bases = get_hint_pep484585_generic_bases_unerased(\n hint_pep_meta.hint)\n\n> get_hint_pep484_generic_bases_unerased(\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484_generic_bases_unerased(\n # Mandatory parameters.\n hint: Any,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of all unerased :mod:`typing` **pseudo-superclasses** (i.e.,\n :mod:`typing` objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`-compliant\n **generic** (i.e., class subclassing at least one non-class :mod:`typing`\n object).\n \n This getter is memoized for efficiency.\n \n Parameters\n ----------\n hint : object\n Object to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this\n :mod:`typing` generic. Specifically:\n \n * If this generic defines an ``__orig_bases__`` dunder instance\n variable, the value of that variable as is.\n * Else, the value of the ``__mro__`` dunder instance variable stripped\n of all ignorable classes conveying *no* semantic meaning, including:\n \n * This generic itself.\n * The :class:`object` root superclass.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * *Not* a :mod:`typing` generic.\n * A :mod:`typing` generic that erased *none* of its superclasses but\n whose method resolution order (MRO) lists strictly less than four\n classes. Valid :pep:`484`-compliant generics should list at least\n four classes, including (in order):\n \n #. This class itself.\n #. The one or more :mod:`typing` objects directly subclassed by this\n generic.\n #. The :class:`typing.Generic` superclass.\n #. The zero or more non-:mod:`typing` superclasses subsequently\n subclassed by this generic (e.g., :class:`abc.ABC`).\n #. The :class:`object` root superclass.\n \n See Also\n --------\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n Further details.\n '''\n \n #FIXME: This tuple appears to be implemented erroneously -- at least under\n #Python 3.7, anyway. Although this tuple is implemented correctly for the\n #common case of user-defined types directly subclassing \"typing\" types,\n #this tuple probably is *NOT* implemented correctly for the edge case of\n #user-defined types indirectly subclassing \"typing\" types: e.g.,\n #\n # >>> import collections.abc, typing\n # >>> T = typing.TypeVar('T')\n # >>> class Direct(collections.abc.Sized, typing.Generic[T]): pass\n # >>> Direct.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n # >>> class Indirect(collections.abc.Container, Direct): pass\n # >>> Indirect.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n #\n #*THAT'S COMPLETELY INSANE.* Clearly, their naive implementation failed to\n #account for actual real-world use cases.\n #\n #On the bright side, the current implementation prevents us from actually\n #having to perform a breadth-first traversal of all original superclasses\n #of this class in method resolution order (MRO). On the dark side, it's\n #pants-on-fire balls -- but there's not much we can do about that. *sigh*\n #\n #If we ever need to perform that breadth-first traversal, resurrect this:\n #\n # # If this class was *NOT* subject to type erasure, reduce to a noop.\n # if not hint_bases:\n # return hint_bases\n #\n # # Fixed list of all typing super attributes to be returned.\n # superattrs = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based index of the last item of this list.\n # superattrs_index = 0\n #\n # # Fixed list of all transitive superclasses originally listed by this\n # # class iterated in method resolution order (MRO).\n # hint_orig_mro = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based indices of the current and last items of this list.\n # hint_orig_mro_index_curr = 0\n # hint_orig_mro_index_last = 0\n #\n # # Initialize this list with the tuple of all direct superclasses of this\n # # class, which iteration then expands to all transitive superclasses.\n # hint_orig_mro[:len(hint_bases)] = hint_bases\n #\n # # While the heat death of the universe has been temporarily forestalled...\n # while (True):\n # # Currently visited superclass of this class.\n # hint_base = hint_orig_mro[hint_orig_mro_index_curr]\n #\n # # If this superclass is a typing attribute...\n # if is_hint_pep_type_typing(hint_base):\n # # Avoid inserting this attribute into the \"hint_orig_mro\" list.\n # # Most typing attributes are *NOT* actual classes and those that\n # # are have no meaningful public superclass. Ergo, iteration\n # # terminates with typing attributes.\n # #\n # # Insert this attribute at the current item of this list.\n # superattrs[superattrs_index] = hint_base\n #\n # # Increment this index to the next item of this list.\n # superattrs_index += 1\n #\n # # If this class subclasses more than the maximum number of \"typing\"\n # # attributes supported by this function, raise an exception.\n # if superattrs_index >= FIXED_LIST_SIZE_MEDIUM:\n # raise BeartypeDecorHintPep560Exception(\n # '{} PEP type {!r} subclasses more than '\n # '{} \"typing\" types.'.format(\n # exception_prefix,\n # hint,\n # FIXED_LIST_SIZE_MEDIUM))\n # # Else, this superclass is *NOT* a typing attribute. In this case...\n # else:\n # # Tuple of all direct superclasses originally listed by this class\n # # prior to PEP 484 type erasure if any *OR* the empty tuple\n # # otherwise.\n # hint_base_bases = getattr(hint_base, '__orig_bases__')\n #\n # #FIXME: Implement breadth-first traversal here.\n #\n # # Tuple sliced from the prefix of this list assigned to above.\n # superattrs_tuple = tuple(superattrs[:superattrs_index])\n #\n # # Release and nullify this list *AFTER* defining this tuple.\n # release_fixed_list(superattrs)\n # del superattrs\n #\n # # Return this tuple as is.\n # return superattrs_tuple\n #\n #Also resurrect this docstring snippet:\n #\n # Raises\n # ----------\n # BeartypeDecorHintPep560Exception\n # If this object defines the ``__orig_bases__`` dunder attribute but that\n # attribute transitively lists :data:`FIXED_LIST_SIZE_MEDIUM` or more :mod:`typing`\n # attributes.\n #\n #Specifically:\n # * Acquire a fixed list of sufficient size (e.g., 64). We probably want\n # to make this a constant in \"utilcachelistfixedpool\" for reuse\n # everywhere, as this is clearly becoming a common idiom.\n # * Slice-assign \"__orig_bases__\" into this list.\n # * Maintain two simple 0-based indices into this list:\n # * \"bases_index_curr\", the current base being visited.\n # * \"bases_index_last\", the end of this list also serving as the list\n # position to insert newly discovered bases at.\n # * Iterate over this list and keep slice-assigning from either\n # \"__orig_bases__\" (if defined) or \"__mro__\" (otherwise) into\n # \"list[bases_index_last:len(__orig_bases__)]\". Note that this has the\n # unfortunate disadvantage of temporarily iterating over duplicates,\n # but... *WHO CARES.* It still works and we subsequently\n # eliminate duplicates at the end.\n # * Return a frozenset of this list, thus implicitly eliminating\n # duplicate superclasses.\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_type_or_none)\n \n # If this hint is *NOT* a class, reduce this hint to the object originating\n # this hint if any. See is_hint_pep484_generic() for details.\n hint = get_hint_pep484585_generic_type_or_none(hint)\n \n # If this hint is *NOT* a PEP 484- or 544-compliant generic, raise an\n # exception.\n if not is_hint_pep484_generic_unsubscripted(hint):\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} neither '\n f'PEP 484 generic nor PEP 544 protocol.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: Type hint neither PEP 484 generic nor PEP 544 protocol.\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #6: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #7: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #8: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #12: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #13: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #14: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.768128000000002, "in_degree": 2, "true_in_degree": 9.200000000000001, "out_degree": 2, "betweenness": 5.915994681927223e-05, "pagerank": 0.0008155136775789026, "harmonic": 0.009073464912280702, "bidirectional_harmonic": 0.20170816482494178, "degree": 4 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextprefix.py", "function_name": "prefix_callable_return_value", "test_info": { "success": false, "failed": 17, "passed": 1113, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation\nLocation: /tmp/benchmark_vp0yrovh/beartype/_util/text/utiltextmunge.py:68\nError: AssertionError: None not string.\n\nTraceback:\n\n> def test_get_func_pith_violation() -> None:\n '''\n Test the\n :func:`beartype._check.error.errget.get_func_pith_violation` getter.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype import BeartypeConf\n from beartype.roar import (\n BeartypeCallHintParamViolation,\n BeartypeCallHintReturnViolation,\n BeartypeDecorHintNonpepException,\n )\n from beartype.roar._roarexc import _BeartypeCallHintPepRaiseException\n from beartype.typing import (\n List,\n Tuple,\n Union,\n )\n from beartype._data.func.datafuncarg import ARG_NAME_RETURN\n from beartype._check.error.errget import get_func_pith_violation\n from beartype._check.metadata.metacheck import BeartypeCheckMeta\n from pytest import raises\n \n # ..................{ LOCALS }..................\n def forest_unknown(\n secret_orchard: List[str],\n achromatic_voice,\n to_bid_you_farewell: str,\n amaranth_symbol: 42,\n ) -> Union[int, Tuple[str, ...]]:\n '''\n Arbitrary callable exercised below.\n '''\n \n return achromatic_voice\n \n # Beartype type-checking call metadata reduced from this decorator metadata.\n check_meta = BeartypeCheckMeta.make_from_decor_meta_kwargs(\n func=forest_unknown, conf=BeartypeConf())\n \n # ..................{ PASS }..................\n # Assert this function returns the expected exception when passed a\n # parameter annotated by a PEP-compliant type hint failing to shallowly\n # satisfy the type of that type hint.\n violation = get_func_pith_violation(\n check_meta=check_meta,\n pith_name='secret_orchard',\n pith_value=(\n 'You are in a forest unknown:',\n 'The secret orchard.',\n ),\n )\n assert isinstance(violation, BeartypeCallHintParamViolation)\n \n # Assert this function returns the expected exception when passed a\n # parameter annotated by a PEP-compliant type hint failing to deeply satisfy\n # the type of that type hint.\n violation = get_func_pith_violation(\n check_meta=check_meta,\n pith_name='secret_orchard',\n pith_value=[\n b'I am awaiting the sunrise',\n b'Gazing modestly through the coldest morning',\n ],\n random_int=0,\n )\n assert isinstance(violation, BeartypeCallHintParamViolation)\n \n # Assert this function returns the expected exception when passed another\n # parameter annotated by a PEP-noncompliant type hint failing to shallowly\n # satisfy the type of that type hint.\n violation = get_func_pith_violation(\n check_meta=check_meta,\n pith_name='to_bid_you_farewell',\n pith_value=(\n b'Once it came you lied,'\n b\"Embracing us over autumn's proud treetops.\"\n ),\n random_int=1,\n )\n assert isinstance(violation, BeartypeCallHintParamViolation)\n \n # Assert this function returns the expected exception when returning a\n # return value annotated by a PEP-compliant type hint failing to satisfy\n # that type hint.\n> violation = get_func_pith_violation(\n check_meta=check_meta,\n pith_name=ARG_NAME_RETURN,\n pith_value=[\n 'Sunbirds leave their dark recesses.',\n 'Shadows glide the archways.',\n ],\n random_int=0,\n )\n\n> return get_hint_object_violation(\n\n> exception_prefix = uppercase_str_char_first(exception_prefix)\n\n> def uppercase_str_char_first(text: str) -> str:\n '''\n Uppercase *only* the first character of the passed string.\n \n Whereas the standard :meth:`str.capitalize` method both uppercases the\n first character of this string *and* lowercases all remaining characters,\n this function *only* uppercases the first character. All remaining\n characters remain unmodified.\n \n Parameters\n ----------\n text : str\n String whose first character is to be uppercased.\n \n Returns\n -------\n str\n This string with the first character uppercased.\n '''\n> assert isinstance(text, str), f'{repr(text)} not string.'\nE AssertionError: None not string.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types\nLocation: /tmp/benchmark_vp0yrovh/beartype/_util/text/utiltextmunge.py:68\nError: AssertionError: None not string.\n\nTraceback:\n\n> def test_get_func_pith_violation_conf_violation_types() -> None:\n '''\n Test the\n :func:`beartype._check.error.errget.get_func_pith_violation` getter with\n respect to the\n :attr:`beartype.BeartypeConf.violation_param_type` and\n :attr:`beartype.BeartypeConf.violation_return_type` options.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype import BeartypeConf\n from beartype.typing import (\n List,\n Tuple,\n Union,\n )\n from beartype._data.func.datafuncarg import ARG_NAME_RETURN\n from beartype._check.error.errget import get_func_pith_violation\n from beartype._check.metadata.metacheck import BeartypeCheckMeta\n \n # ..................{ LOCALS }..................\n class InvolvedAndSwallowed(Exception):\n '''\n Arbitrary exception subclass.\n '''\n \n pass\n \n \n def now_blackness(\n veiled_his: List[str], dizzy_eyes) -> Union[int, Tuple[str, ...]]:\n '''\n Arbitrary callable exercised below.\n '''\n \n return dizzy_eyes\n \n # ..................{ PASS }..................\n # Parameter violation configured to be a non-default exception subclass.\n param_violation = get_func_pith_violation(\n check_meta=BeartypeCheckMeta.make_from_decor_meta_kwargs(\n func=now_blackness, conf=BeartypeConf(\n violation_param_type=InvolvedAndSwallowed)),\n pith_name='veiled_his',\n pith_value=(\n 'Now blackness veiled his dizzy eyes, and night',\n 'Involved and swallowed up the vision; sleep,',\n ),\n )\n \n # Assert that this violation is the expected non-default exception subclass.\n assert type(param_violation) is InvolvedAndSwallowed\n \n # Return violation configured to be a non-default exception subclass.\n> return_violation = get_func_pith_violation(\n check_meta=BeartypeCheckMeta.make_from_decor_meta_kwargs(\n func=now_blackness, conf=BeartypeConf(\n violation_return_type=InvolvedAndSwallowed)),\n pith_name=ARG_NAME_RETURN,\n pith_value=[\n 'Like a dark flood suspended in its course',\n 'Rolled back its impulse on his vacant brain.',\n ],\n )\n\n> return get_hint_object_violation(\n\n> exception_prefix = uppercase_str_char_first(exception_prefix)\n\n> def uppercase_str_char_first(text: str) -> str:\n '''\n Uppercase *only* the first character of the passed string.\n \n Whereas the standard :meth:`str.capitalize` method both uppercases the\n first character of this string *and* lowercases all remaining characters,\n this function *only* uppercases the first character. All remaining\n characters remain unmodified.\n \n Parameters\n ----------\n text : str\n String whose first character is to be uppercased.\n \n Returns\n -------\n str\n This string with the first character uppercased.\n '''\n> assert isinstance(text, str), f'{repr(text)} not string.'\nE AssertionError: None not string.\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #11: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #12: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #13: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #14: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #15: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py", "test_get_func_pith_violation" ], [ "beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py", "test_get_func_pith_violation_conf_violation_types" ] ] }, "complexity_info": { "centrality": { "distance_discount": 25.394892800000015, "in_degree": 1, "true_in_degree": 1.8, "out_degree": 2, "betweenness": 5.419231769704327e-06, "pagerank": 0.00028151589789520825, "harmonic": 0.02826793546365914, "bidirectional_harmonic": 0.21495547581073945, "degree": 3 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/code/codescope.py", "function_name": "add_func_scope_types", "test_info": { "success": false, "failed": 38, "passed": 1092, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_add_func_scope_types\nLocation: /tmp/benchmark_occjappl/beartype_test/a00_unit/a60_check/a20_code/test_codescope.py:128\nError: KeyError: None\n\nTraceback:\n\n> def test_add_func_scope_types() -> None:\n '''\n Test the\n :func:`beartype._check.code.codescope.add_func_scope_types` adder.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import (\n BeartypeDecorHintNonpepException,\n BeartypeDecorHintPep3119Exception,\n )\n from beartype._cave._cavefast import CallableTypes, ModuleOrStrTypes\n from beartype._cave._cavemap import NoneTypeOr\n from beartype._check.code.codescope import add_func_scope_types\n from beartype._util.utilobject import get_object_type_basename\n from beartype_test.a00_unit.data.check.forward.data_fwdref import (\n FORWARDREF_ABSOLUTE,\n FORWARDREF_RELATIVE,\n )\n from beartype_test.a00_unit.data.data_type import (\n Class,\n NonIsinstanceableClass,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Arbitrary scope to be added to below.\n func_scope = {}\n \n # Arbitrary tuple of one or more standard types.\n types = CallableTypes\n \n # ....................{ PASS }....................\n # Assert this function adds a tuple of one or more standard types.\n #\n # Note that, unlike types, tuples are internally added under different\n # objects than their originals (e.g., to ignore both duplicates and\n # ordering) and *MUST* thus be tested by conversion to sets.\n types_scope_name = add_func_scope_types(\n types=types, func_scope=func_scope)\n> assert set(types) == set(func_scope[types_scope_name])\nE KeyError: None\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: <@beartype(__beartype_checker_5) at 0x7a9cbd9bde90>:8\nError: TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n with warns(hint_meta.warning_type):\n is_bearable(pith, hint, conf=conf)\n # print(f'Deprecated type hint {repr(hint)} warned!')\n # Else, this tester is expected to emit *NO* warning for this hint. In\n # this case, call this tester outside of such a context manager.\n else:\n> is_bearable(pith, hint, conf=conf)\n\n> return func_tester(obj) # pyright: ignore\n\n> > ???\nE TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #32: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #33: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #34: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #35: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #36: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #37: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #38: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a20_code/test_codescope.py", "test_add_func_scope_types" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ] ] }, "complexity_info": { "centrality": { "distance_discount": 12.889600000000005, "in_degree": 1, "true_in_degree": 1.8, "out_degree": 6, "betweenness": 3.793462238793029e-05, "pagerank": 0.0004399630541871922, "harmonic": 0.019599780701754384, "bidirectional_harmonic": 0.24589937200956952, "degree": 7 }, "line_count": 59, "code_line_count": 59, "cyclomatic": 18, "halstead_volume": 84.0, "halstead_difficulty": 2.9545454545454546 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep695.py", "function_name": "get_hint_pep695_unsubscripted_alias", "test_info": { "success": false, "failed": 10, "passed": 1120, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py::test_iter_hint_pep695_forwardrefs\nLocation: /home/ubuntu/repos/beartype/venv/lib/python3.12/site-packages/_pytest/capture.py:898\nError: RuntimeError: generator raised StopIteration\n\nTraceback:\n\n> @classmethod\n def from_call(\n cls,\n func: Callable[[], TResult],\n when: Literal[\"collect\", \"setup\", \"call\", \"teardown\"],\n reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,\n ) -> CallInfo[TResult]:\n \"\"\"Call func, wrapping the result in a CallInfo.\n \n :param func:\n The function to call. Called without arguments.\n :type func: Callable[[], _pytest.runner.TResult]\n :param when:\n The phase in which the function is called.\n :param reraise:\n Exception or exceptions that shall propagate if raised by the\n function, instead of being wrapped in the CallInfo.\n \"\"\"\n excinfo = None\n start = timing.time()\n precise_start = timing.perf_counter()\n try:\n> result: TResult | None = func()\n\n> lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise\n\n> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)\n\n> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n\n> yield from thread_exception_runtest_hook()\n\n> yield\n\n> yield from unraisable_exception_runtest_hook()\n\n> yield\n\n> yield from self._runtest_for(item, \"call\")\n\n> yield\n\n> @hookimpl(wrapper=True)\n def pytest_runtest_call(self, item: Item) -> Generator[None]:\n with self.item_capture(\"call\", item):\n> return (yield)\nE RuntimeError: generator raised StopIteration\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable\nLocation: /tmp/benchmark_gb8du3b0/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:200\nError: AssertionError: assert True == False\n + where True = HintPepMetadata(\\n hint=AliasPep484604Depth1T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasUnsubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(),\\n typevars=(),\\n warning_type=None,\\n).is_ignorable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_reduce_hint_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer with\n respect to ignorable hints.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # Defer test-specific imports.\n from beartype.typing import Any\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP_UNIGNORABLE)\n \n # Assert this tester accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n assert reduce_hint(hint_ignorable) is Any\n \n # Assert this tester rejects unignorable PEP-noncompliant type hints.\n for hint_unignorable in HINTS_NONPEP_UNIGNORABLE:\n assert reduce_hint(hint_unignorable) is not Any\n \n # Assert this tester:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # True only if this hint reduces to the ignorable \"Any\" singleton.\n is_hint_ignorable = reduce_hint(hint_pep_meta.hint) is Any\n \n # Assert this hint is either ignorable or unignorable as expected.\n> assert hint_pep_meta.is_ignorable == is_hint_ignorable\nE AssertionError: assert True == False\nE + where True = HintPepMetadata(\\n hint=AliasPep484604Depth1T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasUnsubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(),\\n typevars=(),\\n warning_type=None,\\n).is_ignorable\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep695.py::test_reduce_hint_pep695_unsubscripted", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #8: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #10: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py", "test_iter_hint_pep695_forwardrefs" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint_ignorable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.00040332512315270944, "harmonic": 0.0, "bidirectional_harmonic": 0.15350439947479466, "degree": 2 }, "line_count": 16, "code_line_count": 16, "cyclomatic": 4, "halstead_volume": 6.339850002884625, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/forward/fwdmain.py", "function_name": "_resolve_func_scope_forward_hint", "test_info": { "success": false, "failed": 18, "passed": 1112, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563\nLocation: <@beartype(__beartype_checker_335) at 0x300f9030>:22\nError: beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value violates type hint None, as not instance of .\n\nTraceback:\n\n> def test_resolve_pep563() -> None:\n '''\n Test the :func:`beartype.peps.resolve_pep563` resolver.\n '''\n \n # .....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.peps import resolve_pep563\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n BeartypePep563Exception,\n )\n from beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve import (\n ToAvariceOrPride,\n FrequentWith,\n their_starry_domes,\n )\n from pytest import raises\n \n # .....................{ LOCALS }....................\n # Arbitrary instance of the generic accepted by the function called below.\n numberless_and_immeasurable_halls = ToAvariceOrPride()\n \n # Arbitrary instance of the class defining various problematic methods\n # called below.\n and_thrones_radiant_with_chrysolite = FrequentWith()\n \n # .....................{ PASS }....................\n # Assert that this function unsuccessfully raises the expected exception\n # *BEFORE* resolving all PEP 563-postponed type hints annotating these\n # callables.\n with raises(BeartypeDecorHintForwardRefException):\n their_starry_domes(numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.until_the_doves(\n numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.crystal_column(\n 'Nor had that scene of ampler majesty')\n \n # Resolve all PEP 563-postponed type hints annotating these callables.\n resolve_pep563(their_starry_domes)\n resolve_pep563(FrequentWith.until_the_doves)\n resolve_pep563(FrequentWith.crystal_column)\n \n # Assert that this function successfully accepts and returns this instance.\n> assert their_starry_domes(numberless_and_immeasurable_halls) is (\n numberless_and_immeasurable_halls)\n\n> die_if_unbearable(of_diamond_and_of_gold, ExpandAbove_resolved)\n\n> func_raiser(obj) # pyright: ignore\n\n> > ???\nE beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value violates type hint None, as not instance of .\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data\nLocation: <@beartype(beartype_test.a00_unit.data.hint.data_hintref.stopping_by_woods_on) at 0x791a8dd3c9a0>:29\nError: beartype.roar.BeartypeCallHintParamViolation: Function beartype_test.a00_unit.data.hint.data_hintref.stopping_by_woods_on() parameter a_snowy_evening='Between the woods and frozen lake' violates type hint None, as 'Between the woods and frozen lake' not instance of .\n\nTraceback:\n\n> def test_pep484_ref_data() -> None:\n '''\n Test successful usage of the :func:`beartype.beartype` decorator with\n respect to both PEP-compliant and -noncompliant forward references by\n importing an external data module declaring these references *before* the\n user-defined classes referred to by these references.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar import BeartypeCallHintReturnViolation\n from beartype_test.a00_unit.data.hint.data_hintref import (\n BeforeTheHurricane,\n TheDarkestEveningOfTheYear,\n WithSluggishSurge,\n a_little_shallop,\n but_i_have_promises,\n its_fields_of_snow,\n of_easy_wind,\n stopping_by_woods_on,\n the_dry_leaf,\n the_woods_are_lovely,\n winding_among_the_springs,\n # between_the_woods_and_frozen_lake,\n )\n from pytest import raises\n \n # ..................{ LOCALS }..................\n # Objects passed below to exercise forward references.\n MILES_TO_GO = TheDarkestEveningOfTheYear('And miles to go before I sleep')\n WOODS = TheDarkestEveningOfTheYear('The woods are lovely, dark and deep,')\n LAKE = TheDarkestEveningOfTheYear('Between the woods and frozen lake')\n KNOW = TheDarkestEveningOfTheYear('Whose woods these are I think I know.')\n WITH_BURNING_SMOKE = [\n TheDarkestEveningOfTheYear('With burning smoke, or where bitumen lakes'),\n TheDarkestEveningOfTheYear('On black bare pointed islets ever beat'),\n ]\n RUGGED_AND_DARK = WithSluggishSurge()\n \n # ..................{ PASS }..................\n # Assert these forward-referencing callables return the expected values.\n assert a_little_shallop(WITH_BURNING_SMOKE) is WITH_BURNING_SMOKE\n assert but_i_have_promises(MILES_TO_GO) is MILES_TO_GO\n assert of_easy_wind(WOODS) is WOODS\n> assert stopping_by_woods_on(LAKE) is LAKE\n\n> > ???\nE beartype.roar.BeartypeCallHintParamViolation: Function beartype_test.a00_unit.data.hint.data_hintref.stopping_by_woods_on() parameter a_snowy_evening='Between the woods and frozen lake' violates type hint None, as 'Between the woods and frozen lake' not instance of .\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #14: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #15: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py", "test_resolve_pep563" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py", "test_pep484_ref_data" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.9520000000000004, "in_degree": 1, "true_in_degree": 3.24, "out_degree": 1, "betweenness": 3.793462238793029e-05, "pagerank": 0.00033722112396802596, "harmonic": 0.0030153508771929823, "bidirectional_harmonic": 0.20273671869066692, "degree": 2 }, "line_count": 54, "code_line_count": 54, "cyclomatic": 9, "halstead_volume": 27.0, "halstead_difficulty": 1.8 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/vale/_core/_valecore.py", "function_name": "BeartypeValidator.__init__", "test_info": { "success": false, "failed": 50, "passed": 1043, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_srcvn87o/beartype/vale/_core/_valecoreunary.py:176\nError: AttributeError: 'BeartypeValidator' object has no attribute '_is_valid_code'\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n\n> return BeartypeValidatorNegation(validator_operand=self)\n\n> def __init__(self, validator_operand: BeartypeValidator) -> None:\n '''\n Initialize this higher-level validator from the passed validator.\n \n Parameters\n ----------\n validator_operand : BeartypeValidator\n Validator operated upon by this higher-level validator.\n \n Raises\n ------\n BeartypeValeSubscriptionException\n If this operand is *not* a beartype validator.\n '''\n \n # Validate the passed operand as sane.\n _validate_operand(self, validator_operand)\n \n # Initialize our superclass with all remaining parameters.\n super().__init__(\n validator_operand=validator_operand,\n is_valid=lambda obj: not validator_operand.is_valid(obj),\n> is_valid_code=f'(not {validator_operand._is_valid_code})',\n )\nE AttributeError: 'BeartypeValidator' object has no attribute '_is_valid_code'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none\nLocation: /tmp/benchmark_srcvn87o/beartype/vale/_core/_valecoreunary.py:176\nError: AttributeError: 'BeartypeValidator' object has no attribute '_is_valid_code'\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n\n> return BeartypeValidatorNegation(validator_operand=self)\n\n> def __init__(self, validator_operand: BeartypeValidator) -> None:\n '''\n Initialize this higher-level validator from the passed validator.\n \n Parameters\n ----------\n validator_operand : BeartypeValidator\n Validator operated upon by this higher-level validator.\n \n Raises\n ------\n BeartypeValeSubscriptionException\n If this operand is *not* a beartype validator.\n '''\n \n # Validate the passed operand as sane.\n _validate_operand(self, validator_operand)\n \n # Initialize our superclass with all remaining parameters.\n super().__init__(\n validator_operand=validator_operand,\n is_valid=lambda obj: not validator_operand.is_valid(obj),\n> is_valid_code=f'(not {validator_operand._is_valid_code})',\n )\nE AttributeError: 'BeartypeValidator' object has no attribute '_is_valid_code'\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #25: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #26: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #29: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #30: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #31: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #32: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #33: beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py::test_api_vale_validator_pass", "Failure #34: beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py::test_api_vale_validator_fail", "Failure #35: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #36: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #37: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass", "Failure #38: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_pass", "Failure #39: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_fail", "Failure #40: beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py::test_api_vale_isequal_pass", "Failure #41: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #42: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #43: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #44: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #45: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #46: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #47: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #50: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_type_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 9.817804799999998, "in_degree": 5, "true_in_degree": 5.0, "out_degree": 2, "betweenness": 1.8967311193965145e-05, "pagerank": 0.0005045155993431856, "harmonic": 0.012096647869674185, "bidirectional_harmonic": 0.24063484943419153, "degree": 7 }, "line_count": 39, "code_line_count": 39, "cyclomatic": 7, "halstead_volume": 89.92418250750748, "halstead_difficulty": 2.7083333333333335 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/forward/fwdscope.py", "function_name": "BeartypeForwardScope.__missing__", "test_info": { "success": false, "failed": 11, "passed": 1119, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563\nLocation: <@beartype(__beartype_checker_335) at 0x2e099d20>:22\nError: beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value 'Than gems or gold, the varying roof of heaven' violates type hint None, as str 'Than gems or gold, the varying roof of heaven' not instance of .\n\nTraceback:\n\n> def test_resolve_pep563() -> None:\n '''\n Test the :func:`beartype.peps.resolve_pep563` resolver.\n '''\n \n # .....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.peps import resolve_pep563\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n BeartypePep563Exception,\n )\n from beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve import (\n ToAvariceOrPride,\n FrequentWith,\n their_starry_domes,\n )\n from pytest import raises\n \n # .....................{ LOCALS }....................\n # Arbitrary instance of the generic accepted by the function called below.\n numberless_and_immeasurable_halls = ToAvariceOrPride()\n \n # Arbitrary instance of the class defining various problematic methods\n # called below.\n and_thrones_radiant_with_chrysolite = FrequentWith()\n \n # .....................{ PASS }....................\n # Assert that this function unsuccessfully raises the expected exception\n # *BEFORE* resolving all PEP 563-postponed type hints annotating these\n # callables.\n with raises(BeartypeDecorHintForwardRefException):\n their_starry_domes(numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.until_the_doves(\n numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.crystal_column(\n 'Nor had that scene of ampler majesty')\n \n # Resolve all PEP 563-postponed type hints annotating these callables.\n resolve_pep563(their_starry_domes)\n resolve_pep563(FrequentWith.until_the_doves)\n resolve_pep563(FrequentWith.crystal_column)\n \n # Assert that this function successfully accepts and returns this instance.\n assert their_starry_domes(numberless_and_immeasurable_halls) is (\n numberless_and_immeasurable_halls)\n \n # Assert that this method successfully accepts and returns this string.\n assert FrequentWith.until_the_doves(numberless_and_immeasurable_halls) is (\n numberless_and_immeasurable_halls)\n \n # .....................{ FAIL }....................\n # Assert that this resolver raises the expected exception when passed an\n # uncallable object.\n with raises(BeartypePep563Exception):\n resolve_pep563('Mont Blanc yet gleams on high:\u2014the power is there,')\n \n # Assert that this method unsuccessfully raises the excepted exception, due\n # to being annotated by a missing forward reference.\n with raises(BeartypeCallHintForwardRefException):\n> and_thrones_radiant_with_chrysolite.crystal_column(\n 'Than gems or gold, the varying roof of heaven')\n\n> die_if_unbearable(and_clear_shrines, OfPearl_resolved)\n\n> func_raiser(obj) # pyright: ignore\n\n> > ???\nE beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value 'Than gems or gold, the varying roof of heaven' violates type hint None, as str 'Than gems or gold, the varying roof of heaven' not instance of .\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data\nLocation: /tmp/benchmark_p312r8k7/beartype/_check/forward/fwdmain.py:855\nError: beartype.roar.BeartypeDecorHintForwardRefException: Function beartype_test.a00_unit.data.hint.data_hintref.the_woods_are_lovely() parameter \"dark_and_deep\" stringified type hint 'beartype_test.a00_unit.data.hint.data_hintref.TheDarkestEveningOfTheYear' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_p312r8k7/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \nAttributeError: 'NoneType' object has no attribute 'a00_unit'\n\nTraceback:\n\n> def test_pep484_ref_data() -> None:\n '''\n Test successful usage of the :func:`beartype.beartype` decorator with\n respect to both PEP-compliant and -noncompliant forward references by\n importing an external data module declaring these references *before* the\n user-defined classes referred to by these references.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar import BeartypeCallHintReturnViolation\n> from beartype_test.a00_unit.data.hint.data_hintref import (\n BeforeTheHurricane,\n TheDarkestEveningOfTheYear,\n WithSluggishSurge,\n a_little_shallop,\n but_i_have_promises,\n its_fields_of_snow,\n of_easy_wind,\n stopping_by_woods_on,\n the_dry_leaf,\n the_woods_are_lovely,\n winding_among_the_springs,\n # between_the_woods_and_frozen_lake,\n )\n\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_params = _code_check_args(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> hint_or_sane = sanify_hint_root_func(\n\n> hint = decor_meta.func_arg_name_to_hint[pith_name] = coerce_func_hint_root(\n\n> hint = resolve_hint( # pyright: ignore\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypeDecorHintForwardRefException: Function beartype_test.a00_unit.data.hint.data_hintref.the_woods_are_lovely() parameter \"dark_and_deep\" stringified type hint 'beartype_test.a00_unit.data.hint.data_hintref.TheDarkestEveningOfTheYear' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_p312r8k7/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE AttributeError: 'NoneType' object has no attribute 'a00_unit'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #7: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #8: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #10: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #11: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py", "test_resolve_pep563" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py", "test_pep484_ref_data" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.272000000000002, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 4, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.010416666666666668, "bidirectional_harmonic": 0.18664832061213724, "degree": 4 }, "line_count": 26, "code_line_count": 26, "cyclomatic": 4, "halstead_volume": 24.0, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/utilpepget.py", "function_name": "get_hint_pep_origin_type_or_none", "test_info": { "success": false, "failed": 14, "passed": 1116, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_igt4we69/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:1049\nError: beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic typing.Generic[~S, ~T] subclasses no superclasses.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> hint_child_bases = get_hint_pep484585_generic_bases_unerased(\n\n> def get_hint_pep484585_generic_bases_unerased(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of the one or more **unerased pseudo-superclasses** (i.e.,\n PEP-compliant objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`- or\n :pep:`585`-compliant **generic** (i.e., class superficially subclassing at\n least one PEP-compliant type hint that is possibly *not* an actual class) if\n this object is a generic *or* raise an exception otherwise (i.e., if this\n object is *not* a generic).\n \n This getter is guaranteed to return a non-empty tuple. By definition, a\n generic is a type subclassing one or more generic superclasses.\n \n This getter is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as the implementation trivially reduces\n to an efficient one-liner.\n \n Caveats\n -------\n **This getter should always be called in lieu of attempting to directly\n access the low-level** ``__orig_bases__`` **dunder instance variable.**\n Most PEP-compliant type hints fail to declare that variable, guaranteeing\n :class:`AttributeError` exceptions from all general-purpose logic\n attempting to directly access that variable. Thus this function, which\n \"fills in the gaps\" by implementing this oversight.\n \n **This getter returns tuples possibly containing a mixture of actual\n superclasses and pseudo-superclasses superficially masquerading as actual\n superclasses subscripted by one or more PEP-compliant child hints or type\n variables** (e.g., ``(typing.Iterable[T], typing.Sized[T])``). Indeed, most\n type hints used as superclasses produced by subscripting PEP-compliant type\n hint factories are *not* actually types but singleton objects devilishly\n masquerading as types. Most actual :mod:`typing` superclasses are private,\n fragile, and prone to alteration or even removal between Python versions.\n \n Motivation\n ----------\n :pep:`560` (i.e., \"Core support for typing module and generic types)\n formalizes the ``__orig_bases__`` dunder attribute first informally\n introduced by the :mod:`typing` module's implementation of :pep:`484`.\n Naturally, :pep:`560` remains as unusable as :pep:`484` itself. Ideally,\n :pep:`560` would have generalized the core intention of preserving each\n original user-specified subclass tuple of superclasses as a full-blown\n ``__orig_mro__`` dunder attribute listing the original method resolution\n order (MRO) of that subclass had that tuple *not* been modified.\n \n Naturally, :pep:`560` did no such thing. The original MRO remains obfuscated\n and effectively inaccessible. While computing that MRO would technically be\n feasible, doing so would also be highly non-trivial, expensive, and fragile.\n Instead, this function retrieves *only* the tuple of :mod:`typing`-specific\n pseudo-superclasses that this object's class originally attempted (but\n failed) to subclass.\n \n You are probably now agitatedly cogitating to yourself in the darkness: \"But\n @leycec: what do you mean :pep:`560`? Wasn't :pep:`560` released *after*\n :pep:`484`? Surely no public API defined by the Python stdlib would be so\n malicious as to silently alter the tuple of base classes listed by a\n user-defined subclass?\"\n \n As we've established both above and elsewhere throughout the codebase,\n everything developed for :pep:`484` -- including :pep:`560`, which derives\n its entire raison d'etre from :pep:`484` -- are fundamentally insane. In\n this case, :pep:`484` is insane by subjecting parametrized :mod:`typing`\n types employed as base classes to \"type erasure,\" because:\n \n ...it is common practice in languages with generics (e.g. Java,\n TypeScript).\n \n Since Java and TypeScript are both terrible languages, blindly\n recapitulating bad mistakes baked into such languages is an equally bad\n mistake. In this case, \"type erasure\" means that the :mod:`typing` module\n *intentionally* destroys runtime type information for nebulous and largely\n unjustifiable reasons (i.e., Big Daddy Java and TypeScript do it, so it\n must be unquestionably good).\n \n Specifically, the :mod:`typing` module intentionally munges :mod:`typing`\n types listed as base classes in user-defined subclasses as follows:\n \n * All base classes whose origin is a builtin container (e.g.,\n ``typing.List[T]``) are reduced to that container (e.g., :class:`list`).\n * All base classes derived from an abstract base class declared by the\n :mod:`collections.abc` subpackage (e.g., ``typing.Iterable[T]``) are\n reduced to that abstract base class (e.g., ``collections.abc.Iterable``).\n * All surviving base classes that are parametrized (e.g.,\n ``typing.Generic[S, T]``) are stripped of that parametrization (e.g.,\n :class:`typing.Generic`).\n \n Since there exists no counterpart to the :class:`typing.Generic` superclass,\n the :mod:`typing` module preserves that superclass in unparametrized form.\n Naturally, this is useless, as an unparametrized :class:`typing.Generic`\n superclass conveys no meaningful type information. All other superclasses\n are reduced to their non-:mod:`typing` counterparts: e.g.,\n \n .. code-block:: pycon\n \n >>> from typing import TypeVar, Generic, Iterable, List\n >>> T = TypeVar('T')\n >>> class UserDefinedGeneric(List[T], Iterable[T], Generic[T]): pass\n # This is type erasure.\n >>> UserDefinedGeneric.__mro__\n (list, collections.abc.Iterable, Generic)\n # This is type preservation -- except the original MRO is discarded.\n # So, it's not preservation; it's reduction! We take what we can get.\n >>> UserDefinedGeneric.__orig_bases__\n (typing.List[T], typing.Iterable[T], typing.Generic[T])\n # Guess which we prefer?\n \n So, we prefer the generally useful ``__orig_bases__`` dunder tuple over the\n generally useless ``__mro__`` dunder tuple. Note, however, that the latter\n *is* still occasionally useful and thus occasionally returned by this\n getter. For inexplicable reasons, **single-inherited protocols** (i.e.,\n classes directly subclassing *only* the :pep:`544`-compliant\n :attr:`typing.Protocol` abstract base class (ABC)) are *not* subject to type\n erasure and thus constitute a notable exception to this heuristic:\n \n .. code-block:: pycon\n \n >>> from typing import Protocol\n >>> class UserDefinedProtocol(Protocol): pass\n >>> UserDefinedProtocol.__mro__\n (__main__.UserDefinedProtocol, typing.Protocol, typing.Generic, object)\n >>> UserDefinedProtocol.__orig_bases__\n AttributeError: type object 'UserDefinedProtocol' has no attribute\n '__orig_bases__'\n \n Welcome to :mod:`typing` hell, where even :mod:`typing` types lie broken and\n misshapen on the killing floor of overzealous theory-crafting purists.\n \n Parameters\n ----------\n hint : Hint\n Generic type hint to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this generic.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * Neither a :pep:`484`- nor :pep:`585`-compliant generic.\n * A :pep:`484`- or :pep:`585`-compliant generic subclassing *no*\n pseudo-superclasses.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.typing import Container, Iterable, TypeVar\n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_bases_unerased)\n \n >>> T = TypeVar('T')\n >>> class MuhIterable(Iterable[T], Container[T]): pass\n \n >>> get_hint_pep585_generic_bases_unerased(MuhIterable)\n (typing.Iterable[~T], typing.Container[~T])\n \n >>> MuhIterable.__mro__\n (MuhIterable,\n collections.abc.Iterable,\n collections.abc.Container,\n typing.Generic,\n object)\n '''\n \n # ....................{ IMPORTS }....................\n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic_user)\n \n # ....................{ LOCALS }....................\n # Tuple of either...\n #\n # Note this implicitly raises a \"BeartypeDecorHintPepException\" if this\n # object is *NOT* a PEP-compliant generic. Ergo, we need not explicitly\n # validate that above.\n hint_pep_generic_bases_unerased = (\n # If this is a PEP 585-compliant generic, all unerased\n # pseudo-superclasses of this PEP 585-compliant generic.\n #\n # Note that this unmemoized getter accepts keyword arguments.\n get_hint_pep585_generic_bases_unerased(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n if is_hint_pep585_generic(hint) else\n # Else, this *MUST* be a PEP 484-compliant generic. In this case, all\n # unerased pseudo-superclasses of this PEP 484-compliant generic.\n #\n # Note that this memoized getter prohibits keyword arguments.\n get_hint_pep484_generic_bases_unerased(\n hint,\n exception_cls,\n exception_prefix,\n )\n )\n \n # ....................{ RETURN }....................\n # If this generic....\n if (\n # Subclasses no pseudo-superclasses *AND*...\n not hint_pep_generic_bases_unerased and\n # Is user-defined by a third-party downstream codebase.\n is_hint_pep484585_generic_user(hint)\n ):\n # Raise an exception. By definition, *ALL* user-defined generics should\n # subclass at least one pseudo-superclass. Note that this constraint:\n # * Does *NOT* apply to standard generics defined by either:\n # * The standard \"typing\" module (e.g., \"typing.Generic[S, T]\").\n # * The Python interpreter itself (e.g., \"list[T]\").\n # Why? Because these generics are the root superclasses that other\n # user-defined generics subclass. Clearly, they have no\n # pseudo-superclasses.\n # * Should have already been guaranteed on our behalf by:\n # * If this generic is PEP 484-compliant, the standard \"typing\" module.\n # * If this generic is PEP 585-compliant, the Python interpreter itself.\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n> raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'subclasses no superclasses.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic typing.Generic[~S, ~T] subclasses no superclasses.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user\nLocation: /tmp/benchmark_igt4we69/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py:162\nError: AssertionError: assert True is False\n + where True = ()\n\nTraceback:\n\n> def test_is_hint_pep484585_generic_user(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest.is_hint_pep484585_generic_user`\n tester.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic,\n is_hint_pep484585_generic_user,\n )\n from beartype.typing import (\n Generic,\n Protocol,\n Sequence,\n TypeVar,\n )\n \n # ....................{ TYPEVARS }....................\n # Arbitrary unconstrained type variables referenced below.\n T = TypeVar('T')\n \n # ....................{ LOCALS }....................\n # Tuple of zero or more generics that are *NOT* user-defined by third-party\n # logic residing outside the standard Python library.\n GENERICS_NONUSER = (\n Generic,\n Generic[T],\n Protocol,\n Protocol[T],\n Sequence[T],\n )\n \n # ....................{ ASSERTS }....................\n # Assert this tester rejects all non-user-defined generics.\n for generic_nonuser in GENERICS_NONUSER:\n> assert is_hint_pep484585_generic_user(generic_nonuser) is False\nE AssertionError: assert True is False\nE + where True = ()\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_is_hint_pep544_io_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #5: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #6: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #7: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #8: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #12: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #13: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #14: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py", "test_is_hint_pep484585_generic_user" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 4, "true_in_degree": 17.600000000000005, "out_degree": 1, "betweenness": 3.0708980028324516e-05, "pagerank": 0.0014169902167177075, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.21123262702210113, "degree": 5 }, "line_count": 18, "code_line_count": 18, "cyclomatic": 5, "halstead_volume": 11.60964047443681, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextansi.py", "function_name": "color_type", "test_info": { "success": false, "failed": 7, "passed": 1123, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep586.py::test_is_hint_pep586\nLocation: /tmp/benchmark_k3kusmq1/beartype/_util/text/utiltextjoin.py:130\nError: TypeError: sequence item 0: expected str instance, NoneType found\n\nTraceback:\n\n> def test_is_hint_pep586() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep586.die_unless_hint_pep586`\n raiser.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep586Exception\n from beartype.typing import Optional\n from beartype._util.hint.pep.proposal.pep586 import (\n die_unless_hint_pep586)\n from beartype._util.api.standard.utiltyping import get_typing_attrs\n from enum import Enum\n \n # ....................{ LOCALS }....................\n class _Color(Enum):\n '''\n Arbitrary enumeration to be tested below.\n '''\n \n RED = 0\n \n \n # Tuple of arbitrary objects permissible for use as arguments subscripting\n # PEP 586-compliant \"Literal\" type hints.\n #\n # For conformance, the items of this tuple are copied verbatim from a\n # prominent PEP 586 example under the \"Legal parameters for Literal at type\n # check time\" subsection.\n _LITERAL_ARGS = (\n 26,\n 0x1A,\n -4,\n \"hello world\",\n b\"hello world\",\n u\"hello world\",\n True,\n _Color.RED,\n None,\n )\n \n # ..................{ FACTORIES }..................\n # For each PEP 586-compliant \"Literal\" factory importable from each\n # currently importable \"typing\" module...\n for Literal in get_typing_attrs('Literal'):\n # ....................{ PASS }....................\n # For each object that is a valid literal argument, assert this raiser\n # raises no exception when passed that factory subscripted by that\n # argument.\n for literal_arg in _LITERAL_ARGS:\n die_unless_hint_pep586(Literal[literal_arg])\n \n # Assert this raiser raises no exception when passed that factory\n # subscripted by two or more such arguments.\n die_unless_hint_pep586(Literal[\n 26, \"hello world\", b\"hello world\", True, _Color.RED, None])\n \n # ....................{ FAIL }....................\n # Assert this validator raises the expected exception when passed an\n # object that is *NOT* a literal.\n with raises(BeartypeDecorHintPep586Exception):\n die_unless_hint_pep586(Optional[str])\n \n # Assert this raiser raises the expected exception when passed that\n # unsubscripted factory.\n with raises(BeartypeDecorHintPep586Exception):\n die_unless_hint_pep586(Literal)\n \n # Assert this raiser raises the expected exception when passed that\n # factory subscripted by the empty tuple.\n with raises(BeartypeDecorHintPep586Exception):\n> die_unless_hint_pep586(Literal[()])\n\n> hint_literal_types = join_delimited_disjunction_types(\n\n> return join_delimited_disjunction(\n\n> return join_delimited(\n\n> def join_delimited(\n # Mandatory parameters.\n strs: IterableStrs,\n \n # Mandatory keyword-only parameters.\n *,\n delimiter_if_two: str,\n delimiter_if_three_or_more_nonlast: str,\n delimiter_if_three_or_more_last: str,\n \n # Optional keyword-only parameters.\n is_double_quoted: bool = False,\n ) -> str:\n '''\n Concatenate the passed iterable of zero or more strings delimited by the\n passed delimiter (conditionally depending on both the length of this\n sequence and index of each string in this sequence), yielding a\n human-readable string listing arbitrarily many substrings.\n \n Specifically, this function returns either:\n \n * If this iterable contains no strings, the empty string.\n * If this iterable contains one string, this string as is is unmodified.\n * If this iterable contains two strings, these strings delimited by the\n passed ``delimiter_if_two`` delimiter.\n * If this iterable contains three or more strings, a string listing these\n contained strings such that:\n \n * All contained strings except the last two are suffixed by the passed\n ``delimiter_if_three_or_more_nonlast`` delimiter.\n * The last two contained strings are delimited by the passed\n ``delimiter_if_three_or_more_last`` separator.\n \n Parameters\n ----------\n strs : Iterable[str]\n Iterable of all strings to be joined.\n delimiter_if_two : str\n Substring separating each string contained in this iterable if this\n iterable contains exactly two strings.\n delimiter_if_three_or_more_nonlast : str\n Substring separating each string *except* the last two contained in\n this iterable if this iterable contains three or more strings.\n delimiter_if_three_or_more_last : str\n Substring separating each string the last two contained in this\n iterable if this iterable contains three or more strings.\n is_double_quoted : bool, optional\n :data:`True` only if **double-quoting** (i.e., both prefixing and\n suffixing by the ``\"`` character) each item of this iterable. Defaults\n to :data:`False`.\n \n Returns\n -------\n str\n Concatenation of these strings.\n \n Examples\n --------\n >>> join_delimited(\n ... strs=('Fulgrim', 'Perturabo', 'Angron', 'Mortarion'),\n ... delimiter_if_two=' and ',\n ... delimiter_if_three_or_more_nonlast=', ',\n ... delimiter_if_three_or_more_last=', and ',\n ... )\n 'Fulgrim, Perturabo, Angron, and Mortarion'\n '''\n assert isinstance(strs, IterableABC) and not isinstance(strs, str), (\n f'{repr(strs)} not non-string iterable.')\n assert isinstance(delimiter_if_two, str), (\n f'{repr(delimiter_if_two)} not string.')\n assert isinstance(delimiter_if_three_or_more_nonlast, str), (\n f'{repr(delimiter_if_three_or_more_nonlast)} not string.')\n assert isinstance(delimiter_if_three_or_more_last, str), (\n f'{repr(delimiter_if_three_or_more_last)} not string.')\n \n # If this iterable is *NOT* a sequence, internally coerce this iterable\n # into a sequence for subsequent indexing purposes.\n if not isinstance(strs, SequenceABC):\n strs = tuple(strs)\n # Else, this iterable is already a sequence.\n #\n # In either case, this iterable is now a sequence.\n \n # If double-quoting these strings, do so.\n if is_double_quoted:\n strs = tuple(f'\"{text}\"' for text in strs)\n # Else, preserve these strings as is.\n \n # Number of strings in this sequence.\n num_strs = len(strs)\n \n # If no strings are passed, return the empty string.\n if num_strs == 0:\n return ''\n # If one string is passed, return this string as is.\n elif num_strs == 1:\n # This is clearly a string, yet mypy thinks it's Any\n return strs[0] # type: ignore[no-any-return]\n # If two strings are passed, return these strings delimited appropriately.\n elif num_strs == 2:\n return f'{strs[0]}{delimiter_if_two}{strs[1]}'\n # Else, three or more strings are passed.\n \n # All such strings except the last two, delimited appropriately.\n> strs_nonlast = delimiter_if_three_or_more_nonlast.join(strs[0:-2])\nE TypeError: sequence item 0: expected str instance, NoneType found\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_type\nLocation: /tmp/benchmark_k3kusmq1/beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py:156\nError: AssertionError: assert None == 'str'\n + where None = (str)\n\nTraceback:\n\n> def test_label_type() -> None:\n '''\n Test the :func:`beartype._util.text.utiltextlabel.label_type`\n function.\n '''\n \n # Defer test-specific imports.\n from beartype._util.text.utiltextlabel import label_type\n from beartype_test.a00_unit.data.data_type import Class\n \n # Assert this labeller returns the expected label for a builtin type.\n> assert label_type(str) == 'str'\nE AssertionError: assert None == 'str'\nE + where None = (str)\n", "Failure #3: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_pith", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #7: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep586.py", "test_is_hint_pep586" ], [ "beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py", "test_label_type" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 5, "true_in_degree": 18.28000000000001, "out_degree": 1, "betweenness": 0.00013819041012746034, "pagerank": 0.0009278733729343443, "harmonic": 0.0024671052631578946, "bidirectional_harmonic": 0.20940971035543485, "degree": 6 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 3, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484585/pep484585ref.py", "function_name": "get_hint_pep484585_ref_names", "test_info": { "success": false, "failed": 18, "passed": 1112, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py::test_get_hint_pep484585_ref_names\nLocation: /tmp/benchmark_lpjaytr5/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py:55\nError: AssertionError: assert None == (None, 'He_overleaps.the.bounds')\n + where None = ('He_overleaps.the.bounds')\n\nTraceback:\n\n> def test_get_hint_pep484585_ref_names() -> None:\n '''\n Test\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585ref.get_hint_pep484585_ref_names`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintForwardRefException\n from beartype.typing import ForwardRef\n from beartype._util.hint.pep.proposal.pep484585.pep484585ref import (\n get_hint_pep484585_ref_names)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Arbitrary absolute forward references defined as strings.\n ALAS_ALAS = 'He_overleaps.the.bounds'\n BREATH_AND = 'Were.limbs_and.breath_and'\n \n # Arbitrary absolute forward reference defined as a non-string.\n BEING_INTERTWINED = ForwardRef(BREATH_AND)\n \n # Arbitrary fully-qualified names of a hypothetical module.\n OF_DIM_SLEEP = 'In_the.wide.pathless_desert'\n \n # Arbitrary relative forward reference defined as a string.\n THUS_TREACHEROUSLY = 'Lost_lost_for_ever_lost'\n \n # ....................{ PASS }....................\n # Assert this getter preserves the passed absolute forward reference as is\n # when defined as a string, regardless of whether the second passed object\n # defines the \"__module__\" dunder attribute.\n> assert get_hint_pep484585_ref_names(ALAS_ALAS) == (None, ALAS_ALAS)\nE AssertionError: assert None == (None, 'He_overleaps.the.bounds')\nE + where None = ('He_overleaps.the.bounds')\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py::test_get_hint_pep484585_ref_names_relative_to\nLocation: /tmp/benchmark_lpjaytr5/beartype/_util/hint/pep/proposal/pep484585/pep484585ref.py:320\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_get_hint_pep484585_ref_names_relative_to() -> None:\n '''\n Test\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585ref.get_hint_pep484585_ref_names_relative_to`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintForwardRefException\n from beartype.typing import ForwardRef\n from beartype._util.hint.pep.proposal.pep484585.pep484585ref import (\n get_hint_pep484585_ref_names_relative_to)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n ClassModuleNameFake,\n ClassModuleNameNone,\n function_module_name_fake,\n function_module_name_none,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Fully-qualified name of the current module defining this unit test.\n THIS_MODULE_NAME = __name__\n \n # Arbitrary absolute forward references defined as strings.\n ALAS_ALAS = 'He_overleaps.the.bounds'\n THE_MASK_OF_ANARCHY = 'as_I.lay_asleep.in_Italy'\n WITH_GREAT_POWER_IT = 'And_with.great_power.it_forth.led_me'\n \n # Arbitrary absolute forward reference defined as a non-string.\n WITH_GREAT_POWER = ForwardRef(WITH_GREAT_POWER_IT)\n \n # Arbitrary fully-qualified names of hypothetical modules.\n CASTLEREAGH = 'He_had.a_mask.like_Castlereagh'\n OF_DIM_SLEEP = 'In_the.wide.pathless_desert'\n \n # Arbitrary relative forward references defined as strings.\n VERY_SMOOTH = 'Very_smooth_he_looked_yet_grim'\n THUS_TREACHEROUSLY = 'Lost_lost_for_ever_lost'\n \n # ....................{ CALLABLES }....................\n def and_pendent_mountains():\n '''\n Arbitrary function whose ``__module__`` dunder attribute is preserved as\n the fully-qualified name of this currently importable module.\n '''\n \n pass\n \n # ....................{ CLASSES }....................\n class OfRainbowClouds(object):\n '''\n Arbitrary class whose ``__module__`` dunder attribute is preserved as\n the fully-qualified name of this currently importable module.\n '''\n \n pass\n \n # ....................{ PASS }....................\n # Assert that this getter preserves an absolute forward reference in string\n # format as is.\n> assert get_hint_pep484585_ref_names_relative_to(THE_MASK_OF_ANARCHY) == (\n None, THE_MASK_OF_ANARCHY)\n\n> def get_hint_pep484585_ref_names_relative_to(\n # Mandatory parameters.\n hint: Pep484585ForwardRef,\n \n # Optional parameters.\n cls_stack: TypeStack = None,\n func: Optional[Callable] = None,\n exception_cls: TypeException = BeartypeDecorHintForwardRefException,\n exception_prefix: str = '',\n ) -> Tuple[Optional[str], str]:\n '''\n Possibly undefined fully-qualified module name and possibly qualified\n classname referred to by the passed **forward reference type hint** (i.e.,\n object indirectly referring to a user-defined class that typically has yet\n to be defined), canonicalized relative to the module declaring the passed\n type stack and/or callable (in that order) if this classname is unqualified.\n \n This getter is intentionally *not* memoized (e.g., by the\n ``callable_cached`` decorator), as the implementation mostly reduces to an\n efficient one-liner.\n \n Caveats\n -------\n This getter preferentially canonicalizes this forward reference if relative\n against the fully-qualified name of the module defining (in order):\n \n #. The passed class stack if *not* :data:`None`.\n #. The passed callable.\n \n This getter thus prioritizes classes over callables. Why? Because classes\n are more likely to define ``__module__`` dunder attributes referring to\n importable modules that physically exist. Why? Because dynamically\n synthesizing in-memory callables residing in imaginary and thus unimportable\n modules is trivial; dynamically synthesizing in-memory classes residing in\n imaginary and thus unimportable modules is less trivial.\n \n Consider the standard use case for :mod:`beartype`: beartype import hooks\n declared by the :mod:`beartype.claw` subpackage. Although hooks directly\n apply the :func:`beartype.beartype` decorator to classes and functions\n residing in importable modules that physically exist, that decorator then\n dynamically iterates over the methods of those classes. That iteration is\n dynamic and iterates over methods that both physically exist and only\n dynamically exist in-memory in unimportable modules.\n \n Does this edge case arise in real-world code? All too frequently. For\n unknown reasons, the :class:`typing.NamedTuple` superclass dynamically\n generates dunder methods (e.g., ``__new__``) whose ``__module__`` dunder\n attributes erroneously refer to imaginary and thus unimportable modules\n ``named_{subclass_name}`` for the unqualified basename ``{subclass_name}``\n of the current user-defined class subclassing :class:`typing.NamedTuple`\n despite that user-defined class residing in an importable module: e.g.,\n \n .. code-block:: pycon\n \n >>> from beartype import beartype\n >>> from typing import NamedTuple\n \n >>> @beartype\n ... class NamelessTupleIsBlameless(NamedTuple):\n ... forward_ref: 'UndefinedType'\n \n >>> NamelessTupleIsBlameless.__module__\n '__main__' # <-- makes sense\n >>> NamelessTupleIsBlameless.__new__.__module__\n 'named_NamelessTupleIsBlameless' # <-- lol wut\n \n If this getter erroneously prioritized callables over classes *and* blindly\n accepted imaginary modules as valid, this getter would erroneously resolve\n the relative forward reference ``'UndefinedType'`` to\n ``'named_NamelessTupleIsBlameless.UndefinedType'`` rather than to\n ``'__main__.UndefinedType'``. And... this is why @leycec is currently bald.\n \n Parameters\n ----------\n hint : object\n Forward reference to be canonicalized.\n cls_stack : TypeStack\n Either:\n \n * If this forward reference annotates a method of a class, the\n corresponding **type stack** (i.e., tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing that\n method). If this forward reference is unqualified (i.e., relative),\n this getter then canonicalizes this reference against that class.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n func : Optional[Callable]\n Either:\n \n * If this forward reference annotates a callable, that callable.\n If this forward reference is also unqualified (i.e., relative), this\n getter then canonicalizes this reference against that callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error. Defaults\n to :exc:`.BeartypeDecorHintForwardRefException`.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to the empty string.\n \n Returns\n -------\n Tuple[Optional[str], str]\n 2-tuple ``(ref_module_name, ref_name)`` where:\n \n * ``ref_module_name`` is the possibly undefined fully-qualified module\n name referred to by this forward reference, defined as either:\n \n * If this forward reference is a :class:`typing.ForwardRef` object\n passed a module name at instantiation time via the ``module``\n parameter *or* a type stack or callable defining a module name via\n the ``__module`` dunder attribute are passed, this module name.\n * Else, :data:`None`.\n \n * ``ref_name`` is the possibly qualified classname referred to by this\n forward reference.\n \n Raises\n ------\n exception_cls\n If either:\n \n * This forward reference is *not* actually a forward reference.\n * This forward reference is **relative** (i.e., contains *no* ``.``\n delimiters) and either:\n \n * Neither the passed callable nor class define the ``__module__``\n dunder attribute.\n * The passed callable and/or class define the ``__module__``\n dunder attribute, but the values of those attributes all refer to\n unimportable modules that do *not* appear to physically exist.\n \n See Also\n --------\n :func:`.get_hint_pep484585_ref_names`\n Lower-level getter returning possibly relative forward references.\n '''\n \n # Possibly undefined fully-qualified module name and possibly unqualified\n # classname referred to by this forward reference.\n> hint_module_name, hint_ref_name = get_hint_pep484585_ref_names(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\nE TypeError: cannot unpack non-iterable NoneType object\n", "Failure #3: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_express_func_scope_type_ref", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #18: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py", "test_get_hint_pep484585_ref_names" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py", "test_get_hint_pep484585_ref_names_relative_to" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 2, "true_in_degree": 10.960000000000004, "out_degree": 1, "betweenness": 5.1482701812191104e-05, "pagerank": 0.0004937466945572531, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.21751134464950295, "degree": 3 }, "line_count": 17, "code_line_count": 17, "cyclomatic": 3, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextlabel.py", "function_name": "label_type", "test_info": { "success": false, "failed": 7, "passed": 1123, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep586.py::test_is_hint_pep586\nLocation: /tmp/benchmark_xe_yrc24/beartype/_util/text/utiltextjoin.py:130\nError: TypeError: sequence item 0: expected str instance, NoneType found\n\nTraceback:\n\n> def test_is_hint_pep586() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep586.die_unless_hint_pep586`\n raiser.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep586Exception\n from beartype.typing import Optional\n from beartype._util.hint.pep.proposal.pep586 import (\n die_unless_hint_pep586)\n from beartype._util.api.standard.utiltyping import get_typing_attrs\n from enum import Enum\n \n # ....................{ LOCALS }....................\n class _Color(Enum):\n '''\n Arbitrary enumeration to be tested below.\n '''\n \n RED = 0\n \n \n # Tuple of arbitrary objects permissible for use as arguments subscripting\n # PEP 586-compliant \"Literal\" type hints.\n #\n # For conformance, the items of this tuple are copied verbatim from a\n # prominent PEP 586 example under the \"Legal parameters for Literal at type\n # check time\" subsection.\n _LITERAL_ARGS = (\n 26,\n 0x1A,\n -4,\n \"hello world\",\n b\"hello world\",\n u\"hello world\",\n True,\n _Color.RED,\n None,\n )\n \n # ..................{ FACTORIES }..................\n # For each PEP 586-compliant \"Literal\" factory importable from each\n # currently importable \"typing\" module...\n for Literal in get_typing_attrs('Literal'):\n # ....................{ PASS }....................\n # For each object that is a valid literal argument, assert this raiser\n # raises no exception when passed that factory subscripted by that\n # argument.\n for literal_arg in _LITERAL_ARGS:\n die_unless_hint_pep586(Literal[literal_arg])\n \n # Assert this raiser raises no exception when passed that factory\n # subscripted by two or more such arguments.\n die_unless_hint_pep586(Literal[\n 26, \"hello world\", b\"hello world\", True, _Color.RED, None])\n \n # ....................{ FAIL }....................\n # Assert this validator raises the expected exception when passed an\n # object that is *NOT* a literal.\n with raises(BeartypeDecorHintPep586Exception):\n die_unless_hint_pep586(Optional[str])\n \n # Assert this raiser raises the expected exception when passed that\n # unsubscripted factory.\n with raises(BeartypeDecorHintPep586Exception):\n die_unless_hint_pep586(Literal)\n \n # Assert this raiser raises the expected exception when passed that\n # factory subscripted by the empty tuple.\n with raises(BeartypeDecorHintPep586Exception):\n> die_unless_hint_pep586(Literal[()])\n\n> hint_literal_types = join_delimited_disjunction_types(\n\n> return join_delimited_disjunction(\n\n> return join_delimited(\n\n> def join_delimited(\n # Mandatory parameters.\n strs: IterableStrs,\n \n # Mandatory keyword-only parameters.\n *,\n delimiter_if_two: str,\n delimiter_if_three_or_more_nonlast: str,\n delimiter_if_three_or_more_last: str,\n \n # Optional keyword-only parameters.\n is_double_quoted: bool = False,\n ) -> str:\n '''\n Concatenate the passed iterable of zero or more strings delimited by the\n passed delimiter (conditionally depending on both the length of this\n sequence and index of each string in this sequence), yielding a\n human-readable string listing arbitrarily many substrings.\n \n Specifically, this function returns either:\n \n * If this iterable contains no strings, the empty string.\n * If this iterable contains one string, this string as is is unmodified.\n * If this iterable contains two strings, these strings delimited by the\n passed ``delimiter_if_two`` delimiter.\n * If this iterable contains three or more strings, a string listing these\n contained strings such that:\n \n * All contained strings except the last two are suffixed by the passed\n ``delimiter_if_three_or_more_nonlast`` delimiter.\n * The last two contained strings are delimited by the passed\n ``delimiter_if_three_or_more_last`` separator.\n \n Parameters\n ----------\n strs : Iterable[str]\n Iterable of all strings to be joined.\n delimiter_if_two : str\n Substring separating each string contained in this iterable if this\n iterable contains exactly two strings.\n delimiter_if_three_or_more_nonlast : str\n Substring separating each string *except* the last two contained in\n this iterable if this iterable contains three or more strings.\n delimiter_if_three_or_more_last : str\n Substring separating each string the last two contained in this\n iterable if this iterable contains three or more strings.\n is_double_quoted : bool, optional\n :data:`True` only if **double-quoting** (i.e., both prefixing and\n suffixing by the ``\"`` character) each item of this iterable. Defaults\n to :data:`False`.\n \n Returns\n -------\n str\n Concatenation of these strings.\n \n Examples\n --------\n >>> join_delimited(\n ... strs=('Fulgrim', 'Perturabo', 'Angron', 'Mortarion'),\n ... delimiter_if_two=' and ',\n ... delimiter_if_three_or_more_nonlast=', ',\n ... delimiter_if_three_or_more_last=', and ',\n ... )\n 'Fulgrim, Perturabo, Angron, and Mortarion'\n '''\n assert isinstance(strs, IterableABC) and not isinstance(strs, str), (\n f'{repr(strs)} not non-string iterable.')\n assert isinstance(delimiter_if_two, str), (\n f'{repr(delimiter_if_two)} not string.')\n assert isinstance(delimiter_if_three_or_more_nonlast, str), (\n f'{repr(delimiter_if_three_or_more_nonlast)} not string.')\n assert isinstance(delimiter_if_three_or_more_last, str), (\n f'{repr(delimiter_if_three_or_more_last)} not string.')\n \n # If this iterable is *NOT* a sequence, internally coerce this iterable\n # into a sequence for subsequent indexing purposes.\n if not isinstance(strs, SequenceABC):\n strs = tuple(strs)\n # Else, this iterable is already a sequence.\n #\n # In either case, this iterable is now a sequence.\n \n # If double-quoting these strings, do so.\n if is_double_quoted:\n strs = tuple(f'\"{text}\"' for text in strs)\n # Else, preserve these strings as is.\n \n # Number of strings in this sequence.\n num_strs = len(strs)\n \n # If no strings are passed, return the empty string.\n if num_strs == 0:\n return ''\n # If one string is passed, return this string as is.\n elif num_strs == 1:\n # This is clearly a string, yet mypy thinks it's Any\n return strs[0] # type: ignore[no-any-return]\n # If two strings are passed, return these strings delimited appropriately.\n elif num_strs == 2:\n return f'{strs[0]}{delimiter_if_two}{strs[1]}'\n # Else, three or more strings are passed.\n \n # All such strings except the last two, delimited appropriately.\n> strs_nonlast = delimiter_if_three_or_more_nonlast.join(strs[0:-2])\nE TypeError: sequence item 0: expected str instance, NoneType found\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_type\nLocation: /tmp/benchmark_xe_yrc24/beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py:156\nError: AssertionError: assert None == 'str'\n + where None = (str)\n\nTraceback:\n\n> def test_label_type() -> None:\n '''\n Test the :func:`beartype._util.text.utiltextlabel.label_type`\n function.\n '''\n \n # Defer test-specific imports.\n from beartype._util.text.utiltextlabel import label_type\n from beartype_test.a00_unit.data.data_type import Class\n \n # Assert this labeller returns the expected label for a builtin type.\n> assert label_type(str) == 'str'\nE AssertionError: assert None == 'str'\nE + where None = (str)\n", "Failure #3: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_pith", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #7: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep586.py", "test_is_hint_pep586" ], [ "beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py", "test_label_type" ] ] }, "complexity_info": { "centrality": { "distance_discount": 14.670080000000006, "in_degree": 5, "true_in_degree": 21.48000000000001, "out_degree": 5, "betweenness": 0.001362259386109425, "pagerank": 0.0015677111825566782, "harmonic": 0.0206140350877193, "bidirectional_harmonic": 0.2470800580997949, "degree": 10 }, "line_count": 32, "code_line_count": 32, "cyclomatic": 8, "halstead_volume": 15.509775004326936, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/checkmake.py", "function_name": "make_code_raiser_func_pith_check", "test_info": { "success": false, "failed": 81, "passed": 1049, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_x9roj8fa/beartype/_decor/wrap/_wrapreturn.py:187\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> def code_check_return(decor_meta: BeartypeDecorMeta) -> str:\n '''\n Generate a Python code snippet type-checking the annotated return declared\n by the decorated callable if any *or* the empty string otherwise (i.e., if\n this return is unannotated).\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to be type-checked.\n \n Returns\n -------\n str\n Code type-checking any annotated return of the decorated callable.\n \n Raises\n ------\n BeartypeDecorHintPep484585Exception\n If this callable is either:\n \n * A coroutine *not* annotated by a :obj:`typing.Coroutine` type hint.\n * A generator *not* annotated by a :obj:`typing.Generator` type hint.\n * An asynchronous generator *not* annotated by a\n :obj:`typing.AsyncGenerator` type hint.\n BeartypeDecorHintNonpepException\n If the type hint annotating this return (if any) of this callable is\n neither:\n \n * **PEP-compliant** (i.e., :mod:`beartype`-agnostic hint compliant with\n annotation-centric PEPs).\n * **PEP-noncompliant** (i.e., :mod:`beartype`-specific type hint *not*\n compliant with annotation-centric PEPs)).\n '''\n assert isinstance(decor_meta, BeartypeDecorMeta), (\n f'{repr(decor_meta)} not beartype call.')\n \n # ..................{ LOCALS }..................\n # Possibly insane hint annotating this callable's return if any *OR* the\n # sentinel placeholder otherwise (i.e., if this return is unannotated).\n #\n # Note that \"None\" is a semantically meaningful PEP 484-compliant hint\n # equivalent to \"type(None)\". Ergo, we *MUST* explicitly distinguish between\n # \"None\" and an unannotated return with a sentinel.\n hint_insane: Hint = decor_meta.func_arg_name_to_hint_get( # pyright: ignore\n ARG_NAME_RETURN, SENTINEL)\n # print(f'func {decor_meta} return hint_insane: {hint_insane}')\n \n # If this return is unannotated, silently reduce to a noop.\n if hint_insane is SENTINEL:\n return ''\n # Else, this return is annotated.\n \n # Python code snippet to be returned, defaulting to the empty string\n # implying this callable's return to either be unannotated *OR* annotated by\n # a safely ignorable type hint.\n func_wrapper_code = ''\n \n # Lexical scope (i.e., dictionary mapping from the relative unqualified name\n # to value of each locally or globally scoped attribute accessible to a\n # callable or class), initialized to \"None\" for safety.\n func_scope: LexicalScope = None # type: ignore[assignment]\n \n # ..................{ GENERATE }..................\n # Attempt to...\n try:\n # With a context manager \"catching\" *ALL* non-fatal warnings emitted\n # during this logic for subsequent \"playrback\" below...\n with catch_warnings(record=True) as warnings_issued:\n # Sane hint sanified from this possibly insane return hint if\n # sanifying this hint generated no supplementary metadata *OR*\n # that metadata otherwise. Additionally, if this hint is unsupported\n # by @beartype, raise an exception.\n #\n # Note that:\n # * This hint must sanitized *BEFORE* testing this hint. Why? The\n # PEP 484-compliant \"typing.NoReturn\" return hint in conjunction\n # with PEP 563. If this return hint is \"typing.NoReturn\" *AND*\n # this submodule enables PEP 563 via \"from __future__ import\n # annotations, then this hint will be the useless string\n # \"NoReturn\" rather than the useful hint \"typing.NoReturn\". In\n # this case, this hist *MUST* be sanitized first; doing so\n # destringifies this string into a usable hint, enabling this hint\n # to then be detected below.\n # * For the exact same reason, this sanitization *CANNOT* be\n # performed in the low-level make_check_expr() dynamically\n # generating code type-checking this hint.\n hint_or_sane = sanify_hint_root_func(\n decor_meta=decor_meta,\n hint=hint_insane,\n pith_name=ARG_NAME_RETURN,\n exception_prefix=EXCEPTION_PLACEHOLDER,\n )\n # print(f'Sanified {repr(decor_meta.func_wrappee)} return hint {repr(hint_insane)} to {repr(hint)}...')\n \n # If this is the PEP 484-compliant \"typing.NoReturn\" type hint\n # allowed *ONLY* as a return annotation...\n if hint_or_sane is NoReturn:\n # Pre-generated code snippet validating this callable to *NEVER*\n # successfully return by unconditionally generating a violation.\n code_noreturn_check = PEP484_CODE_CHECK_NORETURN.format(\n func_call_prefix=decor_meta.func_wrapper_code_call_prefix)\n \n # Code snippet handling the previously generated violation by\n # either raising that violation as a fatal exception or emitting\n # that violation as a non-fatal warning.\n (\n code_noreturn_violation,\n func_scope,\n _\n ) = make_code_raiser_func_pep484_noreturn_check(decor_meta.conf)\n \n # Full code snippet to be returned.\n func_wrapper_code = (\n f'{code_noreturn_check}{code_noreturn_violation}')\n # Else, this is *NOT* \"typing.NoReturn\".\n #\n # If this hint is unignorable...\n elif hint_or_sane is not Any:\n # Type stack if required by this hint *OR* \"None\" otherwise.\n # See is_hint_needs_cls_stack() for details.\n #\n # Note that the original unsanitized \"hint_insane\" (e.g.,\n # \"typing.Self\") rather than the new sanitized \"hint\" (e.g.,\n # the class currently being decorated by @beartype) is\n # passed to that tester. See _code_check_args() for details.\n cls_stack = (\n decor_meta.cls_stack\n if is_hint_needs_cls_stack(hint_insane) else\n None\n )\n # print(f'return hint {repr(hint_insane)} -> {repr(hint)} cls_stack: {repr(cls_stack)}')\n \n #FIXME: Uhh... wat? This shouldn't be necessary at all. Excise!\n # # Empty tuple, passed below to satisfy the\n # # unmemoize_func_wrapper_code() API.\n # hint_refs_type_basename = ()\n \n # Code snippet type-checking any arbitrary return.\n> (\n code_return_check_pith,\n func_scope,\n hint_refs_type_basename,\n ) = make_code_raiser_func_pith_check( # type: ignore[assignment]\n hint_or_sane,\n decor_meta.conf,\n cls_stack,\n False, # <-- True only for parameters\n )\nE TypeError: cannot unpack non-iterable NoneType object\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark_x9roj8fa/beartype/_decor/wrap/_wrapargs.py:365\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_params = _code_check_args(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> def code_check_args(decor_meta: BeartypeDecorMeta) -> str:\n '''\n Generate a Python code snippet type-checking all annotated parameters of the\n decorated callable if any *or* the empty string otherwise (i.e., if these\n parameters are unannotated).\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to be type-checked.\n \n Returns\n -------\n str\n Code type-checking all annotated parameters of the decorated callable.\n \n Raises\n ------\n BeartypeDecorParamNameException\n If the name of any parameter declared on this callable is prefixed by\n the reserved substring ``__bear``.\n BeartypeDecorHintNonpepException\n If any type hint annotating any parameter of this callable is neither:\n \n * A PEP-noncompliant type hint.\n * A supported PEP-compliant type hint.\n '''\n assert isinstance(decor_meta, BeartypeDecorMeta), (\n f'{repr(decor_meta)} not beartype call.')\n \n # ..................{ LOCALS ~ func }..................\n # If *NO* callable parameters are annotated, silently reduce to a noop.\n #\n # Note that this is purely an optimization short-circuit mildly improving\n # efficiency for the common case of callables accepting either no\n # parameters *OR* one or more parameters, all of which are unannotated.\n if (\n # That callable is annotated by only one type hint *AND*...\n len(decor_meta.func_arg_name_to_hint) == 1 and\n # That type hint annotates that callable's return rather than a\n # parameter accepted by that callable...\n ARG_NAME_RETURN in decor_meta.func_arg_name_to_hint\n ):\n return ''\n # Else, one or more callable parameters are annotated.\n \n # Python code snippet to be returned, defaulting to the empty string\n # implying this callable's parameters to all either be unannotated *OR*\n # annotated only by safely ignorable type hints.\n func_wrapper_code = ''\n \n # Lexical scope (i.e., dictionary mapping from the relative unqualified name\n # to value of each locally or globally scoped attribute accessible to a\n # callable or class), initialized to \"None\" for safety.\n func_scope: LexicalScope = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ parameter }..................\n #FIXME: Remove this *AFTER* optimizing signature generation, please.\n # True only if that callable possibly accepts one or more positional\n # parameters.\n is_args_positional = False\n \n #FIXME: ******UNIT TEST US UP, PLEASE.******* Do so exhaustively until\n #exhausted. This is super-critical. Yo!\n #FIXME: Remove the \"args_name_keywordable\" local variable and associated\n #\"ARG_NAME_ARGS_NAME_KEYWORDABLE\" global variable *AFTER* refactoring\n #@beartype to generate callable-specific wrapper signatures.\n \n # Either...\n args_name_keywordable: Optional[Set[str]] = (\n #FIXME: [SPEED] Minor optimization. If the decorated callable *ONLY*\n #accepts an annotated variadic keyword parameter and no other\n #parameters, then the empty set reused from a global \"SET_EMPTY\" import\n #suffices here. Probably. Consider, anyway. *sigh*\n # If the decorated callable accepts an annotated variadic keyword\n # parameter (e.g., \"**kwargs: int\"), the set of the names of all\n # keywordable parameters (i.e., parameters that may be passed by\n # keyword), defined as the union of the:\n # * Set of the names of all flexible parameters (i.e., parameters that\n # may be passed either positionally or by keyword).\n # * Set of the names of all keyword-only parameters.\n #\n # This set is required in the body of the type-checking function\n # wrapping the decorated callable to differentiate between:\n # * Keyword parameters explicitly accepted by the decorated callable,\n # which are trivially type-checked by existing logic.\n # * Keyword parameters *NOT* explicitly accepted by the decorated\n # callable and thus implicitly accepted only as excess keyword\n # parameters added by CPython itself to the annotated variadic keyword\n # parameter (e.g., \"**kwargs: int\") accepted by the decorated\n # callable. Excess keyword parameters *CANNOT* be trivially\n # type-checked by existing logic, due to the non-triviality of\n # deciding whether a keyword parameter even is \"excess\" or not.\n set()\n if is_func_arg_variadic_keyword(\n # See the call to the iter_func_args() generator function below for\n # further commentary on these parameters.\n func=decor_meta.func_wrappee_wrappee, is_unwrap=False) else\n # Else, \"None\".\n None\n )\n \n # ..................{ LOCALS ~ hint }..................\n # Possibly insane hint annotating the current parameter if any *OR* the\n # sentinel placeholder otherwise (i.e., if this parameter is unannotated).\n hint_insane: Hint = None # pyright: ignore\n \n # Sane hint annotating the current parameter sanified from this possibly\n # insane hint if sanifying this hint generated no supplementary metadata\n # *OR* that metadata otherwise.\n hint_or_sane: HintOrHintSanifiedData = None # pyright: ignore\n \n # ..................{ GENERATE }..................\n #FIXME: Locally remove the \"arg_index\" local variable (and thus avoid\n #calling the enumerate() builtin here) *AFTER* refactoring @beartype to\n #generate callable-specific wrapper signatures.\n \n # Kind and name of this parameter.\n arg_kind: ArgKind = None # type: ignore[assignment]\n arg_name: str = None # type: ignore[assignment]\n \n #FIXME: Uncomment as needed, please. *sigh*\n # # Default value of this parameter if this parameter is optional *OR* the\n # # \"ArgMandatory\" singleton otherwise (i.e., if this parameter is mandatory).\n # arg_default: object = None\n \n # For the 0-based index of each parameter accepted by that callable and the\n # \"ArgMeta\" 3-tuple describing this parameter (in declaration order)...\n for arg_index, arg_meta in enumerate(iter_func_args(\n # Possibly lowest-level wrappee underlying the possibly higher-level\n # wrapper currently being decorated by the @beartype decorator. The\n # latter typically fails to convey the same callable metadata conveyed\n # by the former -- including the names and kinds of parameters accepted\n # by the possibly unwrapped callable. This renders the latter mostly\n # useless for our purposes.\n func=decor_meta.func_wrappee_wrappee,\n func_codeobj=decor_meta.func_wrappee_wrappee_codeobj,\n # Avoid inefficiently attempting to re-unwrap this wrappee. The\n # previously called BeartypeDecorMeta.reinit() method has already\n # guaranteed this wrappee to be isomorphically unwrapped.\n is_unwrap=False,\n )):\n # Localize metadata for both efficiency and f-string purposes.\n #\n # Note that list unpacking is substantially more efficient than\n # manually indexing list items. The former requires only a single Python\n # statement, whereas the latter requires \"n\" Python statements.\n (\n arg_kind,\n arg_name,\n _, # arg_default,\n ) = arg_meta\n \n # If...\n if (\n # The set of the names of all keywordable parameters must be decided\n # to type-check the decorated callable *AND*...\n args_name_keywordable is not None and\n # This parameter is keywordable...\n arg_kind in _ARG_KINDS_KEYWORD\n ):\n # Add the name of this parameter to that set.\n args_name_keywordable.add(arg_name)\n # Else, this parameter *CANNOT* be passed by keyword.\n \n # Type hint annotating this parameter if any *OR* the sentinel\n # placeholder otherwise (i.e., if this parameter is unannotated).\n #\n # Note that \"None\" is a semantically meaningful PEP 484-compliant type\n # hint equivalent to \"type(None)\". Ergo, we *MUST* explicitly\n # distinguish between that type hint and unannotated parameters.\n hint_insane = decor_meta.func_arg_name_to_hint_get( # pyright: ignore\n arg_name, SENTINEL)\n \n # If this parameter is unannotated, continue to the next parameter.\n if hint_insane is SENTINEL:\n continue\n # Else, this parameter is annotated.\n \n # Attempt to...\n try:\n # With a context manager \"catching\" *ALL* non-fatal warnings emitted\n # during this logic for subsequent \"playrback\" below...\n with catch_warnings(record=True) as warnings_issued:\n # If this parameter's name is reserved for use by the @beartype\n # decorator, raise an exception.\n if arg_name.startswith('__bear'):\n raise BeartypeDecorParamNameException(\n f'{EXCEPTION_PLACEHOLDER}reserved by @beartype.')\n # Else, this parameter's name is *NOT* reserved for use by the\n # @beartype decorator.\n \n # Sane hint sanified from this possibly insane parameter hint if\n # sanifying this hint generated no supplementary metadata *OR*\n # that metadata otherwise. Additionally, if this hint is\n # unsupported by @beartype, raise an exception.\n hint_or_sane = sanify_hint_root_func(\n decor_meta=decor_meta,\n hint=hint_insane,\n pith_name=arg_name,\n arg_kind=arg_kind,\n exception_prefix=EXCEPTION_PLACEHOLDER,\n )\n \n # If this hint is ignorable, continue to the next parameter.\n if hint_or_sane is Any:\n # print(f'Ignoring {decor_meta.func_name} parameter {arg_name} hint {repr(hint)}...')\n continue\n # Else, this hint is unignorable.\n \n #FIXME: Fundamentally unsafe and thus temporarily disabled *FOR\n #THE MOMENT.* The issue is that our current implementation of\n #the is_bearable() tester internally called by this function\n #refuses to resolve relative forward references -- which is\n #obviously awful. Ideally, that tester *ABSOLUTELY* should\n #resolve relative forward references. Until it does, however,\n #this is verboten dark magic that is unsafe in the general case.\n #FIXME: Note that there exist even *MORE* edge cases, however:\n #@dataclass fields, which violate typing semantics: e.g.,\n # from dataclasses import dataclass, field\n # from typing import Dict\n #\n # from beartype import beartype\n #\n # @beartype\n # @dataclass\n # class A:\n # test_dict: Dict[str, str] = field(default_factory=dict)\n #FIXME: Once this has been repaired, please reenable:\n #* The \"test_decor_arg_kind_flex_optional\" unit test.\n \n # # If this parameter is optional *AND* the default value of this\n # # optional parameter violates this hint, raise an exception.\n # _die_if_arg_default_unbearable(\n # decor_meta=decor_meta, arg_default=arg_default, hint=hint)\n # # Else, this parameter is either optional *OR* the default value\n # # of this optional parameter satisfies this hint.\n \n # If this parameter either may *OR* must be passed positionally,\n # record this fact.\n #\n # Note this conditional branch *MUST* be tested after validating\n # this parameter to be unignorable; if this branch were instead\n # nested *BEFORE* validating this parameter to be unignorable,\n # beartype would fail to reduce to a noop for otherwise\n # ignorable callables -- which would be rather bad, really.\n if arg_kind in _ARG_KINDS_POSITIONAL:\n is_args_positional = True\n # Else, this parameter *CANNOT* be passed positionally.\n \n #FIXME: [SPEED] Negligibly optimized the \".get\" access away:\n # ARG_LOCALIZE_TEMPLATE = ARG_KIND_TO_CODE_LOCALIZE_get( # type: ignore\n # arg_kind, None)\n # Python code template localizing this parameter if this kind of\n # parameter is supported *OR* \"None\" otherwise.\n ARG_LOCALIZE_TEMPLATE = ARG_KIND_TO_CODE_LOCALIZE.get( # type: ignore\n arg_kind, None)\n \n # If this kind of parameter is unsupported, raise an exception.\n #\n # Note this edge case should *NEVER* occur, as the parent\n # function should have simply ignored this parameter.\n if ARG_LOCALIZE_TEMPLATE is None:\n raise BeartypeDecorHintPepException(\n f'{EXCEPTION_PLACEHOLDER}kind {repr(arg_kind)} '\n f'currently unsupported by @beartype.'\n )\n # Else, this kind of parameter is supported. Ergo, this code is\n # non-\"None\".\n \n # Type stack if required by this hint *OR* \"None\" otherwise. See\n # the is_hint_needs_cls_stack() tester for further discussion.\n #\n # Note that the original unsanitized \"hint_insane\" (e.g.,\n # \"typing.Self\") rather than the new sanitized \"hint\" (e.g., the\n # class currently being decorated by @beartype) is passed to\n # that tester. Why? Because the latter may already have been\n # reduced above to a different (and seemingly innocuous) type\n # hint that does *NOT* appear to require a type stack at late\n # *EXCEPTION RAISING TIME* (i.e., the\n # beartype._check.error.errget.get_func_pith_violation()\n # function) but actually does. Only the original unsanitized\n # \"hint_insane\" is truth.\n cls_stack = (\n decor_meta.cls_stack\n # if is_hint_needs_cls_stack(hint) else\n if is_hint_needs_cls_stack(hint_insane) else\n None\n )\n # print(f'arg \"{arg_name}\" hint {repr(hint)} cls_stack: {repr(cls_stack)}')\n \n # Code snippet type-checking any parameter with arbitrary name.\n> (\n code_arg_check_pith,\n func_scope,\n hint_refs_type_basename,\n ) = make_code_raiser_func_pith_check(\n hint_or_sane,\n decor_meta.conf,\n cls_stack,\n True, # <-- True only for parameters\n )\nE TypeError: cannot unpack non-iterable NoneType object\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #72: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #73: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #74: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #75: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #76: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #77: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #78: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #79: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #80: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #81: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 57.10841855999994, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 2, "betweenness": 0.0001476740657244429, "pagerank": 0.00029050355774493705, "harmonic": 0.06585800438596494, "bidirectional_harmonic": 0.24481913828130922, "degree": 4 }, "line_count": 36, "code_line_count": 36, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_decor/wrap/wrapmain.py", "function_name": "generate_code", "test_info": { "success": false, "failed": 61, "passed": 1069, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_88sc44wg/beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py:50\nError: assert False is True\n + where False = (.where_that_or at 0x7994327c0a40>)\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n @beartype\n def where_that_or() -> str:\n '''\n Arbitrary callable decorated by the :func:`beartype.beartype` decorator\n intentionally annotated by one or more arbitrary unignorable type hints\n to prevent that decorator from silently reducing to a noop.\n '''\n \n return 'In the still cave of the witch Poesy,'\n \n def thou_art_no_unbidden_guest() -> str:\n '''\n Arbitrary callable *not* decorated by the :func:`beartype.beartype`\n decorator intentionally annotated by one or more arbitrary unignorable\n type hints for parity with the prior callable.\n '''\n \n return 'Seeking among the shadows that pass by'\n \n # Assert this tester returns the expected results for these callables.\n> assert is_func_beartyped(where_that_or) is True\nE assert False is True\nE + where False = (.where_that_or at 0x7994327c0a40>)\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic\nLocation: /tmp/benchmark_88sc44wg/beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py:72\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_decor_type_basic() -> None:\n '''\n Test decoration of user-defined classes by the :func:`beartype.beartype`\n decorator from the perspective of basic usability.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from pytest import raises\n \n # ....................{ CLASSES }....................\n # Intentionally redecorate a class twice by the @beartype decorator,\n # exercising an edge case in class decoration.\n @beartype\n @beartype\n class FromHisInnocuousHand(object):\n '''\n Arbitrary class defining one or more arbitrary annotated methods.\n '''\n \n # ....................{ METHODS }....................\n def his_bloodless_food(self, lured_by_the_gentle_meaning: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(lured_by_the_gentle_meaning)\n \n # ....................{ LOCALS }....................\n # Arbitrary instance of this class.\n of_his_looks = FromHisInnocuousHand()\n \n # ....................{ PASS }....................\n # Assert that this method returns the expected length of the passed string.\n assert of_his_looks.his_bloodless_food(\n 'Lured by the gentle meaning of his looks,') == 41\n \n # Assert that the __sizeof__() dunder method internally monkey-patched by\n # the @beartype decorator returns the expected size.\n of_his_looks_size_new = of_his_looks.__sizeof__()\n of_his_looks_size_old = of_his_looks.__sizeof__.__wrapped__(of_his_looks)\n assert isinstance(of_his_looks_size_new, int)\n assert of_his_looks_size_new >= 0\n assert of_his_looks_size_new == of_his_looks_size_old\n \n # ....................{ FAIL }....................\n # Assert that this method raises the expected exception when passed a\n # invalid parameter.\n> with raises(BeartypeCallHintParamViolation):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #52: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #53: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #54: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #55: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #56: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #57: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #58: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #59: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #60: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #61: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py", "test_decor_type_basic" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.9520000000000004, "in_degree": 1, "true_in_degree": 7.24, "out_degree": 1, "betweenness": 7.586924477586058e-05, "pagerank": 0.0003988015705108617, "harmonic": 0.0030153508771929823, "bidirectional_harmonic": 0.2030454925191776, "degree": 2 }, "line_count": 22, "code_line_count": 22, "cyclomatic": 3, "halstead_volume": 6.339850002884625, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/arg/utilfuncarglen.py", "function_name": "get_func_args_flexible_len", "test_info": { "success": false, "failed": 72, "passed": 1021, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a00_core/test_a00_package.py::test_api_deprecations\nLocation: /tmp/benchmark_q2g5ytrx/beartype_test/a00_unit/a00_core/test_a00_package.py:78\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_api_deprecations() -> None:\n '''\n Test all deprecated attributes importable from the public APIs of all\n subpackages of the :mod:`beartype` package (including itself).\n '''\n \n # Defer test-specific imports.\n from beartype._util.module.utilmodimport import import_module_attr\n from pytest import warns\n \n # Tuple of the fully-qualified names of all deprecated attributes.\n DEPRECATED_ATTRIBUTES = (\n 'beartype.abby',\n 'beartype.cave.HintPep585Type',\n 'beartype.roar.BeartypeAbbyException',\n 'beartype.roar.BeartypeAbbyHintViolation',\n 'beartype.roar.BeartypeAbbyTesterException',\n 'beartype.roar.BeartypeCallHintPepException',\n 'beartype.roar.BeartypeCallHintPepParamException',\n 'beartype.roar.BeartypeCallHintPepReturnException',\n 'beartype.roar.BeartypeDecorHintNonPepException',\n 'beartype.roar.BeartypeDecorHintNonPepNumPyException',\n 'beartype.roar.BeartypeDecorHintPep563Exception',\n 'beartype.roar.BeartypeDecorHintPepDeprecatedWarning',\n 'beartype.roar.BeartypeDecorPepException',\n )\n \n # For each deprecated attribute declared by beartype...\n for deprecated_attribute in DEPRECATED_ATTRIBUTES:\n # Assert that importing this attribute both emits the expected warning\n # and returns a non-\"None\" value.\n> with warns(DeprecationWarning):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py::test_method_cached_arg_by_id\nLocation: /tmp/benchmark_q2g5ytrx/beartype/_util/func/arg/utilfuncargtest.py:105\nError: beartype.roar._BeartypeUtilCallableCachedException: Callable .LikeDust.just_like_moons at 0x7ad10c72cd60> flexible argument count None != 2 (i.e., .LikeDust.just_like_moons at 0x7ad10c72cd60> accepts None rather than 2 positional and/or keyword parameters).\n\nTraceback:\n\n> def test_method_cached_arg_by_id() -> None:\n '''\n Test the\n :func:`beartype._util.cache.utilcachecall.method_cached_arg_by_id`\n decorator.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableCachedException\n from beartype._util.cache.utilcachecall import method_cached_arg_by_id\n from pytest import raises\n \n # ..................{ CLASSES }..................\n> class LikeDust(object):\n\n> @method_cached_arg_by_id\n\n> die_unless_func_args_len_flexible_equal(\n\n> def die_unless_func_args_len_flexible_equal(\n # Mandatory parameters.\n func: Codeobjable,\n func_args_len_flexible: int,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> None:\n '''\n Raise an exception unless the passed pure-Python callable accepts the passed\n number of **flexible parameters** (i.e., parameters passable as either\n positional or keyword arguments).\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n func_args_len_flexible : int\n Number of flexible parameters to validate this callable as accepting.\n is_unwrap: bool, optional\n :data:`True` only if this validator implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function to\n unwrap this possibly higher-level wrapper into its possibly lowest-level\n wrappee *before* returning the code object of that wrappee. Note that\n doing so incurs worst-case time complexity :math:`O(n)` for :math:`n`\n the number of lower-level wrappees wrapped by this wrapper. Defaults to\n :data:`True` for robustness. Why? Because this validator *must* always\n introspect lowest-level wrappees rather than higher-level wrappers. The\n latter typically do *not* accurately replicate the signatures of the\n former. In particular, decorator wrappers typically wrap decorated\n callables with variadic positional and keyword parameters (e.g., ``def\n _decorator_wrapper(*args, **kwargs)``). Since neither constitutes a\n flexible parameter, this validator raises an exception when passed such\n a wrapper with this boolean set to :data:`False`. Only set this boolean\n to :data:`False` if you pretend to know what you're doing.\n exception_cls : type, optional\n Type of exception to be raised. Defaults to\n :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing this exception message. Defaults to the\n empty string.\n \n Raises\n ------\n exception_cls\n If this callable either:\n \n * Is *not* callable.\n * Is callable but is *not* pure-Python.\n * Is a pure-Python callable accepting either more or less than this\n Number of flexible parameters.\n '''\n assert isinstance(func_args_len_flexible, int)\n \n # Number of flexible parameters accepted by this callable.\n func_args_len_flexible_actual = get_func_args_flexible_len(\n func=func,\n is_unwrap=is_unwrap,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # If this callable accepts more or less than this number of flexible\n # parameters, raise an exception.\n if func_args_len_flexible_actual != func_args_len_flexible:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n> raise exception_cls(\n f'{exception_prefix}callable {repr(func)} flexible argument count '\n f'{func_args_len_flexible_actual} != {func_args_len_flexible} '\n f'(i.e., {repr(func)} accepts {func_args_len_flexible_actual} '\n f'rather than {func_args_len_flexible} positional and/or keyword '\n f'parameters).'\n )\nE beartype.roar._BeartypeUtilCallableCachedException: Callable .LikeDust.just_like_moons at 0x7ad10c72cd60> flexible argument count None != 2 (i.e., .LikeDust.just_like_moons at 0x7ad10c72cd60> accepts None rather than 2 positional and/or keyword parameters).\n", "Failure #3: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py::test_get_func_args_len_flexible", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #25: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #26: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #27: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #28: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #29: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #30: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #31: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #32: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #33: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #34: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new", "Failure #35: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #36: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr", "Failure #37: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #38: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #39: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_contains", "Failure #40: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_iter", "Failure #41: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #42: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #43: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #44: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #45: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #46: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #47: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #48: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #49: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_recursion", "Failure #50: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_numpy", "Failure #51: beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py::test_api_vale_validator_pass", "Failure #52: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #53: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_fail", "Failure #54: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #55: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass", "Failure #56: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_pass", "Failure #57: beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py::test_api_vale_isequal_pass", "Failure #58: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #59: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #60: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #61: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #62: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #63: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #64: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #65: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #66: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #71: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #72: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a00_core/test_a00_package.py", "test_api_deprecations" ], [ "beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py", "test_method_cached_arg_by_id" ] ] }, "complexity_info": { "centrality": { "distance_discount": 12.550400000000003, "in_degree": 4, "true_in_degree": 19.520000000000007, "out_degree": 5, "betweenness": 0.000929398248504292, "pagerank": 0.0014609478815238916, "harmonic": 0.018092105263157895, "bidirectional_harmonic": 0.2266487715500875, "degree": 9 }, "line_count": 42, "code_line_count": 42, "cyclomatic": 6, "halstead_volume": 24.0, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/utilpepget.py", "function_name": "get_hint_pep_sign_or_none", "test_info": { "success": false, "failed": 106, "passed": 1024, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return\nLocation: /tmp/benchmark__p0yiljb/beartype/_util/hint/pep/utilpepget.py:387\nError: beartype.roar.BeartypeDecorHintPep484585Exception: Type hint typing.Callable[[], str] currently unsupported by beartype. You suddenly feel encouraged to submit a feature request for this hint to our friendly issue tracker at:\n\thttps://github.com/beartype/beartype/issues\n\nTraceback:\n\n> def test_get_hint_pep484585_callable_params_and_return(hints_pep_meta) -> None:\n '''\n Test both the ``get_hint_pep484585_callable_params`` and\n ``get_hint_pep484585_callable_return`` getters declared by the\n :mod:`beartype._util.hint.pep.proposal.pep484585.pep484585callable`\n submodule.\n \n Since these getters are inextricably interrelated, this unit test exercises\n both within the same test to satisfy Don't Repeat Yourself (DRY).\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import Any\n from beartype._data.hint.pep.sign.datapepsigns import HintSignCallable\n from beartype._util.hint.pep.proposal.pep484585.pep484585callable import (\n get_hint_pep484585_callable_params,\n get_hint_pep484585_callable_return,\n )\n from beartype._util.py.utilpyversion import (\n IS_PYTHON_AT_LEAST_3_10,\n )\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # Intentionally import the callable type hint factory from \"typing\" rather\n # than \"beartype.typing\" to guarantee PEP 484-compliance.\n from typing import Callable as Pep484Callable\n \n # Intentionally import the callable type hint factory from\n # \"collections.abc\" rather than \"beartype.typing\" to guarantee PEP\n # 585-compliance.\n from collections.abc import Callable as Pep585Callable\n \n # ..................{ GENERIC }..................\n # General-purpose logic generically exercising these getters against all\n # globally defined type hints.\n \n # Assert these getters...\n for hint_pep_meta in hints_pep_meta:\n # Return zero or more arguments for PEP-compliant callable type hints.\n if hint_pep_meta.pep_sign is HintSignCallable:\n> hint_callable_params = get_hint_pep484585_callable_params(\n hint_pep_meta.hint)\n\n> _die_unless_hint_pep484585_callable(hint)\n\n> hint_sign = get_hint_pep_sign(\n\n> def get_hint_pep_sign(\n # Mandatory parameters.\n hint: object,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPepSignException,\n exception_prefix: str = '',\n ) -> HintSign:\n '''\n **Sign** (i.e., :class:`HintSign` instance) uniquely identifying the passed\n PEP-compliant type hint if PEP-compliant *or* raise an exception otherwise\n (i.e., if this hint is *not* PEP-compliant).\n \n This getter is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as the implementation trivially reduces\n to an efficient one-liner.\n \n Parameters\n ----------\n hint : object\n Type hint to be inspected.\n exception_cls : TypeException, optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :exc:`.BeartypeDecorHintPepSignException`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n dict\n Sign uniquely identifying this hint.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * PEP-compliant but *not* uniquely identifiable by a sign.\n * PEP-noncompliant.\n * *Not* a hint (i.e., neither PEP-compliant nor -noncompliant).\n \n See Also\n --------\n :func:`.get_hint_pep_sign_or_none`\n Further details.\n '''\n \n # Sign uniquely identifying this hint if recognized *OR* \"None\" otherwise.\n hint_sign = get_hint_pep_sign_or_none(hint)\n \n # If this hint is unrecognized...\n if hint_sign is None:\n assert isinstance(exception_cls, type), (\n f'{exception_cls} not exception type.')\n assert isinstance(exception_prefix, str), (\n f'{exception_prefix} not string.')\n \n # Avoid circular import dependencies.\n from beartype._util.hint.nonpep.utilnonpeptest import die_if_hint_nonpep\n \n # If this hint is PEP-noncompliant, raise an exception.\n die_if_hint_nonpep(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # Else, this hint is *NOT* PEP-noncompliant. Since this hint was\n # unrecognized, this hint *MUST* necessarily be a PEP-compliant type\n # hint currently unsupported by the @beartype decorator.\n \n # Raise an exception indicating this.\n #\n # Note that we intentionally avoid calling the\n # die_if_hint_pep_unsupported() function here, which calls the\n # is_hint_pep_supported() function, which calls this function.\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} '\n f'currently unsupported by beartype. '\n f'You suddenly feel encouraged to submit a feature request '\n f'for this hint to our friendly issue tracker at:\\n'\n f'\\t{URL_ISSUES}'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: Type hint typing.Callable[[], str] currently unsupported by beartype. You suddenly feel encouraged to submit a feature request for this hint to our friendly issue tracker at:\nE \thttps://github.com/beartype/beartype/issues\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol\nLocation: /usr/lib/python3.12/typing.py:1848\nError: TypeError: issubclass() arg 1 must be a class\n\nTraceback:\n\n> def test_reduce_hint_pep484_generic_io_to_pep544_protocol() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep544.reduce_hint_pep484_generic_io_to_pep544_protocol`\n reducer.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep544Exception\n from beartype.typing import Union\n from beartype._util.hint.pep.proposal.pep544 import (\n reduce_hint_pep484_generic_io_to_pep544_protocol)\n from beartype._util.hint.pep.proposal.pep593 import is_hint_pep593\n from beartype._data.cls.datacls import TYPES_PEP484_GENERIC_IO\n from pytest import raises\n from typing import Protocol\n \n # ....................{ PASS }....................\n # For each PEP 484-compliant \"typing\" IO generic base class...\n for pep484_generic_io in TYPES_PEP484_GENERIC_IO:\n # Equivalent protocol reduced from this generic.\n pep544_protocol_io = (\n reduce_hint_pep484_generic_io_to_pep544_protocol(\n pep484_generic_io, ''))\n \n # Assert this protocol is either...\n assert (\n # A PEP 593-compliant type metahint generalizing a protocol\n # *OR*...\n is_hint_pep593(pep544_protocol_io) or\n # A PEP 544-compliant protocol.\n> issubclass(pep544_protocol_io, Protocol)\n )\n\n> def __subclasscheck__(cls, other):\n if cls is Protocol:\n> return type.__subclasscheck__(cls, other)\nE TypeError: issubclass() arg 1 must be a class\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep557.py::test_get_hint_pep557_initvar_arg", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep586.py::test_is_hint_pep586", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_die_unless_hint_pep593", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_get_hint_pep593_metadata", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_get_hint_pep593_metahint", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #18: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #19: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #20: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #21: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #22: beartype_test/a00_unit/a40_api/conf/test_confoverrides.py::test_conf_overrides", "Failure #23: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new", "Failure #24: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #25: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr", "Failure #26: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #27: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #28: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #29: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #30: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #31: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #32: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #33: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #34: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #35: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #36: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #38: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #39: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #40: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #41: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #42: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #43: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #44: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #45: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #46: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #83: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #84: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #85: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #86: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #89: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #90: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #91: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #92: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #93: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #94: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #95: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #96: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #97: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #98: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #99: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #100: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #101: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #102: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #103: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #104: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #105: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #106: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py", "test_get_hint_pep484585_callable_params_and_return" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py", "test_reduce_hint_pep484_generic_io_to_pep544_protocol" ] ] }, "complexity_info": { "centrality": { "distance_discount": 14.803200000000004, "in_degree": 23, "true_in_degree": 68.11999999999995, "out_degree": 9, "betweenness": 0.004459350342495449, "pagerank": 0.007149648953399903, "harmonic": 0.02412280701754386, "bidirectional_harmonic": 0.3237736267752721, "degree": 32 }, "line_count": 45, "code_line_count": 45, "cyclomatic": 15, "halstead_volume": 27.0, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/metadata/metacheck.py", "function_name": "BeartypeCheckMeta.make_from_decor_meta", "test_info": { "success": false, "failed": 49, "passed": 1081, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a00_metadata/test_metacheck.py::test_metadata_check\nLocation: /tmp/benchmark_l3qsx1gd/beartype_test/a00_unit/a60_check/a00_metadata/test_metacheck.py:53\nError: AttributeError: 'NoneType' object has no attribute 'func'\n\nTraceback:\n\n> def test_metadata_check() -> None:\n '''\n Test the :func:`beartype._check.metadata.metacheck.BeartypeCheckMeta`\n dataclass.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import BeartypeConf\n from beartype._check.metadata.metacheck import BeartypeCheckMeta\n from beartype._check.metadata.metadecor import BeartypeDecorMeta\n from beartype_test.a00_unit.data.data_type import (\n Class,\n function_wrappee,\n )\n \n # ....................{ LOCALS }....................\n # Arbitrary beartype configuration.\n conf = BeartypeConf(is_debug=True)\n \n # Arbitrary class stack.\n cls_stack = (Class,)\n \n # Arbitrary beartype decorator call metadata.\n decor_meta = BeartypeDecorMeta()\n decor_meta.reinit(\n func=function_wrappee, conf=conf, cls_stack=cls_stack)\n \n # Beartype type-checking call metadata reduced from this decorator metadata.\n check_meta = BeartypeCheckMeta.make_from_decor_meta(decor_meta)\n \n # ....................{ PASS }....................\n # Assert this metadata exposes the expected fields.\n> assert check_meta.func is function_wrappee\nE AttributeError: 'NoneType' object has no attribute 'func'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation\nLocation: /tmp/benchmark_l3qsx1gd/beartype/_check/error/errget.py:206\nError: AssertionError: None not type-checking call metadata.\n\nTraceback:\n\n> def test_get_func_pith_violation() -> None:\n '''\n Test the\n :func:`beartype._check.error.errget.get_func_pith_violation` getter.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype import BeartypeConf\n from beartype.roar import (\n BeartypeCallHintParamViolation,\n BeartypeCallHintReturnViolation,\n BeartypeDecorHintNonpepException,\n )\n from beartype.roar._roarexc import _BeartypeCallHintPepRaiseException\n from beartype.typing import (\n List,\n Tuple,\n Union,\n )\n from beartype._data.func.datafuncarg import ARG_NAME_RETURN\n from beartype._check.error.errget import get_func_pith_violation\n from beartype._check.metadata.metacheck import BeartypeCheckMeta\n from pytest import raises\n \n # ..................{ LOCALS }..................\n def forest_unknown(\n secret_orchard: List[str],\n achromatic_voice,\n to_bid_you_farewell: str,\n amaranth_symbol: 42,\n ) -> Union[int, Tuple[str, ...]]:\n '''\n Arbitrary callable exercised below.\n '''\n \n return achromatic_voice\n \n # Beartype type-checking call metadata reduced from this decorator metadata.\n check_meta = BeartypeCheckMeta.make_from_decor_meta_kwargs(\n func=forest_unknown, conf=BeartypeConf())\n \n # ..................{ PASS }..................\n # Assert this function returns the expected exception when passed a\n # parameter annotated by a PEP-compliant type hint failing to shallowly\n # satisfy the type of that type hint.\n> violation = get_func_pith_violation(\n check_meta=check_meta,\n pith_name='secret_orchard',\n pith_value=(\n 'You are in a forest unknown:',\n 'The secret orchard.',\n ),\n )\n\n> def get_func_pith_violation(\n # Mandatory parameters.\n check_meta: BeartypeCheckMeta,\n pith_name: str,\n pith_value: object,\n \n # Optional keyword parameters.\n **kwargs\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the parameter with the\n passed name *or* return if this name is the magic string ``return`` of the\n passed decorated function fails to satisfy the type hint annotating this\n parameter or return.\n \n Parameters\n ----------\n check_meta : BeartypeCheckMeta\n **Beartype type-check call metadata** (i.e., object encapsulating *all*\n metadata required by the current call to the wrapper function\n type-checking a :func:`beartype.beartype`-decorated callable).\n pith_name : str\n Either:\n \n * If the object failing to satisfy this hint is a passed parameter, the\n name of this parameter.\n * Else, the magic string ``\"return\"`` implying this object to be the\n value returned from this callable.\n pith_value : object\n Passed parameter or returned value violating this hint.\n \n All remaining keyword parameters are passed as is to the\n :func:`.get_hint_object_violation` getter.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this parameter or\n return to satisfy the type hint annotating this parameter or return.\n This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n \n Raises\n ------\n All exceptions raised by the lower-level :func:`.get_hint_object_violation`\n getter as well as:\n \n _BeartypeCallHintPepRaiseException\n If the parameter or return with the passed name is unannotated.\n \n See Also\n --------\n :func:`.get_hint_object_violation`\n Further details.\n '''\n> assert isinstance(check_meta, BeartypeCheckMeta), (\n f'{repr(check_meta)} not type-checking call metadata.')\nE AssertionError: None not type-checking call metadata.\n", "Failure #3: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #41: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #42: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #43: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #44: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #45: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #46: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #47: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #48: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #49: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a00_metadata/test_metacheck.py", "test_metadata_check" ], [ "beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py", "test_get_func_pith_violation" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 1, "betweenness": 2.7096158848521633e-06, "pagerank": 0.00031609195402298854, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.1486641739108848, "degree": 2 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextansi.py", "function_name": "color_pith", "test_info": { "success": false, "failed": 7, "passed": 1123, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_pith\nLocation: /tmp/benchmark_m7d8xkif/beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py:140\nError: AssertionError: assert '42' in '\\x1b[1m\\x1b[33mint \\x1b[0mNone'\n\nTraceback:\n\n> def test_represent_pith() -> None:\n '''\n Test the\n Test the :func:`beartype._util.text.utiltextrepr.represent_pith` function.\n '''\n \n # Defer test-specific imports.\n from beartype._util.text.utiltextrepr import represent_pith\n \n # Custom type to be represented below.\n class CustomType(object):\n def __repr__(self) -> str: return (\n 'Collaborator\u2010ily brambling unspiritually')\n \n # Assert this representer represents builtin types in the expected way.\n repr_builtin = represent_pith(42)\n assert 'int' in repr_builtin\n> assert '42' in repr_builtin\nE AssertionError: assert '42' in '\\x1b[1m\\x1b[33mint \\x1b[0mNone'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_m7d8xkif/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:187\nError: assert \"['Oboes\u2010obsoleting tines', 'Of language']\" in 'Die_if_unbearable() value None violates type hint typing.Hashable, as list None not instance of .'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n> assert pith_repr in exception_message\nE assert \"['Oboes\u2010obsoleting tines', 'Of language']\" in 'Die_if_unbearable() value None violates type hint typing.Hashable, as list None not instance of .'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #4: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py", "test_represent_pith" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 1, "true_in_degree": 10.920000000000005, "out_degree": 1, "betweenness": 3.251539061822596e-05, "pagerank": 0.0006741943169585033, "harmonic": 0.0024671052631578946, "bidirectional_harmonic": 0.1929381930204307, "degree": 2 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 3, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/door/_cls/doorsuper.py", "function_name": "TypeHint.__init__", "test_info": { "success": false, "failed": 14, "passed": 1116, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping\nLocation: /tmp/benchmark_x_7b0t8k/beartype/door/_cls/doorsuper.py:404\nError: AttributeError: 'TypeVarTypeHint' object has no attribute '_hint'. Did you mean: 'hint'?\n\nTraceback:\n\n> def test_door_typehint_mapping(iter_hints_piths_meta) -> None:\n '''\n Test that the :meth:`beartype.door.TypeHint.__new__` factory method\n successfully creates and returns an instance of a concrete subclass of the\n abstract :class:`beartype.door.TypeHint` superclass conditionally handling\n the kind of low-level type hint passed to that factory method.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n \n # ....................{ ASSERTS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # ....................{ METADATA }....................\n # Metadata describing this type hint.\n hint_meta = hint_pith_meta.hint_meta\n \n # This type hint.\n hint = hint_meta.hint\n \n # If either...\n if (\n # This hint is PEP-noncompliant *OR*...\n not isinstance(hint_meta, HintPepMetadata) or\n # This kind of type hint is currently unsupported by the\n # \"beartype.door\" submodule...\n hint_meta.typehint_cls is None\n ):\n # Silently ignore this hint and continue to the next.\n continue\n # Else, this kind of type hint is currently supported by the\n # \"beartype.door\" submodule *AND* this hint is PEP-compliant.\n \n # Instance of a concrete subclass of the abstract \"TypeHint\" superclass\n # conditionally handling this kind of type hint.\n wrapper = TypeHint(hint)\n \n # Assert that this instance is of the expected subclass.\n assert isinstance(wrapper, hint_meta.typehint_cls)\n \n # ....................{ PROPERTIES }....................\n # Assert that the type hint wrapped by this instance is the same hint.\n> wrapper_hint = wrapper.hint\n\n> @property\n #FIXME: Uncomment *AFTER* the third-party \"typing_extensions\" module\n #releases a new stable release.\n # def hint(self) -> T_Hint:\n def hint(self) -> T:\n '''\n **Original type hint** (i.e., low-level PEP-compliant type hint wrapped\n by this wrapper at :meth:`TypeHint.__init__` instantiation time).\n '''\n \n # Q: Can one-liners solve all possible problems? A: Yes.\n> return self._hint\nE AttributeError: 'TypeVarTypeHint' object has no attribute '_hint'. Did you mean: 'hint'?\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr\nLocation: /tmp/benchmark_x_7b0t8k/beartype/door/_cls/doorsuper.py:174\nError: AttributeError: 'CallableTypeHint' object has no attribute '_hint'. Did you mean: 'hint'?\n\nTraceback:\n\n> def test_door_typehint_repr() -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.__repr__` dunder method.\n '''\n \n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.typing import Callable\n \n annotation = Callable[[], list]\n hint = TypeHint(annotation)\n> assert repr(annotation) in repr(hint)\n\n> def __repr__(self) -> str:\n '''\n Machine-readable representation of this type hint wrapper.\n '''\n \n # Unqualified name of the concrete subclass wrapping this hint.\n hint_wrapper_basename = get_object_type_basename(self)\n # print('hint_wrapper_basename: {hint_wrapper_basename}')\n \n # If this concrete subclass is currently private, deviously hide this\n # implementation detail by defaulting to the unqualified name of this\n # public \"TypeHint\" superclass instead.\n if hint_wrapper_basename[0] == '_':\n hint_wrapper_basename = 'TypeHint'\n # Else, this concrete subclass is public.\n \n # Return this machine-readable representation.\n> return f'{hint_wrapper_basename}({repr(self._hint)})'\nE AttributeError: 'CallableTypeHint' object has no attribute '_hint'. Did you mean: 'hint'?\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #4: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #5: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_contains", "Failure #6: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_iter", "Failure #7: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #8: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #9: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #10: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #11: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #12: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #13: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #14: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_mapping" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_repr" ] ] }, "complexity_info": { "centrality": { "distance_discount": 14.498560000000008, "in_degree": 7, "true_in_degree": 7.0, "out_degree": 3, "betweenness": 0.0001110942512789387, "pagerank": 0.0013279967159277508, "harmonic": 0.019298245614035085, "bidirectional_harmonic": 0.2490263300296197, "degree": 10 }, "line_count": 13, "code_line_count": 13, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncwrap.py", "function_name": "unwrap_func_all", "test_info": { "success": false, "failed": 127, "passed": 966, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a00_core/test_a00_package.py::test_api_deprecations\nLocation: /tmp/benchmark_a8v62r0n/beartype_test/a00_unit/a00_core/test_a00_package.py:78\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_api_deprecations() -> None:\n '''\n Test all deprecated attributes importable from the public APIs of all\n subpackages of the :mod:`beartype` package (including itself).\n '''\n \n # Defer test-specific imports.\n from beartype._util.module.utilmodimport import import_module_attr\n from pytest import warns\n \n # Tuple of the fully-qualified names of all deprecated attributes.\n DEPRECATED_ATTRIBUTES = (\n 'beartype.abby',\n 'beartype.cave.HintPep585Type',\n 'beartype.roar.BeartypeAbbyException',\n 'beartype.roar.BeartypeAbbyHintViolation',\n 'beartype.roar.BeartypeAbbyTesterException',\n 'beartype.roar.BeartypeCallHintPepException',\n 'beartype.roar.BeartypeCallHintPepParamException',\n 'beartype.roar.BeartypeCallHintPepReturnException',\n 'beartype.roar.BeartypeDecorHintNonPepException',\n 'beartype.roar.BeartypeDecorHintNonPepNumPyException',\n 'beartype.roar.BeartypeDecorHintPep563Exception',\n 'beartype.roar.BeartypeDecorHintPepDeprecatedWarning',\n 'beartype.roar.BeartypeDecorPepException',\n )\n \n # For each deprecated attribute declared by beartype...\n for deprecated_attribute in DEPRECATED_ATTRIBUTES:\n # Assert that importing this attribute both emits the expected warning\n # and returns a non-\"None\" value.\n> with warns(DeprecationWarning):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py::test_method_cached_arg_by_id\nLocation: /tmp/benchmark_a8v62r0n/beartype/_util/func/arg/utilfuncarglen.py:365\nError: beartype.roar._BeartypeUtilCallableCachedException: None uncallable.\n\nTraceback:\n\n> def test_method_cached_arg_by_id() -> None:\n '''\n Test the\n :func:`beartype._util.cache.utilcachecall.method_cached_arg_by_id`\n decorator.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableCachedException\n from beartype._util.cache.utilcachecall import method_cached_arg_by_id\n from pytest import raises\n \n # ..................{ CLASSES }..................\n> class LikeDust(object):\n\n> @method_cached_arg_by_id\n\n> die_unless_func_args_len_flexible_equal(\n\n> func_args_len_flexible_actual = get_func_args_flexible_len(\n\n> def get_func_args_flexible_len(\n # Mandatory parameters.\n func: Codeobjable,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> int:\n '''\n Number of **flexible parameters** (i.e., parameters passable as either\n positional or keyword arguments but *not* positional-only, keyword-only,\n variadic, or other more constrained kinds of parameters) accepted by the\n passed pure-Python callable.\n \n This getter transparently handles all of the following:\n \n * Conventional pure-Python callables.\n * If ``is_unwrap`` is :data:`True`:\n \n * Pure-Python **partials** (i.e., pure-Python callable\n :class:`functools.partial` objects directly wrapping pure-Python\n callables). If a partial is passed, this getter transparently returns\n the total number of flexible parameters accepted by the lower-level\n callable wrapped by this partial minus the number of flexible parameters\n partialized away by this partial.\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n is_unwrap: bool, optional\n :data:`True` only if this getter implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function.\n Defaults to :data:`True` for safety. See :func:`.get_func_codeobj` for\n further commentary.\n exception_cls : type, optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the message of any exception raised in\n the event of a fatal error. Defaults to the empty string.\n \n Returns\n -------\n int\n Number of flexible parameters accepted by this callable.\n \n Raises\n ------\n exception_cls\n If that callable is *not* pure-Python.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.api.standard.utilfunctools import (\n get_func_functools_partial_args_flexible_len,\n is_func_functools_partial,\n )\n from beartype._util.func.utilfunctest import is_func_codeobjable\n \n # If the passed callable is pure-Python...\n if is_func_codeobjable(func):\n # Number of various kinds of parameters accepted by that callable.\n func_args_lens = get_func_args_lens(\n func=func,\n is_unwrap=is_unwrap,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # Number of all non-keyword-only parameters (i.e., both optional and\n # mandatory positional-only, positional, and keyword parameters)\n # accepted by that callable.\n return func_args_lens[ARGS_LENS_INDEX_POSONLY_OR_FLEX]\n # Else, that callable has *NO* code object.\n #\n # If that callable is *NOT* actually callable, raise an exception.\n elif not callable(func):\n> raise exception_cls(f'{exception_prefix}{repr(func)} uncallable.')\nE beartype.roar._BeartypeUtilCallableCachedException: None uncallable.\n", "Failure #3: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py::test_get_func_arg_name_first_or_none", "Failure #4: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py::test_get_func_arg_names", "Failure #5: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name", "Failure #6: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_positional", "Failure #7: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_keyword", "Failure #8: beartype_test/a00_unit/a20_util/func/test_utilfunccodeobj.py::test_get_func_codeobj", "Failure #9: beartype_test/a00_unit/a20_util/func/test_utilfunccodeobj.py::test_get_func_codeobj_or_none", "Failure #10: beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py::test_unwrap_func_all", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py::test_get_hint_pep484585_ref_names_relative_to", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #24: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #25: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #26: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #27: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #28: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #29: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #30: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #31: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #32: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #33: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #34: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #35: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #36: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #37: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #38: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #39: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #40: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_beartypeable_kind", "Failure #41: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_callable", "Failure #42: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new", "Failure #43: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #44: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr", "Failure #45: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #46: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #47: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_contains", "Failure #48: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_iter", "Failure #49: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #50: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #51: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #52: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #53: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #54: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #55: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #56: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #57: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_recursion", "Failure #58: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #59: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #60: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #61: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #62: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #63: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #64: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #65: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #66: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #67: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #68: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #69: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #83: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #84: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #85: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #86: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #89: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #90: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #91: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #92: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #93: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #94: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #95: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #96: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #97: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #98: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #99: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #100: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #101: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #102: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #103: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #104: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #105: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #106: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #107: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #108: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #109: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #110: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #111: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #112: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #113: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #114: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #115: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #116: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #117: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #118: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #119: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #120: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #121: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #122: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #123: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #124: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #125: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #126: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #127: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a00_core/test_a00_package.py", "test_api_deprecations" ], [ "beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py", "test_method_cached_arg_by_id" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 24.400000000000013, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.002064807022971178, "harmonic": 0.0, "bidirectional_harmonic": 0.1933232109630145, "degree": 2 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/utilpepget.py", "function_name": "get_hint_pep_args", "test_info": { "success": false, "failed": 96, "passed": 1034, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py::test_die_unless_object_isinstanceable\nLocation: /tmp/benchmark_boeue4e8/beartype/_util/cls/pep/utilpep3119.py:1041\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_die_unless_object_isinstanceable() -> None:\n '''\n Test the\n :func:`beartype._util.cls.pep.utilpep3119.die_unless_object_isinstanceable`\n validator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep3119Exception\n from beartype._util.cls.pep.utilpep3119 import (\n die_unless_object_isinstanceable)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n Class,\n NonIsinstanceableClass,\n )\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this raiser accepts an isinstanceable type.\n die_unless_object_isinstanceable(Class)\n \n # Assert this raiser accepts a tuple of isinstanceable types.\n die_unless_object_isinstanceable((Class, str))\n \n # ....................{ FAIL }....................\n # Assert this raiser raises the expected exception when passed a\n # non-isinstanceable object.\n with raises(BeartypeDecorHintPep3119Exception):\n die_unless_object_isinstanceable('Moab.')\n \n # Assert this raiser raises the expected exception when passed a\n # non-isinstanceable type.\n with raises(BeartypeDecorHintPep3119Exception):\n die_unless_object_isinstanceable(NonIsinstanceableClass)\n \n # Assert this raiser raises the expected exception when passed a tuple of\n # one isinstanceable type and one non-isinstanceable type.\n with raises(BeartypeDecorHintPep3119Exception):\n die_unless_object_isinstanceable((Class, NonIsinstanceableClass))\n \n # ....................{ VERSION }....................\n # If the active Python interpreter targets Python >= 3.10 and thus supports\n # PEP 604-compliant new unions...\n if IS_PYTHON_AT_LEAST_3_10:\n # Assert this raiser accepts a new union of isinstanceable types.\n die_unless_object_isinstanceable(Class | str)\n \n # Assert this raiser raises the expected exception when passed a new\n # union of one isinstanceable type and one non-isinstanceable type.\n with raises(BeartypeDecorHintPep3119Exception):\n> die_unless_object_isinstanceable(Class | NonIsinstanceableClass)\n\n> _die_if_object_uncheckable(\n\n> def _die_if_object_uncheckable(\n obj: IsBuiltinOrSubclassableTypes,\n obj_pith: object,\n obj_raiser: Callable,\n obj_tester: Callable[[object, IsBuiltinOrSubclassableTypes], bool],\n is_forwardref_valid: bool,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> None:\n '''\n Raise an exception of the passed type unless the passed object is\n **runtime-checkable** (i.e., valid as the second parameter to either the\n :func:`isinstance` or :func:`issubclass` builtins) according to the passed\n object tester and raiser.\n \n Parameters\n ----------\n obj : object\n Object to be validated.\n obj_pith : object\n Object guaranteed to satisfy the ``obj_tester`` callable when ``obj`` is\n runtime-typecheckable (i.e., when ``obj_tester`` is called as\n ``obj_tester(obj_pith, obj)``).\n obj_raiser : Callable\n Callable raising an exception unless this object is runtime-checkable\n according to this predicate, which should be either:\n \n * :func:`.die_unless_type_isinstanceable`.\n * :func:`.die_unless_type_issubclassable`.\n obj_tester : Callable[[object, IsBuiltinOrSubclassableTypes], bool]\n Callable returning :data:`True` only if this object is runtime-checkable\n according to this predicate, which should be either:\n \n * :func:`isinstance`.\n * :func:`issubclass`.\n is_forwardref_valid : bool, optional\n :data:`True` only if this function permits this object to be a\n **forward reference proxy** (i.e., :mod:`beartype`-specific private type\n proxying an external type that may currently be undefined). Defaults to\n :data:`True`. If this boolean is:\n \n * :data:`True`, this object is valid only when this object is either an\n isinstanceable classes *or* a forward reference proxy.\n * :data:`False`, this object is valid only when this object is an\n isinstanceable class. Note that forward reference proxies are\n isinstanceable classes *if and only if* the external classes they\n refer to have already been defined.\n exception_cls : TypeException\n Type of exception to be raised.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message.\n \n Raises\n ------\n BeartypeDecorHintPep3119Exception\n If this object is *not* runtime-checkable according to the passed\n object tester and raiser.\n '''\n assert callable(obj_raiser), f'{repr(obj_raiser)} uncallable.'\n assert callable(obj_tester), f'{repr(obj_tester)} uncallable.'\n \n # Avoid circular import dependencies.\n from beartype._util.cls.utilclstest import die_unless_type_or_types\n from beartype._util.hint.pep.proposal.pep484604 import is_hint_pep604\n from beartype._util.hint.pep.utilpepget import get_hint_pep_args\n \n # If this object is *NOT* a PEP 604-compliant new union...\n if not is_hint_pep604(obj):\n # If this object is neither a class nor tuple of classes, raise an\n # exception.\n die_unless_type_or_types(\n type_or_types=obj,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # Else, this object is either a class or tuple of classes.\n # Else, this object is a PEP 604-compliant new union.\n #\n # In any case, this object *COULD* now be runtime-checkable. To decide\n # whether this object is runtime-checkable, further handling is warranted.\n \n #FIXME: *UHHHH... WAT!?* This is totally busted, guys. Since this object is\n #now a PEP 604-compliant new union, this object clearly is neither a type\n #nor a tuple of types; it's a union! So, most of the code below no longer\n #makes any sense whatsoever. Actually, maybe it's just this \"if\n #isinstance(obj, type):\" branch that no longer makes sense? Maybe just\n #remove that branch and quietly pretend this never happened. Note that we\n #still do require the passed \"obj_raiser\" parameter, however. I sigh. *sigh*\n \n # If this object is a class...\n if isinstance(obj, type):\n # If this class is *NOT* runtime-checkable, raise an exception.\n obj_raiser(\n cls=obj,\n is_forwardref_valid=is_forwardref_valid,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # Else, this class is runtime-checkable.\n # Else, this object *MUST* (by process of elimination and validation above)\n # be either a tuple of classes *OR* a PEP 604-compliant new union. In either\n # case...\n else:\n # Attempt to pass this object as the second parameter to isinstance().\n try:\n obj_tester(obj_pith, obj) # type: ignore[arg-type]\n # If doing so raises *ANY* exception, this object is *NOT*\n # runtime-checkable. In this case, raise a human-readable exception.\n #\n # See the die_unless_type_isinstanceable() docstring for details.\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # If this exception ambiguously fails to indicate\n # non-isinstanceability, silently reduce to a noop.\n if _is_exception_ambiguous(exception):\n return\n # Else, this exception unambiguously indicates\n # non-isinstanceability.\n \n # Tuple of all items of this iterable object.\n obj_items: tuple = None # type: ignore[assignment]\n \n # Human-readable label describing this object in this exception\n # message.\n obj_label: str = None # type: ignore[assignment]\n \n # Human-readable label describing the first non-runtime-checkable\n # item of this object in this exception message.\n obj_item_label: str = None # type: ignore[assignment]\n \n # If this object is a tuple, define these locals accordingly.\n if isinstance(obj, tuple):\n obj_items = obj\n obj_label = 'tuple union'\n obj_item_label = 'tuple union item'\n # Else, this object is a new union. Define these locals accordingly.\n else:\n obj_items = get_hint_pep_args(obj)\n obj_label = 'PEP 604 new union'\n obj_item_label = 'new union child type'\n \n # Exception message to be raised.\n exception_message = (\n f'{exception_prefix} {obj_label} {repr(obj)} '\n f'uncheckable at runtime'\n )\n \n # For the 0-based index of each tuple class and that class...\n> for cls_index, cls in enumerate(obj_items):\nE TypeError: 'NoneType' object is not iterable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py::test_die_unless_object_issubclassable\nLocation: /tmp/benchmark_boeue4e8/beartype/_util/cls/pep/utilpep3119.py:1041\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_die_unless_object_issubclassable() -> None:\n '''\n Test the\n :func:`beartype._util.cls.pep.utilpep3119.die_unless_object_issubclassable`\n validator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep3119Exception\n from beartype._util.cls.pep.utilpep3119 import (\n die_unless_object_issubclassable)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n Class,\n NonIssubclassableClass,\n )\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this raiser accepts an issubclassable type.\n die_unless_object_issubclassable(Class)\n \n # Assert this raiser accepts a tuple of issubclassable types.\n die_unless_object_issubclassable((Class, str))\n \n # ....................{ FAIL }....................\n # Assert this raiser raises the expected exception when passed a\n # non-issubclassable object.\n with raises(BeartypeDecorHintPep3119Exception):\n die_unless_object_issubclassable('Moab.')\n \n # Assert this raiser raises the expected exception when passed a\n # non-issubclassable type.\n with raises(BeartypeDecorHintPep3119Exception):\n die_unless_object_issubclassable(NonIssubclassableClass)\n \n # Assert this raiser raises the expected exception when passed a tuple of\n # one issubclassable type and one non-issubclassable type.\n with raises(BeartypeDecorHintPep3119Exception):\n die_unless_object_issubclassable((Class, NonIssubclassableClass))\n \n # ....................{ VERSION }....................\n # If the active Python interpreter targets Python >= 3.10 and thus supports\n # PEP 604-compliant new unions...\n if IS_PYTHON_AT_LEAST_3_10:\n # Assert this raiser accepts a new union of issubclassable types.\n die_unless_object_issubclassable(Class | str)\n \n # Assert this raiser raises the expected exception when passed a new\n # union of one issubclassable type and one non-issubclassable type.\n with raises(BeartypeDecorHintPep3119Exception):\n> die_unless_object_issubclassable(Class | NonIssubclassableClass)\n\n> _die_if_object_uncheckable(\n\n> def _die_if_object_uncheckable(\n obj: IsBuiltinOrSubclassableTypes,\n obj_pith: object,\n obj_raiser: Callable,\n obj_tester: Callable[[object, IsBuiltinOrSubclassableTypes], bool],\n is_forwardref_valid: bool,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> None:\n '''\n Raise an exception of the passed type unless the passed object is\n **runtime-checkable** (i.e., valid as the second parameter to either the\n :func:`isinstance` or :func:`issubclass` builtins) according to the passed\n object tester and raiser.\n \n Parameters\n ----------\n obj : object\n Object to be validated.\n obj_pith : object\n Object guaranteed to satisfy the ``obj_tester`` callable when ``obj`` is\n runtime-typecheckable (i.e., when ``obj_tester`` is called as\n ``obj_tester(obj_pith, obj)``).\n obj_raiser : Callable\n Callable raising an exception unless this object is runtime-checkable\n according to this predicate, which should be either:\n \n * :func:`.die_unless_type_isinstanceable`.\n * :func:`.die_unless_type_issubclassable`.\n obj_tester : Callable[[object, IsBuiltinOrSubclassableTypes], bool]\n Callable returning :data:`True` only if this object is runtime-checkable\n according to this predicate, which should be either:\n \n * :func:`isinstance`.\n * :func:`issubclass`.\n is_forwardref_valid : bool, optional\n :data:`True` only if this function permits this object to be a\n **forward reference proxy** (i.e., :mod:`beartype`-specific private type\n proxying an external type that may currently be undefined). Defaults to\n :data:`True`. If this boolean is:\n \n * :data:`True`, this object is valid only when this object is either an\n isinstanceable classes *or* a forward reference proxy.\n * :data:`False`, this object is valid only when this object is an\n isinstanceable class. Note that forward reference proxies are\n isinstanceable classes *if and only if* the external classes they\n refer to have already been defined.\n exception_cls : TypeException\n Type of exception to be raised.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message.\n \n Raises\n ------\n BeartypeDecorHintPep3119Exception\n If this object is *not* runtime-checkable according to the passed\n object tester and raiser.\n '''\n assert callable(obj_raiser), f'{repr(obj_raiser)} uncallable.'\n assert callable(obj_tester), f'{repr(obj_tester)} uncallable.'\n \n # Avoid circular import dependencies.\n from beartype._util.cls.utilclstest import die_unless_type_or_types\n from beartype._util.hint.pep.proposal.pep484604 import is_hint_pep604\n from beartype._util.hint.pep.utilpepget import get_hint_pep_args\n \n # If this object is *NOT* a PEP 604-compliant new union...\n if not is_hint_pep604(obj):\n # If this object is neither a class nor tuple of classes, raise an\n # exception.\n die_unless_type_or_types(\n type_or_types=obj,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # Else, this object is either a class or tuple of classes.\n # Else, this object is a PEP 604-compliant new union.\n #\n # In any case, this object *COULD* now be runtime-checkable. To decide\n # whether this object is runtime-checkable, further handling is warranted.\n \n #FIXME: *UHHHH... WAT!?* This is totally busted, guys. Since this object is\n #now a PEP 604-compliant new union, this object clearly is neither a type\n #nor a tuple of types; it's a union! So, most of the code below no longer\n #makes any sense whatsoever. Actually, maybe it's just this \"if\n #isinstance(obj, type):\" branch that no longer makes sense? Maybe just\n #remove that branch and quietly pretend this never happened. Note that we\n #still do require the passed \"obj_raiser\" parameter, however. I sigh. *sigh*\n \n # If this object is a class...\n if isinstance(obj, type):\n # If this class is *NOT* runtime-checkable, raise an exception.\n obj_raiser(\n cls=obj,\n is_forwardref_valid=is_forwardref_valid,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # Else, this class is runtime-checkable.\n # Else, this object *MUST* (by process of elimination and validation above)\n # be either a tuple of classes *OR* a PEP 604-compliant new union. In either\n # case...\n else:\n # Attempt to pass this object as the second parameter to isinstance().\n try:\n obj_tester(obj_pith, obj) # type: ignore[arg-type]\n # If doing so raises *ANY* exception, this object is *NOT*\n # runtime-checkable. In this case, raise a human-readable exception.\n #\n # See the die_unless_type_isinstanceable() docstring for details.\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # If this exception ambiguously fails to indicate\n # non-isinstanceability, silently reduce to a noop.\n if _is_exception_ambiguous(exception):\n return\n # Else, this exception unambiguously indicates\n # non-isinstanceability.\n \n # Tuple of all items of this iterable object.\n obj_items: tuple = None # type: ignore[assignment]\n \n # Human-readable label describing this object in this exception\n # message.\n obj_label: str = None # type: ignore[assignment]\n \n # Human-readable label describing the first non-runtime-checkable\n # item of this object in this exception message.\n obj_item_label: str = None # type: ignore[assignment]\n \n # If this object is a tuple, define these locals accordingly.\n if isinstance(obj, tuple):\n obj_items = obj\n obj_label = 'tuple union'\n obj_item_label = 'tuple union item'\n # Else, this object is a new union. Define these locals accordingly.\n else:\n obj_items = get_hint_pep_args(obj)\n obj_label = 'PEP 604 new union'\n obj_item_label = 'new union child type'\n \n # Exception message to be raised.\n exception_message = (\n f'{exception_prefix} {obj_label} {repr(obj)} '\n f'uncheckable at runtime'\n )\n \n # For the 0-based index of each tuple class and that class...\n> for cls_index, cls in enumerate(obj_items):\nE TypeError: 'NoneType' object is not iterable\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585.py::test_get_hint_pep484585_args", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep586.py::test_is_hint_pep586", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #16: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #17: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #18: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new", "Failure #19: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #20: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #21: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #22: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_contains", "Failure #23: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_iter", "Failure #24: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #25: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #26: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #27: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #28: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #29: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #30: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #31: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #32: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py::test_reduce_hint_pep484_subscripted_typevar_to_hint", "Failure #33: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #34: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #35: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #36: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #38: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #39: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #40: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #41: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #42: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #83: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #84: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #85: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #86: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #89: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #90: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #91: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #92: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #93: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #94: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #95: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #96: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py", "test_die_unless_object_isinstanceable" ], [ "beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py", "test_die_unless_object_issubclassable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 23, "true_in_degree": 70.83999999999997, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.005844837735120349, "harmonic": 0.0, "bidirectional_harmonic": 0.2920798682311837, "degree": 23 }, "line_count": 9, "code_line_count": 9, "cyclomatic": 3, "halstead_volume": 10.0, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/forward/reference/fwdrefmake.py", "function_name": "make_forwardref_indexable_subtype", "test_info": { "success": false, "failed": 26, "passed": 1104, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py::test_iter_hint_pep695_forwardrefs\nLocation: /tmp/benchmark_laqap3ij/beartype_test/a00_unit/data/pep/pep695/data_pep695util.py:188\nError: AssertionError\n\nTraceback:\n\n> def test_iter_hint_pep695_forwardrefs() -> None:\n '''\n Test the private\n :mod:`beartype._util.hint.pep.proposal.pep695.iter_hint_pep695_unsubscripted_forwardrefs`\n iterator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep695Exception\n from beartype._util.hint.pep.proposal.pep695 import (\n iter_hint_pep695_unsubscripted_forwardrefs)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_12\n from pytest import raises\n \n # If the active Python interpreter targets Python >= 3.12 and thus supports\n # PEP 695...\n if IS_PYTHON_AT_LEAST_3_12:\n # Defer version-specific imports.\n from beartype_test.a00_unit.data.pep.pep695.data_pep695util import (\n unit_test_iter_hint_pep695_forwardrefs)\n \n # Perform this test.\n> unit_test_iter_hint_pep695_forwardrefs()\n\n> def unit_test_iter_hint_pep695_forwardrefs() -> None:\n '''\n Test the private\n :mod:`beartype._util.hint.pep.proposal.pep695.iter_hint_pep695_unsubscripted_forwardrefs`\n iterator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep695Exception\n from beartype._check.forward.reference.fwdrefmeta import (\n BeartypeForwardRefMeta)\n from beartype._util.hint.pep.proposal.pep695 import (\n iter_hint_pep695_unsubscripted_forwardrefs)\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Type alias containing *NO* unquoted forward references.\n type of_intermitted_song = str | int\n \n # Type alias containing one unquoted forward reference.\n type sudden_she_rose = ItsBurstingBurthen | bool\n \n # Type alias containing two or more unquoted forward reference.\n type as_if_her_heart = ImpatientlyEndured | complex | AtTheSoundHeTurned\n \n # ....................{ ASSERTS ~ null }....................\n # Assert that this iterator yields nothing when passed a type alias\n # containing *NO* unquoted forward references.\n their_own_life = list(iter_hint_pep695_unsubscripted_forwardrefs(of_intermitted_song))\n assert not their_own_life\n \n # ....................{ ASSERTS ~ single }....................\n # Assert that this iterator yields a single forward reference proxy\n # referring to the single unquoted forward reference embedded in a\n # passed type alias containing only that reference.\n and_saw_by = iter_hint_pep695_unsubscripted_forwardrefs(sudden_she_rose)\n the_warm_light_of = next(and_saw_by)\n> assert isinstance(the_warm_light_of, BeartypeForwardRefMeta)\nE AssertionError\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_add_func_scope_types\nLocation: /tmp/benchmark_laqap3ij/beartype_test/a00_unit/data/check/forward/data_fwdref.py:102\nError: AttributeError: 'NoneType' object has no attribute 'Class'\n\nTraceback:\n\n> def test_add_func_scope_types() -> None:\n '''\n Test the\n :func:`beartype._check.code.codescope.add_func_scope_types` adder.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import (\n BeartypeDecorHintNonpepException,\n BeartypeDecorHintPep3119Exception,\n )\n from beartype._cave._cavefast import CallableTypes, ModuleOrStrTypes\n from beartype._cave._cavemap import NoneTypeOr\n from beartype._check.code.codescope import add_func_scope_types\n from beartype._util.utilobject import get_object_type_basename\n> from beartype_test.a00_unit.data.check.forward.data_fwdref import (\n FORWARDREF_ABSOLUTE,\n FORWARDREF_RELATIVE,\n )\n\n> #!/usr/bin/env python3\n # --------------------( LICENSE )--------------------\n # Copyright (c) 2014-2025 Beartype authors.\n # See \"LICENSE\" for further details.\n \n '''\n Project-wide **forward reference proxy data** submodule.\n \n This submodule predefines **forward reference proxies** (i.e., low-level objects\n created by the :func:`beartype._check.forward.reference.fwdrefmake` submodule)\n exercising known edge cases on behalf of higher-level unit test submodules.\n '''\n \n # ....................{ IMPORTS }....................\n from beartype._check.forward.reference.fwdrefmake import (\n make_forwardref_indexable_subtype)\n \n # ....................{ CONSTANTS }....................\n PACKAGE_NAME = 'beartype_test.a00_unit.data'\n '''\n Fully-qualified name of a subpackage defining an arbitrary submodule.\n '''\n \n \n MODULE_BASENAME = 'data_type'\n '''\n Unqualified basename of a submodule in that subpackage defining an arbitrary\n class.\n '''\n \n \n MODULE_NAME = f'{PACKAGE_NAME}.{MODULE_BASENAME}'\n '''\n Fully-qualified name of the same submodule.\n '''\n \n \n CLASS_BASENAME = 'Class'\n '''\n Unqualified basename of that class in that module.\n '''\n \n \n CLASS_NAME = f'{MODULE_NAME}.{CLASS_BASENAME}'\n '''\n Fully-qualified name of that class.\n '''\n \n \n SCOPE_NAME = '__name__'\n '''\n Fully-qualified name of the current test module.\n '''\n \n # ....................{ FORWARDREFS ~ invalid }....................\n FORWARDREF_RELATIVE_CIRCULAR = make_forwardref_indexable_subtype(\n # Fully-qualified name of the current test module.\n SCOPE_NAME,\n # Unqualified basename of this global currently being declared.\n 'FORWARDREF_RELATIVE_CIRCULAR',\n )\n '''\n **Circular forward reference proxy** (i.e., invalid proxy circularly and thus\n recursively referring to the same forward reference proxy).\n \n Since the only means of declaring a circular forward reference proxy is as a\n global attribute, the declaration of this proxy is necessarily isolated to its\n own data submodule.\n '''\n \n # ....................{ FORWARDREFS ~ valid }....................\n FORWARDREF_ABSOLUTE = make_forwardref_indexable_subtype(\n # Intentionally ignored fully-qualified name of this test submodule.\n SCOPE_NAME,\n CLASS_NAME,\n )\n '''\n Forward reference proxy to an unsubscripted class referenced with an absolute\n (i.e., fully-qualified) name.\n '''\n \n \n FORWARDREF_RELATIVE = make_forwardref_indexable_subtype(\n MODULE_NAME, CLASS_BASENAME)\n '''\n Forward reference proxy to an unsubscripted class referenced with a\n relative (i.e., unqualified) name.\n '''\n \n \n FORWARDREF_MODULE_ABSOLUTE = make_forwardref_indexable_subtype(\n # Intentionally ignored fully-qualified name of this test submodule.\n SCOPE_NAME,\n MODULE_NAME,\n )\n '''\n Forward reference proxy to a submodule of a subpackage referenced with an\n absolute (i.e., fully-qualified) name.\n '''\n \n \n> FORWARDREF_MODULE_CLASS = FORWARDREF_MODULE_ABSOLUTE.Class\nE AttributeError: 'NoneType' object has no attribute 'Class'\n", "Failure #3: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_express_func_scope_type_ref", "Failure #4: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py::test_make_forwardref_indexable_subtype", "Failure #5: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdreftest.py::test_is_forwardref", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #22: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #23: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #24: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #25: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #26: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py", "test_iter_hint_pep695_forwardrefs" ], [ "beartype_test/a00_unit/a60_check/a20_code/test_codescope.py", "test_add_func_scope_types" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.592, "in_degree": 5, "true_in_degree": 10.120000000000001, "out_degree": 1, "betweenness": 4.064423827278245e-05, "pagerank": 0.0007674766255124236, "harmonic": 0.0038377192982456134, "bidirectional_harmonic": 0.21151125920862848, "degree": 6 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_decor/decorcore.py", "function_name": "_beartype_object_fatal", "test_info": { "success": false, "failed": 90, "passed": 1040, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_rvqezgvk/beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py:50\nError: assert False is True\n + where False = (None)\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n @beartype\n def where_that_or() -> str:\n '''\n Arbitrary callable decorated by the :func:`beartype.beartype` decorator\n intentionally annotated by one or more arbitrary unignorable type hints\n to prevent that decorator from silently reducing to a noop.\n '''\n \n return 'In the still cave of the witch Poesy,'\n \n def thou_art_no_unbidden_guest() -> str:\n '''\n Arbitrary callable *not* decorated by the :func:`beartype.beartype`\n decorator intentionally annotated by one or more arbitrary unignorable\n type hints for parity with the prior callable.\n '''\n \n return 'Seeking among the shadows that pass by'\n \n # Assert this tester returns the expected results for these callables.\n> assert is_func_beartyped(where_that_or) is True\nE assert False is True\nE + where False = (None)\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark_rvqezgvk/beartype/_util/func/arg/utilfuncarglen.py:365\nError: beartype.roar.BeartypeValeSubscriptionException: None uncallable.\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n @beartype\n def _is_exclamatory(text: str):\n return '!' in text\n \n # Dynamically generated lambda function. To exercise in-memory validators\n # dynamically defined outside of a standard on-disk module (e.g., \"smart\"\n # REPLs like IPython), this function's code is intentionally cached with\n # the standard \"linecache\" module.\n _is_commentary = make_func(\n func_name='_is_commentary',\n func_code=(\n \"\"\"_is_commentary = lambda text: text and text[-1] == ','\"\"\"),\n is_debug=True,\n )\n \n # ....................{ VALIDATORS }....................\n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined physically in this on-disk module.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined dynamically in-memory.\n IsCommentary = Is[_is_commentary]\n \n # Validator produced by subscripting this factory with non-lambda functions\n # satisfying the expected API.\n IsQuoted = Is[_is_quoted]\n> IsExclamatory = Is[_is_exclamatory]\n\n> die_unless_validator_tester(is_valid)\n\n> die_unless_func_args_len_flexible_equal(\n\n> func_args_len_flexible_actual = get_func_args_flexible_len(\n\n> def get_func_args_flexible_len(\n # Mandatory parameters.\n func: Codeobjable,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> int:\n '''\n Number of **flexible parameters** (i.e., parameters passable as either\n positional or keyword arguments but *not* positional-only, keyword-only,\n variadic, or other more constrained kinds of parameters) accepted by the\n passed pure-Python callable.\n \n This getter transparently handles all of the following:\n \n * Conventional pure-Python callables.\n * If ``is_unwrap`` is :data:`True`:\n \n * Pure-Python **partials** (i.e., pure-Python callable\n :class:`functools.partial` objects directly wrapping pure-Python\n callables). If a partial is passed, this getter transparently returns\n the total number of flexible parameters accepted by the lower-level\n callable wrapped by this partial minus the number of flexible parameters\n partialized away by this partial.\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n is_unwrap: bool, optional\n :data:`True` only if this getter implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function.\n Defaults to :data:`True` for safety. See :func:`.get_func_codeobj` for\n further commentary.\n exception_cls : type, optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the message of any exception raised in\n the event of a fatal error. Defaults to the empty string.\n \n Returns\n -------\n int\n Number of flexible parameters accepted by this callable.\n \n Raises\n ------\n exception_cls\n If that callable is *not* pure-Python.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.api.standard.utilfunctools import (\n get_func_functools_partial_args_flexible_len,\n is_func_functools_partial,\n )\n from beartype._util.func.utilfunctest import is_func_codeobjable\n \n # If the passed callable is pure-Python...\n if is_func_codeobjable(func):\n # Number of various kinds of parameters accepted by that callable.\n func_args_lens = get_func_args_lens(\n func=func,\n is_unwrap=is_unwrap,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # Number of all non-keyword-only parameters (i.e., both optional and\n # mandatory positional-only, positional, and keyword parameters)\n # accepted by that callable.\n return func_args_lens[ARGS_LENS_INDEX_POSONLY_OR_FLEX]\n # Else, that callable has *NO* code object.\n #\n # If that callable is *NOT* actually callable, raise an exception.\n elif not callable(func):\n> raise exception_cls(f'{exception_prefix}{repr(func)} uncallable.')\nE beartype.roar.BeartypeValeSubscriptionException: None uncallable.\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_no_type_check", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_type_fail", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #81: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #82: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #83: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #84: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #85: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #86: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #87: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #88: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #89: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #90: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 37.291674009600015, "in_degree": 2, "true_in_degree": 4.3999999999999995, "out_degree": 2, "betweenness": 2.438654296366947e-05, "pagerank": 0.0005694219773026547, "harmonic": 0.04259803153717625, "bidirectional_harmonic": 0.20915125170881815, "degree": 4 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/arg/utilfuncargget.py", "function_name": "get_func_arg_names", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py::test_get_func_arg_name_first_or_none\nLocation: /tmp/benchmark_estfm19g/beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py:45\nError: AssertionError: assert None == 'and_in_her_his_one_delight'\n + where None = ()\n\nTraceback:\n\n> def test_get_func_arg_name_first_or_none() -> None:\n '''\n Test the\n :func:`beartype._util.func.arg.utilfuncargget.get_func_arg_name_first_or_none`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype._util.func.arg.utilfuncargget import (\n get_func_arg_name_first_or_none)\n from beartype_test.a00_unit.data.func.data_func import (\n func_args_0_wrapped,\n func_args_1_varpos_wrapped,\n func_args_3_flex_mandatory_optional_varkw_wrapped,\n )\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this getter returns \"None\" for argumentless callables.\n assert get_func_arg_name_first_or_none(func_args_0_wrapped) is None\n \n # Assert this getter returns the expected names of the first parameters\n # accepted by argumentative callables.\n> assert get_func_arg_name_first_or_none(func_args_1_varpos_wrapped) == (\n 'and_in_her_his_one_delight')\nE AssertionError: assert None == 'and_in_her_his_one_delight'\nE + where None = ()\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py::test_get_func_arg_names\nLocation: /tmp/benchmark_estfm19g/beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py:82\nError: assert None == ()\n + where None = ()\n\nTraceback:\n\n> def test_get_func_arg_names() -> None:\n '''\n Test the\n :func:`beartype._util.func.arg.utilfuncargget.get_func_arg_names`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype._util.func.arg.utilfuncargget import get_func_arg_names\n from beartype_test.a00_unit.data.func.data_func import (\n func_args_0_wrapped,\n func_args_1_varpos_wrapped,\n func_args_3_flex_mandatory_optional_varkw_wrapped,\n func_args_5_flex_mandatory_varpos_kwonly_varkw_wrapped,\n )\n from beartype_test.a00_unit.data.func.data_pep570 import (\n func_args_10_all_except_flex_mandatory)\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this getter when passed an argumentless callable returns the empty\n # list.\n> assert get_func_arg_names(func_args_0_wrapped) == ()\nE assert None == ()\nE + where None = ()\n", "Failure #3: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name", "Failure #4: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_positional", "Failure #5: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_keyword", "Failure #6: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_beartypeable_kind" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py", "test_get_func_arg_name_first_or_none" ], [ "beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py", "test_get_func_arg_names" ] ] }, "complexity_info": { "centrality": { "distance_discount": 8.907520000000005, "in_degree": 2, "true_in_degree": 5.039999999999999, "out_degree": 3, "betweenness": 0.0001395452180698864, "pagerank": 0.0008907932355495148, "harmonic": 0.012143640350877193, "bidirectional_harmonic": 0.19522450776562691, "degree": 5 }, "line_count": 32, "code_line_count": 32, "cyclomatic": 5, "halstead_volume": 8.0, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/error/utilerrraise.py", "function_name": "reraise_exception_placeholder", "test_info": { "success": false, "failed": 25, "passed": 1105, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/error/test_utilerrraise.py::test_reraise_exception_placeholder\nLocation: /tmp/benchmark_xj3yxaw3/beartype_test/a00_unit/a20_util/error/test_utilerrraise.py:92\nError: Failed: DID NOT RAISE .CachedException'>\n\nTraceback:\n\n> def test_reraise_exception_placeholder() -> None:\n '''\n Test the\n :func:`beartype._util.error.utilerrraise.reraise_exception_placeholder`\n function.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.cache.utilcachecall import callable_cached\n from beartype._util.error.utilerrraise import reraise_exception_placeholder\n from pytest import raises\n from random import getrandbits\n \n # ....................{ CLASSES }....................\n class CachedException(ValueError):\n '''\n Test-specific exception intended to be raised below with messages\n containing placeholder substrings replaced by the\n :func:`.reraise_exception_placeholder` re-raiser.\n '''\n \n pass\n \n # ....................{ LOCALS }....................\n # Source substring to be hard-coded into the messages of all exceptions\n # raised by the low-level memoized callable defined below.\n TEST_SOURCE_STR = '{its_got_bro}'\n \n # ....................{ CALLABLES }....................\n @callable_cached\n def portend_low_level_winter(is_winter_coming: bool) -> str:\n '''\n Low-level memoized callable raising unreadable exceptions conditionally\n depending on the value of the passed parameter.\n '''\n \n if is_winter_coming:\n raise CachedException(\n f'{TEST_SOURCE_STR} intimates that winter is coming.')\n else:\n return 'PRAISE THE SUN'\n \n \n def portend_high_level_winter() -> None:\n '''\n High-level non-memoized callable calling the low-level memoized callable\n and reraising unreadable exceptions raised by the latter with equivalent\n readable exceptions.\n '''\n \n try:\n # Call the low-level memoized callable without raising exceptions.\n print(portend_low_level_winter(False))\n \n # Call the low-level memoized callable with raising exceptions.\n print(portend_low_level_winter(True))\n except CachedException as exception:\n # print('exception.args: {!r} ({!r})'.format(exception.args, type(exception.args)))\n reraise_exception_placeholder(\n exception=exception,\n source_str=TEST_SOURCE_STR,\n target_str=(\n 'Random \"Song of Fire and Ice\" spoiler' if getrandbits(1) else\n 'Random \"Dark Souls\" plaintext meme'\n ),\n )\n \n # ....................{ ASSERT }....................\n # Assert this high-level non-memoized callable raises the same type of\n # exception raised by this low-level memoized callable and preserve this\n # exception for subsequent assertion.\n> with raises(CachedException) as exception_info:\nE Failed: DID NOT RAISE .CachedException'>\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_xj3yxaw3/beartype/_check/checkmake.py:807\nError: UnboundLocalError: cannot access local variable 'func_tester' where it is not associated with a value\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n die_if_unbearable(pith, hint, conf=conf)\n \n # ....................{ FAIL }....................\n # Assert this tester raises the expected exception when passed an invalid\n # object as the type hint.\n with raises(BeartypeDecorHintNonpepException):\n> die_if_unbearable(\n obj='Holds every future leaf and flower; the bound',\n hint=b'With which from that detested trance they leap;',\n )\n\n> func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> def _make_func_checker(\n # Mandatory parameters.\n hint: Hint,\n conf: BeartypeConf,\n make_code_check: Callable[..., CodeGenerated],\n \n # Optional parameters.\n exception_prefix: str = 'die_if_unbearable() or is_bearable() ',\n ) -> CallableRaiserOrTester:\n '''\n **Type-checking function factory** (i.e., low-level callable dynamically\n generating a pure-Python tester function testing whether an arbitrary object\n passed to that tester satisfies the type hint passed to this factory and\n either returning that result as its boolean return *or* raising a fatal\n exception or emitting a non-fatal warning if that result is :data:`False`).\n \n This factory is intentionally *not* memoized (e.g., by the\n ``@callable_cached`` decorator), as this factory is only called by\n higher-level memoized factories.\n \n Caveats\n -------\n **This factory intentionally accepts no** ``exception_cls`` **parameter.**\n Doing so would only ambiguously obscure context-sensitive exceptions raised\n by lower-level utility functions called by this higher-level factory.\n \n Parameters\n ----------\n hint : Hint\n Type hint to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n make_code_check : Callable[..., CodeGenerated]\n **Type-checking code factory** (i.e., function dynamically generating a\n code snippet of a function type-checking an arbitrary object against the\n passed type hint under the passed beartype configuration).\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to a reasonably sensible string.\n \n Returns\n -------\n CallableTester\n Type-checking tester function generated by this factory for this hint.\n \n Raises\n ------\n All exceptions raised by the lower-level :func:`.make_check_expr` factory.\n Additionally, this factory also raises:\n \n BeartypeConfException\n If this configuration is *not* a :class:`.BeartypeConf` instance.\n BeartypeDecorHintForwardRefException\n If this hint contains one or more relative forward references, which\n this factory explicitly prohibits to improve both the efficiency and\n portability of calls by users to the resulting type-checker.\n _BeartypeUtilCallableException\n If this function erroneously generates a syntactically invalid\n type-checking function. That should *never* happen, but let's admit that\n you're still reading this for a reason.\n \n Warns\n -----\n All warnings emitted by the lower-level :func:`.make_check_expr` factory.\n '''\n assert callable(make_code_check), f'{repr(make_code_check)} uncallable.'\n \n # Attempt to...\n #\n # Note that the passed \"exception_prefix\" is intentionally *NOT* passed to\n # functions in the body of this \"try\" block. Why? Memoization efficiency.\n # Instead, the placeholder \"EXCEPTION_PLACEHOLDER\" is intentionally passed.\n # The \"except\" block then catches and replaces that with \"exception_prefix\".\n try:\n # With a context manager \"catching\" *ALL* non-fatal warnings emitted\n # during this logic for subsequent \"playback\" below...\n with catch_warnings(record=True) as warnings_issued:\n # ....................{ VALIDATION }....................\n # If \"conf\" is *NOT* a configuration, raise an exception.\n die_unless_conf(conf)\n # Else, \"conf\" is a configuration.\n \n # Sane hint sanified from this possibly insane parameter hint if\n # sanifying this hint generated no supplementary metadata *OR*\n # that metadata otherwise. Additionally, if this hint is\n # unsupported by @beartype, raise an exception.\n #\n # Do this first *BEFORE* passing this hint to any further callables.\n hint_or_sane = sanify_hint_root_statement(\n hint=hint, conf=conf, exception_prefix=EXCEPTION_PLACEHOLDER)\n # print(f'Reduced tester root hint {repr(hint)} to hint or metadata {repr(hint_or_sane)}.')\n \n # If this hint is ignorable, all objects satisfy this hint. In this\n # case, return a trivial function unconditionally returning true.\n if hint_or_sane is Any:\n return _func_checker_ignorable\n # Else, this hint is unignorable.\n \n # ....................{ CODE }....................\n # Python code snippet comprising a single boolean expression\n # type-checking an arbitrary object against this hint.\n (\n code_check,\n func_scope,\n hint_refs_type_basename,\n ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n # print(f'func_scope: {func_scope}')\n \n #FIXME: Actually, nothing below is particularly significant. Users\n #now basically require this. So, let's find a way to do this. The\n #only genuinely significant blocker here from @beartype's\n #perspective is *MEMOIZATION.* Currently, the parent factories\n #(e.g., make_func_raiser()) transitively calling this factory are\n #memoized by @callable_cached. Clearly, memoization breaks down in\n #the face of relative forward references... *OR DOES IT!?* We now\n #need to probably:\n #* Figure out a way of replacing all relative forward references\n # with corresponding \"ForwardRefRelativeProxy\" objects.\n #* This is a fundamentally new type of thing we currently do *NOT*\n # have. The idea here is that these objects should dynamically\n # introspect up the call stack for the first stack frame residing\n # in a non-\"beartype\" module, which these objects then resolve each\n # relative forward reference against.\n #* Consider refactoring our \"codemake\" algorthm to unconditionally\n # do this for *ALL* relative forward references. Doing so would\n # (probably) be a lot faster than the current global string\n # replacement approach... maybe. Okay, maybe not. But maybe.\n #\n #Sounds fun! Sounds like a lot of non-trivial work, too. But that's\n #where all the fun resides, doesn't it? *DOESN'T IT!?*\n #FIXME: *WAIT.* That doesn't quite work. The issue, of course, is\n #that the scope in which a callable is called may no longer have\n #access to the scope in which a callable was defined, which is where\n #the class referred to by relative forward references actually\n #lives. So, we absolutely should *NOT* \"Consider refactoring our...\"\n #No. Don't do that. That said, the above idea *SHOULD* still behave\n #itself for if_bearable() and die_if_unbearable(), because these\n #statement-level type-checkers actually do run in the same scopes\n #that their type hints are defined in. Huh. Pretty nifty, eh? This\n #then suggests that:\n #* We'll need to generalize our \"codemake\" function to accept a new\n # optional \"is_refs_relative_proxy: bool = False\" parameter. When:\n # * \"True\", code generation replaces all relative forward\n # references with corresponding \"ForwardRefRelativeProxy\" objects\n # as detailed above.\n # * \"False\", code generation simply returns relative forward\n # references as it currently does.\n \n # If this hint contains one or more relative forward references,\n # this hint is non-portable across lexical scopes. In this case,\n # raise an exception. Why? Because this hint is relative to and thus\n # valid only with respect to the caller's current lexical scope.\n # However, there is *NO* guarantee that the type-checking function\n # created and returned by this factory resides in the same lexical\n # scope.\n #\n # Suppose that type-checking function does, however. Even in that\n # best case, *ALL* calls to that tester would still be non-portable.\n # Why? Because those calls would now tacitly assume the original\n # lexical scope that they were called in. Those calls are now\n # lexically-dependent and thus could *NOT* be trivially\n # copy-and-pasted into different lexical scopes (e.g., submodules,\n # classes, or callables); doing so would raise exceptions at call\n # time, due to being unable to resolve those references. Preventing\n # users from doing something that will blow up in their test suites\n # commits after the fact is not simply a good thing; it's really the\n # only sane thing left.\n #\n # Suppose that we didn't particularly care about end user sanity,\n # however. Even in that worst case, resolving these references would\n # still be non-trivial, non-portable, and (perhaps most importantly)\n # incredibly slow. Why? Because doing so would require iteratively\n # introspecting the call stack for the first callable *NOT* residing\n # in the \"beartype\" codebase. These references would then be\n # resolved against the global and local lexical scope of that\n # callable. While technically feasible, doing so would render\n # higher-level \"beartype\" functions calling this lower-level factory\n # (e.g., our increasingly popular public beartype.door.is_bearable()\n # and die_if_unbearable() type-checkers) sufficiently slow as to be\n # pragmatically infeasible.\n if hint_refs_type_basename:\n # Defer to a low-level getter to raise a reasonable exception.\n get_hint_pep484585_ref_names_relative_to(\n # First relative forward reference in this type hint,\n # arbitrarily chosen for convenience.\n hint=hint_refs_type_basename[0],\n exception_prefix=(\n f'{EXCEPTION_PLACEHOLDER}type hint {repr(hint)} '),\n )\n # Else, this hint contains *NO* relative forward references.\n \n # Unqualified basename of this type-checking function, uniquified by\n # suffixing an arbitrary integer unique to this function.\n func_checker_name = (\n f'{FUNC_CHECKER_NAME_PREFIX}{next(_func_checker_name_counter)}')\n \n # Python code snippet declaring the signature of the type-checking\n # function function to be defined and returned by this factory.\n code_signature = make_func_signature(\n func_name=func_checker_name,\n func_scope=func_scope,\n code_signature_format=CODE_CHECKER_SIGNATURE,\n conf=conf,\n )\n \n # Python code snippet defining this type-checking function in full.\n func_checker_code = f'{code_signature}{code_check}'\n \n # ....................{ FUNCTION }....................\n # Type-checking tester function to be returned.\n func_tester = make_func(\n func_name=func_checker_name,\n func_code=func_checker_code,\n func_locals=func_scope,\n \n #FIXME: Almost right but *NOT* quite right. Why? Because\n #make_func() will append a space to \"func_label\", but\n #\"EXCEPTION_PLACEHOLDER\" is *ALREADY* suffixed by a space. Oh,\n #well. It's not a super-big deal. In theory, this function\n #should *NEVER* raise exceptions, anyway. *shrug*\n func_label=EXCEPTION_PLACEHOLDER,\n \n is_debug=conf.is_debug,\n )\n # If one or more warnings were issued, reissue these warnings with each\n # placeholder substring (i.e., \"EXCEPTION_PLACEHOLDER\" instance)\n # replaced by a human-readable description of this callable and\n # annotated return.\n if warnings_issued:\n reissue_warnings_placeholder(\n warnings=warnings_issued, target_str=exception_prefix)\n # Else, *NO* warnings were issued.\n # If doing so raises *ANY* exception, reraise this exception with each\n # placeholder substring (i.e., \"EXCEPTION_PLACEHOLDER\" instance) replaced by\n # an explanatory prefix.\n except Exception as exception:\n reraise_exception_placeholder(\n exception=exception, target_str=exception_prefix)\n \n # Return this tester function.\n> return func_tester # type: ignore[return-value]\nE UnboundLocalError: cannot access local variable 'func_tester' where it is not associated with a value\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #22: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #23: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #24: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #25: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/error/test_utilerrraise.py", "test_reraise_exception_placeholder" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.6, "in_degree": 3, "true_in_degree": 5.880000000000001, "out_degree": 2, "betweenness": 2.438654296366947e-05, "pagerank": 0.00043590318095629055, "harmonic": 0.003289473684210526, "bidirectional_harmonic": 0.22355759189640825, "degree": 5 }, "line_count": 17, "code_line_count": 17, "cyclomatic": 6, "halstead_volume": 15.509775004326936, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/metadata/metasane.py", "function_name": "get_hint_or_sane_hint", "test_info": { "success": false, "failed": 16, "passed": 1114, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_toul34aw/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:119\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n> with warns(hint_meta.warning_type):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_toul34aw/beartype/_util/cls/utilclstest.py:133\nError: beartype.roar.BeartypeDecorHintPep3119Exception: Is_bearable() PEP 484 or 585 subclass type hint typing.Type[type] child type hint None neither class nor tuple of one or more classes.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> raise exception # pyright: ignore\n\n> is_bearable(pith, hint, conf=conf)\n\n> func_tester = make_func_tester(hint, conf)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> die_unless_object_issubclassable(\n\n> _die_if_object_uncheckable(\n\n> die_unless_type_or_types(\n\n> def die_unless_type_or_types(\n # Mandatory parameters.\n type_or_types: object,\n \n # Optional parameters.\n exception_cls: TypeException = _BeartypeUtilTypeException,\n exception_prefix: str = '',\n ) -> None:\n '''\n Raise an exception of the passed type unless the passed object is either a\n class *or* tuple of one or more classes.\n \n Parameters\n ----------\n type_or_types : object\n Object to be validated.\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error. Defaults\n to :exc:`._BeartypeUtilTypeException`.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to the empty string.\n \n Raises\n ------\n exception_cls\n If this object is neither a class *nor* tuple of one or more classes.\n '''\n \n # If this object is neither a class *NOR* tuple of one or more classes,\n # raise an exception.\n if not is_type_or_types(type_or_types):\n assert isinstance(exception_cls, type), (\n 'f{repr(exception_cls)} not exception class.')\n assert issubclass(exception_cls, Exception), (\n f'{repr(exception_cls)} not exception subclass.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Exception message to be raised below.\n exception_message = (\n f'{exception_prefix}{repr(type_or_types)} neither '\n f'class nor tuple of one or more classes'\n )\n \n # If this object is a tuple...\n if isinstance(type_or_types, tuple):\n # If this tuple is empty, note that.\n if not type_or_types:\n exception_message += ' (i.e., is empty tuple)'\n # Else, this tuple is non-empty. In this case...\n else:\n # For the 0-based index of each tuple item and that item...\n for cls_index, cls in enumerate(type_or_types):\n # If this object is *NOT* a class...\n if not isinstance(cls, type):\n # Note this.\n exception_message += (\n f' (i.e., tuple item {cls_index} '\n f'{repr(cls)} not class)'\n )\n \n # Halt iteration.\n break\n # Else, this object is a class. Continue to the next item.\n # Else, this object is a non-tuple. In this case, the general-purpose\n # exception message suffices.\n \n # Raise this exception.\n> raise exception_cls(f'{exception_message}.')\nE beartype.roar.BeartypeDecorHintPep3119Exception: Is_bearable() PEP 484 or 585 subclass type hint typing.Type[type] child type hint None neither class nor tuple of one or more classes.\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #11: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #12: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #13: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #14: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #15: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 6, "true_in_degree": 11.920000000000003, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.00042492672381655585, "harmonic": 0.0, "bidirectional_harmonic": 0.2492285994341913, "degree": 6 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/arg/utilfuncarglen.py", "function_name": "_get_func_boundmethod_args_flexible_len", "test_info": { "success": false, "failed": 38, "passed": 1055, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py::test_get_func_args_len_flexible\nLocation: /tmp/benchmark_t0x_99q3/beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py:70\nError: assert None == 0\n + where None = ()\n\nTraceback:\n\n> def test_get_func_args_len_flexible() -> None:\n '''\n Test the\n :func:`beartype._util.func.arg.utilfuncarglen.get_func_args_flexible_len`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype._util.func.arg.utilfuncarglen import (\n get_func_args_flexible_len)\n from beartype_test.a00_unit.data.data_type import (\n ClassCallable,\n function_partial,\n function_partial_bad,\n )\n from beartype_test.a00_unit.data.func.data_func import (\n func_args_0,\n func_args_1_flex_mandatory,\n func_args_1_varpos,\n func_args_2_flex_mandatory,\n func_args_0_wrapped,\n func_args_1_flex_mandatory_wrapped,\n func_args_1_varpos_wrapped,\n func_args_2_flex_mandatory_wrapped,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Callable object whose class defines the __call__() dunder method.\n callable_object = ClassCallable()\n \n # ....................{ PASS }....................\n # Assert this getter returns the expected lengths of unwrapped callables.\n assert get_func_args_flexible_len(func_args_0) == 0\n assert get_func_args_flexible_len(func_args_1_varpos) == 0\n assert get_func_args_flexible_len(func_args_1_flex_mandatory) == 1\n assert get_func_args_flexible_len(func_args_2_flex_mandatory) == 2\n \n # Assert this getter returns the expected lengths of wrapped callables.\n assert get_func_args_flexible_len(func_args_0_wrapped) == 0\n assert get_func_args_flexible_len(func_args_1_varpos_wrapped) == 0\n assert get_func_args_flexible_len(func_args_1_flex_mandatory_wrapped) == 1\n assert get_func_args_flexible_len(func_args_2_flex_mandatory_wrapped) == 2\n \n # Assert this getter returns the expected length of a partial callable.\n assert get_func_args_flexible_len(function_partial) == 0\n \n # Assert this getter returns the expected length of a callable object.\n> assert get_func_args_flexible_len(callable_object) == 0\nE assert None == 0\nE + where None = ()\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_t0x_99q3/beartype/_util/func/arg/utilfuncargtest.py:105\nError: beartype.roar.BeartypeValeSubscriptionException: Callable .TruthSeeker object at 0x737609bc70b0> flexible argument count None != 1 (i.e., .TruthSeeker object at 0x737609bc70b0> accepts None rather than 1 positional and/or keyword parameters).\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> hint=Annotated[object, Is[TruthSeeker()]],\n\n> die_unless_validator_tester(is_valid)\n\n> die_unless_func_args_len_flexible_equal(\n\n> def die_unless_func_args_len_flexible_equal(\n # Mandatory parameters.\n func: Codeobjable,\n func_args_len_flexible: int,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> None:\n '''\n Raise an exception unless the passed pure-Python callable accepts the passed\n number of **flexible parameters** (i.e., parameters passable as either\n positional or keyword arguments).\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n func_args_len_flexible : int\n Number of flexible parameters to validate this callable as accepting.\n is_unwrap: bool, optional\n :data:`True` only if this validator implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function to\n unwrap this possibly higher-level wrapper into its possibly lowest-level\n wrappee *before* returning the code object of that wrappee. Note that\n doing so incurs worst-case time complexity :math:`O(n)` for :math:`n`\n the number of lower-level wrappees wrapped by this wrapper. Defaults to\n :data:`True` for robustness. Why? Because this validator *must* always\n introspect lowest-level wrappees rather than higher-level wrappers. The\n latter typically do *not* accurately replicate the signatures of the\n former. In particular, decorator wrappers typically wrap decorated\n callables with variadic positional and keyword parameters (e.g., ``def\n _decorator_wrapper(*args, **kwargs)``). Since neither constitutes a\n flexible parameter, this validator raises an exception when passed such\n a wrapper with this boolean set to :data:`False`. Only set this boolean\n to :data:`False` if you pretend to know what you're doing.\n exception_cls : type, optional\n Type of exception to be raised. Defaults to\n :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing this exception message. Defaults to the\n empty string.\n \n Raises\n ------\n exception_cls\n If this callable either:\n \n * Is *not* callable.\n * Is callable but is *not* pure-Python.\n * Is a pure-Python callable accepting either more or less than this\n Number of flexible parameters.\n '''\n assert isinstance(func_args_len_flexible, int)\n \n # Number of flexible parameters accepted by this callable.\n func_args_len_flexible_actual = get_func_args_flexible_len(\n func=func,\n is_unwrap=is_unwrap,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # If this callable accepts more or less than this number of flexible\n # parameters, raise an exception.\n if func_args_len_flexible_actual != func_args_len_flexible:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n> raise exception_cls(\n f'{exception_prefix}callable {repr(func)} flexible argument count '\n f'{func_args_len_flexible_actual} != {func_args_len_flexible} '\n f'(i.e., {repr(func)} accepts {func_args_len_flexible_actual} '\n f'rather than {func_args_len_flexible} positional and/or keyword '\n f'parameters).'\n )\nE beartype.roar.BeartypeValeSubscriptionException: Callable .TruthSeeker object at 0x737609bc70b0> flexible argument count None != 1 (i.e., .TruthSeeker object at 0x737609bc70b0> accepts None rather than 1 positional and/or keyword parameters).\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #25: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #29: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #30: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #31: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #32: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #33: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #34: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #35: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #36: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #38: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py", "test_get_func_args_len_flexible" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 10.821120000000004, "in_degree": 1, "true_in_degree": 9.160000000000005, "out_degree": 2, "betweenness": 0.00015715772132142547, "pagerank": 0.0004946666128106095, "harmonic": 0.013651315789473685, "bidirectional_harmonic": 0.1856915608149168, "degree": 3 }, "line_count": 26, "code_line_count": 26, "cyclomatic": 2, "halstead_volume": 10.0, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/door/_cls/doormeta.py", "function_name": "_TypeHintMeta.__call__", "test_info": { "success": false, "failed": 16, "passed": 1114, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new\nLocation: /tmp/benchmark_7udboea0/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:54\nError: AssertionError: assert None is not None\n + where None = (typing.List)\n + and None = (list)\n\nTraceback:\n\n> def test_door_typehint_new() -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.__new__` factory method.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n Union,\n )\n from pytest import raises\n \n # Intentionally import from \"typing\" rather than \"beartype.typing\" to\n # guarantee PEP 484-compliant type hints.\n from typing import List\n \n # ....................{ PASS }....................\n # Assert that recreating a type hint against identical input yields the same\n # previously memoized type hint.\n assert TypeHint(List[Any]) is TypeHint(List[Any])\n assert TypeHint(int) is TypeHint(int)\n \n #FIXME: Generalize \"TypeHint\" to ensure that these two type hints actually\n #do reduce to the same \"TypeHint\" object. Specifically, \"List\" and \"list\"\n #are both indeed semantically equivalent to \"List[Any]\".\n \n # Assert that recreating a type hint against non-identical but semantically\n # equivalent input does *NOT* reduce to the same previously memoized type\n # hint, sadly.\n> assert TypeHint(List) is not TypeHint(list)\nE AssertionError: assert None is not None\nE + where None = (typing.List)\nE + and None = (list)\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping\nLocation: /tmp/benchmark_7udboea0/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:123\nError: AssertionError: assert False\n + where False = isinstance(None, )\n + where = HintPepMetadata(\\n hint=~T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('TypeVar'),\\n typehint_cls=,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith='Oblate weapon Stacks (actually',\\n is_context_manager=False,\\n is_pith_factory=False,\\n)),\\n typevars=(),\\n warning_type=None,\\n).typehint_cls\n\nTraceback:\n\n> def test_door_typehint_mapping(iter_hints_piths_meta) -> None:\n '''\n Test that the :meth:`beartype.door.TypeHint.__new__` factory method\n successfully creates and returns an instance of a concrete subclass of the\n abstract :class:`beartype.door.TypeHint` superclass conditionally handling\n the kind of low-level type hint passed to that factory method.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n \n # ....................{ ASSERTS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # ....................{ METADATA }....................\n # Metadata describing this type hint.\n hint_meta = hint_pith_meta.hint_meta\n \n # This type hint.\n hint = hint_meta.hint\n \n # If either...\n if (\n # This hint is PEP-noncompliant *OR*...\n not isinstance(hint_meta, HintPepMetadata) or\n # This kind of type hint is currently unsupported by the\n # \"beartype.door\" submodule...\n hint_meta.typehint_cls is None\n ):\n # Silently ignore this hint and continue to the next.\n continue\n # Else, this kind of type hint is currently supported by the\n # \"beartype.door\" submodule *AND* this hint is PEP-compliant.\n \n # Instance of a concrete subclass of the abstract \"TypeHint\" superclass\n # conditionally handling this kind of type hint.\n wrapper = TypeHint(hint)\n \n # Assert that this instance is of the expected subclass.\n> assert isinstance(wrapper, hint_meta.typehint_cls)\nE AssertionError: assert False\nE + where False = isinstance(None, )\nE + where = HintPepMetadata(\\n hint=~T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('TypeVar'),\\n typehint_cls=,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith='Oblate weapon Stacks (actually',\\n is_context_manager=False,\\n is_pith_factory=False,\\n)),\\n typevars=(),\\n warning_type=None,\\n).typehint_cls\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr", "Failure #4: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #5: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #6: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_contains", "Failure #7: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_iter", "Failure #8: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #9: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #10: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #11: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #12: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #13: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #14: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #15: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #16: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_new" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_mapping" ] ] }, "complexity_info": { "centrality": { "distance_discount": 10.888704000000008, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.013267543859649122, "bidirectional_harmonic": 0.16610146980212834, "degree": 2 }, "line_count": 20, "code_line_count": 20, "cyclomatic": 4, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484585/pep484585func.py", "function_name": "reduce_hint_pep484585_func_return", "test_info": { "success": false, "failed": 60, "passed": 1070, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic\nLocation: /tmp/benchmark_hzsvjl00/beartype/_check/error/errget.py:479\nError: beartype.roar._BeartypeCallHintPepRaiseDesynchronizationException: Method a00_type.test_decortype_core.test_decor_type_basic.FromHisInnocuousHand.his_bloodless_food() return 41 violates type hint , but violation factory get_hint_object_violation() erroneously suggests this object satisfies this hint. Please report this desynchronization failure to the beartype issue tracker (https://github.com/beartype/beartype/issues) with the accompanying exception traceback and the representation of this object:\n 41\nThe bear groans in disappointment. If you feel similarly, know that you are not alone.\n\nTraceback:\n\n> def test_decor_type_basic() -> None:\n '''\n Test decoration of user-defined classes by the :func:`beartype.beartype`\n decorator from the perspective of basic usability.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from pytest import raises\n \n # ....................{ CLASSES }....................\n # Intentionally redecorate a class twice by the @beartype decorator,\n # exercising an edge case in class decoration.\n @beartype\n @beartype\n class FromHisInnocuousHand(object):\n '''\n Arbitrary class defining one or more arbitrary annotated methods.\n '''\n \n # ....................{ METHODS }....................\n def his_bloodless_food(self, lured_by_the_gentle_meaning: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(lured_by_the_gentle_meaning)\n \n # ....................{ LOCALS }....................\n # Arbitrary instance of this class.\n of_his_looks = FromHisInnocuousHand()\n \n # ....................{ PASS }....................\n # Assert that this method returns the expected length of the passed string.\n> assert of_his_looks.his_bloodless_food(\n 'Lured by the gentle meaning of his looks,') == 41\n\n> ???\n\n> return get_hint_object_violation(\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n if not violation_cause.cause_str_or_none:\n pith_value_repr = represent_object(\n obj=obj, max_len=_CAUSE_TRIM_OBJECT_REPR_MAX_LEN)\n> raise _BeartypeCallHintPepRaiseDesynchronizationException(\n f'{exception_prefix}violates type hint {repr(hint)}, '\n f'but violation factory get_hint_object_violation() '\n f'erroneously suggests this object satisfies this hint. '\n f'Please report this desynchronization failure to '\n f'the beartype issue tracker ({URL_ISSUES}) with '\n f'the accompanying exception traceback and '\n f'the representation of this object:\\n'\n f' {pith_value_repr}\\n'\n f'The bear groans in disappointment. If you feel similarly, '\n f'know that you are not alone.'\n )\nE beartype.roar._BeartypeCallHintPepRaiseDesynchronizationException: Method a00_type.test_decortype_core.test_decor_type_basic.FromHisInnocuousHand.his_bloodless_food() return 41 violates type hint , but violation factory get_hint_object_violation() erroneously suggests this object satisfies this hint. Please report this desynchronization failure to the beartype issue tracker (https://github.com/beartype/beartype/issues) with the accompanying exception traceback and the representation of this object:\nE 41\nE The bear groans in disappointment. If you feel similarly, know that you are not alone.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested\nLocation: /tmp/benchmark_hzsvjl00/beartype/_check/error/errget.py:479\nError: beartype.roar._BeartypeCallHintPepRaiseDesynchronizationException: Method a00_type.test_decortype_core.test_decor_type_nested.TheThrillingSecretsOf.of_the_birth() return 40 violates type hint , but violation factory get_hint_object_violation() erroneously suggests this object satisfies this hint. Please report this desynchronization failure to the beartype issue tracker (https://github.com/beartype/beartype/issues) with the accompanying exception traceback and the representation of this object:\n 40\nThe bear groans in disappointment. If you feel similarly, know that you are not alone.\n\nTraceback:\n\n> def test_decor_type_nested() -> None:\n '''\n Test decoration of user-defined classes nested inside user-defined classes\n by the :func:`beartype.beartype` decorator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from pytest import raises\n \n # ....................{ LOCALS }....................\n class ForHisCouch(object):\n '''\n Arbitrary class *not* decorated by :func:`beartype.beartype`.\n '''\n \n def and_stole(self, from_duties_and_repose: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(from_duties_and_repose)\n \n \n # Intentionally redecorate a class twice by the @beartype decorator,\n # exercising an edge case in class decoration.\n @beartype\n @beartype\n class TheThrillingSecretsOf(object):\n '''\n Arbitrary parent class decorated by :func:`beartype.beartype` containing\n an arbitrary nested child class *not* decorated by\n :func:`beartype.beartype`, exercising that the decoration of this parent\n class implicitly decorates this child class.\n '''\n \n # ....................{ CLASS VARIABLES }....................\n from_her_fathers_tent: type = object\n '''\n Class variable whose value is the root :class:`object` superclass.\n \n This variable exercises an edge cases in :func:`beartype.beartype`.\n Previously, :func:`beartype.beartype` erroneously conflated class\n variables whose values are types with nested classes by decorating the\n former as if they were the latter. In the best case, doing so decorated\n external classes *not* intended to be decorated; in the worst case,\n doing so provoked infinite recursion.\n \n This variable exercises that worst case. Notably:\n \n * :class:`enum.Enum` subclasses as follows:\n \n #. *All* :class:`enum.Enum` subclasses define a private\n ``_member_type_`` attribute whose value is the :class:`object`\n superclass, which :func:`beartype.beartype` then decorated.\n #. However, the :class:`object` superclass defines the ``__class__``\n dunder attribute whose value is the :class:`type` superclass, which\n :func:`beartype.beartype` then decorated.\n #. However, the :class:`type` superclass defines the ``__base__``\n dunder attribute whose value is the :class:`object` superclass,\n which :func:`beartype.beartype` then decorated.\n #. **INFINITE FRIGGIN' RECURSION.** Anarchy today.\n '''\n \n \n and_spread_her_matting: type = type\n '''\n Class variable whose value is the root :class:`type` superclass,\n exercising the same edge case as the prior class variable.\n '''\n \n \n to_tend_his_steps: type = ForHisCouch\n '''\n Class variable whose value is a user-defined class that is neither the\n root :class:`object` nor :class:`type` superclasses.\n \n This variable exercises the aforementioned best case: namely, that\n :func:`beartype.beartype` no longer erroneously decorates external\n classes *not* intended to be decorated when those classes are the values\n of class variables.\n '''\n \n # ....................{ METHODS }....................\n def of_the_birth(self, of_time: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(of_time)\n \n # ....................{ NESTED }....................\n class MeanwhileAMaiden(object):\n '''\n Arbitrary nested child class *not* decorated by\n :func:`beartype.beartype`.\n '''\n \n def brought_his_feed(self, her_daily_portion: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(her_daily_portion)\n \n \n # Arbitrary instance of these classes.\n enamoured = ForHisCouch()\n yet_not_daring = TheThrillingSecretsOf()\n for_deep_awe = TheThrillingSecretsOf.MeanwhileAMaiden()\n \n # ....................{ PASS }....................\n # Assert that these methods passed arbitrary parameters return the expected\n # values from those parameters.\n assert enamoured.and_stole(\n 'To speak her love:\u2014and watched his nightly sleep,') == 49\n> assert yet_not_daring.of_the_birth(\n 'Sleepless herself, to gaze upon his lips') == 40\n\n> ???\n\n> return get_hint_object_violation(\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n if not violation_cause.cause_str_or_none:\n pith_value_repr = represent_object(\n obj=obj, max_len=_CAUSE_TRIM_OBJECT_REPR_MAX_LEN)\n> raise _BeartypeCallHintPepRaiseDesynchronizationException(\n f'{exception_prefix}violates type hint {repr(hint)}, '\n f'but violation factory get_hint_object_violation() '\n f'erroneously suggests this object satisfies this hint. '\n f'Please report this desynchronization failure to '\n f'the beartype issue tracker ({URL_ISSUES}) with '\n f'the accompanying exception traceback and '\n f'the representation of this object:\\n'\n f' {pith_value_repr}\\n'\n f'The bear groans in disappointment. If you feel similarly, '\n f'know that you are not alone.'\n )\nE beartype.roar._BeartypeCallHintPepRaiseDesynchronizationException: Method a00_type.test_decortype_core.test_decor_type_nested.TheThrillingSecretsOf.of_the_birth() return 40 violates type hint , but violation factory get_hint_object_violation() erroneously suggests this object satisfies this hint. Please report this desynchronization failure to the beartype issue tracker (https://github.com/beartype/beartype/issues) with the accompanying exception traceback and the representation of this object:\nE 40\nE The bear groans in disappointment. If you feel similarly, know that you are not alone.\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #54: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #55: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #56: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #57: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #58: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #59: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #60: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py", "test_decor_type_basic" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py", "test_decor_type_nested" ] ] }, "complexity_info": { "centrality": { "distance_discount": 32.46759731200003, "in_degree": 1, "true_in_degree": 2.6, "out_degree": 7, "betweenness": 5.870834417179688e-05, "pagerank": 0.00032861476008027733, "harmonic": 0.041769136382623216, "bidirectional_harmonic": 0.25830538704716355, "degree": 8 }, "line_count": 56, "code_line_count": 56, "cyclomatic": 10, "halstead_volume": 84.0, "halstead_difficulty": 2.9545454545454546 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncwrap.py", "function_name": "unwrap_func_class_or_static_method_once", "test_info": { "success": false, "failed": 18, "passed": 1112, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py::test_unwrap_func_class_or_static_method_once\nLocation: /tmp/benchmark_j0xat1ho/beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py:166\nError: assert None is .never_to_be_reclaimed at 0x710f8ff64ea0>\n\nTraceback:\n\n> def test_unwrap_func_class_or_static_method_once() -> None:\n '''\n Test the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_class_or_static_method_once`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableWrapperException\n from beartype._util.func.utilfuncwrap import (\n unwrap_func_class_or_static_method_once)\n from beartype_test.a00_unit.data.data_type import CALLABLES\n from pytest import raises\n \n # ....................{ CALLABLES }....................\n def never_to_be_reclaimed() -> str:\n '''\n Arbitrary pure-Python function.\n '''\n \n return 'The dwelling-place'\n \n \n def becomes_its_spoil() -> str:\n '''\n Arbitrary pure-Python function.\n '''\n \n return 'The dwelling-place'\n \n # ....................{ CLASSES }....................\n class TheLimitsOfTheDeadAndLivingWorld(object):\n '''\n Arbitrary pure-Python class defining a class method wrapping the\n pure-Python function defined above.\n '''\n \n of_insects_beasts_and_birds = classmethod(never_to_be_reclaimed)\n \n \n class TheirFoodAndTheirRetreatForEverGone(object):\n '''\n Arbitrary pure-Python static defining a static method wrapping the\n pure-Python function defined above.\n '''\n \n so_much_of_life_and_joy_is_lost = staticmethod(becomes_its_spoil)\n \n # ....................{ PASS }....................\n # Assert this getter returns the expected wrappee when passed a class method\n # descriptor.\n #\n # Note that class method descriptors are *ONLY* directly accessible via the\n # low-level \"object.__dict__\" dictionary. When accessed as class or instance\n # attributes, class methods reduce to instances of the standard\n # \"beartype.cave.MethodBoundInstanceOrClassType\" type.\n class_method = TheLimitsOfTheDeadAndLivingWorld.__dict__[\n 'of_insects_beasts_and_birds']\n class_method_wrappee = unwrap_func_class_or_static_method_once(class_method)\n> assert class_method_wrappee is never_to_be_reclaimed\nE assert None is .never_to_be_reclaimed at 0x710f8ff64ea0>\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin\nLocation: /tmp/benchmark_j0xat1ho/beartype/_decor/_decornontype.py:177\nError: beartype.roar.BeartypeDecorWrappeeException: Uncallable None not decoratable by @beartype.\n\nTraceback:\n\n> def test_decor_type_descriptor_builtin() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on **C-based unbound builtin\n method descriptors** (i.e., methods decorated by builtin method decorators).\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from beartype.typing import NoReturn\n from pytest import raises\n \n # ....................{ CLASSES }....................\n> class OrDidASeaOfFire(object):\n\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_decorator(obj, **kwargs) # type: ignore[return-value]\n\n> descriptor_wrappee_checked = beartype_object(descriptor_wrappee, **kwargs) # type: ignore[union-attr]\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> def beartype_nontype(obj: BeartypeableT, **kwargs) -> BeartypeableT:\n '''\n Decorate the passed **non-class beartypeable** (i.e., caller-defined object\n that may be decorated by the :func:`beartype.beartype` decorator but is\n *not* a class) with dynamically generated type-checking.\n \n Parameters\n ----------\n obj : BeartypeableT\n Non-class beartypeable to be decorated.\n \n All remaining keyword parameters are passed as is to a lower-level decorator\n defined by this submodule (e.g., :func:`.beartype_func`).\n \n Returns\n -------\n BeartypeableT\n New pure-Python callable wrapping this beartypeable with type-checking.\n '''\n \n # Validate that the passed object is *NOT* a class.\n assert not isinstance(obj, type), f'{repr(obj)} is class.'\n # print(f'Decorating non-type {repr(obj)} with type-checking...')\n # print(f'Non-type contents: {dir(obj)}')\n # print(f'{dir(obj.__code__)}')\n # print(f'{obj.__code__.co_filename}')\n # print(f'{obj.__code__.co_name}')\n # print(f'{obj.__code__.co_names}')\n # print(f'{obj.__code__.co_qualname}')\n \n # ....................{ PASS 1 ~ dispatch }....................\n # First-pass logic efficiently dispatching a beartype decorator unique to\n # the type of this object in O(1) constant-time dispatch -- including:\n # * Callable third-party objects requiring special handling -- including:\n # * Click commands created by the @click.command() decorator.\n # * Uncallable builtin method descriptors -- including property, class\n # method, instance method, and static method objects. In this case,\n # @beartype was listed above rather than below the builtin decorator\n # generating this descriptor in the chain of decorators decorating this\n # decorated callable. Although @beartype typically *MUST* decorate a\n # callable directly, this edge case is sufficiently common *AND* trivial\n # to resolve to warrant doing so. To do so, this conditional branch\n # effectively reorders @beartype to be the first decorator decorating the\n # pure-Python function underlying this method descriptor: e.g.,\n # # This branch detects and reorders this edge case...\n # class MuhClass(object):\n # @beartype\n # @classmethod\n # def muh_classmethod(cls) -> None: pass\n #\n # # ...to resemble this direct decoration instead.\n # class MuhClass(object):\n # @classmethod\n # @beartype\n # def muh_classmethod(cls) -> None: pass\n #\n # Note that most but *NOT* all of these objects are uncallable.\n # Regardless, *ALL* of these objects are unsuitable for direct decoration.\n # Specifically:\n # * Under Python < 3.10, *ALL* of these objects are uncallable.\n # * Under Python >= 3.10:\n # * Descriptors created by @classmethod and @property are uncallable.\n # * Descriptors created by @staticmethod are technically callable but\n # C-based and thus unsuitable for direct decoration.\n # Type of this object.\n obj_type = type(obj)\n \n # Fully-qualified name of the module defining this type if any *OR* \"None\"\n # (i.e., if this type is only defined in-memory outside of a module).\n obj_type_module_name = get_object_module_name_or_none(obj_type)\n \n # If this type is defined by a module...\n if obj_type_module_name:\n #FIXME: [SPEED] Globalize this dict.get() method as follows:\n # _MODULE_TO_TYPE_NAME_TO_BEARTYPE_DECORATOR_get = (\n # _MODULE_TO_TYPE_NAME_TO_BEARTYPE_DECORATOR.get)\n #Then call _MODULE_TO_TYPE_NAME_TO_BEARTYPE_DECORATOR_get() here.\n \n # Dictionary mapping from the unqualified basename of each well-known\n # standard type of a @beartype-decoratable object defined by the module\n # defining this specific type to a decorator decorating that object with\n # dynamically generated type-checking if any *OR* \"None\" (i.e., if this\n # type is *NOT* defined by such a well-known dispatchable module).\n type_name_to_beartype_decorator = (\n _MODULE_TO_TYPE_NAME_TO_BEARTYPE_DECORATOR.get(\n obj_type_module_name))\n \n # If this type is defined by a well-known dispatchable module...\n if type_name_to_beartype_decorator:\n # Decorator decorating this object with dynamically generated\n # type-checking if any *OR* \"None\" (i.e., if this type is *NOT* a\n # well-known type defined by this module).\n beartype_decorator = type_name_to_beartype_decorator.get( # type: ignore[attr-defined]\n obj_type.__name__)\n \n # If this type is dispatchable, trivially do so.\n if beartype_decorator:\n return beartype_decorator(obj, **kwargs) # type: ignore[return-value]\n # Else, this type is *NOT* dispatchable.\n # Else, this type is *NOT* defined by a well-known dispatchable module.\n # Else, this type is defined in-memory outside a module.\n \n # ....................{ PASS 2 ~ ad-hoc }....................\n # Second-pass logic inefficiently dispatching a beartype decorator unique to\n # the type of this object with a series of ad-hoc heuristics, each of which\n # does *NOT* reduce to a trivial check against the fully-qualified name of\n # the type of this callable and thus *CANNOT* be integrated into the\n # efficient mapping-based O(1) dispatch employed above.\n \n # If this object is uncallable, raise an exception.\n if not callable(obj):\n> raise BeartypeDecorWrappeeException(\n f'Uncallable {repr(obj)} not decoratable by @beartype.')\nE beartype.roar.BeartypeDecorWrappeeException: Uncallable None not decoratable by @beartype.\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin_called", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep435", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep663", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #14: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #15: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py", "test_unwrap_func_class_or_static_method_once" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py", "test_decor_type_descriptor_builtin" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 1, "betweenness": 2.7096158848521633e-06, "pagerank": 0.00035098522167487686, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.13783638236763257, "degree": 2 }, "line_count": 15, "code_line_count": 15, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncframe.py", "function_name": "get_frame_module_name_or_none", "test_info": { "success": false, "failed": 12, "passed": 1118, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563\nLocation: /tmp/benchmark_92gbpscm/beartype/_check/forward/fwdmain.py:855\nError: beartype.roar.BeartypePep563Exception: Stringified type hint 'OfPearl' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_92gbpscm/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \n File \"/tmp/benchmark_92gbpscm/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\n raise AttributeError(f'{exception_message}not found')\nAttributeError: Forward reference scope \"beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve\" attribute \"OfPearl\" not found\n\nTraceback:\n\n> def test_resolve_pep563() -> None:\n '''\n Test the :func:`beartype.peps.resolve_pep563` resolver.\n '''\n \n # .....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.peps import resolve_pep563\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n BeartypePep563Exception,\n )\n from beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve import (\n ToAvariceOrPride,\n FrequentWith,\n their_starry_domes,\n )\n from pytest import raises\n \n # .....................{ LOCALS }....................\n # Arbitrary instance of the generic accepted by the function called below.\n numberless_and_immeasurable_halls = ToAvariceOrPride()\n \n # Arbitrary instance of the class defining various problematic methods\n # called below.\n and_thrones_radiant_with_chrysolite = FrequentWith()\n \n # .....................{ PASS }....................\n # Assert that this function unsuccessfully raises the expected exception\n # *BEFORE* resolving all PEP 563-postponed type hints annotating these\n # callables.\n with raises(BeartypeDecorHintForwardRefException):\n their_starry_domes(numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.until_the_doves(\n numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.crystal_column(\n 'Nor had that scene of ampler majesty')\n \n # Resolve all PEP 563-postponed type hints annotating these callables.\n resolve_pep563(their_starry_domes)\n resolve_pep563(FrequentWith.until_the_doves)\n> resolve_pep563(FrequentWith.crystal_column)\n\n> arg_name_to_hint[arg_name] = resolve_hint(\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypePep563Exception: Stringified type hint 'OfPearl' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_92gbpscm/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE File \"/tmp/benchmark_92gbpscm/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\nE raise AttributeError(f'{exception_message}not found')\nE AttributeError: Forward reference scope \"beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve\" attribute \"OfPearl\" not found\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487\nLocation: /tmp/benchmark_92gbpscm/beartype/_check/forward/fwdmain.py:855\nError: beartype.roar.BeartypeDecorHintForwardRefException: Method a00_type.test_decortype_descriptor.test_decor_type_descriptor_custom_pep487.AndAllThoseActs.doth_ease_its() return stringified type hint 'Optional[HeartOfLove]' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_92gbpscm/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \n File \"/tmp/benchmark_92gbpscm/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\n raise AttributeError(f'{exception_message}not found')\nAttributeError: Forward reference scope \"a00_type.test_decortype_descriptor\" attribute \"HeartOfLove\" not found\n\nTraceback:\n\n> def test_decor_type_descriptor_custom_pep487() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on :pep:`487`-compliant\n **custom pure-Python method descriptors** (i.e., methods decorated by\n pure-Python types satisfying the :pep:`487`-compliant descriptor protocol by\n declaring at least the ``__set_name__()`` dunder method).\n \n This unit test exercises an inscrutable `edge case`_ induced by\n :func:`beartype.beartype`-decorated classes defining at least two kinds of\n seemingly unrelated methods that nonetheless *could* interact harmfully:\n \n * A method decorated by a :pep:`487`-compliant custom pure-Python method\n descriptor declaring at least the ``__set_name__()`` dunder method.\n * A method annotated by a stringified forward reference to a currently\n undefined type, which :func:`beartype.beartype` then internally coerces\n into a **forward reference proxy** (i.e.,\n :class:`beartype._check.forward.reference.fwdrefabc.BeartypeForwardRefABC`\n subclass) encapsulating that undefined type.\n \n For obscure reasons that are difficult to fully explain within the expected\n lifetime of the Universe, this interaction causes the ``__set_name__()``\n dunder method of the descriptor decorating the first method to be\n erroneously called multiple times with erroneous owners. Although seemingly\n innocuous, this issue is indicative of an explosive increase in the space\n and time complexity associated with forward reference proxies. Ergo, this\n issue is actually quite serious. It is imperative this *never* happen again.\n \n .. _edge case:\n https://github.com/beartype/beartype/issues/488#issuecomment-2650865299\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.typing import Optional\n from collections.abc import Callable\n \n # ....................{ DESCRIPTORS }....................\n class setname_descriptor(object):\n '''\n **Setname method descriptor** (i.e., pure-Python object whose\n :pep:`487`-compliant :meth:`__set_name__` dunder method raises an\n exception when called more than once as a regression check against this\n issue silently reverting).\n \n Attributes\n ----------\n _is_set_name_called : bool\n :data:`True` only if Python has already called the\n :pep:`487`-compliant :meth:`__set_name__` dunder method.\n '''\n \n def __init__(self, func: Callable) -> None:\n '''\n Initialize this method descriptor by doing... absolutely nothing.\n '''\n \n # Record that Python has yet to call __set_name__().\n self._is_set_name_called = False\n \n \n def __call__(self) -> None:\n '''\n Call this method descriptor by doing... absolutely nothing.\n '''\n \n # Doing nothing never felt so good, so right, so... clean.\n pass\n \n \n def __set_name__(self, owner: type, name: str) -> None:\n '''\n :pep:`487`-compliant callback called by Python itself with metadata\n describing the current decoration of an external method by this\n descriptor.\n \n Parameters\n ----------\n owner : type\n Parent class declaring that external method.\n name : str\n Unqualified basename of that external method.\n '''\n \n # If Python has already called this dunder method, this issue has\n # reverted. In this case, raise an exception.\n if self._is_set_name_called:\n raise ValueError(\n 'PEP 487 setname_descriptor.__set_name__() dunder method '\n 'already called.'\n )\n # Else, this is Python's first call of this dunder method.\n \n # Record that Python has already called this dunder method.\n self._is_set_name_called = True\n \n # ....................{ CLASSES }....................\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_type(obj, **kwargs) # type: ignore[return-value]\n\n> attr_value_beartyped = beartype_object( # type: ignore[type-var]\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> hint_or_sane = sanify_hint_root_func(\n\n> hint = decor_meta.func_arg_name_to_hint[pith_name] = coerce_func_hint_root(\n\n> hint = resolve_hint( # pyright: ignore\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypeDecorHintForwardRefException: Method a00_type.test_decortype_descriptor.test_decor_type_descriptor_custom_pep487.AndAllThoseActs.doth_ease_its() return stringified type hint 'Optional[HeartOfLove]' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_92gbpscm/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE File \"/tmp/benchmark_92gbpscm/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\nE raise AttributeError(f'{exception_message}not found')\nE AttributeError: Forward reference scope \"a00_type.test_decortype_descriptor\" attribute \"HeartOfLove\" not found\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #8: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #10: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #11: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #12: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py", "test_resolve_pep563" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py", "test_decor_type_descriptor_custom_pep487" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 3.5999999999999996, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0005334552032019705, "harmonic": 0.0, "bidirectional_harmonic": 0.15501537935748497, "degree": 2 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py", "function_name": "get_hint_pep484585_generic_type_or_none", "test_info": { "success": false, "failed": 43, "passed": 1087, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_tqk78m2n/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:1283\nError: beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic not generic (i.e., originates from no isinstanceable class).\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> is_hint_pep484585_generic_user(hint_base) # pyright: ignore\n\n> is_hint_pep484585_generic(hint) and not (\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> not _is_hint_pep484585_generic_blacklisted(hint)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> hint_type = get_hint_pep484585_generic_type(hint)\n\n> def get_hint_pep484585_generic_type(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> type:\n '''\n Either the passed :pep:`484`- or :pep:`585`-compliant **generic** (i.e.,\n class superficially subclassing at least one PEP-compliant type hint that is\n possibly *not* an actual class) if **unsubscripted** (i.e., indexed by *no*\n arguments or type variables), the unsubscripted generic underlying this\n generic if **subscripted** (i.e., indexed by one or more child type hints\n and/or type variables), *or* raise an exception otherwise (i.e., if this\n hint is *not* a generic).\n \n Specifically, this getter returns (in order):\n \n * If this hint originates from an **origin type** (i.e., isinstanceable\n class such that *all* objects satisfying this hint are instances of that\n class), this type regardless of whether this hint is already a class.\n * Else if this hint is already a class, this hint as is.\n * Else, raise an exception.\n \n This getter is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as the implementation trivially reduces\n to an efficient one-liner.\n \n Caveats\n -------\n **This getter returns false positives in edge cases.** That is, this getter\n returns non-:data:`None` values for both generics and non-generics --\n notably, non-generics defining the ``__origin__`` dunder attribute to an\n isinstanceable class. Callers *must* perform subsequent tests to distinguish\n these two cases.\n \n Parameters\n ----------\n hint : Hint\n Generic type hint to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n type\n Class originating this generic.\n \n Raises\n ------\n exception_cls\n If this hint is *not* a generic.\n \n See Also\n --------\n :func:`get_hint_pep484585_generic_type_or_none`\n Further details.\n '''\n \n # This hint if this hint is an unsubscripted generic, the unsubscripted\n # generic underlying this hint if this hint is a subscripted generic, *OR*\n # \"None\" if this hint is not a generic.\n hint_generic_type = get_hint_pep484585_generic_type_or_none(hint)\n \n # If this hint is *NOT* a generic, raise an exception.\n if hint_generic_type is None:\n> raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'not generic (i.e., originates from no isinstanceable class).'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic not generic (i.e., originates from no isinstanceable class).\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_tqk78m2n/beartype/_util/hint/pep/proposal/pep484/pep484generic.py:381\nError: beartype.roar.BeartypeDecorHintPep484585Exception: Type hint None neither PEP 484 generic nor PEP 544 protocol.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_bases_unerased(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._data.hint.pep.sign.datapepsignset import HINT_SIGNS_GENERIC\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_bases_unerased)\n from beartype._util.hint.pep.utilpeptest import is_hint_pep_type_typing\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # For each PEP-compliant hint to be tested...\n for hint_pep_meta in hints_pep_meta:\n # If this is a generic hint, assert that this getter returns the\n # expected unerased pseudo-superclasses of this generic.\n if hint_pep_meta.pep_sign in HINT_SIGNS_GENERIC:\n> hint_pep_bases = get_hint_pep484585_generic_bases_unerased(\n hint_pep_meta.hint)\n\n> get_hint_pep484_generic_bases_unerased(\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484_generic_bases_unerased(\n # Mandatory parameters.\n hint: Any,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of all unerased :mod:`typing` **pseudo-superclasses** (i.e.,\n :mod:`typing` objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`-compliant\n **generic** (i.e., class subclassing at least one non-class :mod:`typing`\n object).\n \n This getter is memoized for efficiency.\n \n Parameters\n ----------\n hint : object\n Object to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this\n :mod:`typing` generic. Specifically:\n \n * If this generic defines an ``__orig_bases__`` dunder instance\n variable, the value of that variable as is.\n * Else, the value of the ``__mro__`` dunder instance variable stripped\n of all ignorable classes conveying *no* semantic meaning, including:\n \n * This generic itself.\n * The :class:`object` root superclass.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * *Not* a :mod:`typing` generic.\n * A :mod:`typing` generic that erased *none* of its superclasses but\n whose method resolution order (MRO) lists strictly less than four\n classes. Valid :pep:`484`-compliant generics should list at least\n four classes, including (in order):\n \n #. This class itself.\n #. The one or more :mod:`typing` objects directly subclassed by this\n generic.\n #. The :class:`typing.Generic` superclass.\n #. The zero or more non-:mod:`typing` superclasses subsequently\n subclassed by this generic (e.g., :class:`abc.ABC`).\n #. The :class:`object` root superclass.\n \n See Also\n --------\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n Further details.\n '''\n \n #FIXME: This tuple appears to be implemented erroneously -- at least under\n #Python 3.7, anyway. Although this tuple is implemented correctly for the\n #common case of user-defined types directly subclassing \"typing\" types,\n #this tuple probably is *NOT* implemented correctly for the edge case of\n #user-defined types indirectly subclassing \"typing\" types: e.g.,\n #\n # >>> import collections.abc, typing\n # >>> T = typing.TypeVar('T')\n # >>> class Direct(collections.abc.Sized, typing.Generic[T]): pass\n # >>> Direct.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n # >>> class Indirect(collections.abc.Container, Direct): pass\n # >>> Indirect.__orig_bases__\n # (collections.abc.Sized, typing.Generic[~T])\n #\n #*THAT'S COMPLETELY INSANE.* Clearly, their naive implementation failed to\n #account for actual real-world use cases.\n #\n #On the bright side, the current implementation prevents us from actually\n #having to perform a breadth-first traversal of all original superclasses\n #of this class in method resolution order (MRO). On the dark side, it's\n #pants-on-fire balls -- but there's not much we can do about that. *sigh*\n #\n #If we ever need to perform that breadth-first traversal, resurrect this:\n #\n # # If this class was *NOT* subject to type erasure, reduce to a noop.\n # if not hint_bases:\n # return hint_bases\n #\n # # Fixed list of all typing super attributes to be returned.\n # superattrs = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based index of the last item of this list.\n # superattrs_index = 0\n #\n # # Fixed list of all transitive superclasses originally listed by this\n # # class iterated in method resolution order (MRO).\n # hint_orig_mro = acquire_fixed_list(FIXED_LIST_SIZE_MEDIUM)\n #\n # # 0-based indices of the current and last items of this list.\n # hint_orig_mro_index_curr = 0\n # hint_orig_mro_index_last = 0\n #\n # # Initialize this list with the tuple of all direct superclasses of this\n # # class, which iteration then expands to all transitive superclasses.\n # hint_orig_mro[:len(hint_bases)] = hint_bases\n #\n # # While the heat death of the universe has been temporarily forestalled...\n # while (True):\n # # Currently visited superclass of this class.\n # hint_base = hint_orig_mro[hint_orig_mro_index_curr]\n #\n # # If this superclass is a typing attribute...\n # if is_hint_pep_type_typing(hint_base):\n # # Avoid inserting this attribute into the \"hint_orig_mro\" list.\n # # Most typing attributes are *NOT* actual classes and those that\n # # are have no meaningful public superclass. Ergo, iteration\n # # terminates with typing attributes.\n # #\n # # Insert this attribute at the current item of this list.\n # superattrs[superattrs_index] = hint_base\n #\n # # Increment this index to the next item of this list.\n # superattrs_index += 1\n #\n # # If this class subclasses more than the maximum number of \"typing\"\n # # attributes supported by this function, raise an exception.\n # if superattrs_index >= FIXED_LIST_SIZE_MEDIUM:\n # raise BeartypeDecorHintPep560Exception(\n # '{} PEP type {!r} subclasses more than '\n # '{} \"typing\" types.'.format(\n # exception_prefix,\n # hint,\n # FIXED_LIST_SIZE_MEDIUM))\n # # Else, this superclass is *NOT* a typing attribute. In this case...\n # else:\n # # Tuple of all direct superclasses originally listed by this class\n # # prior to PEP 484 type erasure if any *OR* the empty tuple\n # # otherwise.\n # hint_base_bases = getattr(hint_base, '__orig_bases__')\n #\n # #FIXME: Implement breadth-first traversal here.\n #\n # # Tuple sliced from the prefix of this list assigned to above.\n # superattrs_tuple = tuple(superattrs[:superattrs_index])\n #\n # # Release and nullify this list *AFTER* defining this tuple.\n # release_fixed_list(superattrs)\n # del superattrs\n #\n # # Return this tuple as is.\n # return superattrs_tuple\n #\n #Also resurrect this docstring snippet:\n #\n # Raises\n # ----------\n # BeartypeDecorHintPep560Exception\n # If this object defines the ``__orig_bases__`` dunder attribute but that\n # attribute transitively lists :data:`FIXED_LIST_SIZE_MEDIUM` or more :mod:`typing`\n # attributes.\n #\n #Specifically:\n # * Acquire a fixed list of sufficient size (e.g., 64). We probably want\n # to make this a constant in \"utilcachelistfixedpool\" for reuse\n # everywhere, as this is clearly becoming a common idiom.\n # * Slice-assign \"__orig_bases__\" into this list.\n # * Maintain two simple 0-based indices into this list:\n # * \"bases_index_curr\", the current base being visited.\n # * \"bases_index_last\", the end of this list also serving as the list\n # position to insert newly discovered bases at.\n # * Iterate over this list and keep slice-assigning from either\n # \"__orig_bases__\" (if defined) or \"__mro__\" (otherwise) into\n # \"list[bases_index_last:len(__orig_bases__)]\". Note that this has the\n # unfortunate disadvantage of temporarily iterating over duplicates,\n # but... *WHO CARES.* It still works and we subsequently\n # eliminate duplicates at the end.\n # * Return a frozenset of this list, thus implicitly eliminating\n # duplicate superclasses.\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_type_or_none)\n \n # If this hint is *NOT* a class, reduce this hint to the object originating\n # this hint if any. See is_hint_pep484_generic() for details.\n hint = get_hint_pep484585_generic_type_or_none(hint)\n \n # If this hint is *NOT* a PEP 484- or 544-compliant generic, raise an\n # exception.\n if not is_hint_pep484_generic_unsubscripted(hint):\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} neither '\n f'PEP 484 generic nor PEP 544 protocol.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: Type hint None neither PEP 484 generic nor PEP 544 protocol.\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_base_in_module_first", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #19: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #20: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #21: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #22: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #23: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #24: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #25: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #26: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #27: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #28: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #29: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #30: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #31: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #32: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #43: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 3, "true_in_degree": 13.080000000000004, "out_degree": 1, "betweenness": 3.025737738084916e-05, "pagerank": 0.0014552642544076262, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.19987284736462438, "degree": 4 }, "line_count": 10, "code_line_count": 10, "cyclomatic": 3, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/_pep/redpep593.py", "function_name": "reduce_hint_pep593", "test_info": { "success": false, "failed": 11, "passed": 1119, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_8uizek82/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:409\nError: AssertionError: assert False is True\n + where False = AnnotatedTypeHint(typing.Annotated[typing.Union[typing.Any, float, str], ]).is_ignorable\n + where AnnotatedTypeHint(typing.Annotated[typing.Union[typing.Any, float, str], ]) = (typing.Annotated[typing.Union[typing.Any, float, str], ])\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n> assert TypeHint(hint_ignorable).is_ignorable is True\nE AssertionError: assert False is True\nE + where False = AnnotatedTypeHint(typing.Annotated[typing.Union[typing.Any, float, str], ]).is_ignorable\nE + where AnnotatedTypeHint(typing.Annotated[typing.Union[typing.Any, float, str], ]) = (typing.Annotated[typing.Union[typing.Any, float, str], ])\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint\nLocation: /tmp/benchmark_8uizek82/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:116\nError: AssertionError: assert (False or False)\n + where False = ()\n + and False = issubclass(, )\n\nTraceback:\n\n> def test_reduce_hint() -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintNonpepNumpyException\n from beartype.typing import (\n Annotated,\n )\n from beartype.vale import IsEqual\n from beartype._cave._cavefast import NoneType\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype._conf.confcls import BeartypeConf\n from beartype._conf.confcommon import BEARTYPE_CONF_DEFAULT\n from beartype._data.cls.datacls import TYPES_PEP484_GENERIC_IO\n from beartype._data.hint.datahinttyping import (\n Pep484TowerComplex,\n Pep484TowerFloat,\n )\n from beartype._data.hint.pep.sign.datapepsigns import HintSignAnnotated\n from beartype._util.hint.pep.proposal.pep593 import is_hint_pep593\n from beartype._util.hint.pep.utilpepget import get_hint_pep_sign\n # from beartype_test.a00_unit.data.hint.pep.proposal.data_pep484 import (\n # T_int,\n # T_str_or_bytes,\n # )\n from beartype_test._util.module.pytmodtest import is_package_numpy\n from dataclasses import InitVar\n from pytest import raises\n \n # Intentionally import PEP 484-specific type hint factories.\n from typing import Protocol\n \n # ..................{ LOCALS }..................\n # Keyword arguments to be passed to all calls to reduce_hints() below.\n kwargs = {\n 'conf': BEARTYPE_CONF_DEFAULT,\n }\n \n # ..................{ CORE }..................\n # Assert this reducer preserves an isinstanceable type as is.\n assert reduce_hint(hint=int, **kwargs) is int\n \n # Assert this reducer reduces \"None\" to \"type(None)\".\n assert reduce_hint(hint=None, **kwargs) is NoneType\n \n # ..................{ PEP 484 ~ tower }..................\n # Assert this reducer expands the builtin \"float\" and \"complex\" types to\n # their corresponding numeric towers when configured to do so.\n assert reduce_hint(\n hint=float,\n conf=BeartypeConf(is_pep484_tower=True),\n ) is Pep484TowerFloat\n assert reduce_hint(\n hint=complex,\n conf=BeartypeConf(is_pep484_tower=True),\n ) is Pep484TowerComplex\n \n # Assert this reducer preserves the builtin \"float\" and \"complex\" types as\n # is when configured to disable the implicit numeric tower.\n assert reduce_hint(\n hint=float,\n conf=BeartypeConf(is_pep484_tower=False),\n ) is float\n assert reduce_hint(\n hint=complex,\n conf=BeartypeConf(is_pep484_tower=False),\n ) is complex\n \n #FIXME: Excise us up, please. We no longer reduce type variables. *sigh*\n # # ..................{ PEP 484 ~ typevar }..................\n # # Assert this reducer preserves unbounded type variables as is.\n # assert reduce_hint(hint=T, **kwargs) is T\n #\n # # Assert this reducer reduces bounded type variables to their upper bound.\n # assert reduce_hint(hint=T_int, **kwargs) is int\n #\n # # Union of all constraints parametrizing a constrained type variable,\n # # reduced from that type variable.\n # typevar_constraints_union = reduce_hint(hint=T_str_or_bytes, **kwargs)\n #\n # # Assert this union contains all constraints parametrizing this variable.\n # assert str in typevar_constraints_union.__args__\n # assert bytes in typevar_constraints_union.__args__\n \n # ..................{ PEP 544 }..................\n # For each PEP 484-compliant \"typing\" IO generic superclass...\n for pep484_generic_io in TYPES_PEP484_GENERIC_IO:\n # Equivalent protocol reduced from this generic.\n pep544_protocol_io = reduce_hint(hint=pep484_generic_io, **kwargs)\n \n # Assert this protocol is either...\n> assert (\n # A PEP 593-compliant type metahint generalizing a protocol\n # *OR*...\n is_hint_pep593(pep544_protocol_io) or\n # A PEP 544-compliant protocol.\n issubclass(pep544_protocol_io, Protocol)\n )\nE AssertionError: assert (False or False)\nE + where False = ()\nE + and False = issubclass(, )\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #11: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint" ] ] }, "complexity_info": { "centrality": { "distance_discount": 9.864990719999998, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.012202380952380954, "bidirectional_harmonic": 0.1885333005809985, "degree": 2 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/module/utilmodimport.py", "function_name": "import_module_attr", "test_info": { "success": false, "failed": 54, "passed": 1038, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a00_core/test_a00_package.py::test_api_deprecations\nLocation: /tmp/benchmark_ohp53in8/beartype_test/a00_unit/a00_core/test_a00_package.py:78\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_api_deprecations() -> None:\n '''\n Test all deprecated attributes importable from the public APIs of all\n subpackages of the :mod:`beartype` package (including itself).\n '''\n \n # Defer test-specific imports.\n from beartype._util.module.utilmodimport import import_module_attr\n from pytest import warns\n \n # Tuple of the fully-qualified names of all deprecated attributes.\n DEPRECATED_ATTRIBUTES = (\n 'beartype.abby',\n 'beartype.cave.HintPep585Type',\n 'beartype.roar.BeartypeAbbyException',\n 'beartype.roar.BeartypeAbbyHintViolation',\n 'beartype.roar.BeartypeAbbyTesterException',\n 'beartype.roar.BeartypeCallHintPepException',\n 'beartype.roar.BeartypeCallHintPepParamException',\n 'beartype.roar.BeartypeCallHintPepReturnException',\n 'beartype.roar.BeartypeDecorHintNonPepException',\n 'beartype.roar.BeartypeDecorHintNonPepNumPyException',\n 'beartype.roar.BeartypeDecorHintPep563Exception',\n 'beartype.roar.BeartypeDecorHintPepDeprecatedWarning',\n 'beartype.roar.BeartypeDecorPepException',\n )\n \n # For each deprecated attribute declared by beartype...\n for deprecated_attribute in DEPRECATED_ATTRIBUTES:\n # Assert that importing this attribute both emits the expected warning\n # and returns a non-\"None\" value.\n> with warns(DeprecationWarning):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_ohp53in8/beartype_test/_util/kind/pytkindmake.py:56\nError: TypeError: 'NoneType' object is not callable\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> def make_container_from_funcs(func_names: 'Iterable[str]') -> list:\n '''\n List created by iterating over the passed iterable and, for the\n fully-qualified name of each callable in that iterable, dynamically\n importing that callable, calling that callable, and adding the items of the\n container returned by that callable to this list..\n \n Parameters\n ----------\n func_names : Iterable[str]\n Iterable of the fully-qualified names of all callables to be called.\n \n Returns\n -------\n T\n Instance of this container, iteratively composed from the containers\n returned by these callables.\n '''\n assert isinstance(func_names, Iterable), f'{repr(func_names)} not iterable.'\n \n # Defer utility-specific imports.\n from beartype._util.module.utilmodimport import import_module_attr\n \n # Temporary list with which to compose this container.\n main_list = []\n \n # For the passed name of each callable...\n for func_name in func_names:\n assert isinstance(func_name, str), f'{repr(func_name)} not string.'\n \n # This callable dynamically imported as this name.\n func = import_module_attr(func_name)\n \n # List produced by calling this callable.\n> func_list = func()\nE TypeError: 'NoneType' object is not callable\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #25: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #29: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #30: beartype_test/a00_unit/a20_util/module/test_utilmodimport.py::test_import_module_attr", "Failure #31: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #32: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #33: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #34: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py::test_make_forwardref_indexable_subtype", "Failure #35: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #36: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #38: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #39: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #50: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #51: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #52: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #53: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #54: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a00_core/test_a00_package.py", "test_api_deprecations" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 5.056000000000002, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 2, "betweenness": 9.483655596982572e-06, "pagerank": 0.0002986453201970444, "harmonic": 0.007401315789473684, "bidirectional_harmonic": 0.19272666752107626, "degree": 3 }, "line_count": 42, "code_line_count": 42, "cyclomatic": 8, "halstead_volume": 87.56916320732489, "halstead_difficulty": 3.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_conf/confcls.py", "function_name": "BeartypeConf.__new__", "test_info": { "success": false, "failed": 149, "passed": 944, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_eqidvafa/beartype/_conf/conftest.py:79\nError: beartype.roar.BeartypeConfException: Beartype configuration None invalid (i.e., not \"beartype.BeartypeConf\" instance).\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> die_unless_conf(conf)\n\n> def die_unless_conf(\n # Mandatory parameters.\n conf: 'beartype.BeartypeConf',\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeConfException,\n ) -> None:\n '''\n Raise an exception unless the passed object is a beartype configuration.\n \n Parameters\n ----------\n conf : beartype.BeartypeConf\n Object to be validated.\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error. Defaults\n to :exc:`._BeartypeConfException`.\n \n Raises\n ------\n exception_cls\n If this object is *not* a beartype configuration.\n '''\n \n # Avoid circular import dependencies.\n from beartype._conf.confcls import BeartypeConf\n \n # If this object is *NOT* a configuration, raise an exception.\n if not isinstance(conf, BeartypeConf):\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception type.')\n \n> raise exception_cls(\n f'Beartype configuration {repr(conf)} invalid '\n f'(i.e., not \"beartype.BeartypeConf\" instance).'\n )\nE beartype.roar.BeartypeConfException: Beartype configuration None invalid (i.e., not \"beartype.BeartypeConf\" instance).\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_eqidvafa/beartype_test/a00_unit/data/hint/util/data_hintmetacls.py:231\nError: AssertionError: None not configuration.\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> HintPepMetadata(\n\n> super().__init__(**kwargs)\n\n> def __init__(\n self,\n *,\n \n # Mandatory keyword-only parameters.\n hint: object,\n \n # Optional keyword-only parameters.\n conf: BeartypeConf = BEARTYPE_CONF_DEFAULT,\n is_ignorable: bool = False,\n is_needs_cls_stack: bool = False,\n is_supported: bool = True,\n piths_meta: Iterable[HintPithSatisfiedMetadata] = (),\n warning_type: Optional[Type[Warning]] = None,\n ) -> None:\n \n # Validate passed non-variadic parameters.\n> assert isinstance(conf, BeartypeConf), (\n f'{repr(conf)} not configuration.')\nE AssertionError: None not configuration.\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #25: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #29: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #30: beartype_test/a00_unit/a40_api/conf/test_confcls.py::test_conf_dataclass", "Failure #31: beartype_test/a00_unit/a40_api/conf/test_confcls.py::test_conf_is_color", "Failure #32: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #33: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #34: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #35: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #36: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #37: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #38: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #39: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_recursion", "Failure #40: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #41: beartype_test/a00_unit/a60_check/a00_metadata/test_metacheck.py::test_metadata_check", "Failure #42: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #43: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #44: beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py::test_coerce_func_hint_root", "Failure #45: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #46: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #47: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #48: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #49: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #50: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #51: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #52: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #53: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #54: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #55: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin_called", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_no_type_check", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #83: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #84: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #85: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep435", "Failure #86: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep663", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #89: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #90: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #91: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #92: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #93: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #94: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #95: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #96: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #97: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #98: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #99: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #100: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #101: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #102: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #103: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #104: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #105: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #106: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #107: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #108: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #109: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #110: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #111: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #112: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #113: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #114: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #115: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #116: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #117: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #118: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #119: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #120: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #121: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #122: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #123: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #124: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #125: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #126: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #127: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #128: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #129: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #130: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_type_fail", "Failure #131: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #132: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #133: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #134: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #135: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #136: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #137: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #138: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf", "Failure #139: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #140: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #141: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #142: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #143: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #144: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #145: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #146: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #147: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #148: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #149: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 14.372126720000006, "in_degree": 4, "true_in_degree": 9.440000000000003, "out_degree": 4, "betweenness": 0.00034954044914592907, "pagerank": 0.0006716827021756978, "harmonic": 0.018973214285714284, "bidirectional_harmonic": 0.22100368107769477, "degree": 8 }, "line_count": 108, "code_line_count": 108, "cyclomatic": 4, "halstead_volume": 28.529325012980813, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/code/_pep/pep484585/codepep484585container.py", "function_name": "make_hint_pep484585_container_check_expr", "test_info": { "success": false, "failed": 20, "passed": 1110, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_te9w1lmj/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:119\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n> with warns(hint_meta.warning_type):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_te9w1lmj/beartype/_check/code/codemake.py:1671\nError: AssertionError: Is_bearable() type hint typing.Container[object] expression undefined.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> raise exception # pyright: ignore\n\n> is_bearable(pith, hint, conf=conf)\n\n> func_tester = make_func_tester(hint, conf)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def make_check_expr(\n # ..................{ ARGS ~ mandatory }..................\n hint_or_sane: HintOrHintSanifiedData,\n conf: BeartypeConf,\n \n # ..................{ ARGS ~ optional }..................\n cls_stack: TypeStack = None,\n ) -> CodeGenerated:\n '''\n **Type-checking expression factory** (i.e., low-level callable dynamically\n generating a pure-Python boolean expression type-checking an arbitrary\n object against the passed PEP-compliant type hint).\n \n This code factory performs a breadth-first search (BFS) over the abstract\n graph of nested type hints reachable from the subscripted arguments of the\n passed root type hint. For each such (possibly nested) hint, this factory\n embeds one or more boolean subexpressions validating a (possibly nested\n sub)object of an arbitrary object against that hint into the full boolean\n expression created and returned by this factory. In short, this factory is\n the beating heart of :mod:`beartype`. We applaud you for your perseverance.\n You finally found the essence of the Great Bear. You did it!! Now, we clap.\n \n This code factory is memoized for efficiency.\n \n Caveats\n -------\n **This factory intentionally accepts no** ``exception_prefix``\n **parameter.** Why? Since that parameter is typically specific to the\n context-sensitive use case of the caller, accepting that parameter would\n prevent this factory from memoizing the passed hint with the returned code,\n which would rather defeat the point. Instead, this factory only:\n \n * Returns generic non-working code containing the placeholder\n :data:`VAR_NAME_PITH_ROOT` substring that the caller is required to\n globally replace by either the name of the current parameter *or*\n ``return`` for return values (e.g., by calling the builtin\n :meth:`str.replace` method) to generate the desired non-generic working\n code type-checking that parameter or return value.\n * Raises generic non-human-readable exceptions containing the placeholder\n :attr:`beartype._util.error.utilerrraise.EXCEPTION_PLACEHOLDER` substring\n that the caller is required to explicitly catch and raise non-generic\n human-readable exceptions from by calling the\n :func:`beartype._util.error.utilerrraise.reraise_exception_placeholder`\n function.\n \n Parameters\n ----------\n hint_or_sane : HintOrHintSanifiedData\n Either a type hint *or* **sanified type hint metadata** (i.e.,\n :data:`.HintSanifiedData` object) to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n \n Returns\n -------\n CodeGenerated\n Tuple containing the Python code snippet dynamically generated by this\n code generator and metadata describing that code. See also the\n :attr:`beartype._data.hint.datahinttyping.CodeGenerated` type hint.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If this object is *not* a PEP-compliant type hint.\n BeartypeDecorHintPepUnsupportedException\n If this object is a PEP-compliant type hint currently unsupported by\n the :func:`beartype.beartype` decorator.\n BeartypeDecorHintPep484Exception\n If one or more PEP-compliant type hints visitable from this object are\n nested :attr:`typing.NoReturn` child hints, since\n :attr:`typing.NoReturn` is valid *only* as a non-nested return hint.\n BeartypeDecorHintPep593Exception\n If one or more PEP-compliant type hints visitable from this object\n subscript the :pep:`593`-compliant :class:`typing.Annotated` class such\n that:\n \n * The second argument subscripting that class is an instance of the\n :class:`beartype.vale.Is` class.\n * One or more further arguments subscripting that class are *not*\n instances of the :class:`beartype.vale.Is` class.\n \n Warns\n -----\n BeartypeDecorHintPep585DeprecationWarning\n If one or more :pep:`484`-compliant type hints visitable from this\n object have been deprecated by :pep:`585`.\n '''\n \n # ..................{ LOCALS ~ hint : root }..................\n # Unpack the passed sanified hint metadata into:\n # * \"hint_root\", the top-level hint to be type-checked.\n # * \"typevar_to_hint_root\", the top-level type variable lookup table (i.e.,\n # dictionary mapping from each type variable parametrizing the origin of\n # this top-level hint to the child hint subscripting this top-level hint).\n hint_root, typevar_to_hint_root = unpack_hint_or_sane(hint_or_sane)\n # print(f'Received root hint {repr(hint_root)} and type variable lookup table {repr(typevar_to_hint_root)}.')\n \n # ..................{ LOCALS ~ hint : current }..................\n # Currently visited hint.\n hint_curr: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this hint (e.g.,\n # \"Union\" if \"hint_curr == Union[int, str]\").\n hint_curr_sign: HintSign = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : child }..................\n # Currently iterated child hint subscripting the currently visited hint.\n hint_child: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this child hint\n # (e.g., \"Union\" if \"hint_child == Union[int, str]\").\n hint_child_sign: Optional[HintSign] = None\n \n # Currently iterated child hint subscripting the currently visited hint *OR*\n # sanified child hint metadata** (i.e., \"HintSanifiedData\" object describing\n # that child hint).\n hint_or_sane_child: HintOrHintSanifiedData = None # pyright: ignore\n \n # ..................{ LOCALS ~ hint : childs }..................\n # Current tuple of all child hints subscripting the currently visited hint\n # (e.g., \"(int, str)\" if \"hint_curr == Union[int, str]\").\n hint_childs: tuple = None # type: ignore[assignment]\n \n # Number of child hints subscripting the currently visited hint.\n hint_childs_len: int = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : metadata }..................\n # Fixed list of all metadata describing all visitable hints currently\n # discovered by the breadth-first search (BFS) below. This list acts as a\n # standard First In First Out (FILO) queue, enabling this BFS to be\n # implemented as an efficient imperative algorithm rather than an\n # inefficient (and dangerous, due to both unavoidable stack exhaustion and\n # avoidable infinite recursion) recursive algorithm.\n #\n # Note that this list is guaranteed by the previously called\n # _die_if_hint_repr_exceeds_child_limit() function to be larger than the\n # number of hints transitively visitable from this root hint. Ergo, *ALL*\n # indexation into this list performed by this BFS is guaranteed to be safe.\n # Ergo, avoid explicitly testing below that the \"hints_meta.index_last\"\n # integer maintained by this BFS is strictly less than\n # \"FIXED_LIST_SIZE_MEDIUM\", as this constraint is already guaranteed to be\n # the case.\n hints_meta = acquire_instance(HintsMeta)\n \n # Initialize this fixed list.\n hints_meta.reinit(cls_stack=cls_stack, conf=conf)\n \n # 0-based index of metadata describing the currently visited hint in this\n # fixed list.\n hints_meta_index_curr = 0\n \n # ..................{ LOCALS ~ pep : 484 }..................\n # Set of the unqualified classnames referred to by all relative forward\n # references visitable from this root hint if any *OR* \"None\" otherwise\n # (i.e., if no such forward references are visitable).\n hint_refs_type_basename: Optional[set] = None\n \n # ..................{ LOCALS ~ func : code }..................\n # Python code snippet type-checking the root pith against the root hint:\n # * Localized separately from the \"func_wrapper_code\" snippet to enable this\n # function to validate this code to be valid *BEFORE* returning this code.\n # * Initialized to a placeholder string to be globally replaced in the\n # Python code snippet to be returned (i.e., \"func_wrapper_code\") by a\n # Python code snippet type-checking the root pith expression (i.e.,\n # \"VAR_NAME_PITH_ROOT\") against the root hint (i.e., \"hint_root\").\n func_root_code = hints_meta.enqueue_hint_child(\n hint=hint_root,\n # 1-based indentation level describing the initial level of indentation\n # appropriate for the root hint.\n indent_level=1,\n pith_expr=VAR_NAME_PITH_ROOT,\n pith_var_name_index=hints_meta.pith_curr_var_name_index,\n typevar_to_hint=typevar_to_hint_root,\n )\n \n # Python code snippet to be returned, seeded with a placeholder to be\n # replaced on the first iteration of the breadth-first search performed\n # below with a snippet type-checking the root pith against the root hint.\n #\n # Note that, shockingly, brute-force string concatenation has been\n # personally profiled by @leycec to be substantially faster than *ALL*\n # alternatives under CPython up to a large number of iterations (e.g.,\n # 100,000). This includes these popular alternatives, *ALL* of which are\n # orders of magnitude slower than brute-force string concatenation:\n # * deque.append().\n # * list.append().\n func_wrapper_code = func_root_code\n \n # ..................{ SEARCH }..................\n # While the 0-based index of metadata describing the next visited hint in\n # the \"hints_meta\" list does *NOT* exceed that describing the last\n # visitable hint in this list, there remains at least one hint to be\n # visited in the breadth-first search performed by this iteration.\n while hints_meta_index_curr <= hints_meta.index_last:\n # Update instance variables of this queue to reflect that this hint is\n # now the currently visited hint.\n hints_meta.set_hint_curr_meta(\n hint_curr_meta=hints_meta[hints_meta_index_curr])\n \n # Localize metadata for both efficiency and f-string purposes.\n hint_curr = hints_meta.hint_curr_meta.hint\n # print(f'Visiting type hint {repr(hint_curr)}...')\n \n # ................{ PEP }................\n # If this hint is PEP-compliant...\n if is_hint_pep(hint_curr):\n #FIXME: Refactor to call warn_if_hint_pep_unsupported() instead.\n #Actually...wait. This is probably still a valid test here. We'll\n #need to instead augment the is_hint_ignorable() function to\n #additionally test whether the passed hint is unsupported, in which\n #case that function should return false as well as emit a non-fatal\n #warning ala the new warn_if_hint_pep_unsupported() function --\n #which should probably simply be removed now. *sigh*\n #FIXME: Actually, in that case, we can simply reduce the following\n #two calls to simply:\n # die_if_hint_pep_ignorable(\n # hint=hint_curr, exception_prefix=hint_curr_exception_prefix)\n #\n #Of course, this implies we want to refactor the\n #die_if_hint_pep_unsupported() function into\n #die_if_hint_pep_ignorable()... probably.\n \n # If this hint is currently unsupported, raise an exception.\n #\n # Note the human-readable label prefixing the representations of\n # child PEP-compliant type hints is unconditionally passed. Since\n # the root hint has already been validated to be supported by\n # the above call to the same function, this call is guaranteed to\n # *NEVER* raise an exception for that hint.\n die_if_hint_pep_unsupported(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n # Else, this hint is supported.\n \n # Assert that this hint is unignorable. Iteration below generating\n # code for child hints of the current parent hint is *REQUIRED* to\n # explicitly ignore ignorable child hints. Since the caller has\n # explicitly ignored ignorable root hints, these two guarantees\n # together ensure that all hints visited by this breadth-first\n # search *SHOULD* be unignorable. Naturally, we validate that here.\n assert hint_curr is not Any, (\n f'{EXCEPTION_PREFIX}ignorable type hint '\n f'{repr(hint_curr)} not ignored.'\n )\n \n # Sign uniquely identifying this hint.\n hint_curr_sign = get_hint_pep_sign(hint_curr)\n # print(f'Visiting PEP type hint {repr(hint_curr)} sign {repr(hint_curr_sign)}...')\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # NOTE: Whenever adding support for (i.e., when generating code\n # type-checking) a new \"typing\" attribute below, similar support\n # for that attribute *MUST* also be added to the parallel:\n # * \"beartype._check.error\" subpackage, which raises exceptions on\n # the current pith failing this check.\n # * \"beartype._data.hint.pep.sign.datapepsignset.HINT_SIGNS_SUPPORTED_DEEP\"\n # frozen set of all signs for which this function generates deeply\n # type-checking code.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n #FIXME: Python 3.10 provides proper syntactic support for \"case\"\n #statements, which should allow us to dramatically optimize this\n #\"if\" logic into equivalent \"case\" logic *AFTER* we drop support\n #for Python 3.9. Of course, that will be basically never, so we'll\n #have to preserve this for basically forever. What you gonna do?\n #FIXME: Actually, we should probably just leverage a hypothetical\n #\"beartype.vale.IsInline[...]\" validator to coerce this slow O(n)\n #procedural logic into fast O(1) object-oriented logic. Of course,\n #object-oriented logic is itself slow -- so we only do this if we\n #can sufficiently memoize that logic. Consideration!\n \n # Switch on (as in, pretend Python provides a \"case\" statement)\n # the sign identifying this hint to decide which type of code to\n # generate to type-check the current pith against the current hint.\n #\n # This decision is intentionally implemented as a linear series of\n # tests ordered in descending likelihood for efficiency. While\n # alternative implementations (that are more readily readable and\n # maintainable) do exist, these alternatives all appear to be\n # substantially less efficient.\n #\n # Consider the standard alternative of sequestering the body of\n # each test implemented below into either:\n #\n # * A discrete private function called by this function. This\n # approach requires maintaining a global private dictionary\n # mapping from each support unsubscripted typing attribute to\n # the function generating code for that attribute: e.g.,\n # def pep_code_check_union(...): ...\n # _HINT_TYPING_ATTR_ARGLESS_TO_CODER = {\n # typing.Union: pep_code_check_union,\n # }\n # Each iteration of this loop then looks up the function\n # generating code for the current attribute from this dictionary\n # and calls that function to do so. Function calls come with\n # substantial overhead in Python, impacting performance more\n # than the comparable linear series of tests implemented below.\n # Additionally, these functions *MUST* mutate local variables of\n # this function by some arcane means -- either:\n # * Passing these locals to each such function, returning these\n # locals from each such function, and assigning these return\n # values to these locals in this function after each such call.\n # * Passing a single composite fixed list of these locals to each\n # such function, which then mutates these locals in-place,\n # which then necessitates this function permanently store these\n # locals in such a list rather than as local variables.\n # * A discrete closure of this function, which adequately resolves\n # the aforementioned locality issue via the \"nonlocal\" keyword at\n # a substantial up-front performance cost of redeclaring these\n # closures on each invocation of this function.\n #\n # ..............{ SHALLOW }..............\n # Perform shallow type-checking logic (i.e., logic that does *NOT*\n # recurse and thus \"bottoms out\" at this hint) *BEFORE* deep\n # type-checking logic. The latter needs additional setup (e.g.,\n # generation of assignment expressions) *NOT* needed by the former,\n # whose requirements are more understandably minimalist.\n #\n # Note that:\n # * Shallow type-checking code should access this pith via\n # \"pith_curr_expr\". Since this code does *NOT* recurse,\n # \"pith_curr_expr\" accesses this pith optimally efficiently.\n # * Deep type-checking code should access this pith via\n # \"pith_assign_expr\". Since that code *DOES* recurse, only\n # \"pith_assign_expr\" accesses this pith optimally efficiently;\n # \"pith_curr_expr\" accesses this pith extremely inefficiently.\n # * Ignorable type-checking code (i.e., code ignoring this hint but\n # otherwise unsuitable for implementation as a reducer called by\n # the \"beartype._check.convert._reduce.redhint\" submodule, typically\n # due to useful side effects intentionally interacting with this\n # BFS) should follow the design pattern established by the\n # \"HintSignPep695TypeAliasSubscripted\" branch below.\n #\n # ..............{ ORIGIN }..............\n # If this hint both...\n if (\n # Originates from an origin type and may thus be shallowly\n # type-checked against that type *AND is either...\n hint_curr_sign in HINT_SIGNS_ORIGIN_ISINSTANCEABLE and (\n # Unsubscripted *OR*...\n not get_hint_pep_args(hint_curr) or\n # Currently unsupported with deep type-checking...\n hint_curr_sign not in HINT_SIGNS_SUPPORTED_DEEP\n )\n ):\n # Then generate trivial code shallowly type-checking the current\n # pith as an instance of the origin type originating this sign\n # (e.g., \"list\" for the hint \"typing.List[int]\").\n # print(f'Shallow checking unsubscripted hint {repr(hint_curr)}...')\n \n # Code type-checking the current pith against this origin type.\n hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n pith_curr_expr=hints_meta.pith_curr_expr,\n # Python expression evaluating to this origin type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n # Origin type of this hint if any *OR* raise an\n # exception -- which should *NEVER* happen, as this hint\n # was validated above to be supported.\n get_hint_pep_origin_type_isinstanceable(hint_curr)),\n )\n # Else, this hint is either subscripted, not shallowly\n # type-checkable, *OR* deeply type-checkable.\n #\n # ..............{ FORWARDREF }..............\n # If this hint is a forward reference...\n elif hint_curr_sign is HintSignForwardRef:\n # Render this forward reference accessible to the body of this\n # wrapper function by populating:\n # * A Python expression evaluating to the class referred to by\n # this forward reference when accessed via the private\n # \"__beartypistry\" parameter.\n # * A set of the unqualified classnames referred to by all\n # relative forward references, including this reference if\n # relative. If this set was previously uninstantiated (i.e.,\n # \"None\"), this assignment initializes this local to the new\n # set instantiated by this call; else, this assignment\n # preserves this local set as is.\n (\n hints_meta.hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_curr, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n \n #FIXME: *REDUNDANT.* Shallow type-checking code defined below\n #already performs this exact same logic. Excise us up, please.\n # # Code type-checking the current pith against this class.\n # hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n # pith_curr_expr=hints_meta.pith_curr_expr,\n # hint_curr_expr=hints_meta.hint_curr_expr,\n # )\n # Else, this hint is *NOT* a forward reference.\n #\n # Since this hint is *NOT* shallowly type-checkable, this hint\n # *MUST* be deeply type-checkable. So, we do so now.\n #\n # ..............{ DEEP }..............\n # Perform deep type-checking logic (i.e., logic that is guaranteed\n # to recurse and thus *NOT* \"bottom out\" at this hint).\n else:\n # Tuple of all child hints subscripting this hint if any *OR*\n # the empty tuple otherwise (e.g., if this hint is its own\n # unsubscripted \"typing\" attribute).\n #\n # Note that the \"__args__\" dunder attribute is *NOT* guaranteed\n # to exist for arbitrary PEP-compliant type hints. Ergo, we\n # obtain this attribute via a higher-level utility getter.\n hint_childs = get_hint_pep_args(hint_curr)\n \n # Number of these child hints.\n hint_childs_len = len(hint_childs)\n \n # ............{ DEEP ~ expression }............\n #FIXME: Unit test that this is behaving as expected. Doing so\n #will require further generalizations, including:\n #* In the \"beartype._decor.decormain\" submodule:\n # * Detect when running under tests.\n # * When running under tests, define a new\n # \"func_wrapper.__beartype_wrapper_code\" attribute added to\n # decorated callables to be the \"func_wrapper_code\" string\n # rather than True. Note that this obviously isn't the right way\n # to do source code association. Ideally, we'd at least\n # interface with the stdlib \"linecache\" module (e.g., by calling\n # the linecache.lazycache() function intended to be used to\n # cache the source code for non-file-based modules) and possibly\n # even go so far as to define a PEP 302-compatible beartype\n # module loader. That's out of scope, so this suffices for now.\n #* In the \"beartype_test.a00_unit.data._data_hint_pep\" submodule:\n # * Add a new \"_PepHintMetadata.code_str_match_regexes\" field,\n # defined as an iterable of regular expressions matching\n # substrings of the \"func_wrapper.__beartype_wrapper_code\"\n # attribute that are expected to exist.\n # * For most \"HINTS_PEP_META\" entries, default this field to\n # merely the empty tuple.\n # * For deeply nested \"HINTS_PEP_META\" entries, define this\n # field as follows:\n # code_str_match_regexes=(r'\\s+:=\\s+',)\n #* In the \"beartype_test.a00_unit.pep.p484.test_p484\" submodule:\n # * Match the \"pep_hinted.__beartype_wrapper_code\" string against\n # all regular expressions in the \"code_str_match_regexes\"\n # iterable for the currently iterated \"pep_hint_meta\".\n #\n #This is fairly important, as we have no other reusable means of\n #ascertaining whether this is actually being applied in general.\n #FIXME: That's all great, except for the\n #\"func_wrapper.__beartype_wrapper_code\" part. Don't do that,\n #please. We really do just want to do this right the first time. As\n #expected, the key to doing so is the linecache.lazycache()\n #function, whose implementation under Python 3.7 reads:\n #\n # def lazycache(filename, module_globals):\n # \"\"\"Seed the cache for filename with module_globals.\n #\n # The module loader will be asked for the source only when getlines is\n # called, not immediately.\n #\n # If there is an entry in the cache already, it is not altered.\n #\n # :return: True if a lazy load is registered in the cache,\n # otherwise False. To register such a load a module loader with a\n # get_source method must be found, the filename must be a cachable\n # filename, and the filename must not be already cached.\n # \"\"\"\n # if filename in cache:\n # if len(cache[filename]) == 1:\n # return True\n # else:\n # return False\n # if not filename or (filename.startswith('<') and filename.endswith('>')):\n # return False\n # # Try for a __loader__, if available\n # if module_globals and '__loader__' in module_globals:\n # name = module_globals.get('__name__')\n # loader = module_globals['__loader__']\n # get_source = getattr(loader, 'get_source', None)\n #\n # if name and get_source:\n # get_lines = functools.partial(get_source, name)\n # cache[filename] = (get_lines,)\n # return True\n # return False\n #\n #Given that, what we need to do is:\n #* Define a new \"beartype._decor._pep302\" submodule implementing a\n # PEP 302-compatible loader for @beartype-generated wrapper\n # functions, enabling external callers (including the stdlib\n # \"linecache\" module) to obtain the source for these functions.\n # For space efficiency, this submodule should internally store\n # code in a compressed format -- which probably means \"gzip\" for\n # maximal portability. This submodule should at least define these\n # attributes:\n # * \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\", a dictionary mapping from\n # the unique fake module names assigned to @beartype-generated\n # wrapper functions by the @beartype decorator to the compressed\n # source strings for those fake modules.\n # * get_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator and returning the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally access the\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has *NOT* already been registered\n # to that dictionary, raise an exception.\n # * Else, uncompress the compressed source string previously\n # registered under that module name with that dictionary and\n # return that uncompressed string. Don't worry about caching\n # uncompressed strings here; that's exactly what the stdlib\n # \"linecache\" module already does on our behalf.\n # Ergo, this function should have signature resembling:\n # def get_source(func_wrapper_module_name: str) -> str:\n # * set_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator as well as as the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has already been registered to\n # that dictionary, raise an exception.\n # * Else, compress the passed uncompressed source string and\n # register that compressed string under that module name with\n # that dictionary.\n #* In the \"beartype._decor.decormain\" submodule:\n # * Do... something? Oh, boy. Why didn't we finish this comment?\n \n # If the expression yielding the current pith is neither...\n #\n # Note that we explicitly test against piths rather than\n # seemingly equivalent metadata to account for edge cases.\n # Notably, child hints of unions (and possibly other \"typing\"\n # objects) do *NOT* narrow the current pith and are *NOT* the\n # root hint. Ergo, a seemingly equivalent test like\n # \"hints_meta_index_curr != 0\" would generate false positives\n # and thus unnecessarily inefficient code.\n if not (\n # The root pith *NOR*...\n #\n # Note that this is merely a negligible optimization for the\n # common case in which the current pith is the root pith\n # (i.e., this is the first iteration of the outermost loop).\n # The subsequent call to the str.isidentifier() method is\n # *MUCH* more expensive than this object identity test.\n hints_meta.pith_curr_expr is VAR_NAME_PITH_ROOT or\n # A simple Python identifier *NOR*...\n hints_meta.pith_curr_expr.isidentifier() or\n # A complex Python expression already containing the\n # assignment expression-specific walrus operator \":=\". Since\n # this implies this expression to already be an assignment\n # expression, needlessly reassigning the local variable to\n # which this assignment expression was previously assigned\n # as yet another redundant local variable only harms\n # efficiency for *NO* tangible gain (e.g., expanding the\n # efficient assignment expression \"__beartype_pith_1 :=\n # next(iter(__beartype_pith_0))\" to the inefficient\n # assignment expression \"__beartype_pith_2 :=\n # __beartype_pith_1 := next(iter(__beartype_pith_0))\").\n #\n # Note that this edge case is induced by method calls\n # performed below of the form:\n # hints_meta.enqueue_hint_child(\n # ..., pith_expr=pith_curr_assign_expr, ...)\n #\n # As of this writing, the only such edge cases are:\n # * PEP 484- or 604-compliant unions containing *ONLY* two\n # or more PEP-compliant type hints (e.g., \"list[str] |\n # set[bytes]\").\n # * PEP 695-compliant subscripted type aliases.\n ':=' in hints_meta.pith_curr_expr\n ):\n # Then the current pith is ideally assigned to a unique\n # local variable via an assignment expression.\n # print(f'Incrementing hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index} by one.')\n \n # Increment the integer suffixing the name of this variable\n # *BEFORE* defining this variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n hints_meta.pith_curr_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Assignment expression assigning this full expression to\n # this local variable.\n hints_meta.pith_curr_assign_expr = (\n CODE_PEP572_PITH_ASSIGN_EXPR_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n pith_curr_expr=hints_meta.pith_curr_expr,\n ))\n # Else, the current pith is *NOT* safely assignable to a unique\n # local variable via an assignment expression. Since the\n # expression yielding the current pith is a simple Python\n # identifier, there is *NO* benefit to assigning that to another\n # local variable via another assignment expression, which would\n # just be an alias of the existing local variable assigned via\n # the existing assignment expression. Moreover, whereas chained\n # assignments are syntactically valid, chained assignment\n # expressions are syntactically invalid unless explicitly\n # protected by parens: e.g.,\n # >>> a = b = 'Mother*Teacher*Destroyer' # <-- fine\n # >>> (a := \"Mother's Abomination\") # <-- fine\n # >>> (a :=\n # ... (b := \"Mother's Illumination\")) # <-- fine\n # >>> (a := b := \"Mother's Illumination\") # <-- not fine\n # SyntaxError: invalid syntax\n #\n # In this case...\n else:\n # print(f'Preserving hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index}.')\n \n # Preserve the Python code snippet evaluating to the value\n # of the current pith as is.\n hints_meta.pith_curr_assign_expr = hints_meta.pith_curr_expr\n \n # ............{ UNION }............\n # If this hint is a union (e.g., \"typing.Union[bool, str]\",\n # typing.Optional[float]\")...\n if hint_curr_sign in HINT_SIGNS_UNION:\n # Python code snippet type-checking the current pith against\n # this union if this union is unignorable *OR* \"None\".\n make_hint_pep484604_check_expr(hints_meta)\n # Else, this hint is *NOT* a union.\n #\n # ..........{ CONTAINERS }............\n # If this hint is either:\n # * A single-argument container like list[int] or set[str].\n # * A similar hint semantically resembling a single-argument\n # container subscripted by one argument and one or more\n # ignorable arguments like tuple[str, ...].\n #\n # Then this hint is effectively (for all intents and purposes) a\n # standard single-argument container. In this case...\n elif hint_curr_sign in HINT_SIGNS_CONTAINER_ARGS_1:\n # Python code snippet type-checking the current pith against\n # this hint if the child hint subscripting this parent\n # container hint is unignorable *OR* \"None\" otherwise.\n make_hint_pep484585_container_check_expr(hints_meta)\n # Else, this hint is *NOT* a standard single-argument container.\n #\n # ............{ SEQUENCES ~ tuple : fixed }............\n # If this hint is a fixed-length tuple (e.g., \"tuple[int,\n # str]\")...\n #\n # Note that if this hint is a:\n # * PEP 484-compliant \"typing.Tuple\"-based hint, this hint is\n # guaranteed to contain one or more child hints. Moreover, if\n # this hint contains exactly one child hint that is the empty\n # tuple, this hint is the empty fixed-length form\n # \"typing.Tuple[()]\".\n # * PEP 585-compliant \"tuple\"-based hint, this hint is *NOT*\n # guaranteed to contain one or more child hints. If this hint\n # contains *NO* child hints, this hint is equivalent to the\n # empty fixed-length PEP 484-compliant form\n # \"typing.Tuple[()]\". Yes, PEP 585 even managed to violate\n # PEP 484-compliance. UUUURGH!\n #\n # While tuples are sequences, the \"typing.Tuple\" singleton that\n # types tuples violates the syntactic norms established for\n # other standard sequences by concurrently supporting two\n # different syntaxes with equally different semantics:\n # * \"typing.Tuple[{typename}, ...]\", typing a tuple whose items\n # all satisfy the \"{typename}\" child hint. Note that the\n # \"...\" substring here is a literal ellipses.\n # * \"typing.Tuple[{typename1}, {typename2}, ..., {typenameN}]\",\n # typing a tuple whose:\n # * First item satisfies the \"{typename1}\" child hint.\n # * Second item satisfies the \"{typename2}\" child hint.\n # * Last item satisfies the \"{typenameN}\" child hint.\n # Note that the \"...\" substring here is *NOT* a literal\n # ellipses.\n #\n # This is what happens when unreadable APIs are promoted.\n elif hint_curr_sign is HintSignTupleFixed:\n # Initialize the code type-checking this pith against this\n # tuple to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_TUPLE_FIXED_PREFIX\n \n # If this hint is the empty fixed-length tuple, generate\n # and append code type-checking the current pith to be the\n # empty tuple. This edge case constitutes a code smell.\n if is_hint_pep484585_tuple_empty(hint_curr):\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_EMPTY_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name))\n # Else, that ridiculous edge case does *NOT* apply. In this\n # case...\n else:\n # Append code type-checking the length of this pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_LEN_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_childs_len=hint_childs_len,\n ))\n \n #FIXME: Optimize by refactoring into a \"while\" loop.\n # For each possibly ignorable insane child hint of this\n # parent tuple...\n for hint_child_index, hint_child in enumerate(\n hint_childs):\n #FIXME: Refactor most (or even *ALL*) calls to\n #sanify_hint_child() to a new\n #hints_meta.sanify_hint() method. The repetition\n #here is becoming... unnerving.\n \n # Unignorable sane child hint sanified from this\n # possibly ignorable insane child hint *OR* \"None\"\n # otherwise (i.e., if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=hint_child,\n cls_stack=hints_meta.cls_stack,\n conf=hints_meta.conf,\n typevar_to_hint=(\n hints_meta.hint_curr_meta.typevar_to_hint),\n exception_prefix=hints_meta.exception_prefix,\n )\n # print(f'Sanified fixed tuple {hints_meta.hint_curr_meta}...')\n # print(f'...child hint {hint_child} -> {hint_or_sane_child}!')\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Python expression yielding the value of the\n # currently indexed item of this tuple to be\n # type-checked against this child hint.\n pith_child_expr = (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_child_index=hint_child_index,\n ))\n \n # Deeply type-check this child pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_child_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n ))\n # Else, this child hint is ignorable.\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_TUPLE_FIXED_SUFFIX}'\n # Format...\n ).format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n )\n # Else, this hint is *NOT* a fixed-length tuple.\n #\n # ..........{ MAPPINGS }............\n # If this hint is a standard mapping (e.g., \"dict[str, int]\")...\n elif hint_curr_sign in HINT_SIGNS_MAPPING:\n # Python expression evaluating to the origin type of this\n # mapping hint as a hidden beartype-specific parameter\n # injected into the signature of this wrapper function.\n hints_meta.hint_curr_expr = (\n hints_meta.add_func_scope_type_or_types(\n get_hint_pep_origin_type_isinstanceable(hint_curr)))\n \n # 2-tuple of the possibly ignorable insane child key and\n # value hints subscripting this mapping hint, defined as\n # either...\n hint_childs = (\n #FIXME: Note that a similar effect can also be achieved\n #through a reduction from type hints the form\n #\"{collections,typing}.Counter[{hint_child}]\" to:\n # typing.Annotated[\n # collections.abc.MutableMapping[{hint_child}, int],\n # beartype.vale.IsInstance[collections.Counter]\n # ]\n #However, the current approach is even *MORE* trivial\n #than that reduction. So, we currently prefer this.\n \n # If this hint describes a \"collections.Counter\"\n # dictionary subclass:\n # * The \"typing.Counter[...]\" type hint factory is\n # subscriptable by only a single key child type hint\n # and assumes the value child type hint typically\n # subscripting dictionary type hint factories to be\n # the standard \"int\" type (e.g., \"typing.Counter[str]\"\n # effectively expands to \"typing.Counter[str, int]\").\n # * The \"collections.Counter[...]\" type hint factory is\n # technically subscriptable by an arbitrary number of\n # child type hints but pragmatically subscriptable by\n # only a single key child type hint. Why? Static\n # type-checkers, which enforce that constraint.\n #\n # Despite these type-checking assumptions and\n # constraints, the \"collections.Counter\" type is itself\n # unconstrained. As of Python 3.13, the\n # collections.Counter.__init__() initializer accepts\n # arbitrary values that are *NOT* integers: e.g.,\n # >>> from collections import Counter\n # >>> c = Counter({'red': 'no, blue!', 'blue': 4.2})\n # >>> print(c)\n # Counter({'red': 'no, blue!', 'blue': 4.2}) # lol\n #\n # That permissiveness arguably constitutes a bug in both\n # CPython itself *AND* user code attempting such\n # shenanigans. Static type-checkers believe this to be\n # the case, anyway -- and that's good enough for us.\n # @beartype thus explicitly catches these bugs by\n # defaulting the undeclared value child type hint for\n # counter type hints to be the \"int\" type.\n (\n get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=EXCEPTION_PREFIX,\n ),\n int,\n )\n if hint_curr_sign is HintSignCounter else\n # Else, this hint does *NOT* describe a\n # \"collections.Counter\" dictionary subclass. In this\n # case, introspect the child key and value type hints\n # subscripting this parent hint in the standard way.\n get_hint_pep484585_args( # type: ignore[assignment]\n hint=hint_curr,\n args_len=2,\n exception_prefix=EXCEPTION_PREFIX,\n )\n )\n \n #FIXME: Consider also contextually considering child key\n #hints that reduce to \"Hashable\" to be ignorable. This\n #includes complex type hints like \"Union[Hashable, str]\",\n #which reduces to \"Hashable\". We can't particularly be\n #bothered at the moment. This is a microoptimization and\n #will probably require a non-trivial amount of work. *sigh*\n # Unignorable sane child key and value hints sanified from\n # these possibly ignorable insane child key and value hints\n # *OR* \"None\" otherwise (i.e., if ignorable).\n hint_or_sane_child_key = (\n sanify_hint_child(\n hint=hint_childs[0],\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n hint_or_sane_child_value = (\n sanify_hint_child(\n hint=hint_childs[1], # type: ignore[has-type]\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n \n # If at least one of these child hints are unignorable...\n if not (\n hint_or_sane_child_key is Any and\n hint_or_sane_child_value is Any\n ):\n # If this child key hint is unignorable...\n if hint_or_sane_child_key is not Any:\n # If this child value hint is also unignorable...\n if hint_or_sane_child_value is not Any:\n # Increase the indentation level of code\n # type-checking this child value pith.\n hints_meta.indent_level_child += 1\n \n # Increment the integer suffixing the name of a\n # unique local variable storing the value of\n # this child key pith *BEFORE* defining this\n # variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n pith_key_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child key pith\n # against this hint.\n hint_key_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_key,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_key_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child value pith\n # against this hint.\n hint_value_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_VALUE_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_key_var_name=pith_key_var_name,\n ),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Code deeply type-checking these child key and\n # value piths against these hints.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_VALUE_format(\n indent_curr=hints_meta.indent_curr,\n pith_key_var_name=pith_key_var_name, # pyright: ignore\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n hint_key_placeholder=(\n hint_key_placeholder),\n hint_value_placeholder=(\n hint_value_placeholder),\n ))\n # Else, this child value hint is ignorable. In this\n # case...\n else:\n # Code deeply type-checking only this child key\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child key pith against this hint.\n hint_key_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=(\n hint_or_sane_child_key),\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n # Else, this child key hint is ignorable. By process\n # of elimination, this child value hint *MUST* be\n # unignorable. In this case...\n else:\n # Code deeply type-checking only this child value\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_VALUE_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child value pith against this hint.\n hint_value_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_VALUE_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Code deeply type-checking this pith as well as at\n # least one of these child key and value piths.\n hints_meta.func_curr_code = CODE_PEP484585_MAPPING_format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hints_meta.hint_curr_expr,\n func_curr_code_key_value=func_curr_code_key_value,\n )\n # Else, these child key *AND* value hints are both\n # ignorable. In this case, fallback to trivial code\n # shallowly type-checking this pith as an instance of this\n # origin type.\n # Else, this hint is *NOT* a mapping.\n #\n # ............{ ANNOTATED }............\n # If this hint is a PEP 593-compliant type metahint, this\n # metahint is guaranteed by the reduction performed above to be\n # beartype-specific (i.e., metahint whose second argument is a\n # beartype validator produced by subscripting a beartype\n # validator factory). In this case...\n elif hint_curr_sign is HintSignAnnotated:\n # Defer heavyweight imports.\n from beartype.vale._core._valecore import BeartypeValidator\n \n # Initialize the code type-checking this pith against this\n # metahint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP593_VALIDATOR_PREFIX\n \n # Unignorable sane metahint annotating this parent hint\n # sanified from this possibly ignorable insane metahint *OR*\n # \"None\" otherwise (i.e., if this metahint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=get_hint_pep593_metahint(hint_curr),\n conf=conf,\n cls_stack=cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # print(f'[593] metahint: {repr(get_hint_pep593_metahint(hint_curr))}')\n # print(f'[593] hint_curr_meta: {repr(hints_meta.hint_curr_meta)}')\n # print(f'[593] hint_curr: {repr(hint_curr)}; hint_or_sane_child: {repr(hint_or_sane_child)}')\n \n # Tuple of the one or more beartype validators annotating\n # this metahint.\n hints_child = get_hint_pep593_metadata(hint_curr)\n # print(f'hints_child: {repr(hints_child)}')\n \n # If this metahint is ignorable...\n if hint_or_sane_child is Any:\n # Expression yielding the value of the current pith,\n # defined as either...\n hint_curr_expr = (\n hints_meta.pith_curr_expr\n # If this metahint is annotated by only one beartype\n # validator, the most efficient expression yielding\n # the value of the current pith is simply the full\n # Python expression *WITHOUT* assigning that value\n # to a reusable local variable in an assignment\n # expression. *NO* assignment expression is needed\n # in this case.\n #\n # Why? Because beartype validators are *NEVER*\n # recursed into. Each beartype validator is\n # guaranteed to be the leaf of a type-checking\n # subtree, guaranteeing this pith to be evaluated\n # only once.\n if len(hints_child) == 1 else\n # Else, this metahint is annotated by two or more\n # beartype validators. In this case, the most\n # efficient expression yielding the value of the\n # current pith is the assignment expression\n # assigning this value to a reusable local variable.\n hints_meta.pith_curr_assign_expr\n )\n # Else, this metahint is unignorable. In this case...\n else:\n # Python expression yielding the value of the current\n # pith, defaulting to the name of the local variable\n # assigned to by the assignment expression performed\n # below.\n hint_curr_expr = hints_meta.pith_curr_var_name\n \n # Code deeply type-checking this metahint.\n hints_meta.func_curr_code += (\n CODE_PEP593_VALIDATOR_METAHINT_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression yielding the value of the\n # current pith assigned to a local variable\n # efficiently reused by code generated by the\n # following iteration.\n #\n # Note this child hint is guaranteed to be followed\n # by at least one more test expression referencing\n # this local variable. Why? Because the \"typing\"\n # module forces metahints to be subscripted by one\n # child hint and one or more arbitrary objects.\n # Ergo, we need *NOT* explicitly validate that here.\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=hints_meta.pith_curr_assign_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n #FIXME: Optimize by refactoring into a \"while\" loop. *sigh*\n # For the 0-based index and each beartype validator\n # annotating this metahint...\n for hint_child_index, hint_child in enumerate(hints_child):\n # print(f'Type-checking PEP 593 type hint {repr(hint_curr)} argument {repr(hint_child)}...')\n # If this is *NOT* a beartype validator, raise an\n # exception.\n #\n # Note that the previously called sanify_hint_child()\n # function validated only the first such to be a\n # beartype validator. All remaining arguments have yet\n # to be validated, so we do so now for consistency and\n # safety.\n if not isinstance(hint_child, BeartypeValidator):\n raise BeartypeDecorHintPep593Exception(\n f'{EXCEPTION_PREFIX}PEP 593 type hint '\n f'{repr(hint_curr)} subscripted by both '\n f'@beartype-specific and -agnostic metadata '\n f'(i.e., {represent_object(hint_child)} not '\n f'beartype validator).'\n )\n # Else, this argument is beartype-specific.\n #\n # If this is any beartype validator *EXCEPT* the first,\n # set the Python expression yielding the value of the\n # current pith to the name of the local variable\n # assigned to by the prior assignment expression. By\n # deduction, it *MUST* be the case now that either:\n # * This metahint was unignorable, in which case this\n # assignment uselessly reduplicates the exact same\n # assignment performed above. While non-ideal, this\n # assignment is sufficiently efficient to make any\n # optimizations here effectively worthless.\n # * This metahint was ignorable, in which case this\n # expression was set above to the assignment\n # expression assigning this pith for the first\n # beartype validator. Since this iteration has already\n # processed the first beartype validator, this\n # assignment expression has already been performed.\n # Avoid inefficiently re-performing this assignment\n # expression for each additional beartype validator by\n # efficiently reusing the previously assigned local.\n elif hint_child_index:\n hint_curr_expr = hints_meta.pith_curr_var_name\n # Else, this is the first beartype validator. See above.\n \n # Code deeply type-checking this validator.\n hints_meta.func_curr_code += CODE_PEP593_VALIDATOR_IS_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression formatting the current pith into\n # the \"{obj}\" format substring previously embedded\n # by this validator into this code string.\n hint_child_expr=hint_child._is_valid_code.format(\n indent=hints_meta.indent_child,\n obj=hint_curr_expr,\n ),\n )\n \n # Generate locals safely merging the locals required by\n # both this validator code *AND* the current code\n # type-checking this entire root hint.\n update_mapping(\n mapping_trg=hints_meta.func_wrapper_scope,\n mapping_src=hint_child._is_valid_code_locals,\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP593_VALIDATOR_SUFFIX_format(indent_curr=hints_meta.indent_curr)}'\n )\n # Else, this hint is *NOT* a metahint.\n #\n # ............{ SUBCLASS }............\n # If this hint is either a PEP 484- or 585-compliant subclass\n # type hint...\n elif hint_curr_sign is HintSignType:\n # Unignorable sane child hint sanified from this possibly\n # ignorable insane child hint *OR* \"None\" otherwise (i.e.,\n # if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n # Possibly ignorable insane child hint subscripting\n # this parent hint, validated to be the *ONLY* child\n # hint subscripting this parent hint.\n hint=get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=hints_meta.exception_prefix,\n ),\n conf=conf,\n cls_stack=hints_meta.cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=hints_meta.exception_prefix,\n )\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Child hint encapsulated by this metadata.\n hint_child = get_hint_or_sane_hint(hint_or_sane_child)\n \n # Sign identifying this child hint.\n hint_child_sign = get_hint_pep_sign_or_none(hint_child)\n \n # If this child hint is a forward reference to a\n # superclass, expose this forward reference to the body\n # of this wrapper function. See above for commentary.\n if hint_child_sign is HintSignForwardRef:\n (\n hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_child, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # Else, this child hint is *NOT* a forward reference. In\n # this case...\n else:\n # If this child hint is a union of superclasses,\n # reduce this union to a tuple of superclasses. Only\n # the latter is safely passable as the second\n # parameter to the issubclass() builtin under all\n # supported Python versions.\n if hint_child_sign is HintSignUnion:\n hint_child = get_hint_pep_args(hint_child) # pyright: ignore\n # Else, this child hint is *NOT* a union.\n \n # If this child hint is *NOT* an issubclassable\n # object, raise an exception.\n #\n # Note that the is_object_issubclassable() tester is\n # considerably faster and thus called before the\n # considerably slower\n # die_unless_object_issubclassable() raiser.\n if not is_object_issubclassable(hint_child): # type: ignore[arg-type]\n die_unless_object_issubclassable(\n obj=hint_child, # type: ignore[arg-type]\n exception_prefix=(\n f'{EXCEPTION_PREFIX}PEP 484 or 585 '\n f'subclass type hint {repr(hint_curr)} '\n f'child type hint '\n ),\n )\n # Else, this child hint is an issubclassable object.\n \n # Python expression evaluating to this child hint.\n hint_curr_expr = hints_meta.add_func_scope_type_or_types(\n hint_child) # pyright: ignore\n \n # Code type-checking this pith against this superclass.\n hints_meta.func_curr_code = CODE_PEP484585_SUBCLASS_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hint_curr_expr,\n indent_curr=hints_meta.indent_curr,\n )\n # Else, this child hint is ignorable. In this case...\n else:\n # Python expression evaluating to the origin type of\n # this hint -- which, by definition, is the \"type\"\n # superclass. Since this superclass is a builtin (i.e.,\n # universally accessible object), we efficiently\n # hardcode the access of this superclass rather than\n # inject a hidden beartype-specific parameter into the\n # signature of this wrapper function as we usually do.\n hints_meta.hint_curr_expr = 'type'\n \n # Fallback to trivial code shallowly type-checking this\n # pith as an instance of this origin type.\n # Else, this hint is *NOT* a subclass type hint.\n #\n # ............{ GENERIC or PROTOCOL }............\n # If this hint is either a:\n # * PEP 484-compliant generic (i.e., user-defined class\n # subclassing a combination of one or more of the\n # \"typing.Generic\" superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 544-compliant protocol (i.e., class subclassing a\n # combination of one or more of the \"typing.Protocol\"\n # superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 585-compliant generic (i.e., user-defined class\n # subclassing at least one non-class PEP 585-compliant\n # pseudo-superclasses) *OR*...\n #\n # ...then this hint is a PEP-compliant generic. In this case...\n elif hint_curr_sign is HintSignPep484585GenericUnsubscripted:\n # print(f'Visiting generic type {repr(hint_curr)}...')\n \n # Initialize the code type-checking this pith against this\n # generic to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_GENERIC_PREFIX\n \n # For each unignorable unerased transitive pseudo-superclass\n # originally declared as a superclass of this generic...\n for hint_or_sane_child in (\n iter_hint_pep484585_generic_bases_unerased(\n hint=hint_curr, # pyright: ignore\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )):\n # print(f'Visiting generic type hint {repr(hint_curr)}...')\n # print(f'...unerased base {repr(hint_child)}...')\n \n # Generate and append code type-checking this pith\n # against this pseudo-superclass.\n hints_meta.func_curr_code += (\n CODE_PEP484585_GENERIC_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n # Python expression efficiently reusing\n # the value of this pith previously\n # assigned to a local variable by the\n # prior expression.\n pith_expr=hints_meta.pith_curr_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_GENERIC_SUFFIX}'\n # Format...\n ).format(\n # Indentation deferred above for efficiency.\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n # Python expression evaluating to this generic type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n hint_curr), # pyright: ignore\n )\n # print(f'{hint_curr_exception_prefix} PEP generic {repr(hint)} handled.')\n # Else, this hint is *NOT* a generic.\n #\n # ............{ PEP 484 ~ type variable }............\n # If this hint is a PEP 484-compliant type variable (i.e.,\n # \"typing.TypeVar\" object), this hint is both dependent on and\n # less common than .PEP 484- and 585-compliant generics and thus\n # intentionally detected immediately after generics. In this\n # case...\n \n #FIXME: Preserved for posterity, once we begin generating\n #call-time type variable type-checking.\n #FIXME: Unit test us up, please.\n #FIXME: Implement corresponding \"beartype._check.error\"\n #validation, please. *sigh*\n # elif hint_curr_sign is HintSignTypeVar:\n # # Either the unignorable hint this type variable reduces to\n # # if any *OR* \"None\" if this type variable is ignorable.\n # hint_child = make_hint_pep484_typevar_check_expr( # type: ignore[assignment]\n # hint_meta=hint_curr_meta,\n # conf=conf,\n # pith_curr_assign_expr=pith_curr_assign_expr,\n # pith_curr_var_name_index=pith_curr_var_name_index,\n # cls_stack=cls_stack,\n # exception_prefix=EXCEPTION_PREFIX,\n # )\n #\n # # If this type variable is reducible to an unignorable\n # # hint, revisit this hint metadata in the outermost \"while\"\n # # loop. Doing so avoids the \"CLEANUP\" logic below, which\n # # assumes this hint to be unignorable and thus\n # # type-checkable.\n # if hint_child is not None:\n # continue\n # # Else, this type variable is *NOT* reducible to an\n # # unignorable hint. Since @beartype currently fails to\n # # generate type-checking code for type variables in and of\n # # themselves, type variables have *NO* intrinsic semantic\n # # meaning and are thus ignorable. In this case, prepare this\n # # BFS to visit the next enqueued hint by incrementing the\n # # 0-based index of metadata describing the next visited hint\n # # in the \"hints_meta\" list *BEFORE* visiting that hint.\n # else:\n # #FIXME: Insufficient. The parent type hint thought this\n # #type variable was unignorable and thus... ugh.\n # hints_meta_index_curr += 1\n # ............{ PEP 586 ~ typing.Literal }............\n # If this hint is a PEP 586-compliant type hint (i.e., the\n # \"typing.Literal\" singleton subscripted by one or more literal\n # objects), this hint is largely useless and thus intentionally\n # detected late. Why? Because \"typing.Literal\" is subscriptable\n # by objects that are instances of only *SIX* possible types,\n # which is sufficiently limiting as to render this singleton\n # patently absurd and a farce that we weep to even implement.\n # In this case...\n elif hint_curr_sign is HintSignLiteral:\n # Tuple of zero or more literal objects subscripting this\n # hint, intentionally replacing the current such tuple due\n # to the non-standard implementation of the third-party\n # \"typing_extensions.Literal\" type hint factory.\n hint_childs = get_hint_pep586_literals(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n \n # Initialize the code type-checking this pith against this\n # hint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP586_PREFIX_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n \n #FIXME: If \"typing.Literal\" is ever extended to support\n #substantially more types (and thus actually becomes\n #useful), optimize the construction of the \"types\" set\n #below to instead leverage a similar\n #\"acquire_instance(set)\" caching solution as that\n #currently employed for unions. For now, we only shrug.\n \n # Python expression evaluating to a tuple of the unique\n # types of all literal objects subscripting this hint.\n hint_child_types_expr=hints_meta.add_func_scope_type_or_types({\n #FIXME: Optimize by refactoring into a \"while\"\n #loop. Also, this should probably be a \"frozenset\"\n #rather than \"set\". *sigh*\n # Set comprehension of all unique literal objects\n # subscripting this hint, implicitly discarding all\n # duplicate such objects.\n type(hint_child) for hint_child in hint_childs}),\n )\n \n #FIXME: Optimize by refactoring into a \"while\" loop. *sigh*\n # For each literal object subscripting this hint...\n for hint_child in hint_childs:\n # Generate and append efficient code type-checking\n # this data validator by embedding this code as is.\n hints_meta.func_curr_code += CODE_PEP586_LITERAL_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n # Python expression evaluating to this object.\n hint_child_expr=add_func_scope_attr(\n attr=hint_child,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=(\n EXCEPTION_PREFIX_FUNC_WRAPPER_LOCAL),\n ),\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" or\" suffix appended by the last\n # child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_OR]}'\n # Suffix this code by the appropriate substring.\n f'{CODE_PEP586_SUFFIX}'\n ).format(indent_curr=hints_meta.indent_curr)\n # Else, this hint is *NOT* a PEP 586-compliant type hint.\n #\n # ............{ UNSUPPORTED }............\n # Else, this hint is neither shallowly nor deeply supported and\n # is thus unsupported. Since an exception should have already\n # been raised above in this case, this conditional branch\n # *NEVER* be triggered. Nonetheless, raise an exception.\n else:\n raise BeartypeDecorHintPepUnsupportedException(\n f'{EXCEPTION_PREFIX_HINT}'\n f'{repr(hint_curr)} unsupported but '\n f'erroneously detected as supported under '\n f'beartype sign {repr(hint_curr_sign)}.'\n )\n \n # ................{ NON-PEP }................\n # Else, this hint is *NOT* PEP-compliant.\n #\n # ................{ NON-PEP ~ type }................\n # If this hint is a non-\"typing\" class...\n #\n # Note that:\n # * This test is intentionally performed *AFTER* that testing whether\n # this hint is PEP-compliant, thus guaranteeing this hint to be a\n # PEP-noncompliant non-\"typing\" class rather than a PEP-compliant\n # type hint originating from such a class. Since many hints are both\n # PEP-compliant *AND* originate from such a class (e.g., the \"List\"\n # in \"List[int]\", PEP-compliant but originating from the\n # PEP-noncompliant builtin class \"list\"), testing these hints first\n # for PEP-compliance ensures we generate non-trivial code deeply\n # type-checking these hints instead of trivial code only shallowly\n # type-checking the non-\"typing\" classes from which they originate.\n # * This class is guaranteed to be a subscripted argument of a\n # PEP-compliant type hint (e.g., the \"int\" in \"Union[Dict[str, str],\n # int]\") rather than the root type hint. Why? Because if this class\n # were the root type hint, it would have already been passed into a\n # faster submodule generating PEP-noncompliant code instead.\n elif isinstance(hint_curr, type):\n # Python expression evaluating to this type.\n hints_meta.hint_curr_expr = hints_meta.add_func_scope_type_or_types(\n hint_curr)\n # ................{ NON-PEP ~ bad }................\n # Else, this hint is neither PEP-compliant *NOR* a class. In this case,\n # raise an exception. Note that:\n # * This should *NEVER* happen, as the \"typing\" module goes to great\n # lengths to validate the integrity of PEP-compliant types at\n # declaration time.\n # * The higher-level die_unless_hint_nonpep() validator is\n # intentionally *NOT* called here, as doing so would permit both:\n # * PEP-noncompliant forward references, which could admittedly be\n # disabled by passing \"is_forwardref_valid=False\" to that call.\n # * PEP-noncompliant tuple unions, which currently *CANNOT* be\n # disabled by passing such an option to that call.\n else: # pragma: no cover\n raise BeartypeDecorHintPepException(\n f'{EXCEPTION_PREFIX_HINT}{repr(hint_curr)} unrecognized '\n f'(i.e., either PEP-noncompliant or '\n f'PEP-compliant but currently unsupported by @beartype).'\n )\n \n # ................{ CLEANUP }................\n # If prior logic generated *NO* code snippet type-checking the current\n # pith against the currently visited hint.\n if hints_meta.func_curr_code is None:\n # Assert that a branch above defined the code snippet used below.\n> assert hints_meta.hint_curr_expr is not None, (\n f'{EXCEPTION_PREFIX_HINT}{repr(hint_curr)} '\n f'expression undefined.'\n )\nE AssertionError: Is_bearable() type hint typing.Container[object] expression undefined.\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #13: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #14: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #15: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 24.942438400000025, "in_degree": 1, "true_in_degree": 4.6800000000000015, "out_degree": 5, "betweenness": 0.0, "pagerank": 0.00026568000250866636, "harmonic": 0.031034617794486213, "bidirectional_harmonic": 0.2507343168527378, "degree": 6 }, "line_count": 36, "code_line_count": 36, "cyclomatic": 5, "halstead_volume": 39.863137138648355, "halstead_difficulty": 1.7142857142857142 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep695.py", "function_name": "is_hint_pep695_subscripted", "test_info": { "success": false, "failed": 9, "passed": 1121, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py::test_is_hint_pep695_subscripted\nLocation: /tmp/benchmark_eida8wim/beartype_test/a00_unit/data/pep/pep695/data_pep695util.py:50\nError: AssertionError\n\nTraceback:\n\n> def test_is_hint_pep695_subscripted() -> None:\n '''\n Test the private\n :mod:`beartype._util.hint.pep.proposal.pep695.is_hint_pep695_subscripted`\n tester.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.hint.pep.proposal.pep695 import (\n is_hint_pep695_subscripted)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_12\n \n # If the active Python interpreter targets Python >= 3.12 and thus supports\n # PEP 695...\n if IS_PYTHON_AT_LEAST_3_12:\n # Defer version-specific imports.\n from beartype_test.a00_unit.data.pep.pep695.data_pep695util import (\n unit_test_is_hint_pep695_subscripted)\n \n # Perform this test.\n> unit_test_is_hint_pep695_subscripted()\n\n> def unit_test_is_hint_pep695_subscripted() -> None:\n '''\n Test the private\n :mod:`beartype._util.hint.pep.proposal.pep695.is_hint_pep695_subscripted`\n tester.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.hint.pep.proposal.pep695 import (\n is_hint_pep695_subscripted)\n \n # ....................{ LOCALS }....................\n # Unsubscripted type alias.\n type and_thou = int | float\n \n # Subscriptable type alias yet to be subscripted by a concrete type.\n #\n # Note that, although subscriptable type aliases superficially appear to be\n # \"pre-subscripted\" by PEP 484-compliant type variables, this\n # \"pre-subscription\" is simply syntactic sugar; subscriptable type aliases\n # remain unsubscripted until explicitly subscripted by concrete types.\n type colossal_skeleton[T] = complex | T\n \n # ....................{ PASS }....................\n # Assert this tester accepts PEP 695-compliant subscripted type aliases\n # (i.e., subscriptable type aliases subscripted by concrete types).\n> assert is_hint_pep695_subscripted(colossal_skeleton[int]) is True\nE AssertionError\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign\nLocation: /tmp/benchmark_eida8wim/beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py:151\nError: assert HintSign('Pep585BuiltinSubscriptedUnknown') is HintSign('HintSignPep695TypeAliasSubscripted')\n + where HintSign('Pep585BuiltinSubscriptedUnknown') = (AliasPep484604[str])\n + where AliasPep484604[str] = HintPepMetadata(\\n hint=AliasPep484604[str],\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasSubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=True,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=True,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=False,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=70.319,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith={'When on the threshold': 'of the green recess', \"The wanderer's footsteps fell,\": 'he knew that death'},\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=frozenset({'Nor ever more offer at thy dark shrine', 'The unheeded tribute of a broken heart.'}),\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=['Knowledge and truth and virtue were her theme,', 'And lofty hopes of divine liberty,'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith={'Thoughts the mo...ntPithUnsatisfiedMetadata(\\n pith=frozenset({b'That paused within his passive being now,', b'To images of the majestic past,'}),\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith=[b'Like winds that bear sweet music, when they breathe', b'Through some dim latticed chamber. He did place'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith={b'His pale lean hand upon the rugged trunk', b'Of the old pine. Upon an ivied stone'},\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith=4207856382,\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\bdict\\\\b', '\\\\bfloat\\\\b', '\\\\bfrozenset\\\\b', '\\\\blist\\\\b', '\\\\bset\\\\b', '\\\\btype hint\\\\b'),\\n exception_str_not_match_regexes=('\\\\n', '\\\\*'),\\n)),\\n typevars=(),\\n warning_type=None,\\n).hint\n + and HintSign('HintSignPep695TypeAliasSubscripted') = HintPepMetadata(\\n hint=AliasPep484604[str],\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasSubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=True,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=True,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=False,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=70.319,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith={'When on the threshold': 'of the green recess', \"The wanderer's footsteps fell,\": 'he knew that death'},\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=frozenset({'Nor ever more offer at thy dark shrine', 'The unheeded tribute of a broken heart.'}),\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=['Knowledge and truth and virtue were her theme,', 'And lofty hopes of divine liberty,'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith={'Thoughts the mo...ntPithUnsatisfiedMetadata(\\n pith=frozenset({b'That paused within his passive being now,', b'To images of the majestic past,'}),\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith=[b'Like winds that bear sweet music, when they breathe', b'Through some dim latticed chamber. He did place'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith={b'His pale lean hand upon the rugged trunk', b'Of the old pine. Upon an ivied stone'},\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith=4207856382,\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\bdict\\\\b', '\\\\bfloat\\\\b', '\\\\bfrozenset\\\\b', '\\\\blist\\\\b', '\\\\bset\\\\b', '\\\\btype hint\\\\b'),\\n exception_str_not_match_regexes=('\\\\n', '\\\\*'),\\n)),\\n typevars=(),\\n warning_type=None,\\n).pep_sign\n\nTraceback:\n\n> def test_get_hint_pep_sign(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.utilpepget.get_hint_pep_sign` getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepSignException\n from beartype._util.hint.pep.utilpepget import get_hint_pep_sign\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP, NonpepCustomFakeTyping)\n from pytest import raises\n \n # Assert this getter returns the expected unsubscripted \"typing\" attribute\n # for all PEP-compliant type hints associated with such an attribute.\n for hint_pep_meta in hints_pep_meta:\n> assert get_hint_pep_sign(hint_pep_meta.hint) is hint_pep_meta.pep_sign\nE assert HintSign('Pep585BuiltinSubscriptedUnknown') is HintSign('HintSignPep695TypeAliasSubscripted')\nE + where HintSign('Pep585BuiltinSubscriptedUnknown') = (AliasPep484604[str])\nE + where AliasPep484604[str] = HintPepMetadata(\\n hint=AliasPep484604[str],\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasSubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=True,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=True,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=False,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=70.319,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith={'When on the threshold': 'of the green recess', \"The wanderer's footsteps fell,\": 'he knew that death'},\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=frozenset({'Nor ever more offer at thy dark shrine', 'The unheeded tribute of a broken heart.'}),\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=['Knowledge and truth and virtue were her theme,', 'And lofty hopes of divine liberty,'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith={'Thoughts the mo...ntPithUnsatisfiedMetadata(\\n pith=frozenset({b'That paused within his passive being now,', b'To images of the majestic past,'}),\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith=[b'Like winds that bear sweet music, when they breathe', b'Through some dim latticed chamber. He did place'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith={b'His pale lean hand upon the rugged trunk', b'Of the old pine. Upon an ivied stone'},\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith=4207856382,\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\bdict\\\\b', '\\\\bfloat\\\\b', '\\\\bfrozenset\\\\b', '\\\\blist\\\\b', '\\\\bset\\\\b', '\\\\btype hint\\\\b'),\\n exception_str_not_match_regexes=('\\\\n', '\\\\*'),\\n)),\\n typevars=(),\\n warning_type=None,\\n).hint\nE + and HintSign('HintSignPep695TypeAliasSubscripted') = HintPepMetadata(\\n hint=AliasPep484604[str],\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasSubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=True,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=True,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=False,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=70.319,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith={'When on the threshold': 'of the green recess', \"The wanderer's footsteps fell,\": 'he knew that death'},\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=frozenset({'Nor ever more offer at thy dark shrine', 'The unheeded tribute of a broken heart.'}),\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=['Knowledge and truth and virtue were her theme,', 'And lofty hopes of divine liberty,'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith={'Thoughts the mo...ntPithUnsatisfiedMetadata(\\n pith=frozenset({b'That paused within his passive being now,', b'To images of the majestic past,'}),\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith=[b'Like winds that bear sweet music, when they breathe', b'Through some dim latticed chamber. He did place'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith={b'His pale lean hand upon the rugged trunk', b'Of the old pine. Upon an ivied stone'},\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n), HintPithUnsatisfiedMetadata(\\n pith=4207856382,\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\bdict\\\\b', '\\\\bfloat\\\\b', '\\\\bfrozenset\\\\b', '\\\\blist\\\\b', '\\\\bset\\\\b', '\\\\btype hint\\\\b'),\\n exception_str_not_match_regexes=('\\\\n', '\\\\*'),\\n)),\\n typevars=(),\\n warning_type=None,\\n).pep_sign\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #5: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #9: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py", "test_is_hint_pep695_subscripted" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py", "test_get_hint_pep_sign" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 43.72000000000003, "out_degree": 1, "betweenness": 0.0002438654296366947, "pagerank": 0.0009215500420958693, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.23604465709728895, "degree": 2 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep544.py", "function_name": "reduce_hint_pep484_generic_io_to_pep544_protocol", "test_info": { "success": false, "failed": 7, "passed": 1123, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol\nLocation: /usr/lib/python3.12/typing.py:1848\nError: TypeError: issubclass() arg 1 must be a class\n\nTraceback:\n\n> def test_reduce_hint_pep484_generic_io_to_pep544_protocol() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep544.reduce_hint_pep484_generic_io_to_pep544_protocol`\n reducer.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep544Exception\n from beartype.typing import Union\n from beartype._util.hint.pep.proposal.pep544 import (\n reduce_hint_pep484_generic_io_to_pep544_protocol)\n from beartype._util.hint.pep.proposal.pep593 import is_hint_pep593\n from beartype._data.cls.datacls import TYPES_PEP484_GENERIC_IO\n from pytest import raises\n from typing import Protocol\n \n # ....................{ PASS }....................\n # For each PEP 484-compliant \"typing\" IO generic base class...\n for pep484_generic_io in TYPES_PEP484_GENERIC_IO:\n # Equivalent protocol reduced from this generic.\n pep544_protocol_io = (\n reduce_hint_pep484_generic_io_to_pep544_protocol(\n pep484_generic_io, ''))\n \n # Assert this protocol is either...\n assert (\n # A PEP 593-compliant type metahint generalizing a protocol\n # *OR*...\n is_hint_pep593(pep544_protocol_io) or\n # A PEP 544-compliant protocol.\n> issubclass(pep544_protocol_io, Protocol)\n )\n\n> def __subclasscheck__(cls, other):\n if cls is Protocol:\n> return type.__subclasscheck__(cls, other)\nE TypeError: issubclass() arg 1 must be a class\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint\nLocation: /tmp/benchmark_4o0ns9xt/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:116\nError: AssertionError: assert (False or False)\n + where False = ()\n + and False = issubclass(, )\n\nTraceback:\n\n> def test_reduce_hint() -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintNonpepNumpyException\n from beartype.typing import (\n Annotated,\n )\n from beartype.vale import IsEqual\n from beartype._cave._cavefast import NoneType\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype._conf.confcls import BeartypeConf\n from beartype._conf.confcommon import BEARTYPE_CONF_DEFAULT\n from beartype._data.cls.datacls import TYPES_PEP484_GENERIC_IO\n from beartype._data.hint.datahinttyping import (\n Pep484TowerComplex,\n Pep484TowerFloat,\n )\n from beartype._data.hint.pep.sign.datapepsigns import HintSignAnnotated\n from beartype._util.hint.pep.proposal.pep593 import is_hint_pep593\n from beartype._util.hint.pep.utilpepget import get_hint_pep_sign\n # from beartype_test.a00_unit.data.hint.pep.proposal.data_pep484 import (\n # T_int,\n # T_str_or_bytes,\n # )\n from beartype_test._util.module.pytmodtest import is_package_numpy\n from dataclasses import InitVar\n from pytest import raises\n \n # Intentionally import PEP 484-specific type hint factories.\n from typing import Protocol\n \n # ..................{ LOCALS }..................\n # Keyword arguments to be passed to all calls to reduce_hints() below.\n kwargs = {\n 'conf': BEARTYPE_CONF_DEFAULT,\n }\n \n # ..................{ CORE }..................\n # Assert this reducer preserves an isinstanceable type as is.\n assert reduce_hint(hint=int, **kwargs) is int\n \n # Assert this reducer reduces \"None\" to \"type(None)\".\n assert reduce_hint(hint=None, **kwargs) is NoneType\n \n # ..................{ PEP 484 ~ tower }..................\n # Assert this reducer expands the builtin \"float\" and \"complex\" types to\n # their corresponding numeric towers when configured to do so.\n assert reduce_hint(\n hint=float,\n conf=BeartypeConf(is_pep484_tower=True),\n ) is Pep484TowerFloat\n assert reduce_hint(\n hint=complex,\n conf=BeartypeConf(is_pep484_tower=True),\n ) is Pep484TowerComplex\n \n # Assert this reducer preserves the builtin \"float\" and \"complex\" types as\n # is when configured to disable the implicit numeric tower.\n assert reduce_hint(\n hint=float,\n conf=BeartypeConf(is_pep484_tower=False),\n ) is float\n assert reduce_hint(\n hint=complex,\n conf=BeartypeConf(is_pep484_tower=False),\n ) is complex\n \n #FIXME: Excise us up, please. We no longer reduce type variables. *sigh*\n # # ..................{ PEP 484 ~ typevar }..................\n # # Assert this reducer preserves unbounded type variables as is.\n # assert reduce_hint(hint=T, **kwargs) is T\n #\n # # Assert this reducer reduces bounded type variables to their upper bound.\n # assert reduce_hint(hint=T_int, **kwargs) is int\n #\n # # Union of all constraints parametrizing a constrained type variable,\n # # reduced from that type variable.\n # typevar_constraints_union = reduce_hint(hint=T_str_or_bytes, **kwargs)\n #\n # # Assert this union contains all constraints parametrizing this variable.\n # assert str in typevar_constraints_union.__args__\n # assert bytes in typevar_constraints_union.__args__\n \n # ..................{ PEP 544 }..................\n # For each PEP 484-compliant \"typing\" IO generic superclass...\n for pep484_generic_io in TYPES_PEP484_GENERIC_IO:\n # Equivalent protocol reduced from this generic.\n pep544_protocol_io = reduce_hint(hint=pep484_generic_io, **kwargs)\n \n # Assert this protocol is either...\n> assert (\n # A PEP 593-compliant type metahint generalizing a protocol\n # *OR*...\n is_hint_pep593(pep544_protocol_io) or\n # A PEP 544-compliant protocol.\n issubclass(pep544_protocol_io, Protocol)\n )\nE AssertionError: assert (False or False)\nE + where False = ()\nE + and False = issubclass(, )\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #7: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py", "test_reduce_hint_pep484_generic_io_to_pep544_protocol" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint" ] ] }, "complexity_info": { "centrality": { "distance_discount": 13.775667200000004, "in_degree": 1, "true_in_degree": 2.6, "out_degree": 4, "betweenness": 3.522500650307812e-05, "pagerank": 0.0004696223316912973, "harmonic": 0.01868342731829574, "bidirectional_harmonic": 0.2007264254385972, "degree": 5 }, "line_count": 30, "code_line_count": 30, "cyclomatic": 5, "halstead_volume": 25.26619429851844, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/arg/utilfuncarglen.py", "function_name": "get_func_args_lens", "test_info": { "success": false, "failed": 174, "passed": 919, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a00_core/test_a00_package.py::test_api_deprecations\nLocation: /tmp/benchmark_nv39zjfh/beartype_test/a00_unit/a00_core/test_a00_package.py:78\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_api_deprecations() -> None:\n '''\n Test all deprecated attributes importable from the public APIs of all\n subpackages of the :mod:`beartype` package (including itself).\n '''\n \n # Defer test-specific imports.\n from beartype._util.module.utilmodimport import import_module_attr\n from pytest import warns\n \n # Tuple of the fully-qualified names of all deprecated attributes.\n DEPRECATED_ATTRIBUTES = (\n 'beartype.abby',\n 'beartype.cave.HintPep585Type',\n 'beartype.roar.BeartypeAbbyException',\n 'beartype.roar.BeartypeAbbyHintViolation',\n 'beartype.roar.BeartypeAbbyTesterException',\n 'beartype.roar.BeartypeCallHintPepException',\n 'beartype.roar.BeartypeCallHintPepParamException',\n 'beartype.roar.BeartypeCallHintPepReturnException',\n 'beartype.roar.BeartypeDecorHintNonPepException',\n 'beartype.roar.BeartypeDecorHintNonPepNumPyException',\n 'beartype.roar.BeartypeDecorHintPep563Exception',\n 'beartype.roar.BeartypeDecorHintPepDeprecatedWarning',\n 'beartype.roar.BeartypeDecorPepException',\n )\n \n # For each deprecated attribute declared by beartype...\n for deprecated_attribute in DEPRECATED_ATTRIBUTES:\n # Assert that importing this attribute both emits the expected warning\n # and returns a non-\"None\" value.\n> with warns(DeprecationWarning):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py::test_method_cached_arg_by_id\nLocation: /tmp/benchmark_nv39zjfh/beartype/_util/func/arg/utilfuncarglen.py:280\nError: TypeError: 'NoneType' object is not subscriptable\n\nTraceback:\n\n> def test_method_cached_arg_by_id() -> None:\n '''\n Test the\n :func:`beartype._util.cache.utilcachecall.method_cached_arg_by_id`\n decorator.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableCachedException\n from beartype._util.cache.utilcachecall import method_cached_arg_by_id\n from pytest import raises\n \n # ..................{ CLASSES }..................\n> class LikeDust(object):\n\n> @method_cached_arg_by_id\n\n> die_unless_func_args_len_flexible_equal(\n\n> func_args_len_flexible_actual = get_func_args_flexible_len(\n\n> def get_func_args_flexible_len(\n # Mandatory parameters.\n func: Codeobjable,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> int:\n '''\n Number of **flexible parameters** (i.e., parameters passable as either\n positional or keyword arguments but *not* positional-only, keyword-only,\n variadic, or other more constrained kinds of parameters) accepted by the\n passed pure-Python callable.\n \n This getter transparently handles all of the following:\n \n * Conventional pure-Python callables.\n * If ``is_unwrap`` is :data:`True`:\n \n * Pure-Python **partials** (i.e., pure-Python callable\n :class:`functools.partial` objects directly wrapping pure-Python\n callables). If a partial is passed, this getter transparently returns\n the total number of flexible parameters accepted by the lower-level\n callable wrapped by this partial minus the number of flexible parameters\n partialized away by this partial.\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n is_unwrap: bool, optional\n :data:`True` only if this getter implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function.\n Defaults to :data:`True` for safety. See :func:`.get_func_codeobj` for\n further commentary.\n exception_cls : type, optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the message of any exception raised in\n the event of a fatal error. Defaults to the empty string.\n \n Returns\n -------\n int\n Number of flexible parameters accepted by this callable.\n \n Raises\n ------\n exception_cls\n If that callable is *not* pure-Python.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.api.standard.utilfunctools import (\n get_func_functools_partial_args_flexible_len,\n is_func_functools_partial,\n )\n from beartype._util.func.utilfunctest import is_func_codeobjable\n \n # If the passed callable is pure-Python...\n if is_func_codeobjable(func):\n # Number of various kinds of parameters accepted by that callable.\n func_args_lens = get_func_args_lens(\n func=func,\n is_unwrap=is_unwrap,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # Number of all non-keyword-only parameters (i.e., both optional and\n # mandatory positional-only, positional, and keyword parameters)\n # accepted by that callable.\n> return func_args_lens[ARGS_LENS_INDEX_POSONLY_OR_FLEX]\nE TypeError: 'NoneType' object is not subscriptable\n", "Failure #3: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py::test_get_func_arg_name_first_or_none", "Failure #4: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py::test_get_func_arg_names", "Failure #5: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py::test_iter_func_args", "Failure #6: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py::test_get_func_args_len_flexible", "Failure #7: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_argless", "Failure #8: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_variadic", "Failure #9: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name", "Failure #10: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_positional", "Failure #11: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_keyword", "Failure #12: beartype_test/a00_unit/a20_util/func/test_utilfunccode.py::test_get_func_code_or_none", "Failure #13: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_wrapper_isomorphic", "Failure #14: beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py::test_unwrap_func_all_isomorphic", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py::test_get_hint_pep484585_ref_names_relative_to", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #24: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #25: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #26: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #27: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype", "Failure #28: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #29: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #30: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #31: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #32: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #33: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #34: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #35: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #36: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #37: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #38: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #39: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #40: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #41: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #42: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #43: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #44: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #45: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #46: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_beartypeable_kind", "Failure #47: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_callable", "Failure #48: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new", "Failure #49: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #50: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr", "Failure #51: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #52: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #53: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_contains", "Failure #54: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_iter", "Failure #55: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #56: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #57: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #58: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #59: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #60: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #61: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #62: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #63: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_recursion", "Failure #64: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_numpy", "Failure #65: beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py::test_api_vale_validator_pass", "Failure #66: beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py::test_api_vale_validator_fail", "Failure #67: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #68: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_fail", "Failure #69: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #70: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass", "Failure #71: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_pass", "Failure #72: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_fail", "Failure #73: beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py::test_api_vale_isequal_pass", "Failure #74: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #75: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #76: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #77: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #78: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #79: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #80: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #81: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #82: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #83: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #84: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #85: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #86: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #89: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #90: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #91: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #92: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #93: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #94: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #95: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #96: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #97: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #98: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #99: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #100: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #101: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #102: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #103: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #104: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #105: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #106: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #107: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #108: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #109: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #110: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #111: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #112: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep435", "Failure #113: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep663", "Failure #114: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #115: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #116: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #117: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #118: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #119: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #120: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #121: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #122: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #123: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #124: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #125: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #126: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #127: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #128: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #129: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #130: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #131: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #132: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #133: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #134: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #135: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #136: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #137: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #138: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #139: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #140: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #141: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #142: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #143: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #144: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #145: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #146: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #147: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #148: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #149: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #150: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #151: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #152: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #153: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #154: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #155: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #156: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #157: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #158: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #159: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #160: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #161: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #162: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #163: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #164: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #165: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #166: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #167: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #168: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #169: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #170: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #171: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #172: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #173: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #174: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a00_core/test_a00_package.py", "test_api_deprecations" ], [ "beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py", "test_method_cached_arg_by_id" ] ] }, "complexity_info": { "centrality": { "distance_discount": 8.793600000000003, "in_degree": 7, "true_in_degree": 27.000000000000014, "out_degree": 2, "betweenness": 0.0006326953091129802, "pagerank": 0.0029422274490236234, "harmonic": 0.011650219298245614, "bidirectional_harmonic": 0.2198270296954514, "degree": 9 }, "line_count": 30, "code_line_count": 30, "cyclomatic": 4, "halstead_volume": 12.0, "halstead_difficulty": 0.6666666666666666 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/utilpepget.py", "function_name": "get_hint_pep_origin_type_isinstanceable_or_none", "test_info": { "success": false, "failed": 33, "passed": 1097, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable\nLocation: /tmp/benchmark_w0vdnhio/beartype/_util/hint/pep/utilpepget.py:1163\nError: beartype.roar.BeartypeDecorHintPepException: Type hint typing.Hashable not isinstanceable (i.e., does not originate from isinstanceable class).\n\nTraceback:\n\n> def test_get_hint_pep_type_isinstanceable(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.utilpepget.get_hint_pep_origin_type_isinstanceable`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._util.hint.pep.utilpepget import (\n get_hint_pep_origin_type_isinstanceable)\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # Assert this getter...\n for hint_pep_meta in hints_pep_meta:\n # Returns the expected type origin for all PEP-compliant type hints\n # originating from an origin type.\n if hint_pep_meta.isinstanceable_type is not None:\n> assert get_hint_pep_origin_type_isinstanceable(hint_pep_meta.hint) is (\n hint_pep_meta.isinstanceable_type)\n\n> def get_hint_pep_origin_type_isinstanceable(hint: Hint) -> type:\n '''\n **Isinstanceable origin type** (i.e., class passable as the second argument\n to the :func:`isinstance` builtin such that *all* objects satisfying the\n passed PEP-compliant type hint are instances of this class) originating\n this hint if this hint originates from such a type *or* raise an exception\n otherwise (i.e., if this hint does *not* originate from such a type).\n \n This getter is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as the implementation trivially reduces\n to an efficient one-liner.\n \n Parameters\n ----------\n hint : Hint\n Type hint to be inspected.\n \n Returns\n -------\n type\n Standard origin type originating this hint.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If this hint does *not* originate from a standard origin type.\n \n See Also\n --------\n :func:`get_hint_pep_origin_type_isinstanceable_or_none`\n Related getter.\n '''\n \n # Origin type originating this object if any *OR* \"None\" otherwise.\n hint_origin_type = get_hint_pep_origin_type_isinstanceable_or_none(hint)\n \n # If this type does *NOT* exist, raise an exception.\n if hint_origin_type is None:\n> raise BeartypeDecorHintPepException(\n f'Type hint {repr(hint)} not isinstanceable (i.e., does not '\n f'originate from isinstanceable class).'\n )\nE beartype.roar.BeartypeDecorHintPepException: Type hint typing.Hashable not isinstanceable (i.e., does not originate from isinstanceable class).\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none\nLocation: /tmp/benchmark_w0vdnhio/beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py:226\nError: assert None is \n + where None = (typing.Hashable)\n + where typing.Hashable = HintPepMetadata(\\n hint=typing.Hashable,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('Hashable'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=,\\n is_args=False,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=True,\\n is_typing=True,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=\"Oh, importunate \u0398 Fortuna'd afforded\",\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=('Us vis\u2010a\u2010vis conduit fjords', 'Of weal\u2010th, and well\u2010heeled,'),\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithUnsatisfiedMetadata(\\n pith=['Oboes\u2010obsoleting tines', 'Of language'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n)),\\n typevars=(),\\n warning_type=,\\n).hint\n + and = HintPepMetadata(\\n hint=typing.Hashable,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('Hashable'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=,\\n is_args=False,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=True,\\n is_typing=True,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=\"Oh, importunate \u0398 Fortuna'd afforded\",\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=('Us vis\u2010a\u2010vis conduit fjords', 'Of weal\u2010th, and well\u2010heeled,'),\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithUnsatisfiedMetadata(\\n pith=['Oboes\u2010obsoleting tines', 'Of language'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n)),\\n typevars=(),\\n warning_type=,\\n).isinstanceable_type\n\nTraceback:\n\n> def test_get_hint_pep_type_isinstanceable_or_none(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.utilpepget.get_hint_pep_origin_type_isinstanceable_or_none`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype._util.hint.pep.utilpepget import (\n get_hint_pep_origin_type_isinstanceable_or_none)\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n \n # Assert this getter returns the expected type origin for all PEP-compliant\n # type hints.\n for hint_pep_meta in hints_pep_meta:\n> assert get_hint_pep_origin_type_isinstanceable_or_none(\n hint_pep_meta.hint) is hint_pep_meta.isinstanceable_type\nE assert None is \nE + where None = (typing.Hashable)\nE + where typing.Hashable = HintPepMetadata(\\n hint=typing.Hashable,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('Hashable'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=,\\n is_args=False,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=True,\\n is_typing=True,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=\"Oh, importunate \u0398 Fortuna'd afforded\",\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=('Us vis\u2010a\u2010vis conduit fjords', 'Of weal\u2010th, and well\u2010heeled,'),\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithUnsatisfiedMetadata(\\n pith=['Oboes\u2010obsoleting tines', 'Of language'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n)),\\n typevars=(),\\n warning_type=,\\n).hint\nE + and = HintPepMetadata(\\n hint=typing.Hashable,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('Hashable'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=,\\n is_args=False,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=True,\\n is_typing=True,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=\"Oh, importunate \u0398 Fortuna'd afforded\",\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith=('Us vis\u2010a\u2010vis conduit fjords', 'Of weal\u2010th, and well\u2010heeled,'),\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithUnsatisfiedMetadata(\\n pith=['Oboes\u2010obsoleting tines', 'Of language'],\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n)),\\n typevars=(),\\n warning_type=,\\n).isinstanceable_type\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #9: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #10: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #11: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #26: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #27: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #28: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #29: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #30: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #31: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #32: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #33: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py", "test_get_hint_pep_type_isinstanceable" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py", "test_get_hint_pep_type_isinstanceable_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 12.930560000000007, "in_degree": 3, "true_in_degree": 9.72, "out_degree": 2, "betweenness": 5.825674152432151e-05, "pagerank": 0.000703222251821634, "harmonic": 0.016557017543859645, "bidirectional_harmonic": 0.25208671536796556, "degree": 5 }, "line_count": 10, "code_line_count": 10, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/error/_pep/errpep484604.py", "function_name": "find_cause_pep484604_union", "test_info": { "success": false, "failed": 20, "passed": 1110, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_953xeeht/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_953xeeht/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #14: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #15: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 27.512064000000027, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 9, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.037225877192982454, "bidirectional_harmonic": 0.26352546850079756, "degree": 9 }, "line_count": 68, "code_line_count": 68, "cyclomatic": 16, "halstead_volume": 126.65973476959637, "halstead_difficulty": 3.9375 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/forward/reference/fwdrefmake.py", "function_name": "_make_forwardref_subtype", "test_info": { "success": false, "failed": 26, "passed": 1104, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py::test_iter_hint_pep695_forwardrefs\nLocation: /tmp/benchmark_fp18v3w0/beartype_test/a00_unit/data/pep/pep695/data_pep695util.py:188\nError: AssertionError\n\nTraceback:\n\n> def test_iter_hint_pep695_forwardrefs() -> None:\n '''\n Test the private\n :mod:`beartype._util.hint.pep.proposal.pep695.iter_hint_pep695_unsubscripted_forwardrefs`\n iterator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep695Exception\n from beartype._util.hint.pep.proposal.pep695 import (\n iter_hint_pep695_unsubscripted_forwardrefs)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_12\n from pytest import raises\n \n # If the active Python interpreter targets Python >= 3.12 and thus supports\n # PEP 695...\n if IS_PYTHON_AT_LEAST_3_12:\n # Defer version-specific imports.\n from beartype_test.a00_unit.data.pep.pep695.data_pep695util import (\n unit_test_iter_hint_pep695_forwardrefs)\n \n # Perform this test.\n> unit_test_iter_hint_pep695_forwardrefs()\n\n> def unit_test_iter_hint_pep695_forwardrefs() -> None:\n '''\n Test the private\n :mod:`beartype._util.hint.pep.proposal.pep695.iter_hint_pep695_unsubscripted_forwardrefs`\n iterator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep695Exception\n from beartype._check.forward.reference.fwdrefmeta import (\n BeartypeForwardRefMeta)\n from beartype._util.hint.pep.proposal.pep695 import (\n iter_hint_pep695_unsubscripted_forwardrefs)\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Type alias containing *NO* unquoted forward references.\n type of_intermitted_song = str | int\n \n # Type alias containing one unquoted forward reference.\n type sudden_she_rose = ItsBurstingBurthen | bool\n \n # Type alias containing two or more unquoted forward reference.\n type as_if_her_heart = ImpatientlyEndured | complex | AtTheSoundHeTurned\n \n # ....................{ ASSERTS ~ null }....................\n # Assert that this iterator yields nothing when passed a type alias\n # containing *NO* unquoted forward references.\n their_own_life = list(iter_hint_pep695_unsubscripted_forwardrefs(of_intermitted_song))\n assert not their_own_life\n \n # ....................{ ASSERTS ~ single }....................\n # Assert that this iterator yields a single forward reference proxy\n # referring to the single unquoted forward reference embedded in a\n # passed type alias containing only that reference.\n and_saw_by = iter_hint_pep695_unsubscripted_forwardrefs(sudden_she_rose)\n the_warm_light_of = next(and_saw_by)\n> assert isinstance(the_warm_light_of, BeartypeForwardRefMeta)\nE AssertionError\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_add_func_scope_types\nLocation: /tmp/benchmark_fp18v3w0/beartype_test/a00_unit/data/check/forward/data_fwdref.py:102\nError: AttributeError: 'NoneType' object has no attribute 'Class'\n\nTraceback:\n\n> def test_add_func_scope_types() -> None:\n '''\n Test the\n :func:`beartype._check.code.codescope.add_func_scope_types` adder.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import (\n BeartypeDecorHintNonpepException,\n BeartypeDecorHintPep3119Exception,\n )\n from beartype._cave._cavefast import CallableTypes, ModuleOrStrTypes\n from beartype._cave._cavemap import NoneTypeOr\n from beartype._check.code.codescope import add_func_scope_types\n from beartype._util.utilobject import get_object_type_basename\n> from beartype_test.a00_unit.data.check.forward.data_fwdref import (\n FORWARDREF_ABSOLUTE,\n FORWARDREF_RELATIVE,\n )\n\n> #!/usr/bin/env python3\n # --------------------( LICENSE )--------------------\n # Copyright (c) 2014-2025 Beartype authors.\n # See \"LICENSE\" for further details.\n \n '''\n Project-wide **forward reference proxy data** submodule.\n \n This submodule predefines **forward reference proxies** (i.e., low-level objects\n created by the :func:`beartype._check.forward.reference.fwdrefmake` submodule)\n exercising known edge cases on behalf of higher-level unit test submodules.\n '''\n \n # ....................{ IMPORTS }....................\n from beartype._check.forward.reference.fwdrefmake import (\n make_forwardref_indexable_subtype)\n \n # ....................{ CONSTANTS }....................\n PACKAGE_NAME = 'beartype_test.a00_unit.data'\n '''\n Fully-qualified name of a subpackage defining an arbitrary submodule.\n '''\n \n \n MODULE_BASENAME = 'data_type'\n '''\n Unqualified basename of a submodule in that subpackage defining an arbitrary\n class.\n '''\n \n \n MODULE_NAME = f'{PACKAGE_NAME}.{MODULE_BASENAME}'\n '''\n Fully-qualified name of the same submodule.\n '''\n \n \n CLASS_BASENAME = 'Class'\n '''\n Unqualified basename of that class in that module.\n '''\n \n \n CLASS_NAME = f'{MODULE_NAME}.{CLASS_BASENAME}'\n '''\n Fully-qualified name of that class.\n '''\n \n \n SCOPE_NAME = '__name__'\n '''\n Fully-qualified name of the current test module.\n '''\n \n # ....................{ FORWARDREFS ~ invalid }....................\n FORWARDREF_RELATIVE_CIRCULAR = make_forwardref_indexable_subtype(\n # Fully-qualified name of the current test module.\n SCOPE_NAME,\n # Unqualified basename of this global currently being declared.\n 'FORWARDREF_RELATIVE_CIRCULAR',\n )\n '''\n **Circular forward reference proxy** (i.e., invalid proxy circularly and thus\n recursively referring to the same forward reference proxy).\n \n Since the only means of declaring a circular forward reference proxy is as a\n global attribute, the declaration of this proxy is necessarily isolated to its\n own data submodule.\n '''\n \n # ....................{ FORWARDREFS ~ valid }....................\n FORWARDREF_ABSOLUTE = make_forwardref_indexable_subtype(\n # Intentionally ignored fully-qualified name of this test submodule.\n SCOPE_NAME,\n CLASS_NAME,\n )\n '''\n Forward reference proxy to an unsubscripted class referenced with an absolute\n (i.e., fully-qualified) name.\n '''\n \n \n FORWARDREF_RELATIVE = make_forwardref_indexable_subtype(\n MODULE_NAME, CLASS_BASENAME)\n '''\n Forward reference proxy to an unsubscripted class referenced with a\n relative (i.e., unqualified) name.\n '''\n \n \n FORWARDREF_MODULE_ABSOLUTE = make_forwardref_indexable_subtype(\n # Intentionally ignored fully-qualified name of this test submodule.\n SCOPE_NAME,\n MODULE_NAME,\n )\n '''\n Forward reference proxy to a submodule of a subpackage referenced with an\n absolute (i.e., fully-qualified) name.\n '''\n \n \n> FORWARDREF_MODULE_CLASS = FORWARDREF_MODULE_ABSOLUTE.Class\nE AttributeError: 'NoneType' object has no attribute 'Class'\n", "Failure #3: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_express_func_scope_type_ref", "Failure #4: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py::test_make_forwardref_indexable_subtype", "Failure #5: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdreftest.py::test_is_forwardref", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #22: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #23: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #24: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #25: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #26: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py", "test_iter_hint_pep695_forwardrefs" ], [ "beartype_test/a00_unit/a60_check/a20_code/test_codescope.py", "test_add_func_scope_types" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.24, "in_degree": 2, "true_in_degree": 8.56, "out_degree": 2, "betweenness": 0.0001246423307031995, "pagerank": 0.001108020156316102, "harmonic": 0.004111842105263158, "bidirectional_harmonic": 0.1860844108377012, "degree": 4 }, "line_count": 35, "code_line_count": 35, "cyclomatic": 6, "halstead_volume": 24.0, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/_pep/pep484/redpep484typevar.py", "function_name": "reduce_hint_pep484_typevar", "test_info": { "success": false, "failed": 9, "passed": 1121, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable\nLocation: /tmp/benchmark_gz7hhvmo/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:200\nError: AssertionError: assert True == False\n + where True = HintPepMetadata(\\n hint=~T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('TypeVar'),\\n typehint_cls=,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith='Oblate weapon Stacks (actually',\\n is_context_manager=False,\\n is_pith_factory=False,\\n)),\\n typevars=(),\\n warning_type=None,\\n).is_ignorable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_reduce_hint_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer with\n respect to ignorable hints.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # Defer test-specific imports.\n from beartype.typing import Any\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP_UNIGNORABLE)\n \n # Assert this tester accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n assert reduce_hint(hint_ignorable) is Any\n \n # Assert this tester rejects unignorable PEP-noncompliant type hints.\n for hint_unignorable in HINTS_NONPEP_UNIGNORABLE:\n assert reduce_hint(hint_unignorable) is not Any\n \n # Assert this tester:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # True only if this hint reduces to the ignorable \"Any\" singleton.\n is_hint_ignorable = reduce_hint(hint_pep_meta.hint) is Any\n \n # Assert this hint is either ignorable or unignorable as expected.\n> assert hint_pep_meta.is_ignorable == is_hint_ignorable\nE AssertionError: assert True == False\nE + where True = HintPepMetadata(\\n hint=~T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('TypeVar'),\\n typehint_cls=,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=False,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithSatisfiedMetadata(\\n pith='Oblate weapon Stacks (actually',\\n is_context_manager=False,\\n is_pith_factory=False,\\n)),\\n typevars=(),\\n warning_type=None,\\n).is_ignorable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: <@beartype(__beartype_checker_338) at 0x13bf93b0>:27\nError: beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value violates type hint ~T, as type not instance of .\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> > ???\nE beartype.roar.BeartypeDoorHintViolation: Die_if_unbearable() value violates type hint ~T, as type not instance of .\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #9: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint_ignorable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.5200000000000005, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.005756578947368421, "bidirectional_harmonic": 0.1812343951735407, "degree": 2 }, "line_count": 26, "code_line_count": 26, "cyclomatic": 8, "halstead_volume": 39.863137138648355, "halstead_difficulty": 1.7142857142857142 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_decor/_decornontype.py", "function_name": "beartype_func", "test_info": { "success": false, "failed": 89, "passed": 1041, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark__rj_33zc/beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py:50\nError: assert False is True\n + where False = (None)\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n @beartype\n def where_that_or() -> str:\n '''\n Arbitrary callable decorated by the :func:`beartype.beartype` decorator\n intentionally annotated by one or more arbitrary unignorable type hints\n to prevent that decorator from silently reducing to a noop.\n '''\n \n return 'In the still cave of the witch Poesy,'\n \n def thou_art_no_unbidden_guest() -> str:\n '''\n Arbitrary callable *not* decorated by the :func:`beartype.beartype`\n decorator intentionally annotated by one or more arbitrary unignorable\n type hints for parity with the prior callable.\n '''\n \n return 'Seeking among the shadows that pass by'\n \n # Assert this tester returns the expected results for these callables.\n> assert is_func_beartyped(where_that_or) is True\nE assert False is True\nE + where False = (None)\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark__rj_33zc/beartype/_util/func/arg/utilfuncarglen.py:365\nError: beartype.roar.BeartypeValeSubscriptionException: None uncallable.\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n @beartype\n def _is_exclamatory(text: str):\n return '!' in text\n \n # Dynamically generated lambda function. To exercise in-memory validators\n # dynamically defined outside of a standard on-disk module (e.g., \"smart\"\n # REPLs like IPython), this function's code is intentionally cached with\n # the standard \"linecache\" module.\n _is_commentary = make_func(\n func_name='_is_commentary',\n func_code=(\n \"\"\"_is_commentary = lambda text: text and text[-1] == ','\"\"\"),\n is_debug=True,\n )\n \n # ....................{ VALIDATORS }....................\n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined physically in this on-disk module.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined dynamically in-memory.\n IsCommentary = Is[_is_commentary]\n \n # Validator produced by subscripting this factory with non-lambda functions\n # satisfying the expected API.\n IsQuoted = Is[_is_quoted]\n> IsExclamatory = Is[_is_exclamatory]\n\n> die_unless_validator_tester(is_valid)\n\n> die_unless_func_args_len_flexible_equal(\n\n> func_args_len_flexible_actual = get_func_args_flexible_len(\n\n> def get_func_args_flexible_len(\n # Mandatory parameters.\n func: Codeobjable,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> int:\n '''\n Number of **flexible parameters** (i.e., parameters passable as either\n positional or keyword arguments but *not* positional-only, keyword-only,\n variadic, or other more constrained kinds of parameters) accepted by the\n passed pure-Python callable.\n \n This getter transparently handles all of the following:\n \n * Conventional pure-Python callables.\n * If ``is_unwrap`` is :data:`True`:\n \n * Pure-Python **partials** (i.e., pure-Python callable\n :class:`functools.partial` objects directly wrapping pure-Python\n callables). If a partial is passed, this getter transparently returns\n the total number of flexible parameters accepted by the lower-level\n callable wrapped by this partial minus the number of flexible parameters\n partialized away by this partial.\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n is_unwrap: bool, optional\n :data:`True` only if this getter implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function.\n Defaults to :data:`True` for safety. See :func:`.get_func_codeobj` for\n further commentary.\n exception_cls : type, optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the message of any exception raised in\n the event of a fatal error. Defaults to the empty string.\n \n Returns\n -------\n int\n Number of flexible parameters accepted by this callable.\n \n Raises\n ------\n exception_cls\n If that callable is *not* pure-Python.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.api.standard.utilfunctools import (\n get_func_functools_partial_args_flexible_len,\n is_func_functools_partial,\n )\n from beartype._util.func.utilfunctest import is_func_codeobjable\n \n # If the passed callable is pure-Python...\n if is_func_codeobjable(func):\n # Number of various kinds of parameters accepted by that callable.\n func_args_lens = get_func_args_lens(\n func=func,\n is_unwrap=is_unwrap,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # Number of all non-keyword-only parameters (i.e., both optional and\n # mandatory positional-only, positional, and keyword parameters)\n # accepted by that callable.\n return func_args_lens[ARGS_LENS_INDEX_POSONLY_OR_FLEX]\n # Else, that callable has *NO* code object.\n #\n # If that callable is *NOT* actually callable, raise an exception.\n elif not callable(func):\n> raise exception_cls(f'{exception_prefix}{repr(func)} uncallable.')\nE beartype.roar.BeartypeValeSubscriptionException: None uncallable.\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_no_type_check", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #80: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #81: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #82: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #83: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #84: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #85: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #86: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #87: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #88: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #89: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 17.83040000000001, "in_degree": 7, "true_in_degree": 9.08, "out_degree": 6, "betweenness": 0.00044031258128847655, "pagerank": 0.0010764432441406273, "harmonic": 0.025493421052631582, "bidirectional_harmonic": 0.2263935762702216, "degree": 13 }, "line_count": 34, "code_line_count": 34, "cyclomatic": 8, "halstead_volume": 22.458839376460833, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/vale/_is/_valeisoper.py", "function_name": "_IsEqualFactory.__getitem__", "test_info": { "success": false, "failed": 41, "passed": 1052, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_eyfybalu/beartype/vale/_is/_valeisobj.py:295\nError: AttributeError: 'NoneType' object has no attribute '_is_valid_code_locals'\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> IsAttrThisMobbedTristeOf = IsAttr[\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def __getitem__( # type: ignore[override]\n self, args: Tuple[str, BeartypeValidator]) -> BeartypeValidator:\n '''\n Create and return a new beartype validator validating object attributes\n with the passed name satisfying the passed validator, suitable for\n subscripting :pep:`593`-compliant :attr:`typing.Annotated` type hints.\n \n This method is memoized for efficiency.\n \n Parameters\n ----------\n args : Tuple[str, BeartypeValidator]\n 2-tuple ``(attr_name, attr_validator)``, where:\n \n * ``attr_name`` is the arbitrary attribute name to validate that\n parameters and returns define satisfying the passed validator.\n * ``attr_validator`` is the attribute validator to validate that\n attributes with the passed name of parameters and returns\n satisfy.\n \n Returns\n -------\n BeartypeValidator\n Beartype validator encapsulating this validation.\n \n Raises\n ------\n BeartypeValeSubscriptionException\n If this factory was subscripted by either:\n \n * *No* arguments.\n * One argument.\n * Three or more arguments.\n \n See Also\n ----------\n :class:`._IsAttrFactory`\n Usage instructions.\n '''\n \n # If this class was subscripted by one non-tuple argument, raise an\n # exception.\n if not isinstance(args, tuple):\n raise BeartypeValeSubscriptionException(\n f'{self._getitem_exception_prefix}non-tuple argument '\n f'{represent_object(args)}.'\n )\n # Else, this class was subscripted by either no *OR* two or more\n # arguments (contained in this tuple).\n #\n # If this class was *NOT* subscripted by two arguments...\n elif len(args) != 2:\n # If this class was subscripted by one or more arguments, then by\n # deduction this class was subscripted by three or more arguments.\n # In this case, raise a human-readable exception.\n if args:\n raise BeartypeValeSubscriptionException(\n f'{self._getitem_exception_prefix}three or more arguments '\n f'{represent_object(args)}.'\n )\n # Else, this class was subscripted by *NO* arguments. In this case,\n # raise a human-readable exception.\n else:\n raise BeartypeValeSubscriptionException(\n f'{self._getitem_exception_prefix}empty tuple.')\n # Else, this class was subscripted by exactly two arguments.\n \n # Localize these arguments to human-readable local variables.\n attr_name, attr_validator = args\n \n # Representer (i.e., callable accepting *NO* arguments returning a\n # machine-readable representation of this validator), defined *AFTER*\n # localizing these validator arguments.\n get_repr = lambda: (\n f'beartype.vale.{self._basename}['\n f'{repr(attr_name)}, {repr(attr_validator)}'\n f']'\n )\n \n # If this name is *NOT* a string, raise an exception.\n if not isinstance(attr_name, str):\n raise BeartypeValeSubscriptionException(\n f'{get_repr()} first argument '\n f'{represent_object(attr_name)} not string.'\n )\n # Else, this name is a string.\n #\n # If this name is the empty string, raise an exception.\n elif not attr_name:\n raise BeartypeValeSubscriptionException(\n f'{get_repr()} first argument is empty string.')\n # Else, this name is a non-empty string.\n #\n # Note that this name has *NOT* yet been validated to be valid Python\n # identifier. While we could do so here by calling our existing\n # is_identifier() tester, doing so would inefficiently repeat\n # the split on \".\" characters performed below. Instead, we iteratively\n # validate each split substring to be a valid Python identifier below.\n \n # Callable inefficiently validating object attributes with this name\n # against this validator.\n # is_valid: BeartypeValidatorTester = None # type: ignore[assignment]\n \n # Code snippet efficiently validating object attributes with this name\n # against this validator.\n is_valid_code = ''\n \n # Dictionary mapping from the name to value of each local attribute\n # referenced in the \"is_valid_code\" snippet defined below.\n is_valid_code_locals: LexicalScope = {}\n \n # If this attribute name is unqualified (i.e., contains no \".\"\n # delimiters), prefer an efficient optimization avoiding iteration.\n if '.' not in attr_name:\n # If this name is *NOT* a valid Python identifier, raise an\n # exception.\n if not attr_name.isidentifier():\n raise BeartypeValeSubscriptionException(\n f'{get_repr()} first argument {repr(attr_name)} not '\n f'syntactically valid Python identifier.'\n )\n # Else, this name is a valid Python identifier.\n \n def is_valid(pith: Any) -> bool:\n f'''\n :data:`True` only if the passed object defines an attribute\n named \"{attr_name}\" whose value satisfies the validator\n {repr(attr_validator)}.\n '''\n \n # Attribute of this object with this name if this object\n # defines such an attribute *OR* a sentinel placeholder\n # otherwise (i.e., if this object defines *NO* such attribute).\n pith_attr = getattr(pith, attr_name, SENTINEL)\n \n # Return true only if...\n return (\n # This object defines an attribute with this name *AND*...\n pith_attr is not SENTINEL and\n # This attribute satisfies this validator.\n attr_validator.is_valid(pith_attr)\n )\n \n # Names of new parameters added to the signature of wrapper\n # functions enabling this validator to be tested in those functions\n # *WITHOUT* additional stack frames whose values are:\n # * The sentinel placeholder.\n #\n # Add these parameters *BEFORE* generating locals.\n local_name_sentinel = add_func_scope_attr(\n attr=SENTINEL, func_scope=is_valid_code_locals)\n \n # Generate locals safely merging the locals required by both the\n # code generated below *AND* the externally provided code\n # validating this attribute.\n update_mapping(\n mapping_trg=is_valid_code_locals,\n> mapping_src=attr_validator._is_valid_code_locals,\n )\nE AttributeError: 'NoneType' object has no attribute '_is_valid_code_locals'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none\nLocation: /tmp/benchmark_eyfybalu/beartype/vale/_is/_valeisobj.py:295\nError: AttributeError: 'NoneType' object has no attribute '_is_valid_code_locals'\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> IsAttrThisMobbedTristeOf = IsAttr[\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def __getitem__( # type: ignore[override]\n self, args: Tuple[str, BeartypeValidator]) -> BeartypeValidator:\n '''\n Create and return a new beartype validator validating object attributes\n with the passed name satisfying the passed validator, suitable for\n subscripting :pep:`593`-compliant :attr:`typing.Annotated` type hints.\n \n This method is memoized for efficiency.\n \n Parameters\n ----------\n args : Tuple[str, BeartypeValidator]\n 2-tuple ``(attr_name, attr_validator)``, where:\n \n * ``attr_name`` is the arbitrary attribute name to validate that\n parameters and returns define satisfying the passed validator.\n * ``attr_validator`` is the attribute validator to validate that\n attributes with the passed name of parameters and returns\n satisfy.\n \n Returns\n -------\n BeartypeValidator\n Beartype validator encapsulating this validation.\n \n Raises\n ------\n BeartypeValeSubscriptionException\n If this factory was subscripted by either:\n \n * *No* arguments.\n * One argument.\n * Three or more arguments.\n \n See Also\n ----------\n :class:`._IsAttrFactory`\n Usage instructions.\n '''\n \n # If this class was subscripted by one non-tuple argument, raise an\n # exception.\n if not isinstance(args, tuple):\n raise BeartypeValeSubscriptionException(\n f'{self._getitem_exception_prefix}non-tuple argument '\n f'{represent_object(args)}.'\n )\n # Else, this class was subscripted by either no *OR* two or more\n # arguments (contained in this tuple).\n #\n # If this class was *NOT* subscripted by two arguments...\n elif len(args) != 2:\n # If this class was subscripted by one or more arguments, then by\n # deduction this class was subscripted by three or more arguments.\n # In this case, raise a human-readable exception.\n if args:\n raise BeartypeValeSubscriptionException(\n f'{self._getitem_exception_prefix}three or more arguments '\n f'{represent_object(args)}.'\n )\n # Else, this class was subscripted by *NO* arguments. In this case,\n # raise a human-readable exception.\n else:\n raise BeartypeValeSubscriptionException(\n f'{self._getitem_exception_prefix}empty tuple.')\n # Else, this class was subscripted by exactly two arguments.\n \n # Localize these arguments to human-readable local variables.\n attr_name, attr_validator = args\n \n # Representer (i.e., callable accepting *NO* arguments returning a\n # machine-readable representation of this validator), defined *AFTER*\n # localizing these validator arguments.\n get_repr = lambda: (\n f'beartype.vale.{self._basename}['\n f'{repr(attr_name)}, {repr(attr_validator)}'\n f']'\n )\n \n # If this name is *NOT* a string, raise an exception.\n if not isinstance(attr_name, str):\n raise BeartypeValeSubscriptionException(\n f'{get_repr()} first argument '\n f'{represent_object(attr_name)} not string.'\n )\n # Else, this name is a string.\n #\n # If this name is the empty string, raise an exception.\n elif not attr_name:\n raise BeartypeValeSubscriptionException(\n f'{get_repr()} first argument is empty string.')\n # Else, this name is a non-empty string.\n #\n # Note that this name has *NOT* yet been validated to be valid Python\n # identifier. While we could do so here by calling our existing\n # is_identifier() tester, doing so would inefficiently repeat\n # the split on \".\" characters performed below. Instead, we iteratively\n # validate each split substring to be a valid Python identifier below.\n \n # Callable inefficiently validating object attributes with this name\n # against this validator.\n # is_valid: BeartypeValidatorTester = None # type: ignore[assignment]\n \n # Code snippet efficiently validating object attributes with this name\n # against this validator.\n is_valid_code = ''\n \n # Dictionary mapping from the name to value of each local attribute\n # referenced in the \"is_valid_code\" snippet defined below.\n is_valid_code_locals: LexicalScope = {}\n \n # If this attribute name is unqualified (i.e., contains no \".\"\n # delimiters), prefer an efficient optimization avoiding iteration.\n if '.' not in attr_name:\n # If this name is *NOT* a valid Python identifier, raise an\n # exception.\n if not attr_name.isidentifier():\n raise BeartypeValeSubscriptionException(\n f'{get_repr()} first argument {repr(attr_name)} not '\n f'syntactically valid Python identifier.'\n )\n # Else, this name is a valid Python identifier.\n \n def is_valid(pith: Any) -> bool:\n f'''\n :data:`True` only if the passed object defines an attribute\n named \"{attr_name}\" whose value satisfies the validator\n {repr(attr_validator)}.\n '''\n \n # Attribute of this object with this name if this object\n # defines such an attribute *OR* a sentinel placeholder\n # otherwise (i.e., if this object defines *NO* such attribute).\n pith_attr = getattr(pith, attr_name, SENTINEL)\n \n # Return true only if...\n return (\n # This object defines an attribute with this name *AND*...\n pith_attr is not SENTINEL and\n # This attribute satisfies this validator.\n attr_validator.is_valid(pith_attr)\n )\n \n # Names of new parameters added to the signature of wrapper\n # functions enabling this validator to be tested in those functions\n # *WITHOUT* additional stack frames whose values are:\n # * The sentinel placeholder.\n #\n # Add these parameters *BEFORE* generating locals.\n local_name_sentinel = add_func_scope_attr(\n attr=SENTINEL, func_scope=is_valid_code_locals)\n \n # Generate locals safely merging the locals required by both the\n # code generated below *AND* the externally provided code\n # validating this attribute.\n update_mapping(\n mapping_trg=is_valid_code_locals,\n> mapping_src=attr_validator._is_valid_code_locals,\n )\nE AttributeError: 'NoneType' object has no attribute '_is_valid_code_locals'\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #25: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #29: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #30: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #31: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_pass", "Failure #32: beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py::test_api_vale_isequal_pass", "Failure #33: beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py::test_api_vale_isequal_fail", "Failure #34: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #35: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #36: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #38: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #39: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #40: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #41: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_type_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 9.45424384, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.011963502506265667, "bidirectional_harmonic": 0.20703659005468272, "degree": 2 }, "line_count": 21, "code_line_count": 21, "cyclomatic": 3, "halstead_volume": 22.458839376460833, "halstead_difficulty": 1.875 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/kind/map/utilmapset.py", "function_name": "update_mapping_keys", "test_info": { "success": false, "failed": 8, "passed": 1122, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars\nLocation: /tmp/benchmark_rcmnddh4/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py:105\nError: assert ()\n\nTraceback:\n\n> def test_get_hint_pep585_generic_typevars(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep585.get_hint_pep585_generic_typevars`\n function.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep585Exception\n from beartype._data.hint.pep.sign.datapepsigns import HintSignTypeVar\n from beartype._util.hint.pep.proposal.pep585 import (\n get_hint_pep585_generic_typevars)\n from beartype._util.hint.pep.utilpepget import get_hint_pep_sign_or_none\n from pytest import raises\n \n # ....................{ ASSERTS }....................\n # For each PEP-compliant test hint...\n for hint_pep_meta in hints_pep_meta:\n # If this hint is a PEP 585-compliant generic...\n if hint_pep_meta.is_pep585_generic:\n # Tuple of all type variables discovered by this getter.\n hint_typevars = get_hint_pep585_generic_typevars(hint_pep_meta.hint)\n assert isinstance(hint_typevars, tuple)\n \n # Assert that all items of this tuple are actually type variables.\n for hint_typevar in hint_typevars:\n assert get_hint_pep_sign_or_none(hint_typevar) is (\n HintSignTypeVar)\n \n # If this hint is parametrized by one or more type variables...\n if hint_pep_meta.is_typevars:\n # Assert that this getter returns one or more type variables.\n> assert hint_typevars\nE assert ()\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars\nLocation: /tmp/benchmark_rcmnddh4/beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py:109\nError: assert ()\n\nTraceback:\n\n> def test_get_hint_pep_typevars(hints_pep_meta) -> None:\n '''\n Test the :func:`beartype._util.hint.pep.utilpepget.get_hint_pep_typevars`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._data.hint.pep.sign.datapepsigns import HintSignTypeVar\n from beartype._util.hint.pep.utilpepget import (\n get_hint_pep_typevars,\n get_hint_pep_sign_or_none,\n )\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n \n # ....................{ ASSERTS }....................\n # For each PEP-compliant test hint...\n for hint_pep_meta in hints_pep_meta:\n # Tuple of all type variables discovered by this getter.\n hint_typevars = get_hint_pep_typevars(hint_pep_meta.hint)\n assert isinstance(hint_typevars, tuple)\n \n # Assert that all items of this tuple are actually type variables.\n for hint_typevar in hint_typevars:\n assert get_hint_pep_sign_or_none(hint_typevar) is HintSignTypeVar\n \n # If this hint is parametrized by one or more type variables...\n if hint_pep_meta.is_typevars:\n # Assert that this getter returns one or more type variables.\n> assert hint_typevars\nE assert ()\n", "Failure #3: beartype_test/a00_unit/a20_util/kind/map/test_utilmapset.py::test_update_mapping_keys", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py", "test_get_hint_pep585_generic_typevars" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py", "test_get_hint_pep_typevars" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 3.7200000000000006, "out_degree": 1, "betweenness": 7.045001300615624e-05, "pagerank": 0.0003633412962686706, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.19152242585630835, "degree": 2 }, "line_count": 10, "code_line_count": 10, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/cache/utilcachecall.py", "function_name": "method_cached_arg_by_id", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py::test_method_cached_arg_by_id\nLocation: /tmp/benchmark_ekpucoeo/beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py:179\nError: TypeError: 'NoneType' object is not callable\n\nTraceback:\n\n> def test_method_cached_arg_by_id() -> None:\n '''\n Test the\n :func:`beartype._util.cache.utilcachecall.method_cached_arg_by_id`\n decorator.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableCachedException\n from beartype._util.cache.utilcachecall import method_cached_arg_by_id\n from pytest import raises\n \n # ..................{ CLASSES }..................\n class LikeDust(object):\n '''\n Arbitrary class containing an arbitrary callable memoized by this\n decorator.\n '''\n \n @method_cached_arg_by_id\n def just_like_moons(self, and_like_suns):\n '''\n Arbitrary callable memoized by this decorator.\n '''\n \n # If an arbitrary condition, raise an exception whose value depends\n # on these parameters to exercise this decorator's conditional\n # caching of exceptions.\n if len(and_like_suns) == 6:\n raise ValueError(and_like_suns)\n \n # Else, return a value depending on these parameters to exercise\n # this decorator's conditional caching of return values.\n return [id(self), and_like_suns]\n \n # ..................{ LOCALS }..................\n # Instance of this class.\n like_air = LikeDust()\n \n # Hashable objects to be passed as parameters below.\n moons = ('Just', 'like', 'moons', 'and', 'like', 'suns,')\n tides = ('With', 'the', 'certainty,', 'of,', 'tides,',)\n \n # Shallow copies of hashable objects defined above.\n #\n # Note that copying a list in a manner guaranteeing even a shallow copy is\n # surprisingly non-trivial. See this relevant StackOverflow answer:\n # https://stackoverflow.com/a/15214661/2809027\n tides_copy = tuple(list(tides))\n \n # Unhashable objects to be passed as parameters below.\n hopes = ['Just', 'like', 'hopes,', 'springing,', 'high',]\n \n # ..................{ PASS }..................\n # Assert that memoizing two calls passed the same positional arguments\n # caches and returns the same value.\n assert (\n> like_air.just_like_moons(tides) is\n like_air.just_like_moons(tides))\nE TypeError: 'NoneType' object is not callable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals\nLocation: /tmp/benchmark_ekpucoeo/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:184\nError: TypeError: 'NoneType' object is not callable\n\nTraceback:\n\n> def test_door_typehint_equals(\n door_cases_equality: 'Iterable[Tuple[object, object, bool]]') -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.__equals__` dunder method.\n \n Parameters\n ----------\n door_cases_equality : Iterable[Tuple[object, object, bool]]\n Iterable of one or more 3-tuples ``(hint_a, hint_b, is_equal)``,\n declared by the :func:`hint_subhint_cases` fixture.\n '''\n \n # Defer test-specific imports.\n from beartype.door import TypeHint\n \n # Intentionally import from \"typing\" rather than \"beartype.typing\" to\n # guarantee PEP 484-compliant type hints.\n from typing import (\n Generator,\n Union,\n )\n \n # Arbitrary hint guaranteed to be unequal to every other hint listed in the\n # \"hint_equality_cases\" iterable.\n typehint_unequal = TypeHint(Generator[Union[list, str], str, None])\n \n # Arbitrary non-hint object. Note that strings are valid type hints!\n nonhint = b'Of insects, beasts, and birds, becomes its spoil;'\n \n # For each equality relation to be tested...\n for hint_a, hint_b, IS_EQUAL in door_cases_equality:\n # \"TypeHint\" instances encapsulating these hints.\n typehint_a = TypeHint(hint_a)\n typehint_b = TypeHint(hint_b)\n \n # Assert this tester returns the expected boolean for these hints.\n> is_equal = (typehint_a == typehint_b)\nE TypeError: 'NoneType' object is not callable\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #4: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #5: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #6: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py", "test_method_cached_arg_by_id" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_equals" ] ] }, "complexity_info": { "centrality": { "distance_discount": 25.072640000000032, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 4, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.030592105263157893, "bidirectional_harmonic": 0.20600275546821656, "degree": 4 }, "line_count": 45, "code_line_count": 45, "cyclomatic": 3, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/cache/pool/utilcachepoollistfixed.py", "function_name": "acquire_fixed_list", "test_info": { "success": false, "failed": 17, "passed": 1113, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoollistfixed.py::test_listfixed_pool_pass\nLocation: /tmp/benchmark_9gll1uab/beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoollistfixed.py:35\nError: TypeError: 'NoneType' object does not support item assignment\n\nTraceback:\n\n> def test_listfixed_pool_pass() -> None:\n '''\n Test successful usage of the\n :mod:`beartype._util.cache.pool.utilcachepoollistfixed` submodule.\n '''\n \n # Defer test-specific imports.\n from beartype._util.cache.pool.utilcachepoollistfixed import (\n acquire_fixed_list, release_fixed_list)\n \n # Acquire a fixed list of some length.\n moloch_solitude_filth = acquire_fixed_list(size=3)\n \n # Initialize this list.\n> moloch_solitude_filth[:] = (\n 'Moloch! Solitude! Filth! Ugliness! Ashcans and unobtainable dollars!',\n 'Children screaming under the stairways! Boys sobbing in armies! Old',\n 'men weeping in the parks!',\n )\nE TypeError: 'NoneType' object does not support item assignment\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoollistfixed.py::test_listfixed_pool_fail\nLocation: /tmp/benchmark_9gll1uab/beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoollistfixed.py:74\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_listfixed_pool_fail() -> None:\n '''\n Test unsuccessful usage of the\n :mod:`beartype._util.cache.pool.utilcachepoollistfixed` submodule.\n '''\n \n # Defer test-specific imports.\n from beartype._util.cache.pool.utilcachepoollistfixed import (\n acquire_fixed_list)\n from beartype.roar._roarexc import _BeartypeUtilCachedFixedListException\n \n # Assert that fixed lists may only be acquired with positive integers.\n> with raises(_BeartypeUtilCachedFixedListException):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #17: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoollistfixed.py", "test_listfixed_pool_pass" ], [ "beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoollistfixed.py", "test_listfixed_pool_fail" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 4.5200000000000005, "out_degree": 1, "betweenness": 2.1676927078817306e-05, "pagerank": 0.00028365100945311076, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.2044343814080661, "degree": 2 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep589.py", "function_name": "is_hint_pep589", "test_info": { "success": false, "failed": 16, "passed": 1114, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep589.py::test_is_hint_pep589\nLocation: /tmp/benchmark_dumf21zq/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep589.py:72\nError: AssertionError: assert None is True\n + where None = (.ThouArtThePath'>)\n\nTraceback:\n\n> def test_is_hint_pep589() -> None:\n '''\n Test the\n :beartype._util.hint.pep.proposal.pep589.is_hint_pep589` tester.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.hint.pep.proposal.pep589 import is_hint_pep589\n from beartype_test._util.module.pytmodtyping import (\n import_typing_attr_or_none_safe)\n \n # ....................{ CLASSES }....................\n class NonTypedDict(dict):\n '''\n :class:`dict` subclass defining only one of the requisite three dunder\n attributes necessarily defined by the :class:`typing.TypedDict`\n superclass.\n '''\n \n # Note that:\n # * The \"__annotations__\" dunder attribute is intentionally omitted;\n # that is the *ONLY* dunder attribute guaranteed to be declared by\n # Python 3.8.\n # * The \"__required_keys__\" dunder attribute is also intentionally\n # omitted; for unknown reasons, Python >= 3.8 implicitly adds an\n # unwanted \"__annotations__\" dunder attribute to *ALL* \"dict\"\n # subclasses -- including \"dict\" subclasses annotating *NO* class or\n # instance variables. Defining both the \"__required_keys__\" and\n # \"__optional_keys__\" dunder attributes here would thus suffice for\n # this subclass to be erroneously detected as a typed dictionary under\n # Python >= 3.8. And we will sleep now. This has spiralled into\n # insanity, folks.\n __optional_keys__ = ()\n __total__ = True\n \n # \"typing.TypedDict\" superclass imported from either the \"typing\" or\n # \"typing_extensions\" modules if importable *OR* \"None\" otherwise.\n TypedDict = import_typing_attr_or_none_safe('TypedDict')\n \n # If this superclass exists...\n if TypedDict is not None:\n class ThouArtThePath(TypedDict):\n '''\n Arbitrary non-empty typed dictionary annotated to require arbitrary\n key-value pairs.\n '''\n \n of_that: str\n unresting_sound: int\n \n # Assert this tester returns true when passed a typed dictionary.\n> assert is_hint_pep589(ThouArtThePath) is True\nE AssertionError: assert None is True\nE + where None = (.ThouArtThePath'>)\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign\nLocation: /tmp/benchmark_dumf21zq/beartype/_util/hint/pep/utilpepget.py:387\nError: beartype.roar.BeartypeDecorHintPepSignException: Type hint .ISeemAsInATranceSublimeAndStrange'> currently unsupported by beartype. You suddenly feel encouraged to submit a feature request for this hint to our friendly issue tracker at:\n\thttps://github.com/beartype/beartype/issues\n\nTraceback:\n\n> def test_get_hint_pep_sign(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.utilpepget.get_hint_pep_sign` getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepSignException\n from beartype._util.hint.pep.utilpepget import get_hint_pep_sign\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP, NonpepCustomFakeTyping)\n from pytest import raises\n \n # Assert this getter returns the expected unsubscripted \"typing\" attribute\n # for all PEP-compliant type hints associated with such an attribute.\n for hint_pep_meta in hints_pep_meta:\n> assert get_hint_pep_sign(hint_pep_meta.hint) is hint_pep_meta.pep_sign\n\n> def get_hint_pep_sign(\n # Mandatory parameters.\n hint: object,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPepSignException,\n exception_prefix: str = '',\n ) -> HintSign:\n '''\n **Sign** (i.e., :class:`HintSign` instance) uniquely identifying the passed\n PEP-compliant type hint if PEP-compliant *or* raise an exception otherwise\n (i.e., if this hint is *not* PEP-compliant).\n \n This getter is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as the implementation trivially reduces\n to an efficient one-liner.\n \n Parameters\n ----------\n hint : object\n Type hint to be inspected.\n exception_cls : TypeException, optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :exc:`.BeartypeDecorHintPepSignException`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n dict\n Sign uniquely identifying this hint.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * PEP-compliant but *not* uniquely identifiable by a sign.\n * PEP-noncompliant.\n * *Not* a hint (i.e., neither PEP-compliant nor -noncompliant).\n \n See Also\n --------\n :func:`.get_hint_pep_sign_or_none`\n Further details.\n '''\n \n # Sign uniquely identifying this hint if recognized *OR* \"None\" otherwise.\n hint_sign = get_hint_pep_sign_or_none(hint)\n \n # If this hint is unrecognized...\n if hint_sign is None:\n assert isinstance(exception_cls, type), (\n f'{exception_cls} not exception type.')\n assert isinstance(exception_prefix, str), (\n f'{exception_prefix} not string.')\n \n # Avoid circular import dependencies.\n from beartype._util.hint.nonpep.utilnonpeptest import die_if_hint_nonpep\n \n # If this hint is PEP-noncompliant, raise an exception.\n die_if_hint_nonpep(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # Else, this hint is *NOT* PEP-noncompliant. Since this hint was\n # unrecognized, this hint *MUST* necessarily be a PEP-compliant type\n # hint currently unsupported by the @beartype decorator.\n \n # Raise an exception indicating this.\n #\n # Note that we intentionally avoid calling the\n # die_if_hint_pep_unsupported() function here, which calls the\n # is_hint_pep_supported() function, which calls this function.\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} '\n f'currently unsupported by beartype. '\n f'You suddenly feel encouraged to submit a feature request '\n f'for this hint to our friendly issue tracker at:\\n'\n f'\\t{URL_ISSUES}'\n )\nE beartype.roar.BeartypeDecorHintPepSignException: Type hint .ISeemAsInATranceSublimeAndStrange'> currently unsupported by beartype. You suddenly feel encouraged to submit a feature request for this hint to our friendly issue tracker at:\nE \thttps://github.com/beartype/beartype/issues\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #6: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #7: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #8: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #9: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #12: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #13: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #14: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #16: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep589.py", "test_is_hint_pep589" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py", "test_get_hint_pep_sign" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 43.72000000000003, "out_degree": 1, "betweenness": 0.00025470389317610334, "pagerank": 0.0009215500420958693, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.2383335825358854, "degree": 2 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 2, "halstead_volume": 28.529325012980813, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/door/_cls/util/doorclsget.py", "function_name": "get_typehint_subclass", "test_info": { "success": false, "failed": 16, "passed": 1114, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new\nLocation: /tmp/benchmark_wm2s5y_u/beartype/door/_cls/doormeta.py:253\nError: TypeError: 'NoneType' object is not callable\n\nTraceback:\n\n> def test_door_typehint_new() -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.__new__` factory method.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n Union,\n )\n from pytest import raises\n \n # Intentionally import from \"typing\" rather than \"beartype.typing\" to\n # guarantee PEP 484-compliant type hints.\n from typing import List\n \n # ....................{ PASS }....................\n # Assert that recreating a type hint against identical input yields the same\n # previously memoized type hint.\n> assert TypeHint(List[Any]) is TypeHint(List[Any])\n\n> _HINT_KEY_TO_WRAPPER.cache_or_get_cached_func_return_passed_arg( # type: ignore[attr-defined]\n\n> value = value_factory(arg)\n\n> def _make_wrapper(cls: '_TypeHintMeta', hint: object):\n '''\n **Type hint wrapper factory** (i.e., low-level private method creating\n and returning a new :class:`beartype.door.TypeHint` instance wrapping\n the passed type hint), intended to be called by the\n :meth:`CacheUnboundedStrong.cache_or_get_cached_func_return_passed_arg`\n method to create a new type hint wrapper singleton for the passed hint.\n \n Parameters\n ----------\n cls : _TypeHintMeta\n The :class:`beartype.door.TypeHint` ABC.\n hint : Hint\n Low-level type hint to be wrapped by a singleton\n :class:`beartype.door.TypeHint` instance.\n \n Returns\n -------\n beartype.door.TypeHint\n :class:`beartype.door.TypeHint` object wrapping this hint.\n \n Raises\n ------\n BeartypeDoorNonpepException\n If this class does *not* currently support the passed hint.\n BeartypeDecorHintPepSignException\n If the passed hint is *not* actually a PEP-compliant type hint.\n '''\n \n # ................{ IMPORTS }................\n # Avoid circular import dependencies.\n from beartype.door._cls.util.doorclsget import get_typehint_subclass\n \n # ................{ REDUCTION }................\n # Reduce this hint to a more amenable form suitable for mapping to a\n # concrete \"TypeHint\" subclass if desired.\n #\n # Note that this reduction intentionally ignores the entire\n # \"beartype._check.convert\" subpackage. Although submodules of that\n # subpackage do perform various coercions, reductions, and sanitizations\n # of low-level PEP-compliant type hints, they do so only for the express\n # purpose of dynamic code generation. That subpackage is *NOT*\n # general-purpose and is, in fact, harmful in this context. Why? Because\n # that subpackage erodes the semantic meaning from numerous type hints\n # that this subpackage necessarily preserves.\n #\n # ................{ REDUCTION ~ pep 484 : none }................\n # If this is the PEP 484-compliant \"None\" singleton, reduce this hint to\n # the type of that singleton. While *NOT* explicitly defined by the\n # \"typing\" module, PEP 484 explicitly supports this singleton:\n # When used in a type hint, the expression None is considered\n # equivalent to type(None).\n #\n # The \"None\" singleton is used to type callables lacking an explicit\n # \"return\" statement and thus absurdly common. Ergo, detect this early.\n if hint is None:\n hint = NoneType # type: ignore[assignment]\n # Else, this is *NOT* the PEP 484-compliant \"None\" singleton.\n \n # ................{ INSTANTIATION }................\n # Concrete \"TypeHint\" subclass handling this hint if this hint is\n # supported by an existing \"TypeHint\" subclass *OR* raise an exception\n # otherwise (i.e., if this hint is currently unsupported).\n wrapper_subclass = get_typehint_subclass(hint) # pyright: ignore\n # print(f'!!!!!!!!!!!!! [ in {repr(cls)}.__new__() ] !!!!!!!!!!!!!!!')\n \n # Type hint wrapper wrapping this hint as a new singleton instance of\n # this subclass.\n> wrapper = wrapper_subclass(hint)\nE TypeError: 'NoneType' object is not callable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping\nLocation: /tmp/benchmark_wm2s5y_u/beartype/door/_cls/doormeta.py:253\nError: TypeError: 'NoneType' object is not callable\n\nTraceback:\n\n> def test_door_typehint_mapping(iter_hints_piths_meta) -> None:\n '''\n Test that the :meth:`beartype.door.TypeHint.__new__` factory method\n successfully creates and returns an instance of a concrete subclass of the\n abstract :class:`beartype.door.TypeHint` superclass conditionally handling\n the kind of low-level type hint passed to that factory method.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n \n # ....................{ ASSERTS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # ....................{ METADATA }....................\n # Metadata describing this type hint.\n hint_meta = hint_pith_meta.hint_meta\n \n # This type hint.\n hint = hint_meta.hint\n \n # If either...\n if (\n # This hint is PEP-noncompliant *OR*...\n not isinstance(hint_meta, HintPepMetadata) or\n # This kind of type hint is currently unsupported by the\n # \"beartype.door\" submodule...\n hint_meta.typehint_cls is None\n ):\n # Silently ignore this hint and continue to the next.\n continue\n # Else, this kind of type hint is currently supported by the\n # \"beartype.door\" submodule *AND* this hint is PEP-compliant.\n \n # Instance of a concrete subclass of the abstract \"TypeHint\" superclass\n # conditionally handling this kind of type hint.\n> wrapper = TypeHint(hint)\n\n> _HINT_KEY_TO_WRAPPER.cache_or_get_cached_func_return_passed_arg( # type: ignore[attr-defined]\n\n> value = value_factory(arg)\n\n> def _make_wrapper(cls: '_TypeHintMeta', hint: object):\n '''\n **Type hint wrapper factory** (i.e., low-level private method creating\n and returning a new :class:`beartype.door.TypeHint` instance wrapping\n the passed type hint), intended to be called by the\n :meth:`CacheUnboundedStrong.cache_or_get_cached_func_return_passed_arg`\n method to create a new type hint wrapper singleton for the passed hint.\n \n Parameters\n ----------\n cls : _TypeHintMeta\n The :class:`beartype.door.TypeHint` ABC.\n hint : Hint\n Low-level type hint to be wrapped by a singleton\n :class:`beartype.door.TypeHint` instance.\n \n Returns\n -------\n beartype.door.TypeHint\n :class:`beartype.door.TypeHint` object wrapping this hint.\n \n Raises\n ------\n BeartypeDoorNonpepException\n If this class does *not* currently support the passed hint.\n BeartypeDecorHintPepSignException\n If the passed hint is *not* actually a PEP-compliant type hint.\n '''\n \n # ................{ IMPORTS }................\n # Avoid circular import dependencies.\n from beartype.door._cls.util.doorclsget import get_typehint_subclass\n \n # ................{ REDUCTION }................\n # Reduce this hint to a more amenable form suitable for mapping to a\n # concrete \"TypeHint\" subclass if desired.\n #\n # Note that this reduction intentionally ignores the entire\n # \"beartype._check.convert\" subpackage. Although submodules of that\n # subpackage do perform various coercions, reductions, and sanitizations\n # of low-level PEP-compliant type hints, they do so only for the express\n # purpose of dynamic code generation. That subpackage is *NOT*\n # general-purpose and is, in fact, harmful in this context. Why? Because\n # that subpackage erodes the semantic meaning from numerous type hints\n # that this subpackage necessarily preserves.\n #\n # ................{ REDUCTION ~ pep 484 : none }................\n # If this is the PEP 484-compliant \"None\" singleton, reduce this hint to\n # the type of that singleton. While *NOT* explicitly defined by the\n # \"typing\" module, PEP 484 explicitly supports this singleton:\n # When used in a type hint, the expression None is considered\n # equivalent to type(None).\n #\n # The \"None\" singleton is used to type callables lacking an explicit\n # \"return\" statement and thus absurdly common. Ergo, detect this early.\n if hint is None:\n hint = NoneType # type: ignore[assignment]\n # Else, this is *NOT* the PEP 484-compliant \"None\" singleton.\n \n # ................{ INSTANTIATION }................\n # Concrete \"TypeHint\" subclass handling this hint if this hint is\n # supported by an existing \"TypeHint\" subclass *OR* raise an exception\n # otherwise (i.e., if this hint is currently unsupported).\n wrapper_subclass = get_typehint_subclass(hint) # pyright: ignore\n # print(f'!!!!!!!!!!!!! [ in {repr(cls)}.__new__() ] !!!!!!!!!!!!!!!')\n \n # Type hint wrapper wrapping this hint as a new singleton instance of\n # this subclass.\n> wrapper = wrapper_subclass(hint)\nE TypeError: 'NoneType' object is not callable\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr", "Failure #4: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #5: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #6: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_contains", "Failure #7: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_iter", "Failure #8: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #9: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #10: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #11: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #12: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #13: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #14: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #15: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #16: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_new" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_mapping" ] ] }, "complexity_info": { "centrality": { "distance_discount": 14.042880000000007, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 3, "betweenness": 1.0838463539408653e-05, "pagerank": 0.0004556650246305419, "harmonic": 0.01869517543859649, "bidirectional_harmonic": 0.2489558413078151, "degree": 4 }, "line_count": 22, "code_line_count": 22, "cyclomatic": 6, "halstead_volume": 51.80615605397529, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncscope.py", "function_name": "get_func_locals", "test_info": { "success": false, "failed": 22, "passed": 1108, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py::test_get_func_locals\nLocation: /tmp/benchmark_plavi3n5/beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py:228\nError: assert None == {}\n + where None = ()\n\nTraceback:\n\n> def test_get_func_locals() -> None:\n '''\n Test the\n :func:`beartype._util.func.utilfuncscope.get_func_locals` getter.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype.typing import Union\n from beartype._util.func.utilfuncmake import make_func\n from beartype._util.func.utilfuncscope import get_func_locals\n from pytest import raises\n \n # ..................{ CALLABLES }..................\n def and_summon_the_shadows_there():\n '''\n Arbitrary nested callable.\n '''\n \n return 'And tie a ribbon on those sheltering arms'\n \n # Arbitrary nested callable dynamically declared in-memory.\n when_the_ash_and_oak_and_the_birch_and_yew = make_func(\n func_name='when_the_ash_and_oak_and_the_birch_and_yew',\n func_code='''def when_the_ash_and_oak_and_the_birch_and_yew(): pass''',\n )\n \n # Arbitrary nested callables whose unqualified and fully-qualified names\n # are maliciously desynchronized below, exercising edge cases.\n def are_dressed_in_ribbons_fair(): pass\n def who_will_go_down_to_the_shady_groves(): pass\n are_dressed_in_ribbons_fair.__qualname__ = (\n 'when_owls_call.the_breathless_moon')\n who_will_go_down_to_the_shady_groves.__qualname__ = (\n '.who_will_go_down_to_the_shady_groves')\n \n # ..................{ PASS ~ noop }..................\n # Assert this getter returns the empty dictionary for callables dynamically\n # declared in-memory.\n> assert get_func_locals(when_the_ash_and_oak_and_the_birch_and_yew) == {}\nE assert None == {}\nE + where None = ()\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563\nLocation: /tmp/benchmark_plavi3n5/beartype/_check/forward/fwdmain.py:582\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_resolve_pep563() -> None:\n '''\n Test the :func:`beartype.peps.resolve_pep563` resolver.\n '''\n \n # .....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.peps import resolve_pep563\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n BeartypePep563Exception,\n )\n from beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve import (\n ToAvariceOrPride,\n FrequentWith,\n their_starry_domes,\n )\n from pytest import raises\n \n # .....................{ LOCALS }....................\n # Arbitrary instance of the generic accepted by the function called below.\n numberless_and_immeasurable_halls = ToAvariceOrPride()\n \n # Arbitrary instance of the class defining various problematic methods\n # called below.\n and_thrones_radiant_with_chrysolite = FrequentWith()\n \n # .....................{ PASS }....................\n # Assert that this function unsuccessfully raises the expected exception\n # *BEFORE* resolving all PEP 563-postponed type hints annotating these\n # callables.\n with raises(BeartypeDecorHintForwardRefException):\n their_starry_domes(numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.until_the_doves(\n numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.crystal_column(\n 'Nor had that scene of ampler majesty')\n \n # Resolve all PEP 563-postponed type hints annotating these callables.\n resolve_pep563(their_starry_domes)\n> resolve_pep563(FrequentWith.until_the_doves)\n\n> arg_name_to_hint[arg_name] = resolve_hint(\n\n> _resolve_func_scope_forward(\n\n> def _resolve_func_scope_forward(\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> None:\n '''\n Resolve the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) for that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n '''\n \n # ..................{ LOCALS }..................\n # Decorated callable and metadata associated with that callable, localized\n # to improve both readability and negligible efficiency when accessed below.\n func = decor_meta.func_wrappee_wrappee\n cls_stack = decor_meta.cls_stack\n \n # ..................{ NESTED }..................\n # If the decorated callable is nested (rather than global) and thus\n # *MAY* have a non-empty local nested scope...\n if decor_meta.func_wrappee_is_nested:\n # Attempt to...\n try:\n # Local scope of the decorated callable, localized to improve\n # readability and negligible efficiency when accessed below.\n func_locals = get_func_locals(\n func=func,\n \n # Ignore all lexical scopes in the fully-qualified name of the\n # decorated callable corresponding to parent classes lexically\n # nesting the current decorated class containing that callable\n # (including that class). Why? Because these classes are *ALL*\n # currently being decorated and thus have yet to be encapsulated\n # by new stack frames on the call stack. If these lexical scopes\n # are *NOT* ignored, this call to get_func_locals() will fail to\n # find the parent lexical scope of the decorated callable and\n # then raise an unexpected exception.\n #\n # Consider, for example, this nested class decoration of a\n # fully-qualified \"muh_package.Outer\" class:\n # @beartype\n # class Outer(object):\n # class Middle(object):\n # class Inner(object):\n # def muh_method(self) -> str:\n # return 'Painful API is painful.'\n #\n # When @beartype finally recurses into decorating the nested\n # muh_package.Outer.Middle.Inner.muh_method() method, this call\n # to get_func_locals() if *NOT* passed this parameter would\n # naively assume that the parent lexical scope of the current\n # muh_method() method on the call stack is named \"Inner\".\n # Instead, the parent lexical scope of that method on the call\n # stack is named \"muh_package\" -- the first lexical scope\n # enclosing that method that exists on the call stack. The\n # non-existent \"Outer\", \"Middle\", and \"Inner\" lexical scopes\n # must *ALL* be silently ignored.\n func_scope_names_ignore=(\n 0 if cls_stack is None else len(cls_stack)),\n \n #FIXME: Consider dynamically calculating exactly how many\n #additional @beartype-specific frames are ignorable on the\n #first call to this function, caching that number, and then\n #reusing that cached number on all subsequent calls to this\n #function. The current approach employed below of naively\n #hard-coding a number of frames to ignore was incredibly\n #fragile and had to be effectively disabled, which hampers\n #runtime efficiency.\n \n # Ignore additional frames on the call stack embodying:\n # * The current call to this function.\n #\n # Note that, for safety, we currently avoid ignoring additional\n # frames that we could technically ignore. These include:\n # * The call to the parent\n # beartype._check.metadata.metadecor.BeartypeDecorMeta.reinit() method.\n # * The call to the parent @beartype.beartype() decorator.\n #\n # Why? Because the @beartype codebase has been sufficiently\n # refactored so as to render any such attempts non-trivial,\n # fragile, and frankly dangerous.\n func_stack_frames_ignore=1,\n exception_cls=exception_cls,\n )\n # If this local scope cannot be found (i.e., if this getter found the\n # lexical scope of the module declaring the decorated callable *BEFORE*\n # that of the parent callable or class declaring that callable), then\n # this resolve_hint() function was called *AFTER* rather than *DURING*\n # the declaration of the decorated callable. This implies that that\n # callable is not, in fact, currently being decorated. Instead, that\n # callable was *NEVER* decorated by @beartype but has instead\n # subsequently been passed to this resolve_hint() function after its\n # initial declaration -- typically due to an external caller passing\n # that callable to our public beartype.peps.resolve_pep563() function.\n #\n # In this case, the call stack frame providing this local scope has\n # (almost certainly) already been deleted and is no longer accessible.\n # We have no recourse but to default to the empty frozen dictionary.\n except _BeartypeUtilCallableScopeNotFoundException:\n func_locals = FROZENDICT_EMPTY\n \n # If the decorated callable is a method transitively defined by a root\n # decorated class, add a pair of local attributes exposing:\n #\n # * The unqualified basename of the root decorated class. Why? Because\n # this class may be recursively referenced in postponed type hints and\n # *MUST* thus be exposed to *ALL* postponed type hints. However, this\n # class is currently being decorated and thus has yet to be defined in\n # either:\n # * If this class is module-scoped, the global attribute dictionary of\n # that module and thus the \"func_globals\" dictionary.\n # * If this class is closure-scoped, the local attribute dictionary of\n # that closure and thus the \"func_locals\" dictionary.\n # * The unqualified basename of the current decorated class. Why? For\n # similar reasons. Since the current decorated class may be lexically\n # nested in the root decorated class, the current decorated class is\n # *NOT* already accessible as either a global or local. Exposing the\n # current decorated class to a stringified\n # type hint referencing that class thus requires adding a local\n # attribute exposing that class.\n #\n # Note that:\n # * *ALL* intermediary classes (i.e., excluding the root decorated\n # class) lexically nesting the current decorated class are irrelevant.\n # Intermediary classes are neither module-scoped nor closure-scoped\n # and thus inaccessible as either globals or locals in the nested\n # lexical scope of the current decorated class: e.g.,\n # # This raises a parser error and is thus *NOT* fine:\n # # NameError: name 'muh_type' is not defined\n # class Outer(object):\n # class Middle(object):\n # muh_type = str\n #\n # class Inner(object):\n # def muh_method(self) -> muh_type:\n # return 'Dumpster fires are all I see.'\n # * This implicitly overrides any previously declared locals of the same\n # name. Although non-ideal, this constitutes syntactically valid\n # Python and is thus *NOT* worth emitting even a non-fatal warning\n # over: e.g.,\n # # This is fine... technically.\n # from beartype import beartype\n # def muh_closure() -> None:\n # MuhClass = 'This is horrible, yet fine.'\n #\n # @beartype\n # class MuhClass(object):\n # def muh_method(self) -> str:\n # return 'Look away and cringe, everyone!'\n if cls_stack:\n # Root and current decorated classes.\n cls_root = cls_stack[0]\n cls_curr = cls_stack[-1]\n \n # If this local scope is the empty frozen dictionary, mutate this\n # local scope into a new mutable dictionary to enable new locals to\n # be added to this scope below.\n if func_locals is FROZENDICT_EMPTY:\n func_locals = {}\n # Else, this local scope is *NOT* the empty frozen dictionary.\n # Presumably, this implies this scope to be a mutable dictionary.\n \n # Add new locals exposing these classes to type hints, overwriting\n # any locals of the same names in the higher-level local scope for\n # any closure declaring this class if any. These classes are\n # currently being decorated and thus guaranteed to be the most\n # recent declarations of these attributes.\n #\n # Note that the current class assumes lexical precedence over the\n # root class and is thus added *AFTER* the latter.\n func_locals[cls_root.__name__] = cls_root\n func_locals[cls_curr.__name__] = cls_curr\n \n # Local scope for the class directly defining this method.\n #\n # Note that callables *ONLY* have direct access to attributes\n # declared by the classes directly defining those callables. Ergo,\n # the local scopes for parent classes of this class (including the\n # root decorated class) are irrelevant.\n cls_curr_locals = get_type_locals(\n cls=cls_curr, exception_cls=exception_cls)\n \n # Forcefully merge this local scope into the current local\n # scope, implicitly overwriting any locals of the same name.\n # Class locals necessarily assume lexical precedence over:\n # * These classes themselves.\n # * Locals defined by higher-level parent classes.\n # * Locals defined by closures defining these classes.\n func_locals.update(cls_curr_locals)\n # Else, the decorated callable is *NOT* a method transitively\n # declared by a root decorated class.\n # Else, the decorated callable is global and thus guaranteed to have an\n # empty local scope. In this case, default to the empty frozen dictionary.\n else:\n func_locals = FROZENDICT_EMPTY\n \n # ..................{ SCOPE }..................\n # Fully-qualified name of the module declaring the decorated callable if\n # that callable defines the \"__module__\" dunder attribute *OR* \"None\"\n # (i.e., if that callable fails to define that attribute).\n func_module_name = get_object_module_name_or_none(func) # type: ignore[operator]\n \n # Global scope of the decorated callable.\n func_globals = get_func_globals(func=func, exception_cls=exception_cls)\n \n # Forward scope compositing this global and local scope of the decorated\n # callable as well as dynamically replacing each unresolved attribute of\n # this stringified type hint with a forward reference proxy resolving\n # this attribute on the first attempt to pass this attribute as the\n # second parameter to an isinstance()-based runtime type-check: e.g.,\n # from beartype import beartype\n # from beartype.typing import Dict, Generic, TypeVar\n #\n # T = TypeVar('T')\n #\n # # @beartype resolves this stringified type hint as follows:\n # # * The \"Dict\", \"str\", and \"int\" attributes are globals and thus\n # # trivially resolved to those objects via the \"func_globals\"\n # # scope decided above.\n # # * The \"MuhGeneric\" attribute is neither a global nor local and\n # # thus remains unresolved. This forward scope replaces this\n # # unresolved attribute with a forward reference proxy.\n # @beartype\n # def muh_func(muh_arg: 'Dict[str, MuhGeneric[int]]') -> None: ...\n #\n # class MuhGeneric(Generic[T]): ...\n #\n # Initialize this forward scope to the set of all builtin attributes\n # (e.g., \"str\", \"Exception\"). Although the eval() builtin does, of\n # course, implicitly evaluate this stringified type hint against all\n # builtin attributes, it does so only *AFTER* invoking the\n # BeartypeForwardScope.__missing__() dunder method with each such\n # builtin attribute referenced in this hint. Since handling that\n # eccentricity would be less efficient and trivial than simply\n # initializing this forward scope with all builtin attributes, we prefer\n # the current (admittedly sus af) approach. Do not squint at this.\n \n #FIXME: [SPEED] Optimize away the repeated access to the\n #\"decor_meta.func_wrappee_scope_forward\" instance variable above, here,\n #and below with a local variable, please. *sigh*\n decor_meta.func_wrappee_scope_forward = BeartypeForwardScope(\n scope_dict=func_builtins, scope_name=func_module_name) # type: ignore[arg-type]\n \n # Composite this global and local scope into this forward scope (in that\n # order), implicitly overwriting first each builtin attribute and then\n # each global attribute previously copied into this forward scope with\n # each global and then local attribute of the same name. Since locals\n # *ALWAYS* assume precedence over globals *ALWAYS* assume precedence\n # over builtins, order of operations is *EXTREMELY* significant here.\n decor_meta.func_wrappee_scope_forward.update(func_globals)\n> decor_meta.func_wrappee_scope_forward.update(func_locals)\nE TypeError: 'NoneType' object is not iterable\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #18: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #21: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #22: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py", "test_get_func_locals" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py", "test_resolve_pep563" ] ] }, "complexity_info": { "centrality": { "distance_discount": 7.712000000000003, "in_degree": 1, "true_in_degree": 3.0800000000000005, "out_degree": 5, "betweenness": 5.4192317697043266e-05, "pagerank": 0.00028725369805818646, "harmonic": 0.012883771929824562, "bidirectional_harmonic": 0.2285975355054305, "degree": 6 }, "line_count": 92, "code_line_count": 92, "cyclomatic": 21, "halstead_volume": 393.82267902166484, "halstead_difficulty": 9.10344827586207 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484/pep484union.py", "function_name": "make_hint_pep484_union", "test_info": { "success": false, "failed": 11, "passed": 1119, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484/test_utilpep484typevar.py::test_get_hint_pep484_typevar_bound_or_none\nLocation: /tmp/benchmark_obfb2wqj/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484/test_utilpep484typevar.py:52\nError: AttributeError: 'NoneType' object has no attribute '__args__'\n\nTraceback:\n\n> def test_get_hint_pep484_typevar_bound_or_none() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484.pep484typevar.get_hint_pep484_typevar_bound_or_none`\n tester.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484Exception\n from beartype._data.hint.datahinttyping import T\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from beartype_test.a00_unit.data.hint.pep.proposal.data_pep484 import (\n T_int,\n T_str_or_bytes,\n )\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this getter returns \"None\" for unbounded type variables.\n assert get_hint_pep484_typevar_bound_or_none(T) is None\n \n # Assert this getter reduces bounded type variables to their upper bound.\n assert get_hint_pep484_typevar_bound_or_none(T_int) is int\n \n # Union of all constraints parametrizing a constrained type variable,\n # reduced from that type variable.\n typevar_constraints_union = get_hint_pep484_typevar_bound_or_none(\n T_str_or_bytes)\n \n # Assert this union contains all constraints parametrizing this variable.\n> assert str in typevar_constraints_union.__args__\nE AttributeError: 'NoneType' object has no attribute '__args__'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_obfb2wqj/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:454\nError: AssertionError: assert False is True\n + where False = TypeVarTypeHint(~AnyStr).is_ignorable\n + where TypeVarTypeHint(~AnyStr) = (~AnyStr)\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n assert TypeHint(hint_ignorable).is_ignorable is True\n \n # Assert this property:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # Hint to be tested.\n hint = hint_pep_meta.hint\n \n # True only if the @beartype decorator currently ignores this hint.\n hint_is_ignorable = hint_pep_meta.is_ignorable\n \n # If this hint is a type variable...\n #\n # Note that the @beartype decorator and the \"beartype.door\" API\n # currently disagree as to whether type variables are ignorable. From:\n # the perspective of:\n # * The low-level @beartype decorator, they mostly are.\n # * The high-level \"beartype.door\" API, they mostly are *NOT*.\n #\n # Since the \"hint_pep_meta.is_ignorable\" variable reflects the\n # perspective of the @beartype decorator rather than the \"beartype.door\"\n # API, further logic is needed to decide whether this type variable is\n # actually ignorable from the \"beartype.door\" perspective.\n if isinstance(hint, TypeVar):\n # Type hint synthesized from all bounded constraints parametrizing\n # this type variable if any *OR* \"None\" otherwise.\n hint_typevar_bound = get_hint_pep484_typevar_bound_or_none(hint)\n \n # This type hint is ignorable only if either...\n hint_is_ignorable = (\n # This type hint is unconstrained *OR*...\n hint_typevar_bound is None or\n # This type hint is constrained by one or more ignorable\n # constraints.\n sanify_hint_child(hint_typevar_bound) is Any\n )\n # Else, this hint is *NOT* a type variable.\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints. Most of these will be\n #\"BeartypeDoorNonpepException\", but there are some covariant type hints\n #(e.g. numpy.dtype[+ScalarType]) that will raise a \"not invariant\"\n #exception in the \"TypeVarTypeHint\" subclass.\n with suppress(BeartypeDoorException):\n> assert TypeHint(hint).is_ignorable is hint_is_ignorable\nE AssertionError: assert False is True\nE + where False = TypeVarTypeHint(~AnyStr).is_ignorable\nE + where TypeVarTypeHint(~AnyStr) = (~AnyStr)\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #11: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484/test_utilpep484typevar.py", "test_get_hint_pep484_typevar_bound_or_none" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 3, "true_in_degree": 9.72, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.00098586824248123, "harmonic": 0.0, "bidirectional_harmonic": 0.18167500901875985, "degree": 3 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 3, "halstead_volume": 2.0, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextjoin.py", "function_name": "join_delimited", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/text/test_utiltextjoin.py::test_join_delimited\nLocation: /tmp/benchmark_44etd7qb/beartype_test/a00_unit/a20_util/text/test_utiltextjoin.py:29\nError: AssertionError: assert None == ''\n + where None = (strs=(), delimiter_if_two='In Xanadu did Kubla Khan', delimiter_if_three_or_more_nonlast='A stately pleasure-dome decree:', delimiter_if_three_or_more_last='Where Alph, the sacred river, ran')\n\nTraceback:\n\n> def test_join_delimited() -> None:\n '''\n Test the :func:`beartype._util.text.utiltextjoin.join_delimited` function.\n '''\n \n # Defer test-specific imports.\n from beartype._util.text.utiltextjoin import join_delimited\n \n # Assert that joining a sequence of no strings returns the empty string.\n> assert join_delimited(\n strs=(),\n delimiter_if_two='In Xanadu did Kubla Khan',\n delimiter_if_three_or_more_nonlast='A stately pleasure-dome decree:',\n delimiter_if_three_or_more_last='Where Alph, the sacred river, ran',\n ) == ''\nE AssertionError: assert None == ''\nE + where None = (strs=(), delimiter_if_two='In Xanadu did Kubla Khan', delimiter_if_three_or_more_nonlast='A stately pleasure-dome decree:', delimiter_if_three_or_more_last='Where Alph, the sacred river, ran')\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/text/test_utiltextjoin.py::test_join_delimited_disjunction\nLocation: /tmp/benchmark_44etd7qb/beartype_test/a00_unit/a20_util/text/test_utiltextjoin.py:97\nError: AssertionError: assert None == 'A mighty fountain momently was forced:, Amid whose swift half-intermitted burst, or Huge fragments vaulted like rebounding hail,'\n + where None = (('A mighty fountain momently was forced:', 'Amid whose swift half-intermitted burst', 'Huge fragments vaulted like rebounding hail,'))\n\nTraceback:\n\n> def test_join_delimited_disjunction() -> None:\n '''\n Test the\n :func:`beartype._util.text.utiltextjoin.join_delimited_disjunction`\n function.\n '''\n \n # Defer test-specific imports.\n from beartype._util.text.utiltextjoin import join_delimited_disjunction\n \n # Assert that joining a sequence of no strings returns the empty string.\n> assert join_delimited_disjunction((\n 'A mighty fountain momently was forced:',\n 'Amid whose swift half-intermitted burst',\n 'Huge fragments vaulted like rebounding hail,',\n )) == (\n 'A mighty fountain momently was forced:, '\n 'Amid whose swift half-intermitted burst, or '\n 'Huge fragments vaulted like rebounding hail,'\n )\nE AssertionError: assert None == 'A mighty fountain momently was forced:, Amid whose swift half-intermitted burst, or Huge fragments vaulted like rebounding hail,'\nE + where None = (('A mighty fountain momently was forced:', 'Amid whose swift half-intermitted burst', 'Huge fragments vaulted like rebounding hail,'))\n", "Failure #3: beartype_test/a00_unit/a40_api/conf/test_confcls.py::test_conf_is_color", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/text/test_utiltextjoin.py", "test_join_delimited" ], [ "beartype_test/a00_unit/a20_util/text/test_utiltextjoin.py", "test_join_delimited_disjunction" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 7.600000000000001, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.001024118604409305, "harmonic": 0.0, "bidirectional_harmonic": 0.16828341614525896, "degree": 2 }, "line_count": 32, "code_line_count": 32, "cyclomatic": 11, "halstead_volume": 78.86917501586544, "halstead_difficulty": 3.25 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/metadata/hint/hintsmeta.py", "function_name": "HintsMeta.enqueue_hint_or_sane_child", "test_info": { "success": false, "failed": 18, "passed": 1112, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_c3c6wjoc/beartype/_check/error/errget.py:479\nError: beartype.roar._BeartypeCallHintPepRaiseDesynchronizationException: Die_if_unbearable() value {\"Had stood a pigmy's height;\", \"she would have ta'en\"} violates type hint typing.Container[str], but violation factory get_hint_object_violation() erroneously suggests this object satisfies this hint. Please report this desynchronization failure to the beartype issue tracker (https://github.com/beartype/beartype/issues) with the accompanying exception traceback and the representation of this object:\n {\"Had stood a pigmy's height;\", \"she would have ta'en\"}\nThe bear groans in disappointment. If you feel similarly, know that you are not alone.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n if not violation_cause.cause_str_or_none:\n pith_value_repr = represent_object(\n obj=obj, max_len=_CAUSE_TRIM_OBJECT_REPR_MAX_LEN)\n> raise _BeartypeCallHintPepRaiseDesynchronizationException(\n f'{exception_prefix}violates type hint {repr(hint)}, '\n f'but violation factory get_hint_object_violation() '\n f'erroneously suggests this object satisfies this hint. '\n f'Please report this desynchronization failure to '\n f'the beartype issue tracker ({URL_ISSUES}) with '\n f'the accompanying exception traceback and '\n f'the representation of this object:\\n'\n f' {pith_value_repr}\\n'\n f'The bear groans in disappointment. If you feel similarly, '\n f'know that you are not alone.'\n )\nE beartype.roar._BeartypeCallHintPepRaiseDesynchronizationException: Die_if_unbearable() value {\"Had stood a pigmy's height;\", \"she would have ta'en\"} violates type hint typing.Container[str], but violation factory get_hint_object_violation() erroneously suggests this object satisfies this hint. Please report this desynchronization failure to the beartype issue tracker (https://github.com/beartype/beartype/issues) with the accompanying exception traceback and the representation of this object:\nE {\"Had stood a pigmy's height;\", \"she would have ta'en\"}\nE The bear groans in disappointment. If you feel similarly, know that you are not alone.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_c3c6wjoc/beartype/_check/error/errget.py:479\nError: beartype.roar._BeartypeCallHintPepRaiseDesynchronizationException: Die_if_unbearable() value {\"Had stood a pigmy's height;\", \"she would have ta'en\"} violates type hint typing.Container[str], but violation factory get_hint_object_violation() erroneously suggests this object satisfies this hint. Please report this desynchronization failure to the beartype issue tracker (https://github.com/beartype/beartype/issues) with the accompanying exception traceback and the representation of this object:\n {\"Had stood a pigmy's height;\", \"she would have ta'en\"}\nThe bear groans in disappointment. If you feel similarly, know that you are not alone.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n typehint.die_if_unbearable(pith, conf=conf)\n # Else, this pith satisfies this hint. In this case, assert this\n # raiser raises *NO* exception when passed this pith and hint.\n else:\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n if not violation_cause.cause_str_or_none:\n pith_value_repr = represent_object(\n obj=obj, max_len=_CAUSE_TRIM_OBJECT_REPR_MAX_LEN)\n> raise _BeartypeCallHintPepRaiseDesynchronizationException(\n f'{exception_prefix}violates type hint {repr(hint)}, '\n f'but violation factory get_hint_object_violation() '\n f'erroneously suggests this object satisfies this hint. '\n f'Please report this desynchronization failure to '\n f'the beartype issue tracker ({URL_ISSUES}) with '\n f'the accompanying exception traceback and '\n f'the representation of this object:\\n'\n f' {pith_value_repr}\\n'\n f'The bear groans in disappointment. If you feel similarly, '\n f'know that you are not alone.'\n )\nE beartype.roar._BeartypeCallHintPepRaiseDesynchronizationException: Die_if_unbearable() value {\"Had stood a pigmy's height;\", \"she would have ta'en\"} violates type hint typing.Container[str], but violation factory get_hint_object_violation() erroneously suggests this object satisfies this hint. Please report this desynchronization failure to the beartype issue tracker (https://github.com/beartype/beartype/issues) with the accompanying exception traceback and the representation of this object:\nE {\"Had stood a pigmy's height;\", \"she would have ta'en\"}\nE The bear groans in disappointment. If you feel similarly, know that you are not alone.\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #17: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #18: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.7520000000000002, "in_degree": 4, "true_in_degree": 7.68, "out_degree": 2, "betweenness": 1.4902887366686899e-05, "pagerank": 0.0007220372146867208, "harmonic": 0.004660087719298245, "bidirectional_harmonic": 0.23598128844839364, "degree": 6 }, "line_count": 17, "code_line_count": 17, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_decor/wrap/_wrapreturn.py", "function_name": "code_check_return", "test_info": { "success": false, "failed": 22, "passed": 1108, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_iilwt4n0/beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py:50\nError: assert False is True\n + where False = (.where_that_or at 0x7e6778fd0a40>)\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n @beartype\n def where_that_or() -> str:\n '''\n Arbitrary callable decorated by the :func:`beartype.beartype` decorator\n intentionally annotated by one or more arbitrary unignorable type hints\n to prevent that decorator from silently reducing to a noop.\n '''\n \n return 'In the still cave of the witch Poesy,'\n \n def thou_art_no_unbidden_guest() -> str:\n '''\n Arbitrary callable *not* decorated by the :func:`beartype.beartype`\n decorator intentionally annotated by one or more arbitrary unignorable\n type hints for parity with the prior callable.\n '''\n \n return 'Seeking among the shadows that pass by'\n \n # Assert this tester returns the expected results for these callables.\n> assert is_func_beartyped(where_that_or) is True\nE assert False is True\nE + where False = (.where_that_or at 0x7e6778fd0a40>)\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call\nLocation: /tmp/benchmark_iilwt4n0/beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py:203\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_nonpep_fail_return_call() -> None:\n '''\n Test type-checking for a function call unsuccessfully returning a value\n annotated with a PEP-noncompliant type hint.\n '''\n \n # Import this decorator.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintReturnViolation\n from pytest import raises\n \n # Annotated function to be type-checked.\n @beartype\n def necron(star_god: str, old_one: str) -> str:\n return 60e6\n \n # Call this function and assert the expected exception.\n> with raises(BeartypeCallHintReturnViolation):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #16: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #17: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #21: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #22: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py", "test_nonpep_fail_return_call" ] ] }, "complexity_info": { "centrality": { "distance_discount": 83.21971200000013, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 9, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.09582745927318306, "bidirectional_harmonic": 0.23198295217209716, "degree": 9 }, "line_count": 77, "code_line_count": 77, "cyclomatic": 9, "halstead_volume": 25.26619429851844, "halstead_difficulty": 1.2 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_convcoerce.py", "function_name": "coerce_hint_root", "test_info": { "success": false, "failed": 82, "passed": 1048, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: <@beartype(beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory) at 0x7cc9f64be700>:29\nError: beartype.roar.BeartypeCallHintParamViolation: Function beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory() parameter text='Thou art the path of that unresting sound\u2014' violates type hint None, as str 'Thou art the path of that unresting sound\u2014' not instance of .\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n @beartype\n def _is_exclamatory(text: str):\n return '!' in text\n \n # Dynamically generated lambda function. To exercise in-memory validators\n # dynamically defined outside of a standard on-disk module (e.g., \"smart\"\n # REPLs like IPython), this function's code is intentionally cached with\n # the standard \"linecache\" module.\n _is_commentary = make_func(\n func_name='_is_commentary',\n func_code=(\n \"\"\"_is_commentary = lambda text: text and text[-1] == ','\"\"\"),\n is_debug=True,\n )\n \n # ....................{ VALIDATORS }....................\n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined physically in this on-disk module.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined dynamically in-memory.\n IsCommentary = Is[_is_commentary]\n \n # Validator produced by subscripting this factory with non-lambda functions\n # satisfying the expected API.\n IsQuoted = Is[_is_quoted]\n IsExclamatory = Is[_is_exclamatory]\n IsFalseFake = Is[_is_false_fake]\n \n # Validator synthesized from the above validators with the domain-specific\n # language (DSL) supported by those validators.\n IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n \n # ....................{ ASSERTS ~ instance }....................\n # Assert these validators satisfy the expected API.\n assert isinstance(IsLengthy, BeartypeValidator)\n assert isinstance(IsLengthyOrUnquotedSentence, BeartypeValidator)\n \n # Assert a validator provides both non-empty code and code locals.\n assert isinstance(IsLengthy._is_valid_code, str)\n assert isinstance(IsLengthy._is_valid_code_locals, Mapping)\n assert bool(IsLengthy._is_valid_code)\n assert bool(IsLengthy._is_valid_code_locals)\n \n # ....................{ ASSERTS ~ is_valid }....................\n # Assert that non-composite validators perform the expected validation.\n assert IsLengthy.is_valid('Plunged in the battery-smoke') is False\n assert IsLengthy.is_valid('Right through the line they broke;') is True\n assert IsSentence.is_valid('Theirs not to make reply,') is False\n assert IsSentence.is_valid('Theirs but to do and die.') is True\n assert IsCommentary.is_valid('Remote, serene, and inaccessible:') is False\n assert IsCommentary.is_valid(\n 'Power dwells apart in its tranquillity,') is True\n assert IsQuoted.is_valid('Theirs not to reason why,') is False\n assert IsQuoted.is_valid('\"Forward, the Light Brigade!\"') is True\n> assert IsExclamatory.is_valid(\n 'Thou art the path of that unresting sound\u2014') is False\n\n> is_obj_valid = is_valid(obj)\n\n> > ???\nE beartype.roar.BeartypeCallHintParamViolation: Function beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory() parameter text='Thou art the path of that unresting sound\u2014' violates type hint None, as str 'Thou art the path of that unresting sound\u2014' not instance of .\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py::test_coerce_func_hint_root\nLocation: /tmp/benchmark_8czezj5h/beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py:48\nError: AssertionError: assert None is str\n + where None = (hint=str, pith_name='return', decor_meta=BeartypeDecorMeta(func=.one_legion_of_wild_thoughts at 0x7cc9f655b740>, conf=BeartypeConf()), exception_prefix='')\n\nTraceback:\n\n> def test_coerce_func_hint_root() -> None:\n '''\n Test the private\n :func:`beartype._check.convert._convcoerce.coerce_func_hint_root`\n coercer.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype import BeartypeConf\n from beartype._check.metadata.metadecor import BeartypeDecorMeta\n from beartype._check.convert._convcoerce import coerce_func_hint_root\n from beartype._data.func.datafuncarg import ARG_NAME_RETURN\n \n # ..................{ CALLABLES }..................\n def one_legion_of_wild_thoughts() -> str:\n '''\n Arbitrary callable with which to test this coercer.\n '''\n \n return 'whose wandering wings'\n \n # Beartype dataclass describing this callable.\n decor_meta = BeartypeDecorMeta()\n decor_meta.reinit(func=one_legion_of_wild_thoughts, conf=BeartypeConf())\n \n # ..................{ CORE }..................\n # Assert this coercer preserves an isinstanceable type as is.\n> assert coerce_func_hint_root(\n hint=str,\n pith_name=ARG_NAME_RETURN,\n decor_meta=decor_meta,\n exception_prefix='',\n ) is str\nE AssertionError: assert None is str\nE + where None = (hint=str, pith_name='return', decor_meta=BeartypeDecorMeta(func=.one_legion_of_wild_thoughts at 0x7cc9f655b740>, conf=BeartypeConf()), exception_prefix='')\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #75: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #76: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #77: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #78: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #79: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #80: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #81: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #82: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ], [ "beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py", "test_coerce_func_hint_root" ] ] }, "complexity_info": { "centrality": { "distance_discount": 10.310963199999996, "in_degree": 2, "true_in_degree": 6.160000000000002, "out_degree": 2, "betweenness": 0.00020593080724876442, "pagerank": 0.00055244133457382, "harmonic": 0.01259790100250627, "bidirectional_harmonic": 0.19636081206804978, "degree": 4 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/module/utilmodimport.py", "function_name": "import_module_attr_or_sentinel", "test_info": { "success": false, "failed": 60, "passed": 1032, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a00_core/test_a00_package.py::test_api_deprecations\nLocation: /tmp/benchmark_coc9kjo1/beartype_test/a00_unit/a00_core/test_a00_package.py:78\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_api_deprecations() -> None:\n '''\n Test all deprecated attributes importable from the public APIs of all\n subpackages of the :mod:`beartype` package (including itself).\n '''\n \n # Defer test-specific imports.\n from beartype._util.module.utilmodimport import import_module_attr\n from pytest import warns\n \n # Tuple of the fully-qualified names of all deprecated attributes.\n DEPRECATED_ATTRIBUTES = (\n 'beartype.abby',\n 'beartype.cave.HintPep585Type',\n 'beartype.roar.BeartypeAbbyException',\n 'beartype.roar.BeartypeAbbyHintViolation',\n 'beartype.roar.BeartypeAbbyTesterException',\n 'beartype.roar.BeartypeCallHintPepException',\n 'beartype.roar.BeartypeCallHintPepParamException',\n 'beartype.roar.BeartypeCallHintPepReturnException',\n 'beartype.roar.BeartypeDecorHintNonPepException',\n 'beartype.roar.BeartypeDecorHintNonPepNumPyException',\n 'beartype.roar.BeartypeDecorHintPep563Exception',\n 'beartype.roar.BeartypeDecorHintPepDeprecatedWarning',\n 'beartype.roar.BeartypeDecorPepException',\n )\n \n # For each deprecated attribute declared by beartype...\n for deprecated_attribute in DEPRECATED_ATTRIBUTES:\n # Assert that importing this attribute both emits the expected warning\n # and returns a non-\"None\" value.\n> with warns(DeprecationWarning):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/api/standard/test_utilapityping.py::test_import_typing_attr\nLocation: /tmp/benchmark_coc9kjo1/beartype/_util/api/standard/utiltyping.py:169\nError: beartype.roar._BeartypeUtilModuleException: Typing attributes \"typing.Union\" and \"typing_extensions.Union\" not found. Please either (A) install the \"typing_extensions\" package or (B) update to a newer Python version. We apologize for the inconvenience and hope you had a great dev cycle flying with Air Beartype, \"Your Grizzled Pal in the Friendly Skies.\"\n\nTraceback:\n\n> def test_import_typing_attr() -> None:\n '''\n Test the :func:`beartype._util.api.standard.utiltyping.import_typing_attr`\n importer.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilModuleException\n from beartype._util.api.standard.utiltyping import import_typing_attr\n from beartype._util.module.utilmodimport import (\n import_module_attr_or_sentinel)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_13\n from beartype._util.utilobject import SENTINEL\n from pytest import raises\n from typing import Union\n \n # ....................{ PASS }....................\n # Assert that dynamically importing \"typing.Union\" attribute (guaranteed to\n # be importable under all supported Python versions) is that attribute.\n> assert import_typing_attr('Union') is Union\n\n> def import_typing_attr(\n # Mandatory parameters.\n typing_attr_basename: str,\n \n # Optional parameters.\n exception_cls: TypeException = _BeartypeUtilModuleException,\n ) -> Any:\n '''\n Dynamically import and return the **typing attribute** (i.e., object\n declared at module scope by either the :mod:`typing` or\n :mod:`typing_extensions` modules) with the passed unqualified name if\n importable from one or more of these modules *or* raise an exception\n otherwise (i.e., if this attribute is *not* importable from these modules).\n \n This function is effectively memoized for efficiency.\n \n Parameters\n ----------\n typing_attr_basename : str\n Unqualified name of the attribute to be imported from a typing module.\n exception_cls : Type[Exception]\n Type of exception to be raised by this function. Defaults to\n :class:`._BeartypeUtilModuleException`.\n \n Returns\n -------\n object\n Attribute with this name dynamically imported from a typing module.\n \n Raises\n ------\n exception_cls\n If either:\n \n * This name is syntactically invalid.\n * Neither the :mod:`typing` nor :mod:`typing_extensions` modules\n declare an attribute with this name.\n \n Warns\n -----\n BeartypeModuleUnimportableWarning\n If any of these modules raise module-scoped exceptions at importation\n time. That said, the :mod:`typing` and :mod:`typing_extensions` modules\n are scrupulously tested and thus unlikely to raise such exceptions.\n \n See Also\n --------\n :func:`beartype._util.module.utilmodimport.import_module_typing_any_attr_or_none`\n Further details.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.module.utilmodtest import is_module\n \n # Attribute with this name imported from either the \"typing\" or\n # \"typing_extensions\" modules if one or more of these modules declare this\n # attribute *OR* \"None\" otherwise.\n #\n # Note that positional rather than keyword arguments are intentionally\n # passed to optimize memoization efficiency.\n typing_attr = import_typing_attr_or_none(\n typing_attr_basename, exception_cls)\n \n # If none of these modules declare this attribute...\n if typing_attr is None:\n # Substrings prefixing and suffixing exception messages raised below.\n EXCEPTION_PREFIX = (\n f'Typing attributes \"typing.{typing_attr_basename}\" and '\n f'\"typing_extensions.{typing_attr_basename}\" not found. '\n )\n EXCEPTION_SUFFIX = (\n 'We apologize for the inconvenience and hope you had a '\n 'great dev cycle flying with Air Beartype, '\n '\"Your Grizzled Pal in the Friendly Skies.\"'\n )\n \n # If the \"typing_extensions\" module is importable, raise an\n # appropriate exception.\n if is_module('typing_extensions'):\n raise exception_cls(\n f'{EXCEPTION_PREFIX} Please either '\n f'(A) update the \"typing_extensions\" package or '\n f'(B) update to a newer Python version. {EXCEPTION_SUFFIX}'\n )\n # Else, the \"typing_extensions\" module is unimportable. In this\n # case, raise an appropriate exception.\n else:\n> raise exception_cls(\n f'{EXCEPTION_PREFIX} Please either '\n f'(A) install the \"typing_extensions\" package or '\n f'(B) update to a newer Python version. {EXCEPTION_SUFFIX}'\n )\nE beartype.roar._BeartypeUtilModuleException: Typing attributes \"typing.Union\" and \"typing_extensions.Union\" not found. Please either (A) install the \"typing_extensions\" package or (B) update to a newer Python version. We apologize for the inconvenience and hope you had a great dev cycle flying with Air Beartype, \"Your Grizzled Pal in the Friendly Skies.\"\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep612.py::test_make_hint_pep612_concatenate_list_or_none", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #24: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #25: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #26: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #27: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #29: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #30: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #31: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #32: beartype_test/a00_unit/a20_util/module/test_utilmodimport.py::test_import_module_attr", "Failure #33: beartype_test/a00_unit/a20_util/module/test_utilmodimport.py::test_import_module_attr_or_none", "Failure #34: beartype_test/a00_unit/a20_util/module/test_utilmodimport.py::test_import_module_attr_or_sentinel", "Failure #35: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #36: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #37: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #38: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_numpy", "Failure #39: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #40: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py::test_make_forwardref_indexable_subtype", "Failure #41: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #42: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #43: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #44: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #45: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #56: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #57: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #58: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #59: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #60: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a00_core/test_a00_package.py", "test_api_deprecations" ], [ "beartype_test/a00_unit/a20_util/api/standard/test_utilapityping.py", "test_import_typing_attr" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.5200000000000005, "in_degree": 2, "true_in_degree": 5.84, "out_degree": 2, "betweenness": 0.000149028873666869, "pagerank": 0.0014872615730317216, "harmonic": 0.005756578947368421, "bidirectional_harmonic": 0.19293878635983966, "degree": 4 }, "line_count": 33, "code_line_count": 33, "cyclomatic": 7, "halstead_volume": 51.80615605397529, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/metadata/metasane.py", "function_name": "HintSanifiedData.__init__", "test_info": { "success": false, "failed": 10, "passed": 1120, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_aym8w7t9/beartype/_check/metadata/metasane.py:357\nError: AttributeError: 'HintSanifiedData' object has no attribute 'hint'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n assert TypeHint(hint_ignorable).is_ignorable is True\n \n # Assert this property:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # Hint to be tested.\n hint = hint_pep_meta.hint\n \n # True only if the @beartype decorator currently ignores this hint.\n hint_is_ignorable = hint_pep_meta.is_ignorable\n \n # If this hint is a type variable...\n #\n # Note that the @beartype decorator and the \"beartype.door\" API\n # currently disagree as to whether type variables are ignorable. From:\n # the perspective of:\n # * The low-level @beartype decorator, they mostly are.\n # * The high-level \"beartype.door\" API, they mostly are *NOT*.\n #\n # Since the \"hint_pep_meta.is_ignorable\" variable reflects the\n # perspective of the @beartype decorator rather than the \"beartype.door\"\n # API, further logic is needed to decide whether this type variable is\n # actually ignorable from the \"beartype.door\" perspective.\n if isinstance(hint, TypeVar):\n # Type hint synthesized from all bounded constraints parametrizing\n # this type variable if any *OR* \"None\" otherwise.\n hint_typevar_bound = get_hint_pep484_typevar_bound_or_none(hint)\n \n # This type hint is ignorable only if either...\n hint_is_ignorable = (\n # This type hint is unconstrained *OR*...\n hint_typevar_bound is None or\n # This type hint is constrained by one or more ignorable\n # constraints.\n sanify_hint_child(hint_typevar_bound) is Any\n )\n # Else, this hint is *NOT* a type variable.\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints. Most of these will be\n #\"BeartypeDoorNonpepException\", but there are some covariant type hints\n #(e.g. numpy.dtype[+ScalarType]) that will raise a \"not invariant\"\n #exception in the \"TypeVarTypeHint\" subclass.\n with suppress(BeartypeDoorException):\n> assert TypeHint(hint).is_ignorable is hint_is_ignorable\n\n> return sanify_hint_child(self._hint) is Any # pyright: ignore\n\n> hint_or_sane = reduce_hint(\n\n> hint, typevar_to_hint = unpack_hint_or_sane(\n\n> def unpack_hint_or_sane(\n # Mandatory parameters.\n hint_or_sane: HintOrHintSanifiedData,\n \n # Optional parameters.\n typevar_to_hint: TypeVarToHint = FROZENDICT_EMPTY,\n ) -> HintOrHintSanifiedDataUnpacked:\n '''\n 2-tuple ``(hint, typevar_to_hint)`` unpacked from the passed parameters.\n \n This low-level utility function \"unpacks\" (i.e., coerces, converts) the\n passed type hint and type variable lookup table.\n \n Parameters\n ----------\n hint_or_sane : HintSanifiedData\n Either a type hint *or* **sanified type hint metadata** (i.e.,\n :class:`.HintSanifiedData` object) to be unpacked.\n typevar_to_hint : TypeVarToHint\n **Type variable lookup table** (i.e., immutable dictionary mapping from\n the :pep:`484`-compliant **type variables** (i.e.,\n :class:`typing.TypeVar` objects) originally parametrizing the origins of\n all transitive parent hints of this hint to the corresponding child\n hints subscripting these parent hints). Defaults to\n :class:`.FROZENDICT_EMPTY`.\n \n Returns\n -------\n Tuple[Hint, TypeVarToHint]\n 2-tuple ``(hint, typevar_to_hint)`` where:\n \n * ``hint`` is the hint encapsulated by the passed parameters.\n * ``typevar_to_hint`` is the type variable lookup table encapsulated by\n the passed parameters. If the pair of type variable lookup tables\n encapsulated by both the passed ``typevar_to_hint`` parameter *and*\n ``hint_or_sane.typevar_to_hint`` instance variable are non-empty, then\n this ``typevar_to_hint`` item of this 2-tuple is a new type variable\n lookup table efficiently merging this parameter and instance variable\n (in that order).\n '''\n assert isinstance(typevar_to_hint, FrozenDict), (\n f'{repr(typevar_to_hint)} not frozen dictionary.')\n \n # If reducing this hint generated supplementary metadata...\n if isinstance(hint_or_sane, HintSanifiedData):\n # This lower-level hint reduced from this higher-level hint.\n> hint = hint_or_sane.hint\nE AttributeError: 'HintSanifiedData' object has no attribute 'hint'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable\nLocation: /tmp/benchmark_aym8w7t9/beartype/_check/metadata/metasane.py:357\nError: AttributeError: 'HintSanifiedData' object has no attribute 'hint'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_reduce_hint_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer with\n respect to ignorable hints.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # Defer test-specific imports.\n from beartype.typing import Any\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP_UNIGNORABLE)\n \n # Assert this tester accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n assert reduce_hint(hint_ignorable) is Any\n \n # Assert this tester rejects unignorable PEP-noncompliant type hints.\n for hint_unignorable in HINTS_NONPEP_UNIGNORABLE:\n assert reduce_hint(hint_unignorable) is not Any\n \n # Assert this tester:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # True only if this hint reduces to the ignorable \"Any\" singleton.\n> is_hint_ignorable = reduce_hint(hint_pep_meta.hint) is Any\n\n> hint, typevar_to_hint = unpack_hint_or_sane(\n\n> def unpack_hint_or_sane(\n # Mandatory parameters.\n hint_or_sane: HintOrHintSanifiedData,\n \n # Optional parameters.\n typevar_to_hint: TypeVarToHint = FROZENDICT_EMPTY,\n ) -> HintOrHintSanifiedDataUnpacked:\n '''\n 2-tuple ``(hint, typevar_to_hint)`` unpacked from the passed parameters.\n \n This low-level utility function \"unpacks\" (i.e., coerces, converts) the\n passed type hint and type variable lookup table.\n \n Parameters\n ----------\n hint_or_sane : HintSanifiedData\n Either a type hint *or* **sanified type hint metadata** (i.e.,\n :class:`.HintSanifiedData` object) to be unpacked.\n typevar_to_hint : TypeVarToHint\n **Type variable lookup table** (i.e., immutable dictionary mapping from\n the :pep:`484`-compliant **type variables** (i.e.,\n :class:`typing.TypeVar` objects) originally parametrizing the origins of\n all transitive parent hints of this hint to the corresponding child\n hints subscripting these parent hints). Defaults to\n :class:`.FROZENDICT_EMPTY`.\n \n Returns\n -------\n Tuple[Hint, TypeVarToHint]\n 2-tuple ``(hint, typevar_to_hint)`` where:\n \n * ``hint`` is the hint encapsulated by the passed parameters.\n * ``typevar_to_hint`` is the type variable lookup table encapsulated by\n the passed parameters. If the pair of type variable lookup tables\n encapsulated by both the passed ``typevar_to_hint`` parameter *and*\n ``hint_or_sane.typevar_to_hint`` instance variable are non-empty, then\n this ``typevar_to_hint`` item of this 2-tuple is a new type variable\n lookup table efficiently merging this parameter and instance variable\n (in that order).\n '''\n assert isinstance(typevar_to_hint, FrozenDict), (\n f'{repr(typevar_to_hint)} not frozen dictionary.')\n \n # If reducing this hint generated supplementary metadata...\n if isinstance(hint_or_sane, HintSanifiedData):\n # This lower-level hint reduced from this higher-level hint.\n> hint = hint_or_sane.hint\nE AttributeError: 'HintSanifiedData' object has no attribute 'hint'\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py::test_reduce_hint_pep484_subscripted_typevar_to_hint", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #10: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint_ignorable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 13.040000000000004, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0004740531345065671, "harmonic": 0.0, "bidirectional_harmonic": 0.19838932083997926, "degree": 2 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/error/errcause.py", "function_name": "ViolationCause.sanify_hint_child", "test_info": { "success": false, "failed": 50, "passed": 1080, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_w042q_tk/beartype/_check/error/errcause.py:607\nError: beartype.roar._BeartypeCallHintPepRaiseException: Die_if_unbearable() value ['Oboes\u2010obsoleting tines', 'Of language'] type hint None unsupported (i.e., no \"find_cause_\"-prefixed getter function defined for this category of hint).\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> def find_cause(self) -> 'ViolationCause':\n '''\n Output cause describing whether the pith of this input cause either\n satisfies or violates the type hint of this input cause.\n \n Design\n ------\n This method is intentionally generalized to support objects both\n satisfying and *not* satisfying hints as equally valid use cases. While\n the parent\n :func:`beartype._check.error.errget.get_func_pith_violation` function\n calling this method is *always* passed an object *not* satisfying the\n passed hint, this method is under no such constraints. Why? Because this\n method is also called to find which of an arbitrary number of objects\n transitively nested in the object passed to\n :func:`beartype._check.error.errget.get_func_pith_violation` fails to\n satisfy the corresponding hint transitively nested in the hint passed to\n that function.\n \n For example, consider the type hint ``List[Union[int, str]]`` describing\n a list whose items are either integers or strings and the list\n ``list(range(256)) + [False,]`` consisting of the integers 0 through 255\n followed by boolean :data:`False`. Since that list is a sequence, the\n :func:`._peperrorsequence.find_cause_sequence_args_1` function must\n decide the cause of this list's failure to comply with this hint by\n finding the list item that is neither an integer nor a string,\n implemented by by iteratively passing each list item to the\n :func:`._peperrorunion.find_cause_pep484604_union` function. Since the\n first 256 items of this list are integers satisfying this hint,\n :func:`._peperrorunion.find_cause_pep484604_union` returns a dataclass\n instance whose :attr:`cause` field is :data:`None` up to\n :func:`._peperrorsequence.find_cause_sequence_args_1` before finally\n finding the non-compliant boolean item and returning its cause.\n \n Returns\n -------\n ViolationCause\n Output cause type-checking this pith against this type hint.\n \n Raises\n ------\n _BeartypeCallHintPepRaiseException\n If this type hint is either:\n \n * PEP-noncompliant (e.g., tuple union).\n * PEP-compliant but no getter function has been implemented to\n handle this category of PEP-compliant type hint yet.\n '''\n \n # If this hint is ignorable, all possible objects satisfy this hint.\n # Since this hint *CANNOT* (by definition) be the cause of this failure,\n # return the same cause as is.\n if self.hint is Any:\n return self\n # Else, this hint is unignorable.\n \n # Getter function returning the desired string.\n cause_finder: Callable[[ViolationCause], ViolationCause] = None # type: ignore[assignment]\n \n #FIXME: Trivially simplify this method by:\n #* Define a new find_cause_nonpep() function elsewhere whose body is\n # the body of this \"if\" conditional branch.\n #* Register this function with HINT_SIGN_TO_GET_CAUSE_FUNC: e.g.,\n # HINT_SIGN_TO_GET_CAUSE_FUNC = {\n # ...,\n # None: find_cause_nonpep,\n # }\n #* Remove this \"if\" conditional branch.\n \n # If *NO* sign uniquely identifies this hint, this hint is either\n # PEP-noncompliant *OR* only contextually PEP-compliant in certain\n # specific use cases. In either case...\n if self.hint_sign is None:\n # Avoid circular import dependencies.\n from beartype._check.error._errtype import (\n find_cause_instance_types_tuple,\n find_cause_instance_type,\n )\n \n # If this hint is a tuple union, defer to the finder specific to\n # tuple unions.\n if isinstance(self.hint, tuple):\n cause_finder = find_cause_instance_types_tuple\n # Else, this hint is *NOT* a tuple union. In this case, assume this\n # hint to be an isinstanceable class by deferring to the finder\n # specific to isinstanceable classes.\n #\n # Note that if this assumption is *NOT* the case, this finder\n # subsequently raises a human-readable exception.\n else:\n cause_finder = find_cause_instance_type\n # Else, this hint is PEP-compliant.\n #\n # If this hint...\n elif (\n # Originates from an origin type and may thus be shallowly\n # type-checked against that type *AND is either...\n self.hint_sign in HINT_SIGNS_ORIGIN_ISINSTANCEABLE and (\n # Unsubscripted *OR*...\n not get_hint_pep_args(self.hint) or\n # Currently unsupported with deep type-checking...\n self.hint_sign not in HINT_SIGNS_SUPPORTED_DEEP\n )\n # Then this hint is both unsubscripted and originating from a standard\n # type origin. In this case, this hint was type-checked shallowly.\n ):\n # Avoid circular import dependencies.\n from beartype._check.error._errtype import (\n find_cause_type_instance_origin)\n \n # Defer to the getter function supporting hints originating from\n # origin types.\n cause_finder = find_cause_type_instance_origin\n # Else, this hint is either subscripted *OR* unsubscripted but not\n # originating from a standard type origin. In either case, this hint was\n # type-checked deeply.\n else:\n # Avoid circular import dependencies.\n from beartype._check.error._errmap import (\n HINT_SIGN_TO_GET_CAUSE_FUNC)\n \n # Getter function returning the desired string for this attribute if\n # any *OR* \"None\" otherwise.\n cause_finder = HINT_SIGN_TO_GET_CAUSE_FUNC.get(\n self.hint_sign, None) # type: ignore[arg-type]\n \n # If no such function has been implemented to handle this attribute\n # yet, raise an exception.\n if cause_finder is None:\n> raise _BeartypeCallHintPepRaiseException(\n f'{self.exception_prefix} type hint '\n f'{repr(self.hint)} unsupported (i.e., no '\n f'\"find_cause_\"-prefixed getter function defined '\n f'for this category of hint).'\n )\nE beartype.roar._BeartypeCallHintPepRaiseException: Die_if_unbearable() value ['Oboes\u2010obsoleting tines', 'Of language'] type hint None unsupported (i.e., no \"find_cause_\"-prefixed getter function defined for this category of hint).\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_w042q_tk/beartype/_check/error/errcause.py:607\nError: beartype.roar._BeartypeCallHintPepRaiseException: Die_if_unbearable() value ['Oboes\u2010obsoleting tines', 'Of language'] type hint None unsupported (i.e., no \"find_cause_\"-prefixed getter function defined for this category of hint).\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> def find_cause(self) -> 'ViolationCause':\n '''\n Output cause describing whether the pith of this input cause either\n satisfies or violates the type hint of this input cause.\n \n Design\n ------\n This method is intentionally generalized to support objects both\n satisfying and *not* satisfying hints as equally valid use cases. While\n the parent\n :func:`beartype._check.error.errget.get_func_pith_violation` function\n calling this method is *always* passed an object *not* satisfying the\n passed hint, this method is under no such constraints. Why? Because this\n method is also called to find which of an arbitrary number of objects\n transitively nested in the object passed to\n :func:`beartype._check.error.errget.get_func_pith_violation` fails to\n satisfy the corresponding hint transitively nested in the hint passed to\n that function.\n \n For example, consider the type hint ``List[Union[int, str]]`` describing\n a list whose items are either integers or strings and the list\n ``list(range(256)) + [False,]`` consisting of the integers 0 through 255\n followed by boolean :data:`False`. Since that list is a sequence, the\n :func:`._peperrorsequence.find_cause_sequence_args_1` function must\n decide the cause of this list's failure to comply with this hint by\n finding the list item that is neither an integer nor a string,\n implemented by by iteratively passing each list item to the\n :func:`._peperrorunion.find_cause_pep484604_union` function. Since the\n first 256 items of this list are integers satisfying this hint,\n :func:`._peperrorunion.find_cause_pep484604_union` returns a dataclass\n instance whose :attr:`cause` field is :data:`None` up to\n :func:`._peperrorsequence.find_cause_sequence_args_1` before finally\n finding the non-compliant boolean item and returning its cause.\n \n Returns\n -------\n ViolationCause\n Output cause type-checking this pith against this type hint.\n \n Raises\n ------\n _BeartypeCallHintPepRaiseException\n If this type hint is either:\n \n * PEP-noncompliant (e.g., tuple union).\n * PEP-compliant but no getter function has been implemented to\n handle this category of PEP-compliant type hint yet.\n '''\n \n # If this hint is ignorable, all possible objects satisfy this hint.\n # Since this hint *CANNOT* (by definition) be the cause of this failure,\n # return the same cause as is.\n if self.hint is Any:\n return self\n # Else, this hint is unignorable.\n \n # Getter function returning the desired string.\n cause_finder: Callable[[ViolationCause], ViolationCause] = None # type: ignore[assignment]\n \n #FIXME: Trivially simplify this method by:\n #* Define a new find_cause_nonpep() function elsewhere whose body is\n # the body of this \"if\" conditional branch.\n #* Register this function with HINT_SIGN_TO_GET_CAUSE_FUNC: e.g.,\n # HINT_SIGN_TO_GET_CAUSE_FUNC = {\n # ...,\n # None: find_cause_nonpep,\n # }\n #* Remove this \"if\" conditional branch.\n \n # If *NO* sign uniquely identifies this hint, this hint is either\n # PEP-noncompliant *OR* only contextually PEP-compliant in certain\n # specific use cases. In either case...\n if self.hint_sign is None:\n # Avoid circular import dependencies.\n from beartype._check.error._errtype import (\n find_cause_instance_types_tuple,\n find_cause_instance_type,\n )\n \n # If this hint is a tuple union, defer to the finder specific to\n # tuple unions.\n if isinstance(self.hint, tuple):\n cause_finder = find_cause_instance_types_tuple\n # Else, this hint is *NOT* a tuple union. In this case, assume this\n # hint to be an isinstanceable class by deferring to the finder\n # specific to isinstanceable classes.\n #\n # Note that if this assumption is *NOT* the case, this finder\n # subsequently raises a human-readable exception.\n else:\n cause_finder = find_cause_instance_type\n # Else, this hint is PEP-compliant.\n #\n # If this hint...\n elif (\n # Originates from an origin type and may thus be shallowly\n # type-checked against that type *AND is either...\n self.hint_sign in HINT_SIGNS_ORIGIN_ISINSTANCEABLE and (\n # Unsubscripted *OR*...\n not get_hint_pep_args(self.hint) or\n # Currently unsupported with deep type-checking...\n self.hint_sign not in HINT_SIGNS_SUPPORTED_DEEP\n )\n # Then this hint is both unsubscripted and originating from a standard\n # type origin. In this case, this hint was type-checked shallowly.\n ):\n # Avoid circular import dependencies.\n from beartype._check.error._errtype import (\n find_cause_type_instance_origin)\n \n # Defer to the getter function supporting hints originating from\n # origin types.\n cause_finder = find_cause_type_instance_origin\n # Else, this hint is either subscripted *OR* unsubscripted but not\n # originating from a standard type origin. In either case, this hint was\n # type-checked deeply.\n else:\n # Avoid circular import dependencies.\n from beartype._check.error._errmap import (\n HINT_SIGN_TO_GET_CAUSE_FUNC)\n \n # Getter function returning the desired string for this attribute if\n # any *OR* \"None\" otherwise.\n cause_finder = HINT_SIGN_TO_GET_CAUSE_FUNC.get(\n self.hint_sign, None) # type: ignore[arg-type]\n \n # If no such function has been implemented to handle this attribute\n # yet, raise an exception.\n if cause_finder is None:\n> raise _BeartypeCallHintPepRaiseException(\n f'{self.exception_prefix} type hint '\n f'{repr(self.hint)} unsupported (i.e., no '\n f'\"find_cause_\"-prefixed getter function defined '\n f'for this category of hint).'\n )\nE beartype.roar._BeartypeCallHintPepRaiseException: Die_if_unbearable() value ['Oboes\u2010obsoleting tines', 'Of language'] type hint None unsupported (i.e., no \"find_cause_\"-prefixed getter function defined for this category of hint).\n", "Failure #3: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #41: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #42: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #43: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #44: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #45: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #46: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #47: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #48: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #49: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #50: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 14.41698816, "in_degree": 1, "true_in_degree": 2.4400000000000004, "out_degree": 1, "betweenness": 8.12884765455649e-06, "pagerank": 0.00028048949203505856, "harmonic": 0.016183035714285712, "bidirectional_harmonic": 0.21853016774891787, "degree": 2 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/cls/pep/utilpep3119.py", "function_name": "is_type_isinstanceable", "test_info": { "success": false, "failed": 19, "passed": 1111, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep\nLocation: /tmp/benchmark_2uzpbqn0/beartype/_util/hint/nonpep/utilnonpeptest.py:204\nError: beartype.roar.BeartypeDecorHintNonpepException: Type hint (, ) either PEP-noncompliant or PEP-compliant but currently unsupported by @beartype. You suddenly feel encouraged to submit a feature request for this hint to our friendly issue tracker at:\n\thttps://github.com/beartype/beartype/issues\n\nTraceback:\n\n> def test_die_unless_hint_nonpep(not_hints_nonpep) -> None:\n '''\n Test the\n :func:`beartype._util.hint.nonpep.utilnonpeptest.die_unless_hint_nonpep`\n validator.\n \n Parameters\n ----------\n not_hints_nonpep : frozenset\n Frozen set of various objects that are *not* PEP-noncompliant type hints\n exercising well-known edge cases.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintNonpepException\n from beartype._util.hint.nonpep.utilnonpeptest import (\n die_unless_hint_nonpep)\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP,\n NOT_HINTS_UNHASHABLE,\n )\n from pytest import raises\n \n # ....................{ ASSERTS }....................\n # Assert this function accepts PEP-noncompliant type hints.\n for hint_nonpep in HINTS_NONPEP:\n> die_unless_hint_nonpep(hint_nonpep, is_forwardref_valid=True)\n\n> def die_unless_hint_nonpep(\n # Mandatory parameters.\n hint: object,\n \n # Optional parameters.\n is_forwardref_valid: bool = False,\n exception_cls: TypeException = BeartypeDecorHintNonpepException,\n exception_prefix: str = '',\n ) -> None:\n '''\n Raise an exception unless the passed object is a **PEP-noncompliant type\n hint** (i.e., :mod:`beartype`-specific annotation *not* compliant with\n annotation-centric PEPs).\n \n This validator is effectively (but technically *not*) memoized. See the\n :func:`beartype._util.hint.utilhinttest.die_unless_hint` validator.\n \n Parameters\n ----------\n hint : object\n Object to be validated.\n is_forwardref_valid : bool, optional\n :data:`True` only if this function permits this object to contain\n forward references. Defaults to :data:`False`. If this boolean is:\n \n * :data:`True`, this object is valid only when containing classes and/or\n forward references.\n * :data:`False`, this object is valid only when containing classes.\n exception_cls : type[Exception], optional\n Type of the exception to be raised by this function. Defaults to\n :class:`BeartypeDecorHintNonpepException`.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to the empty string.\n \n Raises\n ------\n exception_cls\n If this object is neither:\n \n * An **isinstanceable type** (i.e., standard class passable as the\n second parameter to the :func:`isinstance` builtin and thus typically\n *not* compliant with annotation-centric PEPs).\n * A **non-empty tuple** (i.e., semantic union of types) containing one\n or more:\n \n * Non-:mod:`typing` types.\n * If ``is_forwardref_valid`` is :data:`True`, forward references.\n '''\n \n # If this object is a PEP-noncompliant type hint, reduce to a noop.\n #\n # Note that this memoized call is intentionally passed positional rather\n # than keyword parameters to maximize efficiency.\n if is_hint_nonpep(hint, is_forwardref_valid):\n return\n # Else, this object is *NOT* a PEP-noncompliant type hint. In this case,\n # subsequent logic raises an exception specific to the passed parameters.\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # BEGIN: Synchronize changes here with the is_hint_nonpep() tester below.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not type.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # If this object is a class...\n if isinstance(hint, type):\n # If this class is *NOT* PEP-noncompliant (e.g., is either PEP-compliant\n # *OR* not isinstanceable), raise an exception.\n die_unless_hint_nonpep_type(\n hint=hint,\n is_forwardref_valid=is_forwardref_valid,\n exception_prefix=exception_prefix,\n exception_cls=exception_cls,\n )\n # If this class is PEP-noncompliant and thus isinstanceable.\n \n # Silently accept this isinstanceable class as is.\n return\n # Else, this object is *NOT* a class.\n #\n # If this object is a tuple, raise a tuple-specific exception.\n elif isinstance(hint, tuple):\n die_unless_hint_nonpep_tuple(\n hint=hint,\n is_forwardref_valid=is_forwardref_valid,\n exception_prefix=exception_prefix,\n exception_cls=exception_cls,\n )\n # Else, this object is neither a type nor type tuple.\n \n # Raise a generic exception.\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} either '\n f'PEP-noncompliant or PEP-compliant but currently '\n f'unsupported by @beartype. '\n f'You suddenly feel encouraged to submit a feature request '\n f'for this hint to our friendly issue tracker at:\\n'\n f'\\t{URL_ISSUES}'\n )\nE beartype.roar.BeartypeDecorHintNonpepException: Type hint (, ) either PEP-noncompliant or PEP-compliant but currently unsupported by @beartype. You suddenly feel encouraged to submit a feature request for this hint to our friendly issue tracker at:\nE \thttps://github.com/beartype/beartype/issues\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep\nLocation: /tmp/benchmark_2uzpbqn0/beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py:86\nError: AssertionError: assert False is True\n + where False = (hint=(, ), is_forwardref_valid=True)\n\nTraceback:\n\n> def test_is_hint_nonpep(not_hints_nonpep) -> None:\n '''\n Test the\n :func:`beartype._util.hint.nonpep.utilnonpeptest.is_hint_nonpep`\n tester.\n \n Parameters\n ----------\n not_hints_nonpep : frozenset\n Frozen set of various objects that are *not* PEP-noncompliant type hints\n exercising well-known edge cases.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.hint.nonpep.utilnonpeptest import is_hint_nonpep\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP,\n NOT_HINTS_UNHASHABLE,\n )\n \n # ....................{ ASSERTS }....................\n # Assert this function accepts PEP-noncompliant type hints.\n for hint_nonpep in HINTS_NONPEP:\n> assert is_hint_nonpep(\n hint=hint_nonpep, is_forwardref_valid=True) is True\nE AssertionError: assert False is True\nE + where False = (hint=(, ), is_forwardref_valid=True)\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #4: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #5: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #6: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #7: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py::test_get_hint_pep484_typevars_to_hints", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #15: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py", "test_die_unless_hint_nonpep" ], [ "beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py", "test_is_hint_nonpep" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.6, "in_degree": 2, "true_in_degree": 14.960000000000004, "out_degree": 2, "betweenness": 0.00015851252926385155, "pagerank": 0.0011159256010471643, "harmonic": 0.003289473684210526, "bidirectional_harmonic": 0.20195813871800777, "degree": 4 }, "line_count": 19, "code_line_count": 19, "cyclomatic": 6, "halstead_volume": 11.60964047443681, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/code/codemake.py", "function_name": "make_check_expr", "test_info": { "success": false, "failed": 88, "passed": 1042, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_yftes9qq/beartype/_check/checkmake.py:434\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_raiser_func_pith_check( # type: ignore[assignment]\n\n> return func(*args)\n\n> @callable_cached\n def make_code_raiser_func_pith_check(\n hint_or_sane: HintOrHintSanifiedData,\n conf: BeartypeConf,\n cls_stack: Optional[TypeStack],\n is_param: Optional[bool],\n ) -> CodeGenerated:\n '''\n Pure-Python code snippet of a type-checking raiser function type-checking a\n parameter or return of a decorated callable against the passed type hint\n under the passed beartype configuration by either raising a fatal exception\n *or* emitting a non-fatal warning when that parameter or return violates\n this hint.\n \n This factory is memoized for efficiency.\n \n Parameters\n ----------\n hint_or_sane : HintOrHintSanifiedData\n Either a sanified type hint *or* **sanified type hint metadata** (i.e.,\n :data:`.HintSanifiedData` object) to be type-checked.\n hint_insane : Hint\n **Insane** (i.e., pre-sanified) type hint to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n cls_stack : Optional[TypeStack]\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n is_param : Optional[bool]\n **Tri-state pith boolean.** Although it would be simpler for this\n factory to accept a pith name, doing so would also effectively unmemoize\n this factory as well as all higher-level factories calling this factory.\n If the code snippet generated and returned by this factory is\n type-checking a previously localized:\n \n * Parameter of a decorated callable, :data:`True`.\n * Return of a decorated callable, :data:`False`.\n * Arbitrary object passed to the :func:`beartype.door.die_if_unbearable`\n type-checker, :data:`None`.\n \n Defaults to :data:`None`.\n \n Returns\n -------\n CodeGenerated\n Tuple containing the Python code snippet dynamically generated by this\n code factory and metadata describing that code. See the\n :attr:`beartype._data.hint.datahinttyping.CodeGenerated` type hint.\n \n See Also\n --------\n :func:`.make_check_expr`\n Further details.\n '''\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # CAUTION: Synchronize with the make_code_hint_object_check() factory.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n # Python code snippet comprising a single boolean expression type-checking\n # an arbitrary object against this hint.\n> (\n code_expr,\n func_scope,\n hint_refs_type_basename,\n ) = make_check_expr(hint_or_sane, conf, cls_stack)\nE TypeError: cannot unpack non-iterable NoneType object\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark_yftes9qq/beartype/_check/checkmake.py:434\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_params = _code_check_args(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_raiser_func_pith_check(\n\n> return func(*args)\n\n> @callable_cached\n def make_code_raiser_func_pith_check(\n hint_or_sane: HintOrHintSanifiedData,\n conf: BeartypeConf,\n cls_stack: Optional[TypeStack],\n is_param: Optional[bool],\n ) -> CodeGenerated:\n '''\n Pure-Python code snippet of a type-checking raiser function type-checking a\n parameter or return of a decorated callable against the passed type hint\n under the passed beartype configuration by either raising a fatal exception\n *or* emitting a non-fatal warning when that parameter or return violates\n this hint.\n \n This factory is memoized for efficiency.\n \n Parameters\n ----------\n hint_or_sane : HintOrHintSanifiedData\n Either a sanified type hint *or* **sanified type hint metadata** (i.e.,\n :data:`.HintSanifiedData` object) to be type-checked.\n hint_insane : Hint\n **Insane** (i.e., pre-sanified) type hint to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n cls_stack : Optional[TypeStack]\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n is_param : Optional[bool]\n **Tri-state pith boolean.** Although it would be simpler for this\n factory to accept a pith name, doing so would also effectively unmemoize\n this factory as well as all higher-level factories calling this factory.\n If the code snippet generated and returned by this factory is\n type-checking a previously localized:\n \n * Parameter of a decorated callable, :data:`True`.\n * Return of a decorated callable, :data:`False`.\n * Arbitrary object passed to the :func:`beartype.door.die_if_unbearable`\n type-checker, :data:`None`.\n \n Defaults to :data:`None`.\n \n Returns\n -------\n CodeGenerated\n Tuple containing the Python code snippet dynamically generated by this\n code factory and metadata describing that code. See the\n :attr:`beartype._data.hint.datahinttyping.CodeGenerated` type hint.\n \n See Also\n --------\n :func:`.make_check_expr`\n Further details.\n '''\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # CAUTION: Synchronize with the make_code_hint_object_check() factory.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n # Python code snippet comprising a single boolean expression type-checking\n # an arbitrary object against this hint.\n> (\n code_expr,\n func_scope,\n hint_refs_type_basename,\n ) = make_check_expr(hint_or_sane, conf, cls_stack)\nE TypeError: cannot unpack non-iterable NoneType object\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #78: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #79: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #80: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #81: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #82: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #83: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #84: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #85: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #86: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #87: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #88: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 69.38552320000008, "in_degree": 3, "true_in_degree": 4.6, "out_degree": 30, "betweenness": 0.0005527616405098414, "pagerank": 0.0006838088396278052, "harmonic": 0.10193452380952384, "bidirectional_harmonic": 0.32400858918128667, "degree": 33 }, "line_count": 453, "code_line_count": 453, "cyclomatic": 45, "halstead_volume": 882.4815414263342, "halstead_difficulty": 8.571428571428571 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextlabel.py", "function_name": "label_pith_value", "test_info": { "success": false, "failed": 7, "passed": 1123, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_pith\nLocation: /tmp/benchmark_bidk22gl/beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py:140\nError: AssertionError: assert '42' in '\\x1b[1m\\x1b[33mint \\x1b[0mNone'\n\nTraceback:\n\n> def test_represent_pith() -> None:\n '''\n Test the\n Test the :func:`beartype._util.text.utiltextrepr.represent_pith` function.\n '''\n \n # Defer test-specific imports.\n from beartype._util.text.utiltextrepr import represent_pith\n \n # Custom type to be represented below.\n class CustomType(object):\n def __repr__(self) -> str: return (\n 'Collaborator\u2010ily brambling unspiritually')\n \n # Assert this representer represents builtin types in the expected way.\n repr_builtin = represent_pith(42)\n assert 'int' in repr_builtin\n> assert '42' in repr_builtin\nE AssertionError: assert '42' in '\\x1b[1m\\x1b[33mint \\x1b[0mNone'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_bidk22gl/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:187\nError: assert \"['Oboes\u2010obsoleting tines', 'Of language']\" in 'Die_if_unbearable() value None violates type hint typing.Hashable, as list None not instance of .'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n> assert pith_repr in exception_message\nE assert \"['Oboes\u2010obsoleting tines', 'Of language']\" in 'Die_if_unbearable() value None violates type hint typing.Hashable, as list None not instance of .'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #4: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py", "test_represent_pith" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.3920000000000003, "in_degree": 2, "true_in_degree": 14.960000000000004, "out_degree": 2, "betweenness": 0.00012735194658805167, "pagerank": 0.0010067974076218623, "harmonic": 0.005482456140350878, "bidirectional_harmonic": 0.23226437305384698, "degree": 4 }, "line_count": 9, "code_line_count": 9, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/forward/fwdmain.py", "function_name": "_resolve_func_scope_forward", "test_info": { "success": false, "failed": 20, "passed": 1110, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563\nLocation: /tmp/benchmark_ugzhj45q/beartype/_check/forward/fwdmain.py:604\nError: beartype.roar.BeartypePep563Exception: Stringified type hint 'ExpandAbove' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_ugzhj45q/beartype/_check/forward/fwdmain.py\", line 488, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \nNameError: name 'ExpandAbove' is not defined\n\nTraceback:\n\n> def test_resolve_pep563() -> None:\n '''\n Test the :func:`beartype.peps.resolve_pep563` resolver.\n '''\n \n # .....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.peps import resolve_pep563\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n BeartypePep563Exception,\n )\n from beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve import (\n ToAvariceOrPride,\n FrequentWith,\n their_starry_domes,\n )\n from pytest import raises\n \n # .....................{ LOCALS }....................\n # Arbitrary instance of the generic accepted by the function called below.\n numberless_and_immeasurable_halls = ToAvariceOrPride()\n \n # Arbitrary instance of the class defining various problematic methods\n # called below.\n and_thrones_radiant_with_chrysolite = FrequentWith()\n \n # .....................{ PASS }....................\n # Assert that this function unsuccessfully raises the expected exception\n # *BEFORE* resolving all PEP 563-postponed type hints annotating these\n # callables.\n with raises(BeartypeDecorHintForwardRefException):\n their_starry_domes(numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.until_the_doves(\n numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.crystal_column(\n 'Nor had that scene of ampler majesty')\n \n # Resolve all PEP 563-postponed type hints annotating these callables.\n> resolve_pep563(their_starry_domes)\n\n> arg_name_to_hint[arg_name] = resolve_hint(\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypePep563Exception: Stringified type hint 'ExpandAbove' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_ugzhj45q/beartype/_check/forward/fwdmain.py\", line 488, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE NameError: name 'ExpandAbove' is not defined\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487\nLocation: /tmp/benchmark_ugzhj45q/beartype/_check/forward/fwdmain.py:604\nError: beartype.roar.BeartypeDecorHintForwardRefException: Method a00_type.test_decortype_descriptor.test_decor_type_descriptor_custom_pep487.AndAllThoseActs.doth_ease_its() return stringified type hint 'Optional[HeartOfLove]' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_ugzhj45q/beartype/_check/forward/fwdmain.py\", line 488, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \nNameError: name 'HeartOfLove' is not defined\n\nTraceback:\n\n> def test_decor_type_descriptor_custom_pep487() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on :pep:`487`-compliant\n **custom pure-Python method descriptors** (i.e., methods decorated by\n pure-Python types satisfying the :pep:`487`-compliant descriptor protocol by\n declaring at least the ``__set_name__()`` dunder method).\n \n This unit test exercises an inscrutable `edge case`_ induced by\n :func:`beartype.beartype`-decorated classes defining at least two kinds of\n seemingly unrelated methods that nonetheless *could* interact harmfully:\n \n * A method decorated by a :pep:`487`-compliant custom pure-Python method\n descriptor declaring at least the ``__set_name__()`` dunder method.\n * A method annotated by a stringified forward reference to a currently\n undefined type, which :func:`beartype.beartype` then internally coerces\n into a **forward reference proxy** (i.e.,\n :class:`beartype._check.forward.reference.fwdrefabc.BeartypeForwardRefABC`\n subclass) encapsulating that undefined type.\n \n For obscure reasons that are difficult to fully explain within the expected\n lifetime of the Universe, this interaction causes the ``__set_name__()``\n dunder method of the descriptor decorating the first method to be\n erroneously called multiple times with erroneous owners. Although seemingly\n innocuous, this issue is indicative of an explosive increase in the space\n and time complexity associated with forward reference proxies. Ergo, this\n issue is actually quite serious. It is imperative this *never* happen again.\n \n .. _edge case:\n https://github.com/beartype/beartype/issues/488#issuecomment-2650865299\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.typing import Optional\n from collections.abc import Callable\n \n # ....................{ DESCRIPTORS }....................\n class setname_descriptor(object):\n '''\n **Setname method descriptor** (i.e., pure-Python object whose\n :pep:`487`-compliant :meth:`__set_name__` dunder method raises an\n exception when called more than once as a regression check against this\n issue silently reverting).\n \n Attributes\n ----------\n _is_set_name_called : bool\n :data:`True` only if Python has already called the\n :pep:`487`-compliant :meth:`__set_name__` dunder method.\n '''\n \n def __init__(self, func: Callable) -> None:\n '''\n Initialize this method descriptor by doing... absolutely nothing.\n '''\n \n # Record that Python has yet to call __set_name__().\n self._is_set_name_called = False\n \n \n def __call__(self) -> None:\n '''\n Call this method descriptor by doing... absolutely nothing.\n '''\n \n # Doing nothing never felt so good, so right, so... clean.\n pass\n \n \n def __set_name__(self, owner: type, name: str) -> None:\n '''\n :pep:`487`-compliant callback called by Python itself with metadata\n describing the current decoration of an external method by this\n descriptor.\n \n Parameters\n ----------\n owner : type\n Parent class declaring that external method.\n name : str\n Unqualified basename of that external method.\n '''\n \n # If Python has already called this dunder method, this issue has\n # reverted. In this case, raise an exception.\n if self._is_set_name_called:\n raise ValueError(\n 'PEP 487 setname_descriptor.__set_name__() dunder method '\n 'already called.'\n )\n # Else, this is Python's first call of this dunder method.\n \n # Record that Python has already called this dunder method.\n self._is_set_name_called = True\n \n # ....................{ CLASSES }....................\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_type(obj, **kwargs) # type: ignore[return-value]\n\n> attr_value_beartyped = beartype_object( # type: ignore[type-var]\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> hint_or_sane = sanify_hint_root_func(\n\n> hint = decor_meta.func_arg_name_to_hint[pith_name] = coerce_func_hint_root(\n\n> hint = resolve_hint( # pyright: ignore\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypeDecorHintForwardRefException: Method a00_type.test_decortype_descriptor.test_decor_type_descriptor_custom_pep487.AndAllThoseActs.doth_ease_its() return stringified type hint 'Optional[HeartOfLove]' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_ugzhj45q/beartype/_check/forward/fwdmain.py\", line 488, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE NameError: name 'HeartOfLove' is not defined\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #16: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py", "test_resolve_pep563" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py", "test_decor_type_descriptor_custom_pep487" ] ] }, "complexity_info": { "centrality": { "distance_discount": 20.781824000000015, "in_degree": 1, "true_in_degree": 3.24, "out_degree": 7, "betweenness": 0.000149028873666869, "pagerank": 0.00033722112396802596, "harmonic": 0.028974780701754386, "bidirectional_harmonic": 0.2389763471177945, "degree": 8 }, "line_count": 40, "code_line_count": 40, "cyclomatic": 6, "halstead_volume": 22.458839376460833, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfunccodeobj.py", "function_name": "get_func_codeobj_basename", "test_info": { "success": false, "failed": 21, "passed": 1109, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/standard/test_utilapicontextlib.py::test_get_func_contextlib_contextmanager_or_none\nLocation: /tmp/benchmark_h38uj7ai/beartype_test/a00_unit/a20_util/api/standard/test_utilapicontextlib.py:49\nError: assert is \n + where = ()\n\nTraceback:\n\n> def test_get_func_contextlib_contextmanager_or_none() -> None:\n '''\n Test the\n :func:`beartype._util.api.standard.utilcontextlib.get_func_contextlib_contextmanager_or_none`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.api.standard.utilcontextlib import (\n get_func_contextlib_contextmanager_or_none)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_11\n from beartype_test.a00_unit.data.data_type import (\n async_context_manager_factory,\n context_manager_factory,\n decorator_isomorphic,\n decorator_nonisomorphic,\n function,\n )\n from contextlib import (\n asynccontextmanager,\n contextmanager,\n )\n \n # ....................{ PASS }....................\n # Assert this getter either accepts or rejects isomorphic closures created\n # and returned by @contextlib decorators conditionally depending on whether\n # the active Python interpreter targets Python >= 3.11 or not.\n if IS_PYTHON_AT_LEAST_3_11:\n> assert get_func_contextlib_contextmanager_or_none(\n async_context_manager_factory) is asynccontextmanager\nE assert is \nE + where = ()\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom\nLocation: /tmp/benchmark_h38uj7ai/beartype/_util/func/utilfuncwrap.py:62\nError: beartype.roar._BeartypeUtilCallableWrapperException: Callable .AndStillTheseTwo.were_postured_motionless at 0x7bc2de422ca0> not wrapper (i.e., has no \"__wrapped__\" dunder attribute defined by @functools.wrap or functools.update_wrapper()).\n\nTraceback:\n\n> def test_decor_type_descriptor_custom() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on **custom pure-Python method\n descriptors** (i.e., methods decorated by pure-Python types satisfying the\n descriptor protocol by declaring at least the ``__get__()`` dunder method).\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from beartype.typing import Optional\n from beartype._util.utilobject import SENTINEL\n from collections.abc import Callable\n from functools import wraps\n from pytest import raises\n \n # ....................{ DESCRIPTORS }....................\n class flexible_descriptor(object):\n '''\n **Flexible class or bound method descriptor** (i.e., pure-Python object\n whose ``__get__()`` dunder method transparently supports access of the\n underlying pure-Python callable decorated by this descriptor as both a\n class method *and* bound method).\n '''\n \n def __init__(self, func: Callable) -> None:\n '''\n Initialize this method descriptor with the passed function.\n '''\n \n # Classify all passed parameters.\n # self._func = beartype(func)\n self._func = func\n \n \n def __get__(\n self,\n func_self: object = SENTINEL,\n func_cls: Optional[type] = SENTINEL,\n ) -> Callable:\n '''\n **Flexible class or bound method descriptor getter** (i.e., method\n decorating the low-level callable originally decorated by this\n descriptor by being passed to the :meth:`__init__` method with a\n higher-level wrapper, which this method then returns).\n '''\n \n # First parameter passed to the low-level callable decorated by this\n # descriptor, conditionally depending on whether this callable is\n # called as:\n # * A class method, in which case this parameter is \"cls\".\n # * A bound method, in which case this parameter is \"self\".\n self_or_cls = func_self if func_self is not None else func_cls\n \n # @beartype\n @wraps(self._func)\n def _func_flexible(*args, **kwargs):\n '''\n High-level closure wrapping the low-level callable decorated by\n this descriptor with:\n \n * :func:`beartype.beartype`-based type-checking.\n * Functionality enabling that callable to be flexibly called as\n either a class *or* bound method.\n '''\n \n return self._func(self_or_cls, *args, **kwargs)\n \n # Return this closure.\n return _func_flexible\n \n # ....................{ CLASSES }....................\n @beartype\n> class AndStillTheseTwo(object):\n\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return _beartype_func_contextlib_contextmanager( # type: ignore[return-value]\n\n> generator = unwrap_func_once(func) # type: ignore[arg-type]\n\n> def unwrap_func_once(func: Callable) -> Callable:\n '''\n Immediate **wrappee** (i.e., callable wrapped by the passed wrapper\n callable) of the passed higher-level **wrapper** (i.e., callable wrapping\n the wrappee callable to be returned) if the passed callable is a wrapper\n *or* that callable as is otherwise (i.e., if that callable is *not* a\n wrapper).\n \n Specifically, this getter undoes the work performed by any of the following:\n \n * A single use of the :func:`functools.wrap` decorator on the wrappee\n callable to be returned.\n * A single call to the :func:`functools.update_wrapper` function on the\n wrappee callable to be returned.\n \n Parameters\n ----------\n func : Callable\n Wrapper callable to be unwrapped.\n \n Returns\n -------\n Callable\n The immediate wrappee callable wrapped by the passed wrapper callable.\n \n Raises\n ------\n _BeartypeUtilCallableWrapperException\n If the passed callable is *not* a wrapper.\n '''\n \n # Immediate wrappee callable wrapped by the passed wrapper callable if any\n # *OR* \"None\" otherwise (i.e., if that callable is *NOT* a wrapper).\n func_wrappee = getattr(func, '__wrapped__', None)\n \n # If that callable is *NOT* a wrapper, raise an exception.\n if func_wrappee is None:\n> raise _BeartypeUtilCallableWrapperException(\n f'Callable {repr(func)} not wrapper '\n f'(i.e., has no \"__wrapped__\" dunder attribute '\n f'defined by @functools.wrap or functools.update_wrapper()).'\n )\nE beartype.roar._BeartypeUtilCallableWrapperException: Callable .AndStillTheseTwo.were_postured_motionless at 0x7bc2de422ca0> not wrapper (i.e., has no \"__wrapped__\" dunder attribute defined by @functools.wrap or functools.update_wrapper()).\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #21: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/standard/test_utilapicontextlib.py", "test_get_func_contextlib_contextmanager_or_none" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py", "test_decor_type_descriptor_custom" ] ] }, "complexity_info": { "centrality": { "distance_discount": 4.5376, "in_degree": 2, "true_in_degree": 3.44, "out_degree": 1, "betweenness": 1.0838463539408653e-05, "pagerank": 0.0003589543668382755, "harmonic": 0.005893640350877193, "bidirectional_harmonic": 0.21357299498746946, "degree": 3 }, "line_count": 9, "code_line_count": 9, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484/pep484generic.py", "function_name": "is_hint_pep484_generic_subscripted", "test_info": { "success": false, "failed": 26, "passed": 1104, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_rhzufkxg/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:705\nError: beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep484GenericST[int, float] pseudo-superclasses not found.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def get_hint_pep484585_generic_args_full(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n hint_base_target: Optional[Hint] = None,\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> TupleHints:\n '''\n Tuple of the one or more **full child type hints** (i.e., complete tuple of\n *all* type hints directly subscripting both the passed generic *and*\n one or more pseudo-superclasses of this generic) transitively subscripting\n the passed :pep:`484`- or :pep:`585`-compliant **generic** (i.e., class\n superficially subclassing at least one PEP-compliant type hint that is\n possibly *not* an actual class) if this object is a generic *or* raise an\n exception otherwise (i.e., if this object is not a generic).\n \n This getter greedily replaces in the passed tuple as many abstract\n :pep:`484`-compliant **type variables** (i.e., :class:`typing.TypeVar`\n objects) as there are concrete child type hints directly subscripting the\n passed generic. Doing so effectively \"bubbles up\" these concrete children up\n the class hierarchy into the \"empty placeholders\" established by the type\n variables transitively subscripting all pseudo-superclasses of this generic.\n \n This getter is guaranteed to return a non-empty tuple. By definition, a\n generic subclasses one or more generic superclasses necessarily subscripted\n by one or more child type hints.\n \n This getter is memoized for efficiency.\n \n Caveats\n -------\n **This getter is computationally complex in both space and time.** This\n getter exhibits:\n \n * Amortized :math:`O(1)` constant time complexity, thanks to memoization.\n * Non-amortized worst-case :math:`O(jk)` quadratic time complexity for:\n \n * :math:`j` the largest number of child type hints transitively\n subscripting a pseudo-superclass of this generic.\n * :math:`k` the total number of transitive pseudo-superclasses of this\n generic.\n \n **This getter is currently implemented with recursion.** Doing so yields a\n relatively trivial algorithm at a relatively non-trivial increase in runtime\n overhead, due to overhead associated with function calls in Python.\n \n Parameters\n ----------\n hint : object\n Generic type hint to be inspected.\n hint_base_target : Optional[Hint] = None\n **Target pseudo-superclass** (i.e., erased transitive pseudo-superclass\n of the passed generic to specifically search, filter, and return the\n child type hints of). Defaults to :data:`None`. Specifically:\n \n * If this parameter is :data:`None`, this getter returns the complete\n tuple of *all* type hints directly subscripting both the passed\n generic *and* one or more pseudo-superclasses of this generic.\n * If this parameter is *not* :data:`None`, this getter returns the\n partial tuple of *only* type hints directly subscripting both the\n passed generic *and* this passed pseudo-superclass of this generic.\n \n A target pseudo-superclass is passed to deduce whether two generics are\n related according to the :func:`beartype.door.is_subhint` relation. If\n all child type hints in the tuple returned by this getter (when passed\n some generic and its pseudo-superclass) are subhints of all child type\n hints in the tuple returned by this getter passed *only* that\n pseudo-superclass, then that generic is necessarily a subhint of that\n pseudo-superclass. Look. Just go with it, people.\n \n Lastly, note that this getter intentionally ignores *all* child hints\n subscripting this target pseudo-superclass. For search purposes, *any*\n child hints subscripting this target pseudo-superclass are not only\n irrelevant but harmful -- promoting false negatives in higher-level\n functions (e.g., :func:`beartype.door.is_subhint`) internally leveraging\n this lower-level getter. Ignoring these child hints is thus imperative.\n Since deciding child hint compatibility between the passed generic and\n this target pseudo-superclass is a non-trivial decision problem, this\n lower-level getter defers that problem to the caller by unconditionally\n returning the same result regardless of child hints subscripting this\n target pseudo-superclass.\n \n For example, consider the :pep:`484`-compliant :obj:`typing.Any`.\n Clearly, this getter should return the same tuple when passed an\n unsubscripted target pseudo-superclass as when passed a target\n pseudo-superclass subscripted by :obj:`typing.Any`: e.g.,\n \n .. code-block:: pycon\n \n >>> from typing import Any, Generic\n >>> class MuhGeneric[S, T](Generic[S, T]): pass\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[Any])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[S, T])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[int, float])\n (S, T)\n \n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`.BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n Tuple[Hint, ...]\n Tuple of the one or more full child type hints transitively subscripting\n this generic.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * Neither a :pep:`484`- nor :pep:`585`-compliant generic.\n * A :pep:`484`- or :pep:`585`-compliant generic subclassing *no*\n pseudo-superclasses.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.typing import Generic, TypeVar\n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_args_full)\n \n >>> S = TypeVar('S')\n >>> T = TypeVar('T')\n \n >>> class GenericSuperclass(Generic[S], list[T]): pass\n >>> class GenericList(list[complex]): pass\n >>> class GenericSubclass(GenericSuperclass[int, T], GenericList): pass\n \n >>> get_hint_pep484585_generic_args_full(GenericSuperclass)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(GenericSuperclass[int, float])\n (int, float)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass)\n (int, T, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n '''\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception type.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # ....................{ IMPORTS }....................\n # Avoid circular import dependencies.\n from beartype._util.hint.pep.utilpepget import get_hint_pep_args\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic_user)\n \n # ....................{ PREAMBLE }....................\n # If the caller explicitly passed a pseudo-superclass target...\n #\n # Note that this is the common case for this getter and thus tested first.\n if hint_base_target:\n hint_base_target = (\n # If this pseudo-superclass target is this generic, this\n # pseudo-superclass target is effectively meaningless (albeit\n # technically valid). In this case, silently ignore this\n # pseudo-superclass target.\n None\n if hint is hint_base_target else\n # Else, this pseudo-superclass target is *NOT* this generic. In this\n # case, the unsubscripted generic underlying this possibly\n # subscripted target pseudo-superclass generic. See the docstring.\n get_hint_pep484585_generic_type( # pyright: ignore\n hint=hint_base_target,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n )\n # Else, the caller passed *NO* pseudosuperclass target. In this case...\n \n # ....................{ LOCALS }....................\n # Metadata describing the passed generic, used to seed the depth-first\n # search (DFS) below with the first pseudo-superclass to be visited.\n hint_root_data = [\n # This generic.\n hint,\n \n # Metadata describing the direct parent pseudo-superclass of this\n # generic. By definition, this generic is the root of this n-ary tree\n # and thus has *NO* parent (either direct or indirect).\n None,\n ]\n \n # Unvisited pseudo-superclass stack (i.e., efficiently poppable list of\n # metadata describing *ALL* unvisited transitive pseudo-superclasses of this\n # generic, intentionally reordered in reverse order to enable the\n # non-recursive depth-first search (DFS) performed below to both visit and\n # pop these pseudo-superclasses in the expected order), seeded with metadata\n # describing the passed generic.\n #\n # Each item of this stack is a list of metadata describing an unvisited\n # transitive pseudo-superclass of this generic such that this list is\n # either:\n # * If this pseudo-superclass has yet to be visited by this DFS, a 2-list\n # \"(hint, hint_super_data)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is either:\n # * If this pseudo-superclass has a parent pseudo-superclass, the item\n # of this stack describing that parent pseudo-superclass.\n # * Else, this pseudo-superclass is the passed generic. Since this\n # generic has *NO* parent pseudo-superclass, \"None\".\n # * If this pseudo-superclass is itself a user-defined generic (i.e.,\n # defined by a third-party downstream package) that has already been\n # visited by this DFS, a 4-list \"(hint, hint_super_data, hint_args_stack,\n # hint_args_full)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is as defined above.\n # * \"hint_args_stack\" is this pseudo-superclass' direct child hint stack\n # (i.e., list of the zero or more child hints directly subscripting this\n # pseudo-superclass in reverse order, embodying an efficiently poppable\n # stack of these hints), popped off while recursing up from the child\n # pseudo-superclasses of this pseudo-superclass.\n # * \"hint_args_full\" is the list of zero or more child hints transitively\n # subscripting this pseudo-superclass, defined while recursing up from\n # the child pseudo-superclasses of this pseudo-superclass.\n #\n # In short, there be dragons here -- albeit extremely efficient dragons.\n hint_bases_data: _HintBasesData = [hint_root_data]\n \n # Dictionary mapping from each previously observed PEP 484-compliant type\n # variable (i.e., \"typing.TypeVar\" object) subscripting a transitive\n # pseudo-superclass of this generic to the corresponding child hint \"bubbled\n # up\" from a subclass of that pseudo-superclass into that type variable.\n #\n # This dictionary enables the DFS below to reliably \"bubble up\" a single\n # child hint to the same type variable appearing multiple times throughout a\n # generics hierarchy. For example, this dictionary enables the \"int\" child\n # hint subscripting the \"GenericList\" generic to be \"bubbled up\" into the\n # type variable \"T\" subscripting the pseudo-superclasses \"List\" and\n # \"Generic\" of this generic: e.g.,\n # >>> class GenericList[T](List[T], Generic[T]): pass\n # >>> get_hint_pep484585_generic_args_full(GenericList[int])\n # (int, int)\n #\n # For the above call, this contents of this dictionary resemble:\n # typevar_to_hint = {T: int}\n typevar_to_hint: TypeVarToHint = {}\n \n # ....................{ LOCALS ~ target }....................\n # List of zero or more child hints transitively subscripting the passed\n # target pseudo-superclass of this generic if this pseudo-superclass has\n # already been visited by the DFS below *OR* \"None\" otherwise (i.e., if this\n # pseudo-superclass has yet to be visited by this DFS).\n hint_base_target_args_full: Optional[ListHints] = None\n \n # True only if the pseudo-superclass currently visited by the DFS below is\n # still transitively subscripted by one or more PEP 484-compliant type\n # variables (i.e., \"TypeVar\" objects) that have yet to be replaced by\n # concrete hints of a parent pseudo-superclass of that pseudo-superclass.\n is_hint_base_arg_typevar = False\n \n # ....................{ SEARCH }....................\n # Iteration simulating a recursive depth-first search (DFS), efficiently\n # deciding the tuple of all child hints transitively subscripting the\n # desired pseudo-superclass of this generic.\n \n # With at least one transitive pseudo-superclass of this generic remains\n # unvisited...\n while hint_bases_data:\n # Metadata describing the currently visited transitive pseudo-superclass\n # of this generic defined as the top-most item of this stack.\n #\n # Note that we intentionally avoid popping this pseudo-superclass off\n # this stack yet. We only pop a pseudo-superclass off this stack *AFTER*\n # resolving all child pseudo-superclasses of that pseudo-superclass,\n # which simulates the \"backing out\" performed by genuine recursion.\n hint_base_data = hint_bases_data[-1]\n \n # Currently visited transitive pseudo-superclass of this generic.\n hint_base = hint_base_data[_HINT_BASES_INDEX_HINT]\n \n # True only if the metadata describing this pseudo-superclass is still\n # its initial size, implying that this DFS has yet to visit this\n # pseudo-superclass by recursing down into the child pseudo-superclasses\n # of this pseudo-superclass.\n is_hint_base_leaf = len(hint_base_data) == _HINT_BASE_DATA_LEN_LEAF\n \n # If...\n if (\n # This DFS has yet to visit this pseudo-superclass *AND*...\n is_hint_base_leaf and\n # This pseudo-superclass is itself a PEP 484- or 585-compliant\n # user-defined generic. Standard generics (i.e., that are *NOT*\n # user-defined) have *NO* pseudo-superclasses and are thus omitted.\n # Examples of omittable standard generics include:\n # * \"dict[str, U]\".\n # * \"typing.Generic[S, int]\").\n # * \"typing.Protocol[float, T]\").\n #\n # Note that this tester is mildly slower than the prior test and\n # thus intentionally tested later.\n is_hint_pep484585_generic_user(hint_base) # pyright: ignore\n # Then this DFS is currently recursing down into the child\n # pseudo-superclasses of this pseudo-superclass. In this case...\n ):\n # Expand the metadata describing this pseudo-superclass from its\n # current 2-list \"(hint, hint_super_data)\" into the expanded 4-list\n # \"(hint, hint_super_data, hint_args_stack, hint_args_full)\".\n # Specifically, append (in order):\n hint_base_data.extend((\n # Poppable stack of the zero or more child hints directly\n # subscripting this child pseudo-superclass.\n make_stack(get_hint_pep_args(hint_base)),\n # List of the zero or more child hints transitively subscripting\n # this child pseudo-superclass.\n [],\n ))\n \n # Tuple of the one or more child pseudo-superclasses of this\n # pseudo-superclass.\n # print(f'Introspecting generic {hint} unerased bases...')\n hint_child_bases = get_hint_pep484585_generic_bases_unerased(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # print(f'Generic {hint} unerased bases: {hint_child_bases}')\n \n # For each child pseudo-superclass of this pseudo-superclass,\n # intentionally iterated in reverse order so as to ensure that the\n # *FIRST* child pseudo-superclass is the *LAST* item of this stack\n # (and thus the *FIRST* unvisited pseudo-superclass to be visited by\n # this depth-first search (DFS) next).\n #\n # Note that the reversed() builtin is well-known to be the most\n # efficient means of producing a reversed iterable for iteration\n # purposes. See also:\n # https://stackoverflow.com/a/16514411/2809027\n for hint_child_base in reversed(hint_child_bases):\n # Push metadata describing this unvisited child\n # pseudo-superclass onto this stack.\n hint_bases_data.append([\n # This child pseudo-superclass.\n hint_child_base,\n \n # Metadata describing the direct parent\n # pseudo-superclass of this child pseudo-superclass.\n hint_base_data,\n ])\n # Else, either:\n # * This DFS has already visited this pseudo-superclass *OR*...\n # * This pseudo-superclass is a \"terminal\" leaf generic *OR*...\n # * This pseudo-superclass is *NOT* a generic.\n #\n # In any case, this DFS should *NOT* recurse (back) down into this\n # pseudo-superclass. Therefore, this DFS is currently recursing back up\n # out of this pseudo-superclass into its parent pseudo-superclass.\n else:\n # Pop this pseudo-superclass off this stack.\n hint_bases_data.pop()\n # print(f'Resuming generic {hint} pseudo-superclass {hint_base} args {hint_base_args}...')\n \n # List of the zero or more child hints transitively subscripting\n # this pseudo-superclass, defined as either...\n hint_base_args_full: ListHints = ( # pyright: ignore\n # If this is a terminal leaf pseudo-superclass, the tuple of\n # zero or more child hints directly subscripting this\n # pseudo-superclass. Why? Because this pseudo-superclass has\n # *NO* child pseudo-superclass to recurse down into. If this\n # pseudo-superclass had one or more child pseudo-superclasses to\n # recurse down into, then those child pseudo-superclasses would\n # have defined the \"hint_base_data[_HINT_BASES_INDEX_ARGS_FULL]\"\n # list accessed by the next branch, providing the list of zero\n # or more child hints transitively subscripting this\n # pseudo-superclass. Although that list remains undefined, the\n # tuple of zero or more child hints directly subscripting this\n # pseudo-superclass is semantically equivalent to what that list\n # would have been (had that list actually been defined).\n list(get_hint_pep_args(hint_base))\n if is_hint_base_leaf else\n # Else, this is *NOT* a terminal leaf pseudo-superclass. In this\n # case, the list of zero or more child hints transitively\n # subscripting this pseudo-superclass previously defined by\n # child pseudo-superclasses of this pseudo-superclass in\n # lower-level recursion.\n hint_base_data[_HINT_BASES_INDEX_ARGS_FULL]\n )\n \n # Reset this boolean to its default value (i.e., \"False\") *BEFORE*\n # possibly setting this boolean to \"True\" below, facilitating\n # efficient communication between the \"if hint_base_args_full:\" and\n # \"if hint_base_target:\" branches below.\n #\n # Equivalently, record that this pseudo-superclass is transitively\n # subscripted by *NO* type variables. Since the \"if\n # hint_base_args_full:\" branch below works as hard as possible to\n # ensure that this is the case, this default is sensible until\n # proven otherwise below.\n is_hint_base_arg_typevar = False\n \n # If this pseudo-superclass is transitively subscripted by\n # at least one child hint...\n if hint_base_args_full:\n # Metadata describing the direct parent pseudo-superclass of\n # this pseudo-superclass.\n hint_base_super_data = hint_base_data[_HINT_BASES_INDEX_PARENT]\n # print(f'Resuming generic {hint} pseudo {hint_base} parent {hint_base_super_data[0]}...')\n \n # If this pseudo-superclass has a parent pseudo-superclass\n # (i.e., this pseudo-superclass is *NOT* the passed root generic\n # and is thus a transitive child of this generic)...\n if hint_base_super_data:\n # Poppable stack of the zero or more child hints directly\n # subscripting this parent pseudo-superclass.\n hint_base_super_args_stack = hint_base_super_data[ # pyright: ignore\n _HINT_BASES_INDEX_ARGS_STACK]\n \n # For the 0-based index of each child hint transitively\n # subscripting this pseudo-superclass and this hint...\n #\n # Note that this iteration could be fenced behind an \"if\"\n # conditional resembling:\n # if not (\n # hint_base_super_args_stack or\n # typevar_to_hint\n # ):\n #\n # However, doing so would be almost entirely pointless. Why?\n # Because almost *ALL* generics are transitively subscripted\n # by one or more type variables. Ergo, \"typevar_to_hint\" is\n # almost *ALWAYS* non-empty. Ergo, the above \"if\"\n # conditional reduces to \"if True:\" in most cases. We sigh.\n for hint_base_arg_full_index, hint_base_arg_full in (\n enumerate(hint_base_args_full)):\n # If this hint is a type variable...\n if is_hint_pep484_typevar(hint_base_arg_full):\n # If a concrete (i.e., non-type variable) child hint\n # directly subscripting a sibling pseudo-superclass\n # of this pseudo-superclass has already been\n # \"bubbled up\" into this type variable, preserve\n # that bubbling by re-bubbling up the same child\n # hint back into this type variable. <-- lol\n if hint_base_arg_full in typevar_to_hint:\n # print(f'Rebubbling hint {typevar_to_hint[hint_base_arg]} into...')\n # print(f'base {hint_base} typevar {hint_base_arg}!')\n hint_base_args_full[hint_base_arg_full_index] = ( # type: ignore[index]\n typevar_to_hint[hint_base_arg_full])\n # Else, *NO* child hint directly subscripting a\n # sibling pseudo-superclass of this child\n # pseudo-superclass has already been \"bubbled up\"\n # into this type variable.\n #\n # If this parent pseudo-superclass of this child\n # pseudo-superclass is still directly subscripted by\n # one or more child hints that have yet to \"bubble\n # up\" the class hierarchy (i.e., by replacing the\n # first unused type variable transitively\n # subscripting this child pseudo-superclass),\n # \"bubble up\" the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass into the \"empty placeholder\"\n # signified by this type variable in this list of\n # child hints transitively subscripting this child\n # pseudo-superclass. <-- wat\n elif hint_base_super_args_stack:\n # print(f'Bubbling hint {hint_base_super_args_stack[-1]} into...')\n # print(f'base {hint_base} typevar {hint_base_arg}!')\n hint_base_arg_full_new = (\n hint_base_args_full[hint_base_arg_full_index]) = ( # type: ignore[index]\n hint_base_super_args_stack.pop()) # pyright: ignore\n \n # If the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass is itself a type variable,\n # record that this child pseudo-superclass is\n # now known to be subscripted by at least one\n # type variable.\n if is_hint_pep484_typevar(\n hint_base_arg_full_new):\n # print(f'Recording pseudo {hint_base} typevarred args {hint_base_arg_full}...')\n is_hint_base_arg_typevar = True\n # Else, the currently unassigned child hint\n # directly subscripting this parent\n # pseudo-superclass is *NOT* itself a type\n # variable. In this case, record that this child\n # hint has now been \"bubbled up\" into this type\n # variable for subsequent lookup.\n #\n # Note that bubbling up a type variable into\n # another type variable would be entirely\n # pointless. Type variables are only\n # meaningfully replaceable with concrete hints.\n # Moreover, doing so here would erroneously map\n # this type variable to this other type variable\n # in the \"typevar_to_hint\" dictionary -- which\n # would then inhibit this \"if\" conditional from\n # subsequently bubbling up a concrete hint into\n # this type variable. <-- omg\n else:\n # print(f'Recording non-typevar {hint_base_arg_full} -> {hint_base_arg_full_new}...')\n typevar_to_hint[hint_base_arg_full] = ( # pyright: ignore\n hint_base_arg_full_new)\n # Else, all child hints directly subscripting this\n # parent pseudo-superclass have already been\n # \"bubbled up\" the class hierarchy. But this hint is\n # a type variable! Record that this child\n # pseudo-superclass is now known to be subscripted\n # by at least one type variable.\n else:\n is_hint_base_arg_typevar = True\n #print(f'Bubbled up generic {hint} arg {hint_args[hint_args_index_curr]}...')\n #print(f'...into pseudo-superclass {hint_base} args {hint_base_args}!')\n # Else, this hint is *NOT* a type variable. In this\n # case, preserve this hint and continue to the next.\n \n # Parent list of the zero or more child hints transitively\n # subscripting this parent pseudo-superclass of this\n # pseudo-superclass.\n hint_base_super_args_full = hint_base_super_data[ # pyright: ignore\n _HINT_BASES_INDEX_ARGS_FULL]\n \n # Append to this parent list this child list of all child\n # hints transitively subscripting this pseudo-superclass.\n hint_base_super_args_full.extend(hint_base_args_full) # pyright: ignore\n # print(f'Inspected generic {hint} pseudo-superclass {hint_base} args {hint_base_args}!')\n # Else, this pseudo-superclass is the passed root generic.\n # Else, this pseudo-superclass is transitively unsubscripted.\n \n # If searching for a target pseudo-superclass...\n if hint_base_target:\n # Unsubscripted generic underlying this possibly subscripted\n # pseudo-superclass generic. Strip this pseudo-superclass of\n # *ALL* child hints, allowing this unsubscripted current\n # pseudo-superclass to be compared against this\n # unsubscripted target pseudo-superclass.\n hint_base_type = get_hint_pep484585_generic_type(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # If this pseudo-superclass is the desired target...\n if hint_base_type == hint_base_target:\n # If this target pseudo-superclass is no longer subscripted\n # by any type variables requiring subsequent replacement by\n # concrete child hints, this target pseudo-superclass is\n # *ONLY* subscripted by concrete child hints. In this case,\n # immediately return a tuple of these hints.\n #\n # Note that:\n # * This efficiently short-circuits this recursion in the\n # best case and is one of several reasons to prefer a\n # non-recursive algorithm. This algorithm was initially\n # implemented recursively (supposedly for simplicity);\n # doing so introduced significant unforeseen complications\n # by effectively preventing short-circuiting. After all, a\n # recursive algorithm *CANNOT* efficiently short-circuit\n # up out of a deeply nested recursive call stack --\n # without inefficiently raising an exception, which is so\n # inefficient as to defeat the point in most cases.\n # * This recursion *CANNOT* be short-circuited in the worst\n # case, which occurs when the passed root generic is\n # directly subscripted by a concrete child hint that will\n # only be subsequently \"bubbled up\" into a type hint\n # transitively subscripting this target pseudo-superclass\n # *AFTER* this DFS recurses through the tree of all\n # pseudo-superclasses and back up into this generic. In\n # this worst case, the full dictionary of type variable\n # mappings and thus the list of child hints transitively\n # subscripting this target pseudo-superclass is only\n # decidable *AFTER* this DFS fully recurses out.\n #\n # Consider this torturous hierarchy, in which bubbling up\n # the child hint \"complex\" subscripting the root generic\n # \"ListFloat[complex]\" into the child type variable \"U\"\n # subscripting the child pseudo-superclass \"Generic[U]\"\n # requires recursing through the full tree:\n # >>> from typing import Generic\n # >>> class ListTU(list[T], Generic[U]): pass\n # >>> class ListFloat(ListTU[float]): pass\n # >>> get_hint_pep484585_generic_args_full(\n # ... hint=ListFloat[complex],\n # ... hint_base_target=Generic[U],\n # ... )\n # (complex,)\n if not is_hint_base_arg_typevar:\n return tuple(hint_base_args_full)\n # Else, this target pseudo-superclass is still subscripted\n # by one or more type variables requiring subsequent\n # replacement by concrete child hints. In this case,\n # continue \"bubbling up\" child hints into these type\n # variables. Doing so enables final logic below to replace\n # these type variables with these hints *AFTER* recursing\n # through the full entirety of this DFS.\n \n # List of zero or more child hints transitively subscripting\n # this target pseudo-superclass.\n hint_base_target_args_full = hint_base_args_full\n # print(f'Found target {hint_base} args {hint_base_args_full}!')\n # Else, this pseudo-superclass is *NOT* equal to this target.\n # Else, *NO* target pseudo-superclass is being searched for.\n \n # ....................{ RETURN }....................\n # If the caller passed a target pseudo-superclass...\n if hint_base_target:\n # If the DFS above failed to find the list of zero or more child hints\n # transitively subscripting this target, this DFS failed to find this\n # target. Since this implies this target is *NOT* a pseudo-superclass of\n # this generic, raise an exception.\n if hint_base_target_args_full is None:\n raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'pseudo-superclass target {repr(hint_base_target)} not found.'\n )\n # Else, this DFS found the list of zero or more child hints transitively\n # subscripting this target.\n \n # List of the zero or more child hints transitively subscripting this\n # target pseudo-superclass, to be coerced into a tuple and returned.\n hint_args_full = hint_base_target_args_full\n \n # For the 0-based index of each child hint transitively subscripting\n # this target pseudo-superclass and this hint...\n for hint_arg_full_index, hint_arg_full in enumerate(hint_args_full):\n # If this hint is a type variable...\n if is_hint_pep484_typevar(hint_arg_full):\n # Either:\n # * If a child hint directly subscripting a sibling\n # pseudo-superclass of this target pseudo-superclass has\n # already been \"bubbled up\" into this type variable, preserve\n # that bubbling by re-bubbling up the same child hint back\n # into this # type variable. <-- lol\n # * If *NO* child hint directly subscripting a sibling\n # pseudo-superclass of this target pseudo-superclass has\n # already been \"bubbled up\" into this type variable, preserve\n # this type variable as is.\n hint_args_full[hint_arg_full_index] = typevar_to_hint.get( # pyright: ignore\n hint_arg_full, hint_arg_full) # pyright: ignore\n # Else, this hint is *NOT* a type variable.\n # Else, the caller did *NOT* pass a target pseudo-superclass.\n else:\n # If the metadata describing the passed generic is still its initial size,\n # then the above DFS failed to expand this metadata with the\n # \"_HINT_BASES_INDEX_ARGS_FULL\" index accessed below. In turn, this implies\n # that the above DFS failed to recurse down into the child\n # pseudo-superclasses of this generic. However, by definition, *ALL*\n # generics subclass one or more pseudo-superclasses. The above DFS should\n # have recursed down into those pseudo-superclasses. In this case, raise an\n # exception.\n #\n # Note that this should *NEVER* occur.\n if len(hint_root_data) == _HINT_BASE_DATA_LEN_LEAF: # pragma: no cover\n> raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'pseudo-superclasses not found.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep484GenericST[int, float] pseudo-superclasses not found.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic\nLocation: /tmp/benchmark_rhzufkxg/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py:44\nError: AssertionError: assert False is (HintSign('HintSignPep484585GenericSubscripted') in frozenset({HintSign('HintSignPep484585GenericSubscripted'), HintSign('HintSignPep484585GenericUnsubscripted')}))\n + where False = (beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep484GenericST[~S, ~T])\n + where beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep484GenericST[~S, ~T] = HintPepMetadata(\\n hint=beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep484GenericST[~S, ~T],\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep484585GenericSubscripted'),\\n typehint_cls=None,\\n generic_type=,\\n isinstanceable_type=None,\\n is_args=True,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithUnsatisfiedMetadata(\\n pith='Token welfare\u2019s malformed keening fare, keenly despaired',\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n)),\\n typevars=(~S, ~T),\\n warning_type=None,\\n).hint\n + and HintSign('HintSignPep484585GenericSubscripted') = HintPepMetadata(\\n hint=beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep484GenericST[~S, ~T],\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep484585GenericSubscripted'),\\n typehint_cls=None,\\n generic_type=,\\n isinstanceable_type=None,\\n is_args=True,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithUnsatisfiedMetadata(\\n pith='Token welfare\u2019s malformed keening fare, keenly despaired',\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n)),\\n typevars=(~S, ~T),\\n warning_type=None,\\n).pep_sign\n\nTraceback:\n\n> def test_is_hint_pep484585_generic(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest.is_hint_pep484585_generic`\n tester.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype._data.hint.pep.sign.datapepsignset import HINT_SIGNS_GENERIC\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic)\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n \n # Assert this tester:\n # * Accepts generic PEP 484-compliant generics.\n # * Rejects concrete PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n> assert is_hint_pep484585_generic(hint_pep_meta.hint) is (\n hint_pep_meta.pep_sign in HINT_SIGNS_GENERIC)\nE AssertionError: assert False is (HintSign('HintSignPep484585GenericSubscripted') in frozenset({HintSign('HintSignPep484585GenericSubscripted'), HintSign('HintSignPep484585GenericUnsubscripted')}))\nE + where False = (beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep484GenericST[~S, ~T])\nE + where beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep484GenericST[~S, ~T] = HintPepMetadata(\\n hint=beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep484GenericST[~S, ~T],\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep484585GenericSubscripted'),\\n typehint_cls=None,\\n generic_type=,\\n isinstanceable_type=None,\\n is_args=True,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithUnsatisfiedMetadata(\\n pith='Token welfare\u2019s malformed keening fare, keenly despaired',\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n)),\\n typevars=(~S, ~T),\\n warning_type=None,\\n).hint\nE + and HintSign('HintSignPep484585GenericSubscripted') = HintPepMetadata(\\n hint=beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic.Pep484GenericST[~S, ~T],\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep484585GenericSubscripted'),\\n typehint_cls=None,\\n generic_type=,\\n isinstanceable_type=None,\\n is_args=True,\\n is_ignorable=False,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(HintPithSatisfiedMetadata(\\n pith=,\\n is_context_manager=False,\\n is_pith_factory=False,\\n), HintPithUnsatisfiedMetadata(\\n pith='Token welfare\u2019s malformed keening fare, keenly despaired',\\n is_context_manager=False,\\n is_pith_factory=False,\\n exception_str_match_regexes=('\\\\btype hint\\\\b',),\\n exception_str_not_match_regexes=(),\\n)),\\n typevars=(~S, ~T),\\n warning_type=None,\\n).pep_sign\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #11: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #12: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #13: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #14: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #15: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #16: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #17: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #18: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #19: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #20: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #21: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #26: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py", "test_is_hint_pep484585_generic" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.8800000000000003, "in_degree": 2, "true_in_degree": 25.840000000000014, "out_degree": 2, "betweenness": 0.00010522341686175901, "pagerank": 0.000960926970784742, "harmonic": 0.004934210526315789, "bidirectional_harmonic": 0.21397972915242694, "degree": 4 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/door/_func/doorcheck.py", "function_name": "die_if_unbearable", "test_info": { "success": false, "failed": 10, "passed": 1120, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_h5ifiihs/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:176\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n> with raises(BeartypeDoorHintViolation) as exception_info:\nE Failed: DID NOT RAISE \n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_h5ifiihs/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:272\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n> with raises(BeartypeDoorHintViolation):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #8: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #10: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 31.234939699200005, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 1, "betweenness": 2.1676927078817306e-05, "pagerank": 0.0004905582922824302, "harmonic": 0.03455317982456139, "bidirectional_harmonic": 0.18409114642667349, "degree": 3 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/redhint.py", "function_name": "reduce_hint_child", "test_info": { "success": false, "failed": 8, "passed": 1122, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_dpwa9mjo/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:409\nError: AssertionError: assert False is True\n + where False = UnionTypeHint(typing.Union[complex, int, typing.Annotated[typing.Any, ]]).is_ignorable\n + where UnionTypeHint(typing.Union[complex, int, typing.Annotated[typing.Any, ]]) = (typing.Union[complex, int, typing.Annotated[typing.Any, ]])\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n> assert TypeHint(hint_ignorable).is_ignorable is True\nE AssertionError: assert False is True\nE + where False = UnionTypeHint(typing.Union[complex, int, typing.Annotated[typing.Any, ]]).is_ignorable\nE + where UnionTypeHint(typing.Union[complex, int, typing.Annotated[typing.Any, ]]) = (typing.Union[complex, int, typing.Annotated[typing.Any, ]])\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable\nLocation: /tmp/benchmark_dpwa9mjo/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:186\nError: AssertionError: assert typing.Union[complex, int, typing.Annotated[typing.Any, ]] is typing.Any\n + where typing.Union[complex, int, typing.Annotated[typing.Any, ]] = (typing.Union[complex, int, typing.Annotated[typing.Any, ]])\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_reduce_hint_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer with\n respect to ignorable hints.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # Defer test-specific imports.\n from beartype.typing import Any\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP_UNIGNORABLE)\n \n # Assert this tester accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n> assert reduce_hint(hint_ignorable) is Any\nE AssertionError: assert typing.Union[complex, int, typing.Annotated[typing.Any, ]] is typing.Any\nE + where typing.Union[complex, int, typing.Annotated[typing.Any, ]] = (typing.Union[complex, int, typing.Annotated[typing.Any, ]])\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #8: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint_ignorable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 12.481638400000007, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 2, "betweenness": 3.522500650307812e-05, "pagerank": 0.0004207717569786536, "harmonic": 0.015217731829573934, "bidirectional_harmonic": 0.19693255392268616, "degree": 4 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep585.py", "function_name": "get_hint_pep585_generic_bases_unerased", "test_info": { "success": false, "failed": 13, "passed": 1117, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_3hi9fpre/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:1049\nError: beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic subclasses no superclasses.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> hint_child_bases = get_hint_pep484585_generic_bases_unerased(\n\n> def get_hint_pep484585_generic_bases_unerased(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of the one or more **unerased pseudo-superclasses** (i.e.,\n PEP-compliant objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`- or\n :pep:`585`-compliant **generic** (i.e., class superficially subclassing at\n least one PEP-compliant type hint that is possibly *not* an actual class) if\n this object is a generic *or* raise an exception otherwise (i.e., if this\n object is *not* a generic).\n \n This getter is guaranteed to return a non-empty tuple. By definition, a\n generic is a type subclassing one or more generic superclasses.\n \n This getter is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as the implementation trivially reduces\n to an efficient one-liner.\n \n Caveats\n -------\n **This getter should always be called in lieu of attempting to directly\n access the low-level** ``__orig_bases__`` **dunder instance variable.**\n Most PEP-compliant type hints fail to declare that variable, guaranteeing\n :class:`AttributeError` exceptions from all general-purpose logic\n attempting to directly access that variable. Thus this function, which\n \"fills in the gaps\" by implementing this oversight.\n \n **This getter returns tuples possibly containing a mixture of actual\n superclasses and pseudo-superclasses superficially masquerading as actual\n superclasses subscripted by one or more PEP-compliant child hints or type\n variables** (e.g., ``(typing.Iterable[T], typing.Sized[T])``). Indeed, most\n type hints used as superclasses produced by subscripting PEP-compliant type\n hint factories are *not* actually types but singleton objects devilishly\n masquerading as types. Most actual :mod:`typing` superclasses are private,\n fragile, and prone to alteration or even removal between Python versions.\n \n Motivation\n ----------\n :pep:`560` (i.e., \"Core support for typing module and generic types)\n formalizes the ``__orig_bases__`` dunder attribute first informally\n introduced by the :mod:`typing` module's implementation of :pep:`484`.\n Naturally, :pep:`560` remains as unusable as :pep:`484` itself. Ideally,\n :pep:`560` would have generalized the core intention of preserving each\n original user-specified subclass tuple of superclasses as a full-blown\n ``__orig_mro__`` dunder attribute listing the original method resolution\n order (MRO) of that subclass had that tuple *not* been modified.\n \n Naturally, :pep:`560` did no such thing. The original MRO remains obfuscated\n and effectively inaccessible. While computing that MRO would technically be\n feasible, doing so would also be highly non-trivial, expensive, and fragile.\n Instead, this function retrieves *only* the tuple of :mod:`typing`-specific\n pseudo-superclasses that this object's class originally attempted (but\n failed) to subclass.\n \n You are probably now agitatedly cogitating to yourself in the darkness: \"But\n @leycec: what do you mean :pep:`560`? Wasn't :pep:`560` released *after*\n :pep:`484`? Surely no public API defined by the Python stdlib would be so\n malicious as to silently alter the tuple of base classes listed by a\n user-defined subclass?\"\n \n As we've established both above and elsewhere throughout the codebase,\n everything developed for :pep:`484` -- including :pep:`560`, which derives\n its entire raison d'etre from :pep:`484` -- are fundamentally insane. In\n this case, :pep:`484` is insane by subjecting parametrized :mod:`typing`\n types employed as base classes to \"type erasure,\" because:\n \n ...it is common practice in languages with generics (e.g. Java,\n TypeScript).\n \n Since Java and TypeScript are both terrible languages, blindly\n recapitulating bad mistakes baked into such languages is an equally bad\n mistake. In this case, \"type erasure\" means that the :mod:`typing` module\n *intentionally* destroys runtime type information for nebulous and largely\n unjustifiable reasons (i.e., Big Daddy Java and TypeScript do it, so it\n must be unquestionably good).\n \n Specifically, the :mod:`typing` module intentionally munges :mod:`typing`\n types listed as base classes in user-defined subclasses as follows:\n \n * All base classes whose origin is a builtin container (e.g.,\n ``typing.List[T]``) are reduced to that container (e.g., :class:`list`).\n * All base classes derived from an abstract base class declared by the\n :mod:`collections.abc` subpackage (e.g., ``typing.Iterable[T]``) are\n reduced to that abstract base class (e.g., ``collections.abc.Iterable``).\n * All surviving base classes that are parametrized (e.g.,\n ``typing.Generic[S, T]``) are stripped of that parametrization (e.g.,\n :class:`typing.Generic`).\n \n Since there exists no counterpart to the :class:`typing.Generic` superclass,\n the :mod:`typing` module preserves that superclass in unparametrized form.\n Naturally, this is useless, as an unparametrized :class:`typing.Generic`\n superclass conveys no meaningful type information. All other superclasses\n are reduced to their non-:mod:`typing` counterparts: e.g.,\n \n .. code-block:: pycon\n \n >>> from typing import TypeVar, Generic, Iterable, List\n >>> T = TypeVar('T')\n >>> class UserDefinedGeneric(List[T], Iterable[T], Generic[T]): pass\n # This is type erasure.\n >>> UserDefinedGeneric.__mro__\n (list, collections.abc.Iterable, Generic)\n # This is type preservation -- except the original MRO is discarded.\n # So, it's not preservation; it's reduction! We take what we can get.\n >>> UserDefinedGeneric.__orig_bases__\n (typing.List[T], typing.Iterable[T], typing.Generic[T])\n # Guess which we prefer?\n \n So, we prefer the generally useful ``__orig_bases__`` dunder tuple over the\n generally useless ``__mro__`` dunder tuple. Note, however, that the latter\n *is* still occasionally useful and thus occasionally returned by this\n getter. For inexplicable reasons, **single-inherited protocols** (i.e.,\n classes directly subclassing *only* the :pep:`544`-compliant\n :attr:`typing.Protocol` abstract base class (ABC)) are *not* subject to type\n erasure and thus constitute a notable exception to this heuristic:\n \n .. code-block:: pycon\n \n >>> from typing import Protocol\n >>> class UserDefinedProtocol(Protocol): pass\n >>> UserDefinedProtocol.__mro__\n (__main__.UserDefinedProtocol, typing.Protocol, typing.Generic, object)\n >>> UserDefinedProtocol.__orig_bases__\n AttributeError: type object 'UserDefinedProtocol' has no attribute\n '__orig_bases__'\n \n Welcome to :mod:`typing` hell, where even :mod:`typing` types lie broken and\n misshapen on the killing floor of overzealous theory-crafting purists.\n \n Parameters\n ----------\n hint : Hint\n Generic type hint to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this generic.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * Neither a :pep:`484`- nor :pep:`585`-compliant generic.\n * A :pep:`484`- or :pep:`585`-compliant generic subclassing *no*\n pseudo-superclasses.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.typing import Container, Iterable, TypeVar\n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_bases_unerased)\n \n >>> T = TypeVar('T')\n >>> class MuhIterable(Iterable[T], Container[T]): pass\n \n >>> get_hint_pep585_generic_bases_unerased(MuhIterable)\n (typing.Iterable[~T], typing.Container[~T])\n \n >>> MuhIterable.__mro__\n (MuhIterable,\n collections.abc.Iterable,\n collections.abc.Container,\n typing.Generic,\n object)\n '''\n \n # ....................{ IMPORTS }....................\n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic_user)\n \n # ....................{ LOCALS }....................\n # Tuple of either...\n #\n # Note this implicitly raises a \"BeartypeDecorHintPepException\" if this\n # object is *NOT* a PEP-compliant generic. Ergo, we need not explicitly\n # validate that above.\n hint_pep_generic_bases_unerased = (\n # If this is a PEP 585-compliant generic, all unerased\n # pseudo-superclasses of this PEP 585-compliant generic.\n #\n # Note that this unmemoized getter accepts keyword arguments.\n get_hint_pep585_generic_bases_unerased(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n if is_hint_pep585_generic(hint) else\n # Else, this *MUST* be a PEP 484-compliant generic. In this case, all\n # unerased pseudo-superclasses of this PEP 484-compliant generic.\n #\n # Note that this memoized getter prohibits keyword arguments.\n get_hint_pep484_generic_bases_unerased(\n hint,\n exception_cls,\n exception_prefix,\n )\n )\n \n # ....................{ RETURN }....................\n # If this generic....\n if (\n # Subclasses no pseudo-superclasses *AND*...\n not hint_pep_generic_bases_unerased and\n # Is user-defined by a third-party downstream codebase.\n is_hint_pep484585_generic_user(hint)\n ):\n # Raise an exception. By definition, *ALL* user-defined generics should\n # subclass at least one pseudo-superclass. Note that this constraint:\n # * Does *NOT* apply to standard generics defined by either:\n # * The standard \"typing\" module (e.g., \"typing.Generic[S, T]\").\n # * The Python interpreter itself (e.g., \"list[T]\").\n # Why? Because these generics are the root superclasses that other\n # user-defined generics subclass. Clearly, they have no\n # pseudo-superclasses.\n # * Should have already been guaranteed on our behalf by:\n # * If this generic is PEP 484-compliant, the standard \"typing\" module.\n # * If this generic is PEP 585-compliant, the Python interpreter itself.\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n> raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'subclasses no superclasses.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic subclasses no superclasses.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_3hi9fpre/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:1049\nError: beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic subclasses no superclasses.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_bases_unerased(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._data.hint.pep.sign.datapepsignset import HINT_SIGNS_GENERIC\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_bases_unerased)\n from beartype._util.hint.pep.utilpeptest import is_hint_pep_type_typing\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # For each PEP-compliant hint to be tested...\n for hint_pep_meta in hints_pep_meta:\n # If this is a generic hint, assert that this getter returns the\n # expected unerased pseudo-superclasses of this generic.\n if hint_pep_meta.pep_sign in HINT_SIGNS_GENERIC:\n> hint_pep_bases = get_hint_pep484585_generic_bases_unerased(\n hint_pep_meta.hint)\n\n> def get_hint_pep484585_generic_bases_unerased(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of the one or more **unerased pseudo-superclasses** (i.e.,\n PEP-compliant objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`- or\n :pep:`585`-compliant **generic** (i.e., class superficially subclassing at\n least one PEP-compliant type hint that is possibly *not* an actual class) if\n this object is a generic *or* raise an exception otherwise (i.e., if this\n object is *not* a generic).\n \n This getter is guaranteed to return a non-empty tuple. By definition, a\n generic is a type subclassing one or more generic superclasses.\n \n This getter is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as the implementation trivially reduces\n to an efficient one-liner.\n \n Caveats\n -------\n **This getter should always be called in lieu of attempting to directly\n access the low-level** ``__orig_bases__`` **dunder instance variable.**\n Most PEP-compliant type hints fail to declare that variable, guaranteeing\n :class:`AttributeError` exceptions from all general-purpose logic\n attempting to directly access that variable. Thus this function, which\n \"fills in the gaps\" by implementing this oversight.\n \n **This getter returns tuples possibly containing a mixture of actual\n superclasses and pseudo-superclasses superficially masquerading as actual\n superclasses subscripted by one or more PEP-compliant child hints or type\n variables** (e.g., ``(typing.Iterable[T], typing.Sized[T])``). Indeed, most\n type hints used as superclasses produced by subscripting PEP-compliant type\n hint factories are *not* actually types but singleton objects devilishly\n masquerading as types. Most actual :mod:`typing` superclasses are private,\n fragile, and prone to alteration or even removal between Python versions.\n \n Motivation\n ----------\n :pep:`560` (i.e., \"Core support for typing module and generic types)\n formalizes the ``__orig_bases__`` dunder attribute first informally\n introduced by the :mod:`typing` module's implementation of :pep:`484`.\n Naturally, :pep:`560` remains as unusable as :pep:`484` itself. Ideally,\n :pep:`560` would have generalized the core intention of preserving each\n original user-specified subclass tuple of superclasses as a full-blown\n ``__orig_mro__`` dunder attribute listing the original method resolution\n order (MRO) of that subclass had that tuple *not* been modified.\n \n Naturally, :pep:`560` did no such thing. The original MRO remains obfuscated\n and effectively inaccessible. While computing that MRO would technically be\n feasible, doing so would also be highly non-trivial, expensive, and fragile.\n Instead, this function retrieves *only* the tuple of :mod:`typing`-specific\n pseudo-superclasses that this object's class originally attempted (but\n failed) to subclass.\n \n You are probably now agitatedly cogitating to yourself in the darkness: \"But\n @leycec: what do you mean :pep:`560`? Wasn't :pep:`560` released *after*\n :pep:`484`? Surely no public API defined by the Python stdlib would be so\n malicious as to silently alter the tuple of base classes listed by a\n user-defined subclass?\"\n \n As we've established both above and elsewhere throughout the codebase,\n everything developed for :pep:`484` -- including :pep:`560`, which derives\n its entire raison d'etre from :pep:`484` -- are fundamentally insane. In\n this case, :pep:`484` is insane by subjecting parametrized :mod:`typing`\n types employed as base classes to \"type erasure,\" because:\n \n ...it is common practice in languages with generics (e.g. Java,\n TypeScript).\n \n Since Java and TypeScript are both terrible languages, blindly\n recapitulating bad mistakes baked into such languages is an equally bad\n mistake. In this case, \"type erasure\" means that the :mod:`typing` module\n *intentionally* destroys runtime type information for nebulous and largely\n unjustifiable reasons (i.e., Big Daddy Java and TypeScript do it, so it\n must be unquestionably good).\n \n Specifically, the :mod:`typing` module intentionally munges :mod:`typing`\n types listed as base classes in user-defined subclasses as follows:\n \n * All base classes whose origin is a builtin container (e.g.,\n ``typing.List[T]``) are reduced to that container (e.g., :class:`list`).\n * All base classes derived from an abstract base class declared by the\n :mod:`collections.abc` subpackage (e.g., ``typing.Iterable[T]``) are\n reduced to that abstract base class (e.g., ``collections.abc.Iterable``).\n * All surviving base classes that are parametrized (e.g.,\n ``typing.Generic[S, T]``) are stripped of that parametrization (e.g.,\n :class:`typing.Generic`).\n \n Since there exists no counterpart to the :class:`typing.Generic` superclass,\n the :mod:`typing` module preserves that superclass in unparametrized form.\n Naturally, this is useless, as an unparametrized :class:`typing.Generic`\n superclass conveys no meaningful type information. All other superclasses\n are reduced to their non-:mod:`typing` counterparts: e.g.,\n \n .. code-block:: pycon\n \n >>> from typing import TypeVar, Generic, Iterable, List\n >>> T = TypeVar('T')\n >>> class UserDefinedGeneric(List[T], Iterable[T], Generic[T]): pass\n # This is type erasure.\n >>> UserDefinedGeneric.__mro__\n (list, collections.abc.Iterable, Generic)\n # This is type preservation -- except the original MRO is discarded.\n # So, it's not preservation; it's reduction! We take what we can get.\n >>> UserDefinedGeneric.__orig_bases__\n (typing.List[T], typing.Iterable[T], typing.Generic[T])\n # Guess which we prefer?\n \n So, we prefer the generally useful ``__orig_bases__`` dunder tuple over the\n generally useless ``__mro__`` dunder tuple. Note, however, that the latter\n *is* still occasionally useful and thus occasionally returned by this\n getter. For inexplicable reasons, **single-inherited protocols** (i.e.,\n classes directly subclassing *only* the :pep:`544`-compliant\n :attr:`typing.Protocol` abstract base class (ABC)) are *not* subject to type\n erasure and thus constitute a notable exception to this heuristic:\n \n .. code-block:: pycon\n \n >>> from typing import Protocol\n >>> class UserDefinedProtocol(Protocol): pass\n >>> UserDefinedProtocol.__mro__\n (__main__.UserDefinedProtocol, typing.Protocol, typing.Generic, object)\n >>> UserDefinedProtocol.__orig_bases__\n AttributeError: type object 'UserDefinedProtocol' has no attribute\n '__orig_bases__'\n \n Welcome to :mod:`typing` hell, where even :mod:`typing` types lie broken and\n misshapen on the killing floor of overzealous theory-crafting purists.\n \n Parameters\n ----------\n hint : Hint\n Generic type hint to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this generic.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * Neither a :pep:`484`- nor :pep:`585`-compliant generic.\n * A :pep:`484`- or :pep:`585`-compliant generic subclassing *no*\n pseudo-superclasses.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.typing import Container, Iterable, TypeVar\n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_bases_unerased)\n \n >>> T = TypeVar('T')\n >>> class MuhIterable(Iterable[T], Container[T]): pass\n \n >>> get_hint_pep585_generic_bases_unerased(MuhIterable)\n (typing.Iterable[~T], typing.Container[~T])\n \n >>> MuhIterable.__mro__\n (MuhIterable,\n collections.abc.Iterable,\n collections.abc.Container,\n typing.Generic,\n object)\n '''\n \n # ....................{ IMPORTS }....................\n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic_user)\n \n # ....................{ LOCALS }....................\n # Tuple of either...\n #\n # Note this implicitly raises a \"BeartypeDecorHintPepException\" if this\n # object is *NOT* a PEP-compliant generic. Ergo, we need not explicitly\n # validate that above.\n hint_pep_generic_bases_unerased = (\n # If this is a PEP 585-compliant generic, all unerased\n # pseudo-superclasses of this PEP 585-compliant generic.\n #\n # Note that this unmemoized getter accepts keyword arguments.\n get_hint_pep585_generic_bases_unerased(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n if is_hint_pep585_generic(hint) else\n # Else, this *MUST* be a PEP 484-compliant generic. In this case, all\n # unerased pseudo-superclasses of this PEP 484-compliant generic.\n #\n # Note that this memoized getter prohibits keyword arguments.\n get_hint_pep484_generic_bases_unerased(\n hint,\n exception_cls,\n exception_prefix,\n )\n )\n \n # ....................{ RETURN }....................\n # If this generic....\n if (\n # Subclasses no pseudo-superclasses *AND*...\n not hint_pep_generic_bases_unerased and\n # Is user-defined by a third-party downstream codebase.\n is_hint_pep484585_generic_user(hint)\n ):\n # Raise an exception. By definition, *ALL* user-defined generics should\n # subclass at least one pseudo-superclass. Note that this constraint:\n # * Does *NOT* apply to standard generics defined by either:\n # * The standard \"typing\" module (e.g., \"typing.Generic[S, T]\").\n # * The Python interpreter itself (e.g., \"list[T]\").\n # Why? Because these generics are the root superclasses that other\n # user-defined generics subclass. Clearly, they have no\n # pseudo-superclasses.\n # * Should have already been guaranteed on our behalf by:\n # * If this generic is PEP 484-compliant, the standard \"typing\" module.\n # * If this generic is PEP 585-compliant, the Python interpreter itself.\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n> raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'subclasses no superclasses.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic subclasses no superclasses.\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #5: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #6: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #7: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #12: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #13: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.63422976, "in_degree": 2, "true_in_degree": 9.680000000000003, "out_degree": 2, "betweenness": 0.00010206219832943148, "pagerank": 0.0004581887311181791, "harmonic": 0.008914865288220549, "bidirectional_harmonic": 0.1952955898268407, "degree": 4 }, "line_count": 16, "code_line_count": 16, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/_pep/redpep695.py", "function_name": "reduce_hint_pep695_unsubscripted", "test_info": { "success": false, "failed": 9, "passed": 1121, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable\nLocation: /tmp/benchmark_9d4k6dhq/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:200\nError: AssertionError: assert True == False\n + where True = HintPepMetadata(\\n hint=AliasPep484604Depth1T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasUnsubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(),\\n typevars=(),\\n warning_type=None,\\n).is_ignorable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_reduce_hint_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer with\n respect to ignorable hints.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # Defer test-specific imports.\n from beartype.typing import Any\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP_UNIGNORABLE)\n \n # Assert this tester accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n assert reduce_hint(hint_ignorable) is Any\n \n # Assert this tester rejects unignorable PEP-noncompliant type hints.\n for hint_unignorable in HINTS_NONPEP_UNIGNORABLE:\n assert reduce_hint(hint_unignorable) is not Any\n \n # Assert this tester:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # True only if this hint reduces to the ignorable \"Any\" singleton.\n is_hint_ignorable = reduce_hint(hint_pep_meta.hint) is Any\n \n # Assert this hint is either ignorable or unignorable as expected.\n> assert hint_pep_meta.is_ignorable == is_hint_ignorable\nE AssertionError: assert True == False\nE + where True = HintPepMetadata(\\n hint=AliasPep484604Depth1T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasUnsubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(),\\n typevars=(),\\n warning_type=None,\\n).is_ignorable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep695.py::test_reduce_hint_pep695_unsubscripted\nLocation: /tmp/benchmark_9d4k6dhq/beartype_test/a00_unit/data/pep/pep695/data_pep695util.py:272\nError: AssertionError\n\nTraceback:\n\n> def test_reduce_hint_pep695_unsubscripted() -> None:\n '''\n Test the private\n :mod:`beartype._util.hint.pep.proposal.pep695.reduce_hint_pep695_unsubscripted`\n iterator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_12\n \n # If the active Python interpreter targets Python >= 3.12 and thus supports\n # PEP 695...\n if IS_PYTHON_AT_LEAST_3_12:\n # Defer version-specific imports.\n from beartype_test.a00_unit.data.pep.pep695.data_pep695util import (\n unit_test_reduce_hint_pep695_unsubscripted)\n \n # Perform this test.\n> unit_test_reduce_hint_pep695_unsubscripted()\n\n> def unit_test_reduce_hint_pep695_unsubscripted() -> None:\n '''\n Test the private\n :mod:`beartype._check.convert._reduce._pep.redpep695.reduce_hint_pep695_unsubscripted`\n reducer.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep695Exception\n from beartype._check.convert._reduce._pep.redpep695 import (\n reduce_hint_pep695_unsubscripted)\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Type alias containing *NO* unquoted forward references.\n type her_dark_locks = str | int\n \n # Type alias containing one unquoted forward reference.\n type floating_in = TheBreathOfNight | bool\n \n # ....................{ PASS }....................\n # Assert that this reducer returns the type hint underlying the passed type\n # alias containing *NO* unquoted forward references.\n> assert reduce_hint_pep695_unsubscripted(\n hint=her_dark_locks, exception_prefix='') == str | int\nE AssertionError\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #8: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint_ignorable" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep695.py", "test_reduce_hint_pep695_unsubscripted" ] ] }, "complexity_info": { "centrality": { "distance_discount": 4.308480000000001, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.006222587719298245, "bidirectional_harmonic": 0.1435510898093137, "degree": 2 }, "line_count": 30, "code_line_count": 30, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/claw/_package/clawpkgtrie.py", "function_name": "PackagesTrieWhitelist.__init__", "test_info": { "success": false, "failed": 8, "passed": 1114, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a90_claw/a00_core/test_claw_api.py::test_claw_api\nLocation: /tmp/benchmark_h_kk90oo/beartype/claw/_package/clawpkgtrie.py:421\nError: AttributeError: 'PackagesTrieWhitelist' object has no attribute 'conf_if_hooked'\n\nTraceback:\n\n> @fixture(autouse=True, scope='function')\n def clean_claws() -> None: # <-- heh. get it... clean *CLAWS*? it is punny.\n '''\n Permanently, silently, and recursively remove all **bytecode files** (i.e.,\n pure-Python bytecode compiled to platform-dependent temporary files residing\n in temporary ``__pycache__/`` subdirectories) of the test-specific\n :mod:`beartype_test.a00_unit.data` subpackage and all subsubpackages of that\n subpackage regardless of depth.\n \n Note that this unit test-scoped fixture is implicitly performed *before*\n each unit test transitively defined in sibling and child submodules of the\n subpackage directly containing this submodule. Why? Because failing to do so\n would invite subtle but easily reproducible desynchronization woes between\n those files and more recent changes to the implementation of the\n :mod:`beartype.claw` subpackage in the main codebase.\n \n See Also\n --------\n :func:`beartype._util.path.utilpathremove.remove_package_bytecode_files`\n Further details.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype.claw._package.clawpkgcontext import packages_trie_cleared\n from beartype._util.module.utilmodget import get_module_dir\n from beartype._util.path.utilpathremove import (\n remove_package_bytecode_files)\n from beartype_test.a00_unit.data import claw\n \n # ....................{ PATHS }....................\n # Path encapsulating the absolute dirname of the \"beartype.claw\" subpackage.\n #\n # Note that we intentionally avoid importing any subsubpackages (e.g.,\n # \"beartype_test.a00_unit.data.claw.intraprocess.hookable_package.beartype_this_package\")\n # above. Why? Because doing so would implicitly install the exact beartype\n # import hook which calling unit tests are attempting to subsequently\n # exercise and which *MUST* be confined to a context manager for test\n # idempotency.\n claw_dir = get_module_dir(claw)\n \n # Recursively remove *ALL* previously compiled bytecode files from both this\n # subdirectory *and* *ALL* subsubdirectories of this subdirectory.\n remove_package_bytecode_files(claw_dir)\n \n # ....................{ HOOKS }....................\n # With a context manager guaranteeably reverting *ALL* beartype import hooks\n # transitively installed in the body of this context manager, defer to the\n # parent unit test implicitly invoking this fixture.\n> with packages_trie_cleared():\n\n> return next(self.gen)\n\n> die_if_packages_trie()\n\n> if is_packages_trie():\n\n> def is_packages_trie() -> bool:\n '''\n :data:`True` only if one or more packages have been registered by a prior\n call to the :func:`beartype.claw._package.clawpkghook.hook_packages` function.\n \n Returns\n -------\n bool\n :data:`True` only if one or more packages have been registered.\n '''\n \n # Avoid circular import dependencies.\n from beartype.claw._clawstate import claw_state\n \n # Return true only if either...\n return (\n # A global configuration has been added by a prior call to the public\n # beartype.claw.beartype_all() function *OR*...\n> claw_state.packages_trie_whitelist.conf_if_hooked is not None or\n # One or more package-specific configurations have been added by prior\n # calls to public beartype.claw.beartype_*() functions.\n bool(claw_state.packages_trie_whitelist)\n )\nE AttributeError: 'PackagesTrieWhitelist' object has no attribute 'conf_if_hooked'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_extraprocess.py::test_claw_extraprocess_executable_submodule\nLocation: /tmp/benchmark_h_kk90oo/beartype/claw/_package/clawpkgtrie.py:421\nError: AttributeError: 'PackagesTrieWhitelist' object has no attribute 'conf_if_hooked'\n\nTraceback:\n\n> @fixture(autouse=True, scope='function')\n def clean_claws() -> None: # <-- heh. get it... clean *CLAWS*? it is punny.\n '''\n Permanently, silently, and recursively remove all **bytecode files** (i.e.,\n pure-Python bytecode compiled to platform-dependent temporary files residing\n in temporary ``__pycache__/`` subdirectories) of the test-specific\n :mod:`beartype_test.a00_unit.data` subpackage and all subsubpackages of that\n subpackage regardless of depth.\n \n Note that this unit test-scoped fixture is implicitly performed *before*\n each unit test transitively defined in sibling and child submodules of the\n subpackage directly containing this submodule. Why? Because failing to do so\n would invite subtle but easily reproducible desynchronization woes between\n those files and more recent changes to the implementation of the\n :mod:`beartype.claw` subpackage in the main codebase.\n \n See Also\n --------\n :func:`beartype._util.path.utilpathremove.remove_package_bytecode_files`\n Further details.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype.claw._package.clawpkgcontext import packages_trie_cleared\n from beartype._util.module.utilmodget import get_module_dir\n from beartype._util.path.utilpathremove import (\n remove_package_bytecode_files)\n from beartype_test.a00_unit.data import claw\n \n # ....................{ PATHS }....................\n # Path encapsulating the absolute dirname of the \"beartype.claw\" subpackage.\n #\n # Note that we intentionally avoid importing any subsubpackages (e.g.,\n # \"beartype_test.a00_unit.data.claw.intraprocess.hookable_package.beartype_this_package\")\n # above. Why? Because doing so would implicitly install the exact beartype\n # import hook which calling unit tests are attempting to subsequently\n # exercise and which *MUST* be confined to a context manager for test\n # idempotency.\n claw_dir = get_module_dir(claw)\n \n # Recursively remove *ALL* previously compiled bytecode files from both this\n # subdirectory *and* *ALL* subsubdirectories of this subdirectory.\n remove_package_bytecode_files(claw_dir)\n \n # ....................{ HOOKS }....................\n # With a context manager guaranteeably reverting *ALL* beartype import hooks\n # transitively installed in the body of this context manager, defer to the\n # parent unit test implicitly invoking this fixture.\n> with packages_trie_cleared():\n\n> return next(self.gen)\n\n> die_if_packages_trie()\n\n> if is_packages_trie():\n\n> def is_packages_trie() -> bool:\n '''\n :data:`True` only if one or more packages have been registered by a prior\n call to the :func:`beartype.claw._package.clawpkghook.hook_packages` function.\n \n Returns\n -------\n bool\n :data:`True` only if one or more packages have been registered.\n '''\n \n # Avoid circular import dependencies.\n from beartype.claw._clawstate import claw_state\n \n # Return true only if either...\n return (\n # A global configuration has been added by a prior call to the public\n # beartype.claw.beartype_all() function *OR*...\n> claw_state.packages_trie_whitelist.conf_if_hooked is not None or\n # One or more package-specific configurations have been added by prior\n # calls to public beartype.claw.beartype_*() functions.\n bool(claw_state.packages_trie_whitelist)\n )\nE AttributeError: 'PackagesTrieWhitelist' object has no attribute 'conf_if_hooked'\n", "Failure #3: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_extraprocess.py::test_claw_extraprocess_executable_package", "Failure #4: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #8: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a90_claw/a00_core/test_claw_api.py", "test_claw_api" ], [ "beartype_test/a00_unit/a90_claw/a90_hook/test_claw_extraprocess.py", "test_claw_extraprocess_executable_submodule" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 7.600000000000001, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0008245224839217296, "harmonic": 0.0, "bidirectional_harmonic": 0.1518759018759022, "degree": 2 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/utilpepget.py", "function_name": "get_hint_pep_origin", "test_info": { "success": false, "failed": 10, "passed": 1120, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable\nLocation: /tmp/benchmark_pit273w9/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:200\nError: AssertionError: assert True == False\n + where True = HintPepMetadata(\\n hint=AliasPep484604Depth1T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasUnsubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(),\\n typevars=(),\\n warning_type=None,\\n).is_ignorable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_reduce_hint_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer with\n respect to ignorable hints.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # Defer test-specific imports.\n from beartype.typing import Any\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP_UNIGNORABLE)\n \n # Assert this tester accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n assert reduce_hint(hint_ignorable) is Any\n \n # Assert this tester rejects unignorable PEP-noncompliant type hints.\n for hint_unignorable in HINTS_NONPEP_UNIGNORABLE:\n assert reduce_hint(hint_unignorable) is not Any\n \n # Assert this tester:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # True only if this hint reduces to the ignorable \"Any\" singleton.\n is_hint_ignorable = reduce_hint(hint_pep_meta.hint) is Any\n \n # Assert this hint is either ignorable or unignorable as expected.\n> assert hint_pep_meta.is_ignorable == is_hint_ignorable\nE AssertionError: assert True == False\nE + where True = HintPepMetadata(\\n hint=AliasPep484604Depth1T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasUnsubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(),\\n typevars=(),\\n warning_type=None,\\n).is_ignorable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py::test_reduce_hint_pep484_subscripted_typevar_to_hint\nLocation: /tmp/benchmark_pit273w9/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py:148\nError: AssertionError: assert None is \n + where None = (typing.Generic[~S, ~T])\n\nTraceback:\n\n> def test_reduce_hint_pep484_subscripted_typevar_to_hint() -> None:\n '''\n Test the private\n :mod:`beartype._check.convert._reduce._pep.pep484.redpep484typevar.reduce_hint_pep484_subscripted_typevar_to_hint`\n reducer.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484TypeVarException\n from beartype.typing import (\n Generic,\n )\n from beartype._check.convert._reduce._pep.pep484.redpep484typevar import (\n reduce_hint_pep484_subscripted_typevar_to_hint)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_12\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n )\n from pytest import raises\n \n # ....................{ PEP 484 }....................\n # Assert that this reducer reduces the PEP 484-compliant \"typing.Generic\"\n # superclass subscripted by only type variables to simply that superclass.\n> assert reduce_hint_pep484_subscripted_typevar_to_hint(\n Generic[S, T]) is Generic\nE AssertionError: assert None is \nE + where None = (typing.Generic[~S, ~T])\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #10: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint_ignorable" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py", "test_reduce_hint_pep484_subscripted_typevar_to_hint" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 1.8, "out_degree": 1, "betweenness": 2.7096158848521633e-06, "pagerank": 0.0003000410509031199, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.19195069824181715, "degree": 2 }, "line_count": 14, "code_line_count": 14, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextprefix.py", "function_name": "prefix_callable_arg_value", "test_info": { "success": false, "failed": 41, "passed": 1089, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation\nLocation: /tmp/benchmark_mwi9tu3f/beartype/_util/text/utiltextmunge.py:68\nError: AssertionError: None not string.\n\nTraceback:\n\n> def test_get_func_pith_violation() -> None:\n '''\n Test the\n :func:`beartype._check.error.errget.get_func_pith_violation` getter.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype import BeartypeConf\n from beartype.roar import (\n BeartypeCallHintParamViolation,\n BeartypeCallHintReturnViolation,\n BeartypeDecorHintNonpepException,\n )\n from beartype.roar._roarexc import _BeartypeCallHintPepRaiseException\n from beartype.typing import (\n List,\n Tuple,\n Union,\n )\n from beartype._data.func.datafuncarg import ARG_NAME_RETURN\n from beartype._check.error.errget import get_func_pith_violation\n from beartype._check.metadata.metacheck import BeartypeCheckMeta\n from pytest import raises\n \n # ..................{ LOCALS }..................\n def forest_unknown(\n secret_orchard: List[str],\n achromatic_voice,\n to_bid_you_farewell: str,\n amaranth_symbol: 42,\n ) -> Union[int, Tuple[str, ...]]:\n '''\n Arbitrary callable exercised below.\n '''\n \n return achromatic_voice\n \n # Beartype type-checking call metadata reduced from this decorator metadata.\n check_meta = BeartypeCheckMeta.make_from_decor_meta_kwargs(\n func=forest_unknown, conf=BeartypeConf())\n \n # ..................{ PASS }..................\n # Assert this function returns the expected exception when passed a\n # parameter annotated by a PEP-compliant type hint failing to shallowly\n # satisfy the type of that type hint.\n> violation = get_func_pith_violation(\n check_meta=check_meta,\n pith_name='secret_orchard',\n pith_value=(\n 'You are in a forest unknown:',\n 'The secret orchard.',\n ),\n )\n\n> return get_hint_object_violation(\n\n> exception_prefix = uppercase_str_char_first(exception_prefix)\n\n> def uppercase_str_char_first(text: str) -> str:\n '''\n Uppercase *only* the first character of the passed string.\n \n Whereas the standard :meth:`str.capitalize` method both uppercases the\n first character of this string *and* lowercases all remaining characters,\n this function *only* uppercases the first character. All remaining\n characters remain unmodified.\n \n Parameters\n ----------\n text : str\n String whose first character is to be uppercased.\n \n Returns\n -------\n str\n This string with the first character uppercased.\n '''\n> assert isinstance(text, str), f'{repr(text)} not string.'\nE AssertionError: None not string.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color\nLocation: /tmp/benchmark_mwi9tu3f/beartype/_util/text/utiltextmunge.py:68\nError: AssertionError: None not string.\n\nTraceback:\n\n> def test_get_func_pith_violation_conf_is_color() -> None:\n '''\n Test the\n :func:`beartype._check.error.errget.get_func_pith_violation` getter with\n respect to the :attr:`beartype.BeartypeConf.is_color` option.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype import BeartypeConf\n from beartype.typing import (\n List,\n Tuple,\n Union,\n )\n from beartype._check.error.errget import get_func_pith_violation\n from beartype._check.metadata.metacheck import BeartypeCheckMeta\n from beartype._util.os.utilostty import is_stdout_terminal\n from beartype._util.text.utiltextansi import is_str_ansi\n \n # ..................{ LOCALS }..................\n def she_drew_back(\n a_while: List[str], then_yielding) -> Union[int, Tuple[str, ...]]:\n '''\n Arbitrary callable exercised below.\n '''\n \n return then_yielding\n \n \n # Keyword arguments to be unconditionally passed to *ALL* calls of the\n # get_func_pith_violation() getter below.\n kwargs = dict(\n pith_name='a_while',\n pith_value=(\n 'With frantic gesture and short breathless cry',\n 'Folded his frame in her dissolving arms.',\n ),\n )\n \n # ..................{ PASS }..................\n # Violation configured to contain ANSI escape sequences.\n> violation = get_func_pith_violation(\n check_meta=BeartypeCheckMeta.make_from_decor_meta_kwargs(\n func=she_drew_back, conf=BeartypeConf(is_color=True)), **kwargs)\n\n> return get_hint_object_violation(\n\n> exception_prefix = uppercase_str_char_first(exception_prefix)\n\n> def uppercase_str_char_first(text: str) -> str:\n '''\n Uppercase *only* the first character of the passed string.\n \n Whereas the standard :meth:`str.capitalize` method both uppercases the\n first character of this string *and* lowercases all remaining characters,\n this function *only* uppercases the first character. All remaining\n characters remain unmodified.\n \n Parameters\n ----------\n text : str\n String whose first character is to be uppercased.\n \n Returns\n -------\n str\n This string with the first character uppercased.\n '''\n> assert isinstance(text, str), f'{repr(text)} not string.'\nE AssertionError: None not string.\n", "Failure #3: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #34: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #35: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #36: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #37: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #38: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #39: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #40: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #41: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py", "test_get_func_pith_violation" ], [ "beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py", "test_get_func_pith_violation_conf_is_color" ] ] }, "complexity_info": { "centrality": { "distance_discount": 31.055616000000033, "in_degree": 1, "true_in_degree": 1.8, "out_degree": 3, "betweenness": 1.0838463539408653e-05, "pagerank": 0.00028151589789520825, "harmonic": 0.035166040100250616, "bidirectional_harmonic": 0.22410269281157472, "degree": 4 }, "line_count": 15, "code_line_count": 15, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_reduce/_pep/pep484/redpep484typevar.py", "function_name": "reduce_hint_pep484_subscripted_typevar_to_hint", "test_info": { "success": false, "failed": 10, "passed": 1120, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable\nLocation: /tmp/benchmark_1fal34i9/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py:200\nError: AssertionError: assert True == False\n + where True = HintPepMetadata(\\n hint=AliasPep484604Depth1T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasUnsubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(),\\n typevars=(),\\n warning_type=None,\\n).is_ignorable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_reduce_hint_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the private\n :func:`beartype._check.convert._reduce.redhint.reduce_hint` reducer with\n respect to ignorable hints.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # Defer test-specific imports.\n from beartype.typing import Any\n from beartype._check.convert._reduce.redhint import reduce_hint\n from beartype_test.a00_unit.data.hint.data_hint import (\n HINTS_NONPEP_UNIGNORABLE)\n \n # Assert this tester accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n assert reduce_hint(hint_ignorable) is Any\n \n # Assert this tester rejects unignorable PEP-noncompliant type hints.\n for hint_unignorable in HINTS_NONPEP_UNIGNORABLE:\n assert reduce_hint(hint_unignorable) is not Any\n \n # Assert this tester:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # True only if this hint reduces to the ignorable \"Any\" singleton.\n is_hint_ignorable = reduce_hint(hint_pep_meta.hint) is Any\n \n # Assert this hint is either ignorable or unignorable as expected.\n> assert hint_pep_meta.is_ignorable == is_hint_ignorable\nE AssertionError: assert True == False\nE + where True = HintPepMetadata(\\n hint=AliasPep484604Depth1T,\\n conf=BeartypeConf(),\\n pep_sign=HintSign('HintSignPep695TypeAliasUnsubscripted'),\\n typehint_cls=None,\\n generic_type=None,\\n isinstanceable_type=None,\\n is_args=False,\\n is_ignorable=True,\\n is_needs_cls_stack=False,\\n is_pep585_builtin_subscripted=False,\\n is_pep585_generic=False,\\n is_supported=True,\\n is_typevars=True,\\n is_type_typing=True,\\n is_typing=False,\\n piths_meta=(),\\n typevars=(),\\n warning_type=None,\\n).is_ignorable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py::test_reduce_hint_pep484_subscripted_typevar_to_hint\nLocation: /tmp/benchmark_1fal34i9/beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py:148\nError: AssertionError: assert None is \n + where None = (typing.Generic[~S, ~T])\n\nTraceback:\n\n> def test_reduce_hint_pep484_subscripted_typevar_to_hint() -> None:\n '''\n Test the private\n :mod:`beartype._check.convert._reduce._pep.pep484.redpep484typevar.reduce_hint_pep484_subscripted_typevar_to_hint`\n reducer.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484TypeVarException\n from beartype.typing import (\n Generic,\n )\n from beartype._check.convert._reduce._pep.pep484.redpep484typevar import (\n reduce_hint_pep484_subscripted_typevar_to_hint)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_12\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n )\n from pytest import raises\n \n # ....................{ PEP 484 }....................\n # Assert that this reducer reduces the PEP 484-compliant \"typing.Generic\"\n # superclass subscripted by only type variables to simply that superclass.\n> assert reduce_hint_pep484_subscripted_typevar_to_hint(\n Generic[S, T]) is Generic\nE AssertionError: assert None is \nE + where None = (typing.Generic[~S, ~T])\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #10: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py", "test_reduce_hint_ignorable" ], [ "beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py", "test_reduce_hint_pep484_subscripted_typevar_to_hint" ] ] }, "complexity_info": { "centrality": { "distance_discount": 22.13790720000002, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 5, "betweenness": 2.9805774733373798e-05, "pagerank": 0.00031609195402298854, "harmonic": 0.028305137844611528, "bidirectional_harmonic": 0.23100928220171651, "degree": 6 }, "line_count": 26, "code_line_count": 26, "cyclomatic": 3, "halstead_volume": 22.458839376460833, "halstead_difficulty": 1.875 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/metadata/metadecor.py", "function_name": "BeartypeDecorMeta.reinit", "test_info": { "success": false, "failed": 99, "passed": 1031, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_wzbvel31/beartype/_decor/wrap/_wrapargs.py:111\nError: TypeError: object of type 'NoneType' has no len()\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_params = _code_check_args(decor_meta)\n\n> def code_check_args(decor_meta: BeartypeDecorMeta) -> str:\n '''\n Generate a Python code snippet type-checking all annotated parameters of the\n decorated callable if any *or* the empty string otherwise (i.e., if these\n parameters are unannotated).\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to be type-checked.\n \n Returns\n -------\n str\n Code type-checking all annotated parameters of the decorated callable.\n \n Raises\n ------\n BeartypeDecorParamNameException\n If the name of any parameter declared on this callable is prefixed by\n the reserved substring ``__bear``.\n BeartypeDecorHintNonpepException\n If any type hint annotating any parameter of this callable is neither:\n \n * A PEP-noncompliant type hint.\n * A supported PEP-compliant type hint.\n '''\n assert isinstance(decor_meta, BeartypeDecorMeta), (\n f'{repr(decor_meta)} not beartype call.')\n \n # ..................{ LOCALS ~ func }..................\n # If *NO* callable parameters are annotated, silently reduce to a noop.\n #\n # Note that this is purely an optimization short-circuit mildly improving\n # efficiency for the common case of callables accepting either no\n # parameters *OR* one or more parameters, all of which are unannotated.\n if (\n # That callable is annotated by only one type hint *AND*...\n> len(decor_meta.func_arg_name_to_hint) == 1 and\n # That type hint annotates that callable's return rather than a\n # parameter accepted by that callable...\n ARG_NAME_RETURN in decor_meta.func_arg_name_to_hint\n ):\nE TypeError: object of type 'NoneType' has no len()\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark_wzbvel31/beartype/_decor/wrap/_wrapargs.py:111\nError: TypeError: object of type 'NoneType' has no len()\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_params = _code_check_args(decor_meta)\n\n> def code_check_args(decor_meta: BeartypeDecorMeta) -> str:\n '''\n Generate a Python code snippet type-checking all annotated parameters of the\n decorated callable if any *or* the empty string otherwise (i.e., if these\n parameters are unannotated).\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to be type-checked.\n \n Returns\n -------\n str\n Code type-checking all annotated parameters of the decorated callable.\n \n Raises\n ------\n BeartypeDecorParamNameException\n If the name of any parameter declared on this callable is prefixed by\n the reserved substring ``__bear``.\n BeartypeDecorHintNonpepException\n If any type hint annotating any parameter of this callable is neither:\n \n * A PEP-noncompliant type hint.\n * A supported PEP-compliant type hint.\n '''\n assert isinstance(decor_meta, BeartypeDecorMeta), (\n f'{repr(decor_meta)} not beartype call.')\n \n # ..................{ LOCALS ~ func }..................\n # If *NO* callable parameters are annotated, silently reduce to a noop.\n #\n # Note that this is purely an optimization short-circuit mildly improving\n # efficiency for the common case of callables accepting either no\n # parameters *OR* one or more parameters, all of which are unannotated.\n if (\n # That callable is annotated by only one type hint *AND*...\n> len(decor_meta.func_arg_name_to_hint) == 1 and\n # That type hint annotates that callable's return rather than a\n # parameter accepted by that callable...\n ARG_NAME_RETURN in decor_meta.func_arg_name_to_hint\n ):\nE TypeError: object of type 'NoneType' has no len()\n", "Failure #3: beartype_test/a00_unit/a60_check/a00_metadata/test_metacheck.py::test_metadata_check", "Failure #4: beartype_test/a00_unit/a60_check/a00_metadata/test_metadecor.py::test_metadata_decor", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #8: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #9: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #10: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep435", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep663", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #83: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #84: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #85: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #86: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #89: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #90: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #91: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #92: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #93: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #94: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #95: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #96: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #97: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #98: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #99: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 13.529600000000006, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 6, "betweenness": 2.528974825862019e-05, "pagerank": 0.00031609195402298854, "harmonic": 0.020422149122807015, "bidirectional_harmonic": 0.22207869341915434, "degree": 7 }, "line_count": 49, "code_line_count": 49, "cyclomatic": 12, "halstead_volume": 74.23092131656186, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/forward/reference/fwdrefmeta.py", "function_name": "BeartypeForwardRefMeta.__type_beartype__", "test_info": { "success": false, "failed": 22, "passed": 1108, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py::test_make_forwardref_indexable_subtype\nLocation: /tmp/benchmark_5hlkkr5j/beartype/_check/forward/reference/fwdrefabc.py:112\nError: TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union\n\nTraceback:\n\n> def test_make_forwardref_indexable_subtype() -> None:\n '''\n Test the\n :func:`beartype._check.forward.reference.fwdrefmake.make_forwardref_indexable_subtype`\n factory.\n '''\n \n # ....................{ LOCALS }....................\n # Defer test-specific imports.\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n )\n from beartype_test.a00_unit.data.check.forward.data_fwdref import (\n CLASS_BASENAME,\n CLASS_NAME,\n FORWARDREF_ABSOLUTE,\n FORWARDREF_MODULE_ABSOLUTE,\n FORWARDREF_MODULE_CLASS,\n FORWARDREF_RELATIVE,\n FORWARDREF_RELATIVE_CIRCULAR,\n MODULE_BASENAME,\n MODULE_NAME,\n PACKAGE_NAME,\n SCOPE_NAME,\n )\n from beartype_test.a00_unit.data.data_type import (\n Class,\n Subclass,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Arbitrary instance of a subclass of that class.\n obj_subclass = Subclass()\n \n # ....................{ PASS ~ attr }....................\n # Assert that these proxies have the expected class names.\n assert FORWARDREF_ABSOLUTE.__name__ == CLASS_BASENAME\n assert FORWARDREF_RELATIVE.__name__ == CLASS_BASENAME\n assert FORWARDREF_MODULE_ABSOLUTE.__name__ == MODULE_BASENAME\n assert FORWARDREF_MODULE_CLASS.__name__ == CLASS_BASENAME\n \n # Assert that these proxies have the expected module names.\n assert FORWARDREF_ABSOLUTE.__module__ == MODULE_NAME\n assert FORWARDREF_RELATIVE.__module__ == MODULE_NAME\n assert FORWARDREF_MODULE_ABSOLUTE.__module__ == PACKAGE_NAME\n assert FORWARDREF_MODULE_CLASS.__module__ == (\n f'{PACKAGE_NAME}.{MODULE_BASENAME}')\n \n # Assert that these proxies have the expected hint names.\n assert FORWARDREF_ABSOLUTE.__name_beartype__ == CLASS_NAME\n assert FORWARDREF_RELATIVE.__name_beartype__ == CLASS_BASENAME\n assert FORWARDREF_MODULE_ABSOLUTE.__name_beartype__ == MODULE_NAME\n assert FORWARDREF_MODULE_CLASS.__name_beartype__ == CLASS_NAME\n \n # Assert that these proxies have the expected scope names.\n assert FORWARDREF_ABSOLUTE.__scope_name_beartype__ == SCOPE_NAME\n assert FORWARDREF_RELATIVE.__scope_name_beartype__ == MODULE_NAME\n assert FORWARDREF_MODULE_ABSOLUTE.__scope_name_beartype__ == SCOPE_NAME\n assert FORWARDREF_MODULE_CLASS.__scope_name_beartype__ == SCOPE_NAME\n \n # ....................{ PASS ~ check }....................\n # Assert that an instance of a subclass of that class is also an instance of\n # these proxies.\n> assert isinstance(obj_subclass, FORWARDREF_ABSOLUTE)\n\n> return cls.__is_instance_beartype__(obj)\n\n> @classmethod\n def __is_instance_beartype__(cls, obj: object) -> bool:\n '''\n :data:`True` only if the passed object is an instance of the external\n class referred to by this forward reference.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be tested.\n \n Returns\n -------\n bool\n :data:`True` only if this object is an instance of the external\n class referred to by this forward reference subclass.\n '''\n \n # # Resolve the external class referred to by this forward reference and\n # # permanently store that class in the \"__type_beartype__\" variable.\n # cls.__beartype_resolve_type__()\n \n # Return true only if this object is an instance of the external class\n # referenced by this forward reference.\n> return isinstance(obj, cls.__type_beartype__) # type: ignore[arg-type]\nE TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_5hlkkr5j/beartype/_check/forward/reference/fwdrefabc.py:112\nError: TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n with warns(hint_meta.warning_type):\n is_bearable(pith, hint, conf=conf)\n # print(f'Deprecated type hint {repr(hint)} warned!')\n # Else, this tester is expected to emit *NO* warning for this hint. In\n # this case, call this tester outside of such a context manager.\n else:\n> is_bearable(pith, hint, conf=conf)\n\n> return func_tester(obj) # pyright: ignore\n\n> ???\n\n> return cls.__is_instance_beartype__(obj)\n\n> @classmethod\n def __is_instance_beartype__(cls, obj: object) -> bool:\n '''\n :data:`True` only if the passed object is an instance of the external\n class referred to by this forward reference.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be tested.\n \n Returns\n -------\n bool\n :data:`True` only if this object is an instance of the external\n class referred to by this forward reference subclass.\n '''\n \n # # Resolve the external class referred to by this forward reference and\n # # permanently store that class in the \"__type_beartype__\" variable.\n # cls.__beartype_resolve_type__()\n \n # Return true only if this object is an instance of the external class\n # referenced by this forward reference.\n> return isinstance(obj, cls.__type_beartype__) # type: ignore[arg-type]\nE TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #18: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #20: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #21: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #22: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py", "test_make_forwardref_indexable_subtype" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ] ] }, "complexity_info": { "centrality": { "distance_discount": 16.640000000000008, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 4, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.022066885964912287, "bidirectional_harmonic": 0.206632585251007, "degree": 4 }, "line_count": 36, "code_line_count": 36, "cyclomatic": 5, "halstead_volume": 12.0, "halstead_difficulty": 0.6666666666666666 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/convsanify.py", "function_name": "sanify_hint_root_statement", "test_info": { "success": false, "failed": 14, "passed": 1116, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_p0896x3z/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:119\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n> with warns(hint_meta.warning_type):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_p0896x3z/beartype/_check/code/codemake.py:1614\nError: beartype.roar.BeartypeDecorHintPepUnsupportedException: Is_bearable() type hint None unsupported but erroneously detected as supported under beartype sign HintSign('None').\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> raise exception # pyright: ignore\n\n> is_bearable(pith, hint, conf=conf)\n\n> func_tester = make_func_tester(hint, conf)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def make_check_expr(\n # ..................{ ARGS ~ mandatory }..................\n hint_or_sane: HintOrHintSanifiedData,\n conf: BeartypeConf,\n \n # ..................{ ARGS ~ optional }..................\n cls_stack: TypeStack = None,\n ) -> CodeGenerated:\n '''\n **Type-checking expression factory** (i.e., low-level callable dynamically\n generating a pure-Python boolean expression type-checking an arbitrary\n object against the passed PEP-compliant type hint).\n \n This code factory performs a breadth-first search (BFS) over the abstract\n graph of nested type hints reachable from the subscripted arguments of the\n passed root type hint. For each such (possibly nested) hint, this factory\n embeds one or more boolean subexpressions validating a (possibly nested\n sub)object of an arbitrary object against that hint into the full boolean\n expression created and returned by this factory. In short, this factory is\n the beating heart of :mod:`beartype`. We applaud you for your perseverance.\n You finally found the essence of the Great Bear. You did it!! Now, we clap.\n \n This code factory is memoized for efficiency.\n \n Caveats\n -------\n **This factory intentionally accepts no** ``exception_prefix``\n **parameter.** Why? Since that parameter is typically specific to the\n context-sensitive use case of the caller, accepting that parameter would\n prevent this factory from memoizing the passed hint with the returned code,\n which would rather defeat the point. Instead, this factory only:\n \n * Returns generic non-working code containing the placeholder\n :data:`VAR_NAME_PITH_ROOT` substring that the caller is required to\n globally replace by either the name of the current parameter *or*\n ``return`` for return values (e.g., by calling the builtin\n :meth:`str.replace` method) to generate the desired non-generic working\n code type-checking that parameter or return value.\n * Raises generic non-human-readable exceptions containing the placeholder\n :attr:`beartype._util.error.utilerrraise.EXCEPTION_PLACEHOLDER` substring\n that the caller is required to explicitly catch and raise non-generic\n human-readable exceptions from by calling the\n :func:`beartype._util.error.utilerrraise.reraise_exception_placeholder`\n function.\n \n Parameters\n ----------\n hint_or_sane : HintOrHintSanifiedData\n Either a type hint *or* **sanified type hint metadata** (i.e.,\n :data:`.HintSanifiedData` object) to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n \n Returns\n -------\n CodeGenerated\n Tuple containing the Python code snippet dynamically generated by this\n code generator and metadata describing that code. See also the\n :attr:`beartype._data.hint.datahinttyping.CodeGenerated` type hint.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If this object is *not* a PEP-compliant type hint.\n BeartypeDecorHintPepUnsupportedException\n If this object is a PEP-compliant type hint currently unsupported by\n the :func:`beartype.beartype` decorator.\n BeartypeDecorHintPep484Exception\n If one or more PEP-compliant type hints visitable from this object are\n nested :attr:`typing.NoReturn` child hints, since\n :attr:`typing.NoReturn` is valid *only* as a non-nested return hint.\n BeartypeDecorHintPep593Exception\n If one or more PEP-compliant type hints visitable from this object\n subscript the :pep:`593`-compliant :class:`typing.Annotated` class such\n that:\n \n * The second argument subscripting that class is an instance of the\n :class:`beartype.vale.Is` class.\n * One or more further arguments subscripting that class are *not*\n instances of the :class:`beartype.vale.Is` class.\n \n Warns\n -----\n BeartypeDecorHintPep585DeprecationWarning\n If one or more :pep:`484`-compliant type hints visitable from this\n object have been deprecated by :pep:`585`.\n '''\n \n # ..................{ LOCALS ~ hint : root }..................\n # Unpack the passed sanified hint metadata into:\n # * \"hint_root\", the top-level hint to be type-checked.\n # * \"typevar_to_hint_root\", the top-level type variable lookup table (i.e.,\n # dictionary mapping from each type variable parametrizing the origin of\n # this top-level hint to the child hint subscripting this top-level hint).\n hint_root, typevar_to_hint_root = unpack_hint_or_sane(hint_or_sane)\n # print(f'Received root hint {repr(hint_root)} and type variable lookup table {repr(typevar_to_hint_root)}.')\n \n # ..................{ LOCALS ~ hint : current }..................\n # Currently visited hint.\n hint_curr: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this hint (e.g.,\n # \"Union\" if \"hint_curr == Union[int, str]\").\n hint_curr_sign: HintSign = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : child }..................\n # Currently iterated child hint subscripting the currently visited hint.\n hint_child: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this child hint\n # (e.g., \"Union\" if \"hint_child == Union[int, str]\").\n hint_child_sign: Optional[HintSign] = None\n \n # Currently iterated child hint subscripting the currently visited hint *OR*\n # sanified child hint metadata** (i.e., \"HintSanifiedData\" object describing\n # that child hint).\n hint_or_sane_child: HintOrHintSanifiedData = None # pyright: ignore\n \n # ..................{ LOCALS ~ hint : childs }..................\n # Current tuple of all child hints subscripting the currently visited hint\n # (e.g., \"(int, str)\" if \"hint_curr == Union[int, str]\").\n hint_childs: tuple = None # type: ignore[assignment]\n \n # Number of child hints subscripting the currently visited hint.\n hint_childs_len: int = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : metadata }..................\n # Fixed list of all metadata describing all visitable hints currently\n # discovered by the breadth-first search (BFS) below. This list acts as a\n # standard First In First Out (FILO) queue, enabling this BFS to be\n # implemented as an efficient imperative algorithm rather than an\n # inefficient (and dangerous, due to both unavoidable stack exhaustion and\n # avoidable infinite recursion) recursive algorithm.\n #\n # Note that this list is guaranteed by the previously called\n # _die_if_hint_repr_exceeds_child_limit() function to be larger than the\n # number of hints transitively visitable from this root hint. Ergo, *ALL*\n # indexation into this list performed by this BFS is guaranteed to be safe.\n # Ergo, avoid explicitly testing below that the \"hints_meta.index_last\"\n # integer maintained by this BFS is strictly less than\n # \"FIXED_LIST_SIZE_MEDIUM\", as this constraint is already guaranteed to be\n # the case.\n hints_meta = acquire_instance(HintsMeta)\n \n # Initialize this fixed list.\n hints_meta.reinit(cls_stack=cls_stack, conf=conf)\n \n # 0-based index of metadata describing the currently visited hint in this\n # fixed list.\n hints_meta_index_curr = 0\n \n # ..................{ LOCALS ~ pep : 484 }..................\n # Set of the unqualified classnames referred to by all relative forward\n # references visitable from this root hint if any *OR* \"None\" otherwise\n # (i.e., if no such forward references are visitable).\n hint_refs_type_basename: Optional[set] = None\n \n # ..................{ LOCALS ~ func : code }..................\n # Python code snippet type-checking the root pith against the root hint:\n # * Localized separately from the \"func_wrapper_code\" snippet to enable this\n # function to validate this code to be valid *BEFORE* returning this code.\n # * Initialized to a placeholder string to be globally replaced in the\n # Python code snippet to be returned (i.e., \"func_wrapper_code\") by a\n # Python code snippet type-checking the root pith expression (i.e.,\n # \"VAR_NAME_PITH_ROOT\") against the root hint (i.e., \"hint_root\").\n func_root_code = hints_meta.enqueue_hint_child(\n hint=hint_root,\n # 1-based indentation level describing the initial level of indentation\n # appropriate for the root hint.\n indent_level=1,\n pith_expr=VAR_NAME_PITH_ROOT,\n pith_var_name_index=hints_meta.pith_curr_var_name_index,\n typevar_to_hint=typevar_to_hint_root,\n )\n \n # Python code snippet to be returned, seeded with a placeholder to be\n # replaced on the first iteration of the breadth-first search performed\n # below with a snippet type-checking the root pith against the root hint.\n #\n # Note that, shockingly, brute-force string concatenation has been\n # personally profiled by @leycec to be substantially faster than *ALL*\n # alternatives under CPython up to a large number of iterations (e.g.,\n # 100,000). This includes these popular alternatives, *ALL* of which are\n # orders of magnitude slower than brute-force string concatenation:\n # * deque.append().\n # * list.append().\n func_wrapper_code = func_root_code\n \n # ..................{ SEARCH }..................\n # While the 0-based index of metadata describing the next visited hint in\n # the \"hints_meta\" list does *NOT* exceed that describing the last\n # visitable hint in this list, there remains at least one hint to be\n # visited in the breadth-first search performed by this iteration.\n while hints_meta_index_curr <= hints_meta.index_last:\n # Update instance variables of this queue to reflect that this hint is\n # now the currently visited hint.\n hints_meta.set_hint_curr_meta(\n hint_curr_meta=hints_meta[hints_meta_index_curr])\n \n # Localize metadata for both efficiency and f-string purposes.\n hint_curr = hints_meta.hint_curr_meta.hint\n # print(f'Visiting type hint {repr(hint_curr)}...')\n \n # ................{ PEP }................\n # If this hint is PEP-compliant...\n if is_hint_pep(hint_curr):\n #FIXME: Refactor to call warn_if_hint_pep_unsupported() instead.\n #Actually...wait. This is probably still a valid test here. We'll\n #need to instead augment the is_hint_ignorable() function to\n #additionally test whether the passed hint is unsupported, in which\n #case that function should return false as well as emit a non-fatal\n #warning ala the new warn_if_hint_pep_unsupported() function --\n #which should probably simply be removed now. *sigh*\n #FIXME: Actually, in that case, we can simply reduce the following\n #two calls to simply:\n # die_if_hint_pep_ignorable(\n # hint=hint_curr, exception_prefix=hint_curr_exception_prefix)\n #\n #Of course, this implies we want to refactor the\n #die_if_hint_pep_unsupported() function into\n #die_if_hint_pep_ignorable()... probably.\n \n # If this hint is currently unsupported, raise an exception.\n #\n # Note the human-readable label prefixing the representations of\n # child PEP-compliant type hints is unconditionally passed. Since\n # the root hint has already been validated to be supported by\n # the above call to the same function, this call is guaranteed to\n # *NEVER* raise an exception for that hint.\n die_if_hint_pep_unsupported(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n # Else, this hint is supported.\n \n # Assert that this hint is unignorable. Iteration below generating\n # code for child hints of the current parent hint is *REQUIRED* to\n # explicitly ignore ignorable child hints. Since the caller has\n # explicitly ignored ignorable root hints, these two guarantees\n # together ensure that all hints visited by this breadth-first\n # search *SHOULD* be unignorable. Naturally, we validate that here.\n assert hint_curr is not Any, (\n f'{EXCEPTION_PREFIX}ignorable type hint '\n f'{repr(hint_curr)} not ignored.'\n )\n \n # Sign uniquely identifying this hint.\n hint_curr_sign = get_hint_pep_sign(hint_curr)\n # print(f'Visiting PEP type hint {repr(hint_curr)} sign {repr(hint_curr_sign)}...')\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # NOTE: Whenever adding support for (i.e., when generating code\n # type-checking) a new \"typing\" attribute below, similar support\n # for that attribute *MUST* also be added to the parallel:\n # * \"beartype._check.error\" subpackage, which raises exceptions on\n # the current pith failing this check.\n # * \"beartype._data.hint.pep.sign.datapepsignset.HINT_SIGNS_SUPPORTED_DEEP\"\n # frozen set of all signs for which this function generates deeply\n # type-checking code.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n #FIXME: Python 3.10 provides proper syntactic support for \"case\"\n #statements, which should allow us to dramatically optimize this\n #\"if\" logic into equivalent \"case\" logic *AFTER* we drop support\n #for Python 3.9. Of course, that will be basically never, so we'll\n #have to preserve this for basically forever. What you gonna do?\n #FIXME: Actually, we should probably just leverage a hypothetical\n #\"beartype.vale.IsInline[...]\" validator to coerce this slow O(n)\n #procedural logic into fast O(1) object-oriented logic. Of course,\n #object-oriented logic is itself slow -- so we only do this if we\n #can sufficiently memoize that logic. Consideration!\n \n # Switch on (as in, pretend Python provides a \"case\" statement)\n # the sign identifying this hint to decide which type of code to\n # generate to type-check the current pith against the current hint.\n #\n # This decision is intentionally implemented as a linear series of\n # tests ordered in descending likelihood for efficiency. While\n # alternative implementations (that are more readily readable and\n # maintainable) do exist, these alternatives all appear to be\n # substantially less efficient.\n #\n # Consider the standard alternative of sequestering the body of\n # each test implemented below into either:\n #\n # * A discrete private function called by this function. This\n # approach requires maintaining a global private dictionary\n # mapping from each support unsubscripted typing attribute to\n # the function generating code for that attribute: e.g.,\n # def pep_code_check_union(...): ...\n # _HINT_TYPING_ATTR_ARGLESS_TO_CODER = {\n # typing.Union: pep_code_check_union,\n # }\n # Each iteration of this loop then looks up the function\n # generating code for the current attribute from this dictionary\n # and calls that function to do so. Function calls come with\n # substantial overhead in Python, impacting performance more\n # than the comparable linear series of tests implemented below.\n # Additionally, these functions *MUST* mutate local variables of\n # this function by some arcane means -- either:\n # * Passing these locals to each such function, returning these\n # locals from each such function, and assigning these return\n # values to these locals in this function after each such call.\n # * Passing a single composite fixed list of these locals to each\n # such function, which then mutates these locals in-place,\n # which then necessitates this function permanently store these\n # locals in such a list rather than as local variables.\n # * A discrete closure of this function, which adequately resolves\n # the aforementioned locality issue via the \"nonlocal\" keyword at\n # a substantial up-front performance cost of redeclaring these\n # closures on each invocation of this function.\n #\n # ..............{ SHALLOW }..............\n # Perform shallow type-checking logic (i.e., logic that does *NOT*\n # recurse and thus \"bottoms out\" at this hint) *BEFORE* deep\n # type-checking logic. The latter needs additional setup (e.g.,\n # generation of assignment expressions) *NOT* needed by the former,\n # whose requirements are more understandably minimalist.\n #\n # Note that:\n # * Shallow type-checking code should access this pith via\n # \"pith_curr_expr\". Since this code does *NOT* recurse,\n # \"pith_curr_expr\" accesses this pith optimally efficiently.\n # * Deep type-checking code should access this pith via\n # \"pith_assign_expr\". Since that code *DOES* recurse, only\n # \"pith_assign_expr\" accesses this pith optimally efficiently;\n # \"pith_curr_expr\" accesses this pith extremely inefficiently.\n # * Ignorable type-checking code (i.e., code ignoring this hint but\n # otherwise unsuitable for implementation as a reducer called by\n # the \"beartype._check.convert._reduce.redhint\" submodule, typically\n # due to useful side effects intentionally interacting with this\n # BFS) should follow the design pattern established by the\n # \"HintSignPep695TypeAliasSubscripted\" branch below.\n #\n # ..............{ ORIGIN }..............\n # If this hint both...\n if (\n # Originates from an origin type and may thus be shallowly\n # type-checked against that type *AND is either...\n hint_curr_sign in HINT_SIGNS_ORIGIN_ISINSTANCEABLE and (\n # Unsubscripted *OR*...\n not get_hint_pep_args(hint_curr) or\n # Currently unsupported with deep type-checking...\n hint_curr_sign not in HINT_SIGNS_SUPPORTED_DEEP\n )\n ):\n # Then generate trivial code shallowly type-checking the current\n # pith as an instance of the origin type originating this sign\n # (e.g., \"list\" for the hint \"typing.List[int]\").\n # print(f'Shallow checking unsubscripted hint {repr(hint_curr)}...')\n \n # Code type-checking the current pith against this origin type.\n hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n pith_curr_expr=hints_meta.pith_curr_expr,\n # Python expression evaluating to this origin type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n # Origin type of this hint if any *OR* raise an\n # exception -- which should *NEVER* happen, as this hint\n # was validated above to be supported.\n get_hint_pep_origin_type_isinstanceable(hint_curr)),\n )\n # Else, this hint is either subscripted, not shallowly\n # type-checkable, *OR* deeply type-checkable.\n #\n # ..............{ FORWARDREF }..............\n # If this hint is a forward reference...\n elif hint_curr_sign is HintSignForwardRef:\n # Render this forward reference accessible to the body of this\n # wrapper function by populating:\n # * A Python expression evaluating to the class referred to by\n # this forward reference when accessed via the private\n # \"__beartypistry\" parameter.\n # * A set of the unqualified classnames referred to by all\n # relative forward references, including this reference if\n # relative. If this set was previously uninstantiated (i.e.,\n # \"None\"), this assignment initializes this local to the new\n # set instantiated by this call; else, this assignment\n # preserves this local set as is.\n (\n hints_meta.hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_curr, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n \n #FIXME: *REDUNDANT.* Shallow type-checking code defined below\n #already performs this exact same logic. Excise us up, please.\n # # Code type-checking the current pith against this class.\n # hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n # pith_curr_expr=hints_meta.pith_curr_expr,\n # hint_curr_expr=hints_meta.hint_curr_expr,\n # )\n # Else, this hint is *NOT* a forward reference.\n #\n # Since this hint is *NOT* shallowly type-checkable, this hint\n # *MUST* be deeply type-checkable. So, we do so now.\n #\n # ..............{ DEEP }..............\n # Perform deep type-checking logic (i.e., logic that is guaranteed\n # to recurse and thus *NOT* \"bottom out\" at this hint).\n else:\n # Tuple of all child hints subscripting this hint if any *OR*\n # the empty tuple otherwise (e.g., if this hint is its own\n # unsubscripted \"typing\" attribute).\n #\n # Note that the \"__args__\" dunder attribute is *NOT* guaranteed\n # to exist for arbitrary PEP-compliant type hints. Ergo, we\n # obtain this attribute via a higher-level utility getter.\n hint_childs = get_hint_pep_args(hint_curr)\n \n # Number of these child hints.\n hint_childs_len = len(hint_childs)\n \n # ............{ DEEP ~ expression }............\n #FIXME: Unit test that this is behaving as expected. Doing so\n #will require further generalizations, including:\n #* In the \"beartype._decor.decormain\" submodule:\n # * Detect when running under tests.\n # * When running under tests, define a new\n # \"func_wrapper.__beartype_wrapper_code\" attribute added to\n # decorated callables to be the \"func_wrapper_code\" string\n # rather than True. Note that this obviously isn't the right way\n # to do source code association. Ideally, we'd at least\n # interface with the stdlib \"linecache\" module (e.g., by calling\n # the linecache.lazycache() function intended to be used to\n # cache the source code for non-file-based modules) and possibly\n # even go so far as to define a PEP 302-compatible beartype\n # module loader. That's out of scope, so this suffices for now.\n #* In the \"beartype_test.a00_unit.data._data_hint_pep\" submodule:\n # * Add a new \"_PepHintMetadata.code_str_match_regexes\" field,\n # defined as an iterable of regular expressions matching\n # substrings of the \"func_wrapper.__beartype_wrapper_code\"\n # attribute that are expected to exist.\n # * For most \"HINTS_PEP_META\" entries, default this field to\n # merely the empty tuple.\n # * For deeply nested \"HINTS_PEP_META\" entries, define this\n # field as follows:\n # code_str_match_regexes=(r'\\s+:=\\s+',)\n #* In the \"beartype_test.a00_unit.pep.p484.test_p484\" submodule:\n # * Match the \"pep_hinted.__beartype_wrapper_code\" string against\n # all regular expressions in the \"code_str_match_regexes\"\n # iterable for the currently iterated \"pep_hint_meta\".\n #\n #This is fairly important, as we have no other reusable means of\n #ascertaining whether this is actually being applied in general.\n #FIXME: That's all great, except for the\n #\"func_wrapper.__beartype_wrapper_code\" part. Don't do that,\n #please. We really do just want to do this right the first time. As\n #expected, the key to doing so is the linecache.lazycache()\n #function, whose implementation under Python 3.7 reads:\n #\n # def lazycache(filename, module_globals):\n # \"\"\"Seed the cache for filename with module_globals.\n #\n # The module loader will be asked for the source only when getlines is\n # called, not immediately.\n #\n # If there is an entry in the cache already, it is not altered.\n #\n # :return: True if a lazy load is registered in the cache,\n # otherwise False. To register such a load a module loader with a\n # get_source method must be found, the filename must be a cachable\n # filename, and the filename must not be already cached.\n # \"\"\"\n # if filename in cache:\n # if len(cache[filename]) == 1:\n # return True\n # else:\n # return False\n # if not filename or (filename.startswith('<') and filename.endswith('>')):\n # return False\n # # Try for a __loader__, if available\n # if module_globals and '__loader__' in module_globals:\n # name = module_globals.get('__name__')\n # loader = module_globals['__loader__']\n # get_source = getattr(loader, 'get_source', None)\n #\n # if name and get_source:\n # get_lines = functools.partial(get_source, name)\n # cache[filename] = (get_lines,)\n # return True\n # return False\n #\n #Given that, what we need to do is:\n #* Define a new \"beartype._decor._pep302\" submodule implementing a\n # PEP 302-compatible loader for @beartype-generated wrapper\n # functions, enabling external callers (including the stdlib\n # \"linecache\" module) to obtain the source for these functions.\n # For space efficiency, this submodule should internally store\n # code in a compressed format -- which probably means \"gzip\" for\n # maximal portability. This submodule should at least define these\n # attributes:\n # * \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\", a dictionary mapping from\n # the unique fake module names assigned to @beartype-generated\n # wrapper functions by the @beartype decorator to the compressed\n # source strings for those fake modules.\n # * get_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator and returning the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally access the\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has *NOT* already been registered\n # to that dictionary, raise an exception.\n # * Else, uncompress the compressed source string previously\n # registered under that module name with that dictionary and\n # return that uncompressed string. Don't worry about caching\n # uncompressed strings here; that's exactly what the stdlib\n # \"linecache\" module already does on our behalf.\n # Ergo, this function should have signature resembling:\n # def get_source(func_wrapper_module_name: str) -> str:\n # * set_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator as well as as the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has already been registered to\n # that dictionary, raise an exception.\n # * Else, compress the passed uncompressed source string and\n # register that compressed string under that module name with\n # that dictionary.\n #* In the \"beartype._decor.decormain\" submodule:\n # * Do... something? Oh, boy. Why didn't we finish this comment?\n \n # If the expression yielding the current pith is neither...\n #\n # Note that we explicitly test against piths rather than\n # seemingly equivalent metadata to account for edge cases.\n # Notably, child hints of unions (and possibly other \"typing\"\n # objects) do *NOT* narrow the current pith and are *NOT* the\n # root hint. Ergo, a seemingly equivalent test like\n # \"hints_meta_index_curr != 0\" would generate false positives\n # and thus unnecessarily inefficient code.\n if not (\n # The root pith *NOR*...\n #\n # Note that this is merely a negligible optimization for the\n # common case in which the current pith is the root pith\n # (i.e., this is the first iteration of the outermost loop).\n # The subsequent call to the str.isidentifier() method is\n # *MUCH* more expensive than this object identity test.\n hints_meta.pith_curr_expr is VAR_NAME_PITH_ROOT or\n # A simple Python identifier *NOR*...\n hints_meta.pith_curr_expr.isidentifier() or\n # A complex Python expression already containing the\n # assignment expression-specific walrus operator \":=\". Since\n # this implies this expression to already be an assignment\n # expression, needlessly reassigning the local variable to\n # which this assignment expression was previously assigned\n # as yet another redundant local variable only harms\n # efficiency for *NO* tangible gain (e.g., expanding the\n # efficient assignment expression \"__beartype_pith_1 :=\n # next(iter(__beartype_pith_0))\" to the inefficient\n # assignment expression \"__beartype_pith_2 :=\n # __beartype_pith_1 := next(iter(__beartype_pith_0))\").\n #\n # Note that this edge case is induced by method calls\n # performed below of the form:\n # hints_meta.enqueue_hint_child(\n # ..., pith_expr=pith_curr_assign_expr, ...)\n #\n # As of this writing, the only such edge cases are:\n # * PEP 484- or 604-compliant unions containing *ONLY* two\n # or more PEP-compliant type hints (e.g., \"list[str] |\n # set[bytes]\").\n # * PEP 695-compliant subscripted type aliases.\n ':=' in hints_meta.pith_curr_expr\n ):\n # Then the current pith is ideally assigned to a unique\n # local variable via an assignment expression.\n # print(f'Incrementing hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index} by one.')\n \n # Increment the integer suffixing the name of this variable\n # *BEFORE* defining this variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n hints_meta.pith_curr_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Assignment expression assigning this full expression to\n # this local variable.\n hints_meta.pith_curr_assign_expr = (\n CODE_PEP572_PITH_ASSIGN_EXPR_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n pith_curr_expr=hints_meta.pith_curr_expr,\n ))\n # Else, the current pith is *NOT* safely assignable to a unique\n # local variable via an assignment expression. Since the\n # expression yielding the current pith is a simple Python\n # identifier, there is *NO* benefit to assigning that to another\n # local variable via another assignment expression, which would\n # just be an alias of the existing local variable assigned via\n # the existing assignment expression. Moreover, whereas chained\n # assignments are syntactically valid, chained assignment\n # expressions are syntactically invalid unless explicitly\n # protected by parens: e.g.,\n # >>> a = b = 'Mother*Teacher*Destroyer' # <-- fine\n # >>> (a := \"Mother's Abomination\") # <-- fine\n # >>> (a :=\n # ... (b := \"Mother's Illumination\")) # <-- fine\n # >>> (a := b := \"Mother's Illumination\") # <-- not fine\n # SyntaxError: invalid syntax\n #\n # In this case...\n else:\n # print(f'Preserving hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index}.')\n \n # Preserve the Python code snippet evaluating to the value\n # of the current pith as is.\n hints_meta.pith_curr_assign_expr = hints_meta.pith_curr_expr\n \n # ............{ UNION }............\n # If this hint is a union (e.g., \"typing.Union[bool, str]\",\n # typing.Optional[float]\")...\n if hint_curr_sign in HINT_SIGNS_UNION:\n # Python code snippet type-checking the current pith against\n # this union if this union is unignorable *OR* \"None\".\n make_hint_pep484604_check_expr(hints_meta)\n # Else, this hint is *NOT* a union.\n #\n # ..........{ CONTAINERS }............\n # If this hint is either:\n # * A single-argument container like list[int] or set[str].\n # * A similar hint semantically resembling a single-argument\n # container subscripted by one argument and one or more\n # ignorable arguments like tuple[str, ...].\n #\n # Then this hint is effectively (for all intents and purposes) a\n # standard single-argument container. In this case...\n elif hint_curr_sign in HINT_SIGNS_CONTAINER_ARGS_1:\n # Python code snippet type-checking the current pith against\n # this hint if the child hint subscripting this parent\n # container hint is unignorable *OR* \"None\" otherwise.\n make_hint_pep484585_container_check_expr(hints_meta)\n # Else, this hint is *NOT* a standard single-argument container.\n #\n # ............{ SEQUENCES ~ tuple : fixed }............\n # If this hint is a fixed-length tuple (e.g., \"tuple[int,\n # str]\")...\n #\n # Note that if this hint is a:\n # * PEP 484-compliant \"typing.Tuple\"-based hint, this hint is\n # guaranteed to contain one or more child hints. Moreover, if\n # this hint contains exactly one child hint that is the empty\n # tuple, this hint is the empty fixed-length form\n # \"typing.Tuple[()]\".\n # * PEP 585-compliant \"tuple\"-based hint, this hint is *NOT*\n # guaranteed to contain one or more child hints. If this hint\n # contains *NO* child hints, this hint is equivalent to the\n # empty fixed-length PEP 484-compliant form\n # \"typing.Tuple[()]\". Yes, PEP 585 even managed to violate\n # PEP 484-compliance. UUUURGH!\n #\n # While tuples are sequences, the \"typing.Tuple\" singleton that\n # types tuples violates the syntactic norms established for\n # other standard sequences by concurrently supporting two\n # different syntaxes with equally different semantics:\n # * \"typing.Tuple[{typename}, ...]\", typing a tuple whose items\n # all satisfy the \"{typename}\" child hint. Note that the\n # \"...\" substring here is a literal ellipses.\n # * \"typing.Tuple[{typename1}, {typename2}, ..., {typenameN}]\",\n # typing a tuple whose:\n # * First item satisfies the \"{typename1}\" child hint.\n # * Second item satisfies the \"{typename2}\" child hint.\n # * Last item satisfies the \"{typenameN}\" child hint.\n # Note that the \"...\" substring here is *NOT* a literal\n # ellipses.\n #\n # This is what happens when unreadable APIs are promoted.\n elif hint_curr_sign is HintSignTupleFixed:\n # Initialize the code type-checking this pith against this\n # tuple to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_TUPLE_FIXED_PREFIX\n \n # If this hint is the empty fixed-length tuple, generate\n # and append code type-checking the current pith to be the\n # empty tuple. This edge case constitutes a code smell.\n if is_hint_pep484585_tuple_empty(hint_curr):\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_EMPTY_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name))\n # Else, that ridiculous edge case does *NOT* apply. In this\n # case...\n else:\n # Append code type-checking the length of this pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_LEN_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_childs_len=hint_childs_len,\n ))\n \n #FIXME: Optimize by refactoring into a \"while\" loop.\n # For each possibly ignorable insane child hint of this\n # parent tuple...\n for hint_child_index, hint_child in enumerate(\n hint_childs):\n #FIXME: Refactor most (or even *ALL*) calls to\n #sanify_hint_child() to a new\n #hints_meta.sanify_hint() method. The repetition\n #here is becoming... unnerving.\n \n # Unignorable sane child hint sanified from this\n # possibly ignorable insane child hint *OR* \"None\"\n # otherwise (i.e., if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=hint_child,\n cls_stack=hints_meta.cls_stack,\n conf=hints_meta.conf,\n typevar_to_hint=(\n hints_meta.hint_curr_meta.typevar_to_hint),\n exception_prefix=hints_meta.exception_prefix,\n )\n # print(f'Sanified fixed tuple {hints_meta.hint_curr_meta}...')\n # print(f'...child hint {hint_child} -> {hint_or_sane_child}!')\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Python expression yielding the value of the\n # currently indexed item of this tuple to be\n # type-checked against this child hint.\n pith_child_expr = (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_child_index=hint_child_index,\n ))\n \n # Deeply type-check this child pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_child_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n ))\n # Else, this child hint is ignorable.\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_TUPLE_FIXED_SUFFIX}'\n # Format...\n ).format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n )\n # Else, this hint is *NOT* a fixed-length tuple.\n #\n # ..........{ MAPPINGS }............\n # If this hint is a standard mapping (e.g., \"dict[str, int]\")...\n elif hint_curr_sign in HINT_SIGNS_MAPPING:\n # Python expression evaluating to the origin type of this\n # mapping hint as a hidden beartype-specific parameter\n # injected into the signature of this wrapper function.\n hints_meta.hint_curr_expr = (\n hints_meta.add_func_scope_type_or_types(\n get_hint_pep_origin_type_isinstanceable(hint_curr)))\n \n # 2-tuple of the possibly ignorable insane child key and\n # value hints subscripting this mapping hint, defined as\n # either...\n hint_childs = (\n #FIXME: Note that a similar effect can also be achieved\n #through a reduction from type hints the form\n #\"{collections,typing}.Counter[{hint_child}]\" to:\n # typing.Annotated[\n # collections.abc.MutableMapping[{hint_child}, int],\n # beartype.vale.IsInstance[collections.Counter]\n # ]\n #However, the current approach is even *MORE* trivial\n #than that reduction. So, we currently prefer this.\n \n # If this hint describes a \"collections.Counter\"\n # dictionary subclass:\n # * The \"typing.Counter[...]\" type hint factory is\n # subscriptable by only a single key child type hint\n # and assumes the value child type hint typically\n # subscripting dictionary type hint factories to be\n # the standard \"int\" type (e.g., \"typing.Counter[str]\"\n # effectively expands to \"typing.Counter[str, int]\").\n # * The \"collections.Counter[...]\" type hint factory is\n # technically subscriptable by an arbitrary number of\n # child type hints but pragmatically subscriptable by\n # only a single key child type hint. Why? Static\n # type-checkers, which enforce that constraint.\n #\n # Despite these type-checking assumptions and\n # constraints, the \"collections.Counter\" type is itself\n # unconstrained. As of Python 3.13, the\n # collections.Counter.__init__() initializer accepts\n # arbitrary values that are *NOT* integers: e.g.,\n # >>> from collections import Counter\n # >>> c = Counter({'red': 'no, blue!', 'blue': 4.2})\n # >>> print(c)\n # Counter({'red': 'no, blue!', 'blue': 4.2}) # lol\n #\n # That permissiveness arguably constitutes a bug in both\n # CPython itself *AND* user code attempting such\n # shenanigans. Static type-checkers believe this to be\n # the case, anyway -- and that's good enough for us.\n # @beartype thus explicitly catches these bugs by\n # defaulting the undeclared value child type hint for\n # counter type hints to be the \"int\" type.\n (\n get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=EXCEPTION_PREFIX,\n ),\n int,\n )\n if hint_curr_sign is HintSignCounter else\n # Else, this hint does *NOT* describe a\n # \"collections.Counter\" dictionary subclass. In this\n # case, introspect the child key and value type hints\n # subscripting this parent hint in the standard way.\n get_hint_pep484585_args( # type: ignore[assignment]\n hint=hint_curr,\n args_len=2,\n exception_prefix=EXCEPTION_PREFIX,\n )\n )\n \n #FIXME: Consider also contextually considering child key\n #hints that reduce to \"Hashable\" to be ignorable. This\n #includes complex type hints like \"Union[Hashable, str]\",\n #which reduces to \"Hashable\". We can't particularly be\n #bothered at the moment. This is a microoptimization and\n #will probably require a non-trivial amount of work. *sigh*\n # Unignorable sane child key and value hints sanified from\n # these possibly ignorable insane child key and value hints\n # *OR* \"None\" otherwise (i.e., if ignorable).\n hint_or_sane_child_key = (\n sanify_hint_child(\n hint=hint_childs[0],\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n hint_or_sane_child_value = (\n sanify_hint_child(\n hint=hint_childs[1], # type: ignore[has-type]\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n \n # If at least one of these child hints are unignorable...\n if not (\n hint_or_sane_child_key is Any and\n hint_or_sane_child_value is Any\n ):\n # If this child key hint is unignorable...\n if hint_or_sane_child_key is not Any:\n # If this child value hint is also unignorable...\n if hint_or_sane_child_value is not Any:\n # Increase the indentation level of code\n # type-checking this child value pith.\n hints_meta.indent_level_child += 1\n \n # Increment the integer suffixing the name of a\n # unique local variable storing the value of\n # this child key pith *BEFORE* defining this\n # variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n pith_key_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child key pith\n # against this hint.\n hint_key_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_key,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_key_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child value pith\n # against this hint.\n hint_value_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_VALUE_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_key_var_name=pith_key_var_name,\n ),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Code deeply type-checking these child key and\n # value piths against these hints.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_VALUE_format(\n indent_curr=hints_meta.indent_curr,\n pith_key_var_name=pith_key_var_name, # pyright: ignore\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n hint_key_placeholder=(\n hint_key_placeholder),\n hint_value_placeholder=(\n hint_value_placeholder),\n ))\n # Else, this child value hint is ignorable. In this\n # case...\n else:\n # Code deeply type-checking only this child key\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child key pith against this hint.\n hint_key_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=(\n hint_or_sane_child_key),\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n # Else, this child key hint is ignorable. By process\n # of elimination, this child value hint *MUST* be\n # unignorable. In this case...\n else:\n # Code deeply type-checking only this child value\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_VALUE_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child value pith against this hint.\n hint_value_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_VALUE_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Code deeply type-checking this pith as well as at\n # least one of these child key and value piths.\n hints_meta.func_curr_code = CODE_PEP484585_MAPPING_format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hints_meta.hint_curr_expr,\n func_curr_code_key_value=func_curr_code_key_value,\n )\n # Else, these child key *AND* value hints are both\n # ignorable. In this case, fallback to trivial code\n # shallowly type-checking this pith as an instance of this\n # origin type.\n # Else, this hint is *NOT* a mapping.\n #\n # ............{ ANNOTATED }............\n # If this hint is a PEP 593-compliant type metahint, this\n # metahint is guaranteed by the reduction performed above to be\n # beartype-specific (i.e., metahint whose second argument is a\n # beartype validator produced by subscripting a beartype\n # validator factory). In this case...\n elif hint_curr_sign is HintSignAnnotated:\n # Defer heavyweight imports.\n from beartype.vale._core._valecore import BeartypeValidator\n \n # Initialize the code type-checking this pith against this\n # metahint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP593_VALIDATOR_PREFIX\n \n # Unignorable sane metahint annotating this parent hint\n # sanified from this possibly ignorable insane metahint *OR*\n # \"None\" otherwise (i.e., if this metahint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=get_hint_pep593_metahint(hint_curr),\n conf=conf,\n cls_stack=cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # print(f'[593] metahint: {repr(get_hint_pep593_metahint(hint_curr))}')\n # print(f'[593] hint_curr_meta: {repr(hints_meta.hint_curr_meta)}')\n # print(f'[593] hint_curr: {repr(hint_curr)}; hint_or_sane_child: {repr(hint_or_sane_child)}')\n \n # Tuple of the one or more beartype validators annotating\n # this metahint.\n hints_child = get_hint_pep593_metadata(hint_curr)\n # print(f'hints_child: {repr(hints_child)}')\n \n # If this metahint is ignorable...\n if hint_or_sane_child is Any:\n # Expression yielding the value of the current pith,\n # defined as either...\n hint_curr_expr = (\n hints_meta.pith_curr_expr\n # If this metahint is annotated by only one beartype\n # validator, the most efficient expression yielding\n # the value of the current pith is simply the full\n # Python expression *WITHOUT* assigning that value\n # to a reusable local variable in an assignment\n # expression. *NO* assignment expression is needed\n # in this case.\n #\n # Why? Because beartype validators are *NEVER*\n # recursed into. Each beartype validator is\n # guaranteed to be the leaf of a type-checking\n # subtree, guaranteeing this pith to be evaluated\n # only once.\n if len(hints_child) == 1 else\n # Else, this metahint is annotated by two or more\n # beartype validators. In this case, the most\n # efficient expression yielding the value of the\n # current pith is the assignment expression\n # assigning this value to a reusable local variable.\n hints_meta.pith_curr_assign_expr\n )\n # Else, this metahint is unignorable. In this case...\n else:\n # Python expression yielding the value of the current\n # pith, defaulting to the name of the local variable\n # assigned to by the assignment expression performed\n # below.\n hint_curr_expr = hints_meta.pith_curr_var_name\n \n # Code deeply type-checking this metahint.\n hints_meta.func_curr_code += (\n CODE_PEP593_VALIDATOR_METAHINT_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression yielding the value of the\n # current pith assigned to a local variable\n # efficiently reused by code generated by the\n # following iteration.\n #\n # Note this child hint is guaranteed to be followed\n # by at least one more test expression referencing\n # this local variable. Why? Because the \"typing\"\n # module forces metahints to be subscripted by one\n # child hint and one or more arbitrary objects.\n # Ergo, we need *NOT* explicitly validate that here.\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=hints_meta.pith_curr_assign_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n #FIXME: Optimize by refactoring into a \"while\" loop. *sigh*\n # For the 0-based index and each beartype validator\n # annotating this metahint...\n for hint_child_index, hint_child in enumerate(hints_child):\n # print(f'Type-checking PEP 593 type hint {repr(hint_curr)} argument {repr(hint_child)}...')\n # If this is *NOT* a beartype validator, raise an\n # exception.\n #\n # Note that the previously called sanify_hint_child()\n # function validated only the first such to be a\n # beartype validator. All remaining arguments have yet\n # to be validated, so we do so now for consistency and\n # safety.\n if not isinstance(hint_child, BeartypeValidator):\n raise BeartypeDecorHintPep593Exception(\n f'{EXCEPTION_PREFIX}PEP 593 type hint '\n f'{repr(hint_curr)} subscripted by both '\n f'@beartype-specific and -agnostic metadata '\n f'(i.e., {represent_object(hint_child)} not '\n f'beartype validator).'\n )\n # Else, this argument is beartype-specific.\n #\n # If this is any beartype validator *EXCEPT* the first,\n # set the Python expression yielding the value of the\n # current pith to the name of the local variable\n # assigned to by the prior assignment expression. By\n # deduction, it *MUST* be the case now that either:\n # * This metahint was unignorable, in which case this\n # assignment uselessly reduplicates the exact same\n # assignment performed above. While non-ideal, this\n # assignment is sufficiently efficient to make any\n # optimizations here effectively worthless.\n # * This metahint was ignorable, in which case this\n # expression was set above to the assignment\n # expression assigning this pith for the first\n # beartype validator. Since this iteration has already\n # processed the first beartype validator, this\n # assignment expression has already been performed.\n # Avoid inefficiently re-performing this assignment\n # expression for each additional beartype validator by\n # efficiently reusing the previously assigned local.\n elif hint_child_index:\n hint_curr_expr = hints_meta.pith_curr_var_name\n # Else, this is the first beartype validator. See above.\n \n # Code deeply type-checking this validator.\n hints_meta.func_curr_code += CODE_PEP593_VALIDATOR_IS_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression formatting the current pith into\n # the \"{obj}\" format substring previously embedded\n # by this validator into this code string.\n hint_child_expr=hint_child._is_valid_code.format(\n indent=hints_meta.indent_child,\n obj=hint_curr_expr,\n ),\n )\n \n # Generate locals safely merging the locals required by\n # both this validator code *AND* the current code\n # type-checking this entire root hint.\n update_mapping(\n mapping_trg=hints_meta.func_wrapper_scope,\n mapping_src=hint_child._is_valid_code_locals,\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP593_VALIDATOR_SUFFIX_format(indent_curr=hints_meta.indent_curr)}'\n )\n # Else, this hint is *NOT* a metahint.\n #\n # ............{ SUBCLASS }............\n # If this hint is either a PEP 484- or 585-compliant subclass\n # type hint...\n elif hint_curr_sign is HintSignType:\n # Unignorable sane child hint sanified from this possibly\n # ignorable insane child hint *OR* \"None\" otherwise (i.e.,\n # if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n # Possibly ignorable insane child hint subscripting\n # this parent hint, validated to be the *ONLY* child\n # hint subscripting this parent hint.\n hint=get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=hints_meta.exception_prefix,\n ),\n conf=conf,\n cls_stack=hints_meta.cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=hints_meta.exception_prefix,\n )\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Child hint encapsulated by this metadata.\n hint_child = get_hint_or_sane_hint(hint_or_sane_child)\n \n # Sign identifying this child hint.\n hint_child_sign = get_hint_pep_sign_or_none(hint_child)\n \n # If this child hint is a forward reference to a\n # superclass, expose this forward reference to the body\n # of this wrapper function. See above for commentary.\n if hint_child_sign is HintSignForwardRef:\n (\n hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_child, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # Else, this child hint is *NOT* a forward reference. In\n # this case...\n else:\n # If this child hint is a union of superclasses,\n # reduce this union to a tuple of superclasses. Only\n # the latter is safely passable as the second\n # parameter to the issubclass() builtin under all\n # supported Python versions.\n if hint_child_sign is HintSignUnion:\n hint_child = get_hint_pep_args(hint_child) # pyright: ignore\n # Else, this child hint is *NOT* a union.\n \n # If this child hint is *NOT* an issubclassable\n # object, raise an exception.\n #\n # Note that the is_object_issubclassable() tester is\n # considerably faster and thus called before the\n # considerably slower\n # die_unless_object_issubclassable() raiser.\n if not is_object_issubclassable(hint_child): # type: ignore[arg-type]\n die_unless_object_issubclassable(\n obj=hint_child, # type: ignore[arg-type]\n exception_prefix=(\n f'{EXCEPTION_PREFIX}PEP 484 or 585 '\n f'subclass type hint {repr(hint_curr)} '\n f'child type hint '\n ),\n )\n # Else, this child hint is an issubclassable object.\n \n # Python expression evaluating to this child hint.\n hint_curr_expr = hints_meta.add_func_scope_type_or_types(\n hint_child) # pyright: ignore\n \n # Code type-checking this pith against this superclass.\n hints_meta.func_curr_code = CODE_PEP484585_SUBCLASS_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hint_curr_expr,\n indent_curr=hints_meta.indent_curr,\n )\n # Else, this child hint is ignorable. In this case...\n else:\n # Python expression evaluating to the origin type of\n # this hint -- which, by definition, is the \"type\"\n # superclass. Since this superclass is a builtin (i.e.,\n # universally accessible object), we efficiently\n # hardcode the access of this superclass rather than\n # inject a hidden beartype-specific parameter into the\n # signature of this wrapper function as we usually do.\n hints_meta.hint_curr_expr = 'type'\n \n # Fallback to trivial code shallowly type-checking this\n # pith as an instance of this origin type.\n # Else, this hint is *NOT* a subclass type hint.\n #\n # ............{ GENERIC or PROTOCOL }............\n # If this hint is either a:\n # * PEP 484-compliant generic (i.e., user-defined class\n # subclassing a combination of one or more of the\n # \"typing.Generic\" superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 544-compliant protocol (i.e., class subclassing a\n # combination of one or more of the \"typing.Protocol\"\n # superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 585-compliant generic (i.e., user-defined class\n # subclassing at least one non-class PEP 585-compliant\n # pseudo-superclasses) *OR*...\n #\n # ...then this hint is a PEP-compliant generic. In this case...\n elif hint_curr_sign is HintSignPep484585GenericUnsubscripted:\n # print(f'Visiting generic type {repr(hint_curr)}...')\n \n # Initialize the code type-checking this pith against this\n # generic to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_GENERIC_PREFIX\n \n # For each unignorable unerased transitive pseudo-superclass\n # originally declared as a superclass of this generic...\n for hint_or_sane_child in (\n iter_hint_pep484585_generic_bases_unerased(\n hint=hint_curr, # pyright: ignore\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )):\n # print(f'Visiting generic type hint {repr(hint_curr)}...')\n # print(f'...unerased base {repr(hint_child)}...')\n \n # Generate and append code type-checking this pith\n # against this pseudo-superclass.\n hints_meta.func_curr_code += (\n CODE_PEP484585_GENERIC_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n # Python expression efficiently reusing\n # the value of this pith previously\n # assigned to a local variable by the\n # prior expression.\n pith_expr=hints_meta.pith_curr_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_GENERIC_SUFFIX}'\n # Format...\n ).format(\n # Indentation deferred above for efficiency.\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n # Python expression evaluating to this generic type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n hint_curr), # pyright: ignore\n )\n # print(f'{hint_curr_exception_prefix} PEP generic {repr(hint)} handled.')\n # Else, this hint is *NOT* a generic.\n #\n # ............{ PEP 484 ~ type variable }............\n # If this hint is a PEP 484-compliant type variable (i.e.,\n # \"typing.TypeVar\" object), this hint is both dependent on and\n # less common than .PEP 484- and 585-compliant generics and thus\n # intentionally detected immediately after generics. In this\n # case...\n \n #FIXME: Preserved for posterity, once we begin generating\n #call-time type variable type-checking.\n #FIXME: Unit test us up, please.\n #FIXME: Implement corresponding \"beartype._check.error\"\n #validation, please. *sigh*\n # elif hint_curr_sign is HintSignTypeVar:\n # # Either the unignorable hint this type variable reduces to\n # # if any *OR* \"None\" if this type variable is ignorable.\n # hint_child = make_hint_pep484_typevar_check_expr( # type: ignore[assignment]\n # hint_meta=hint_curr_meta,\n # conf=conf,\n # pith_curr_assign_expr=pith_curr_assign_expr,\n # pith_curr_var_name_index=pith_curr_var_name_index,\n # cls_stack=cls_stack,\n # exception_prefix=EXCEPTION_PREFIX,\n # )\n #\n # # If this type variable is reducible to an unignorable\n # # hint, revisit this hint metadata in the outermost \"while\"\n # # loop. Doing so avoids the \"CLEANUP\" logic below, which\n # # assumes this hint to be unignorable and thus\n # # type-checkable.\n # if hint_child is not None:\n # continue\n # # Else, this type variable is *NOT* reducible to an\n # # unignorable hint. Since @beartype currently fails to\n # # generate type-checking code for type variables in and of\n # # themselves, type variables have *NO* intrinsic semantic\n # # meaning and are thus ignorable. In this case, prepare this\n # # BFS to visit the next enqueued hint by incrementing the\n # # 0-based index of metadata describing the next visited hint\n # # in the \"hints_meta\" list *BEFORE* visiting that hint.\n # else:\n # #FIXME: Insufficient. The parent type hint thought this\n # #type variable was unignorable and thus... ugh.\n # hints_meta_index_curr += 1\n # ............{ PEP 586 ~ typing.Literal }............\n # If this hint is a PEP 586-compliant type hint (i.e., the\n # \"typing.Literal\" singleton subscripted by one or more literal\n # objects), this hint is largely useless and thus intentionally\n # detected late. Why? Because \"typing.Literal\" is subscriptable\n # by objects that are instances of only *SIX* possible types,\n # which is sufficiently limiting as to render this singleton\n # patently absurd and a farce that we weep to even implement.\n # In this case...\n elif hint_curr_sign is HintSignLiteral:\n # Tuple of zero or more literal objects subscripting this\n # hint, intentionally replacing the current such tuple due\n # to the non-standard implementation of the third-party\n # \"typing_extensions.Literal\" type hint factory.\n hint_childs = get_hint_pep586_literals(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n \n # Initialize the code type-checking this pith against this\n # hint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP586_PREFIX_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n \n #FIXME: If \"typing.Literal\" is ever extended to support\n #substantially more types (and thus actually becomes\n #useful), optimize the construction of the \"types\" set\n #below to instead leverage a similar\n #\"acquire_instance(set)\" caching solution as that\n #currently employed for unions. For now, we only shrug.\n \n # Python expression evaluating to a tuple of the unique\n # types of all literal objects subscripting this hint.\n hint_child_types_expr=hints_meta.add_func_scope_type_or_types({\n #FIXME: Optimize by refactoring into a \"while\"\n #loop. Also, this should probably be a \"frozenset\"\n #rather than \"set\". *sigh*\n # Set comprehension of all unique literal objects\n # subscripting this hint, implicitly discarding all\n # duplicate such objects.\n type(hint_child) for hint_child in hint_childs}),\n )\n \n #FIXME: Optimize by refactoring into a \"while\" loop. *sigh*\n # For each literal object subscripting this hint...\n for hint_child in hint_childs:\n # Generate and append efficient code type-checking\n # this data validator by embedding this code as is.\n hints_meta.func_curr_code += CODE_PEP586_LITERAL_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n # Python expression evaluating to this object.\n hint_child_expr=add_func_scope_attr(\n attr=hint_child,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=(\n EXCEPTION_PREFIX_FUNC_WRAPPER_LOCAL),\n ),\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" or\" suffix appended by the last\n # child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_OR]}'\n # Suffix this code by the appropriate substring.\n f'{CODE_PEP586_SUFFIX}'\n ).format(indent_curr=hints_meta.indent_curr)\n # Else, this hint is *NOT* a PEP 586-compliant type hint.\n #\n # ............{ UNSUPPORTED }............\n # Else, this hint is neither shallowly nor deeply supported and\n # is thus unsupported. Since an exception should have already\n # been raised above in this case, this conditional branch\n # *NEVER* be triggered. Nonetheless, raise an exception.\n else:\n> raise BeartypeDecorHintPepUnsupportedException(\n f'{EXCEPTION_PREFIX_HINT}'\n f'{repr(hint_curr)} unsupported but '\n f'erroneously detected as supported under '\n f'beartype sign {repr(hint_curr_sign)}.'\n )\nE beartype.roar.BeartypeDecorHintPepUnsupportedException: Is_bearable() type hint None unsupported but erroneously detected as supported under beartype sign HintSign('None').\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #9: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #10: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #11: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #12: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #13: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #14: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 17.138380800000007, "in_degree": 1, "true_in_degree": 3.8800000000000003, "out_degree": 2, "betweenness": 0.0002587683170033816, "pagerank": 0.00039170504193056536, "harmonic": 0.02040256892230576, "bidirectional_harmonic": 0.20998987762968105, "degree": 3 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/error/utilerrget.py", "function_name": "get_name_error_attr_name", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/error/test_utilerrget.py::test_get_name_error_attr_name\nLocation: /tmp/benchmark_3pih0wcx/beartype_test/a00_unit/a20_util/error/test_utilerrget.py:39\nError: assert None == 'undefined_attr'\n + where None = (NameError(\"name 'undefined_attr' is not defined\"))\n\nTraceback:\n\n> def test_get_name_error_attr_name() -> None:\n '''\n Test the\n :func:`beartype._util.error.utilerrget.get_name_error_attr_name` getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.error.utilerrget import get_name_error_attr_name\n \n # ....................{ ASSERT }....................\n # Attempt to access an attribute *NEVER* defined in either the global or\n # local scopes of this unit test.\n try:\n undefined_attr\n # When doing so necessarily raises the standard \"NameError\" exception...\n except NameError as exception:\n # Assert that the unqualified basename of this undefined attribute\n # returned by this getter is the expected basename.\n> assert get_name_error_attr_name(exception) == 'undefined_attr'\nE assert None == 'undefined_attr'\nE + where None = (NameError(\"name 'undefined_attr' is not defined\"))\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py::test_iter_hint_pep695_forwardrefs\nLocation: /tmp/benchmark_3pih0wcx/beartype/_util/hint/pep/proposal/pep695.py:579\nError: beartype.roar.BeartypeDecorHintPep695Exception: PEP 695 local type alias \"sudden_she_rose\" unquoted relative forward reference \"None\" unsupported, due to severe deficiencies in CPython's runtime implementation of PEP 695 local type aliases outside beartype's control. Consider either:\n* Refactoring this local type alias into a global type alias:\n # Instead of a local type alias defined in a callable like this...\n def muh_func(...) -> ...:\n type sudden_she_rose = ...\n\n # Prefer a global type alias defined at module scope.\n type sudden_she_rose = ...\n* Quoting this forward reference in this type alias:\n # Instead of an unquoted forward reference like this...\n type sudden_she_rose = ... None ...\n\n # Prefer a quoted forward reference.\n type sudden_she_rose = ... \"None\" ...\n\nTraceback:\n\n> def test_iter_hint_pep695_forwardrefs() -> None:\n '''\n Test the private\n :mod:`beartype._util.hint.pep.proposal.pep695.iter_hint_pep695_unsubscripted_forwardrefs`\n iterator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep695Exception\n from beartype._util.hint.pep.proposal.pep695 import (\n iter_hint_pep695_unsubscripted_forwardrefs)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_12\n from pytest import raises\n \n # If the active Python interpreter targets Python >= 3.12 and thus supports\n # PEP 695...\n if IS_PYTHON_AT_LEAST_3_12:\n # Defer version-specific imports.\n from beartype_test.a00_unit.data.pep.pep695.data_pep695util import (\n unit_test_iter_hint_pep695_forwardrefs)\n \n # Perform this test.\n> unit_test_iter_hint_pep695_forwardrefs()\n\n> the_warm_light_of = next(and_saw_by)\n\n> def iter_hint_pep695_unsubscripted_forwardrefs(\n # Mandatory parameters.\n hint: HintPep695TypeAlias,\n \n # Optional parameters.\n exception_prefix: str = '',\n ) -> Iterable[BeartypeForwardRefMeta]:\n '''\n Iteratively create and yield one **forward reference proxy** (i.e.,\n :class:`beartype._check.forward.reference.fwdrefabc.BeartypeForwardRefABC`\n subclass) for each unquoted relative forward reference in the passed\n :pep:`695`-compliant **unsubscripted type alias** (i.e., object created by a\n statement of the form ``type {alias_name} = {alias_value}``) to the\n underlying type hint lazily referred to by this type alias.\n \n This iterator is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as this iterator is intended to be\n called only once per unsubscripted type alias in userspace code dynamically\n instrumented by beartype import hook abstract syntax tree (AST) node\n transformers. Since those transformers are expected to replace *all*\n unquoted relative forward references in this unsubscripted type alias with\n corresponding forward reference proxies, calling this iterator again on any\n unsubscripted type alias instrumented in this way *should* silently reduce\n to a noop. \"Should\" is doing a lot of heavy lifting here.\n \n Parameters\n ----------\n hint : HintPep695TypeAlias\n Unsubscripted type alias to be iterated over.\n exception_prefix : str, optional\n Human-readable substring prefixing exception messages raised by this\n reducer. Defaults to the empty string.\n \n Yields\n ------\n BeartypeForwardRefMeta\n Forward reference proxy encapsulating the next unquoted relative forward\n reference in this unsubscripted type alias.\n \n Raises\n ------\n BeartypeDecorHintPep695Exception\n If this type hint is *not* an unsubscripted type alias.\n '''\n \n # Unqualified basename of the previous undeclared attribute in this alias.\n hint_ref_name_prev: Optional[str] = None\n \n # While this alias still contains one or more forward references to\n # attributes *NOT* defined by the module declaring this alias...\n while True:\n # Attempt to...\n try:\n # print(f'type {hint.__name__} = {hint.__value__}')\n \n # Reduce this alias to the type hint it lazily refers to. If this\n # alias contains *NO* forward references to undeclared attributes,\n # this reduction *SHOULD* succeed. Let's pretend we mean that.\n #\n # Note that _get_hint_pep695_unsubscripted_alias() is memoized and\n # thus intentionally called with positional arguments.\n get_hint_pep695_unsubscripted_alias(hint, exception_prefix)\n \n # This reduction raised *NO* exception and thus succeeded. In this\n # case, immediately halt iteration.\n break\n # If doing so raises a builtin \"NameError\" exception, this alias\n # contains one or more forward references to undeclared attributes. In\n # this case...\n except NameError as exception:\n # Unqualified basename of this alias (i.e., name of the global or\n # local variable assigned to by the left-hand side of this alias).\n hint_name = repr(hint)\n \n # Fully-qualified name of the external third-party module defining\n # this alias.\n hint_module_name = hint.__module__\n # print(f'hint_module_name: {hint_module_name}')\n \n # If this alias defines *NO* module name, raise an exception.\n #\n # Note that this should *NEVER* happen. Nonetheless, static\n # type-checkers like mypy insist this can happen. It almost\n # certainly can't. Nonetheless, let's dot our i's and cross our t's.\n if not hint_module_name:\n raise BeartypeDecorHintPep695Exception(\n f'{exception_prefix}PEP 695 type alias \"{hint_name}\" '\n f'module undefined (i.e., \"__module__\" attribute '\n f'either \"None\" or the empty string).'\n ) from exception\n # Else, this alias defines a module name.\n \n # That module as its previously imported object.\n hint_module = get_module_imported_or_none(hint_module_name)\n \n # Unqualified basename of the next remaining undeclared attribute\n # contained in this alias relative to that module.\n hint_ref_name = get_name_error_attr_name(exception)\n # print(f'hint: {hint}; hint_ref_name: {hint_ref_name}')\n \n # If this attribute is the same as that of the prior iteration of\n # this \"while\" loop, then that iteration *MUST* have failed to\n # define this attribute as a global variable of that module. In this\n # case, raise an exception.\n #\n # Note that this should *NEVER* happen. Of course, this frequently\n # happens. Specifically, this happens whenever the caller defines a\n # callable defining type alias as a local variable containing one or\n # more unquoted relative forward reference to user-defined classes\n # that have yet to be defined. Why? Because CPython's low-level\n # C-based implementation of PEP 695-compliant type aliases currently\n # fails to properly resolve unquoted relative forward references\n # defined in a local rather than global scope: e.g.,\n # >>> def foo():\n # ... type bar = wut\n # ... globals()['wut'] = str\n # ... print(bar.__value__)\n # ... class wut(object): pass # <-- causes madness; WTF!?!?\n # >>> foo()\n # NameError: cannot access free variable 'wut' where it is not\n # associated with a value in enclosing scope\n #\n # Why does this matter? Because the abstract syntax tree (AST)\n # transformation implemented by \"beartype.claw\" import hooks\n # dynamically declares the objects that these forward references\n # refer. Due to deficiencies [read: bugs] in CPython's type alias\n # implementation, local type aliases remain unable to resolve either\n # global *OR* local referees that are defined dynamically. Ergo, we\n # have no recourse but to detect this edge case and raise a\n # human-readable exception advising the caller with recommendations.\n if hint_ref_name == hint_ref_name_prev:\n> raise BeartypeDecorHintPep695Exception(\n f'{exception_prefix}PEP 695 local type alias \"{hint_name}\" '\n f'unquoted relative forward reference \"{hint_ref_name}\" '\n f\"unsupported, due to severe deficiencies in CPython's \"\n f'runtime implementation of PEP 695 local type aliases '\n f\"outside beartype's control. Consider either:\\n\"\n f'* Refactoring this local type alias into a '\n f'global type alias:\\n'\n f' # Instead of a local type alias '\n f'defined in a callable like this...\\n'\n f' def muh_func(...) -> ...:\\n'\n f' type {hint_name} = ...\\n'\n f'\\n'\n f' # Prefer a global type alias defined at module scope.\\n'\n f' type {hint_name} = ...\\n'\n f'* Quoting this forward reference in this type alias:\\n'\n f' # Instead of an unquoted forward reference '\n f'like this...\\n'\n f' type {hint_name} = ... {hint_ref_name} ...\\n'\n f'\\n'\n f' # Prefer a quoted forward reference.\\n'\n f' type {hint_name} = ... \"{hint_ref_name}\" ...'\n ) from exception\nE beartype.roar.BeartypeDecorHintPep695Exception: PEP 695 local type alias \"sudden_she_rose\" unquoted relative forward reference \"None\" unsupported, due to severe deficiencies in CPython's runtime implementation of PEP 695 local type aliases outside beartype's control. Consider either:\nE * Refactoring this local type alias into a global type alias:\nE # Instead of a local type alias defined in a callable like this...\nE def muh_func(...) -> ...:\nE type sudden_she_rose = ...\nE \nE # Prefer a global type alias defined at module scope.\nE type sudden_she_rose = ...\nE * Quoting this forward reference in this type alias:\nE # Instead of an unquoted forward reference like this...\nE type sudden_she_rose = ... None ...\nE \nE # Prefer a quoted forward reference.\nE type sudden_she_rose = ... \"None\" ...\n", "Failure #3: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #4: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/error/test_utilerrget.py", "test_get_name_error_attr_name" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py", "test_iter_hint_pep695_forwardrefs" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.3856000000000006, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 1, "betweenness": 5.419231769704327e-06, "pagerank": 0.00040332512315270944, "harmonic": 0.004523026315789475, "bidirectional_harmonic": 0.17108024011806955, "degree": 3 }, "line_count": 25, "code_line_count": 25, "cyclomatic": 6, "halstead_volume": 58.81033751683406, "halstead_difficulty": 2.857142857142857 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/metadata/metadecor.py", "function_name": "BeartypeDecorMeta.deinit", "test_info": { "success": false, "failed": 99, "passed": 1031, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_152uk87c/beartype/_check/metadata/metadecor.py:449\nError: AttributeError: 'BeartypeDecorMeta' object has no attribute 'func_wrapper_scope'. Did you mean: 'func_wrapper_name'?\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> decor_meta = make_beartype_call(\n\n> decor_meta.reinit(**kwargs)\n\n> def reinit(\n self,\n \n # Mandatory parameters.\n func: Callable,\n conf: BeartypeConf,\n \n # Optional parameters.\n cls_stack: TypeStack = None,\n wrapper: Optional[Callable] = None,\n ) -> None:\n '''\n Reinitialize this metadata from the passed callable, typically after\n acquisition of a previously cached instance of this class from the\n :mod:`beartype._util.cache.pool.utilcachepoolobject` submodule.\n \n If :pep:`563` is conditionally active for this callable, this function\n additionally resolves all postponed annotations on this callable to\n their referents (i.e., the intended annotations to which those\n postponed annotations refer).\n \n Parameters\n ----------\n func : Callable\n Callable currently being decorated by :func:`beartype.beartype`.\n conf : BeartypeConf\n Beartype configuration configuring :func:`beartype.beartype`\n specific to this callable.\n cls_stack : TypeStack\n **Type stack** (i.e., either tuple of zero or more arbitrary types\n *or* :data:`None`). See also the parameter of the same name accepted\n by the :func:`beartype._decor.decorcore.beartype_object` function.\n wrapper : Optional[Callable]\n Wrapper callable to be unwrapped in the event that the callable\n currently being decorated by :func:`beartype.beartype` differs from\n the callable to be unwrapped. Typically, these two callables are the\n same. Edge cases in which these two callables differ include:\n \n * When ``wrapper`` is a **pseudo-callable** (i.e., otherwise\n uncallable object whose type renders that object callable by\n defining the ``__call__()`` dunder method) *and* ``func`` is that\n ``__call__()`` dunder method. If that pseudo-callable wraps a\n lower-level callable, then that pseudo-callable (rather than\n ``__call__()`` dunder method) defines the ``__wrapped__`` instance\n variable providing that callable.\n \n Defaults to :data:`None`, in which case this parameter *actually*\n defaults to ``func``.\n \n Raises\n ------\n BeartypePep563Exception\n If evaluating a postponed annotation on this callable raises an\n exception (e.g., due to that annotation referring to local state no\n longer accessible from this deferred evaluation).\n BeartypeDecorWrappeeException\n If either:\n \n * This callable is uncallable.\n * This callable is neither a pure-Python function *nor* method;\n equivalently, if this callable is either C-based *or* a class or\n object defining the ``__call__()`` dunder method.\n * This configuration is *not* actually a configuration.\n * ``cls_owner`` is neither a class *nor* :data:`None`.\n '''\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # CAUTION: Note this method intentionally avoids creating and passing an\n # \"exception_prefix\" substring to callables called below. Why? Because\n # exhaustive profiling has shown that creating that substring consumes a\n # non-trivial slice of decoration time. In other words, efficiency.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n # If the caller failed to pass a callable to be unwrapped, default that\n # to the callable to be type-checked.\n if wrapper is None:\n wrapper = func\n # Else, the caller passed a callable to be unwrapped. Preserve it up!\n # print(f'Beartyping func {repr(func)} + wrapper {repr(wrapper)}...')\n \n # If the callable to be type-checked is uncallable, raise an exception.\n if not callable(func):\n raise BeartypeDecorWrappeeException(f'{repr(func)} uncallable.')\n # Else, that callable is callable.\n #\n # If the callable to be unwrapped is uncallable, raise an exception.\n elif not callable(wrapper):\n raise BeartypeDecorWrappeeException(f'{repr(wrapper)} uncallable.')\n # Else, that callable is callable.\n #\n # If this configuration is *NOT* a configuration, raise an exception.\n elif not isinstance(conf, BeartypeConf):\n raise BeartypeDecorWrappeeException(\n f'\"conf\" {repr(conf)} not beartype configuration.')\n # Else, this configuration is a configuration.\n #\n # If this class stack is neither a tuple *NOR* \"None\", raise an\n # exception.\n elif not isinstance(cls_stack, NoneTypeOr[tuple]):\n raise BeartypeDecorWrappeeException(\n f'\"cls_stack\" {repr(cls_stack)} neither tuple nor \"None\".')\n # Else, this class stack is either a tuple *OR* \"None\".\n \n # If the caller passed a non-empty class stack...\n if cls_stack:\n # For each item of this class stack...\n for cls_stack_item in cls_stack:\n # If this item is *NOT* a type, raise an exception.\n if not isinstance(cls_stack_item, type):\n raise BeartypeDecorWrappeeException(\n f'\"cls_stack\" item {repr(cls_stack_item)} not type.')\n # Else, this item is a type.\n # Else, the caller either passed no class stack *OR* an empty class\n # stack. In either case, ignore this parameter.\n \n # Classify all passed parameters.\n self.conf = conf\n self.cls_stack = cls_stack\n \n # Wrappee callable currently being decorated.\n self.func_wrappee = func\n \n # Possibly unwrapped callable unwrapped from this wrappee callable.\n self.func_wrappee_wrappee = unwrap_func_all_isomorphic(\n func=func, wrapper=wrapper)\n # print(f'func_wrappee: {self.func_wrappee}')\n # print(f'func_wrappee_wrappee: {self.func_wrappee_wrappee}')\n # print(f'{dir(self.func_wrappee_wrappee)}')\n \n # True only if this wrappee callable is nested. As a minor efficiency\n # gain, we can avoid the slightly expensive call to is_func_nested() by\n # noting that:\n # * If the class stack is non-empty, then this wrappee callable is\n # necessarily nested in one or more classes.\n # * Else, defer to the is_func_nested() tester.\n self.func_wrappee_is_nested = bool(cls_stack) or is_func_nested(func)\n \n # Defer the resolution of both global and local scopes for this wrappee\n # callable until needed to subsequently resolve stringified type hints.\n self.func_wrappee_scope_forward = None\n self.func_wrappee_scope_nested_names = None\n \n # Possibly wrapped callable wrappee code object (i.e., code object\n # underlying the callable currently being type-checked by the\n # @beartype.beartype decorator) if this wrappee is pure-Python *OR*\n # \"None\" otherwise.\n #\n # Note that only the possibly unwrapped callable (i.e.,\n # \"self.func_wrappee_wrappee\") need actually be pure-Python. Whereas the\n # latter is required to have a code object, the \"self.func_wrappee\" is\n # permitted to be C-based and thus *NOT* have a code object.\n func_wrappee_codeobj = get_func_codeobj_or_none(func)\n \n # Possibly unwrapped callable code object.\n self.func_wrappee_wrappee_codeobj = get_func_codeobj(\n func=self.func_wrappee_wrappee,\n exception_cls=BeartypeDecorWrappeeException,\n )\n \n # Efficiently reduce this local scope back to the dictionary of all\n # parameters unconditionally required by *ALL* wrapper functions.\n> self.func_wrapper_scope.clear()\nE AttributeError: 'BeartypeDecorMeta' object has no attribute 'func_wrapper_scope'. Did you mean: 'func_wrapper_name'?\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark_152uk87c/beartype/_check/metadata/metadecor.py:449\nError: AttributeError: 'BeartypeDecorMeta' object has no attribute 'func_wrapper_scope'. Did you mean: 'func_wrapper_name'?\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> decor_meta = make_beartype_call(\n\n> decor_meta.reinit(**kwargs)\n\n> def reinit(\n self,\n \n # Mandatory parameters.\n func: Callable,\n conf: BeartypeConf,\n \n # Optional parameters.\n cls_stack: TypeStack = None,\n wrapper: Optional[Callable] = None,\n ) -> None:\n '''\n Reinitialize this metadata from the passed callable, typically after\n acquisition of a previously cached instance of this class from the\n :mod:`beartype._util.cache.pool.utilcachepoolobject` submodule.\n \n If :pep:`563` is conditionally active for this callable, this function\n additionally resolves all postponed annotations on this callable to\n their referents (i.e., the intended annotations to which those\n postponed annotations refer).\n \n Parameters\n ----------\n func : Callable\n Callable currently being decorated by :func:`beartype.beartype`.\n conf : BeartypeConf\n Beartype configuration configuring :func:`beartype.beartype`\n specific to this callable.\n cls_stack : TypeStack\n **Type stack** (i.e., either tuple of zero or more arbitrary types\n *or* :data:`None`). See also the parameter of the same name accepted\n by the :func:`beartype._decor.decorcore.beartype_object` function.\n wrapper : Optional[Callable]\n Wrapper callable to be unwrapped in the event that the callable\n currently being decorated by :func:`beartype.beartype` differs from\n the callable to be unwrapped. Typically, these two callables are the\n same. Edge cases in which these two callables differ include:\n \n * When ``wrapper`` is a **pseudo-callable** (i.e., otherwise\n uncallable object whose type renders that object callable by\n defining the ``__call__()`` dunder method) *and* ``func`` is that\n ``__call__()`` dunder method. If that pseudo-callable wraps a\n lower-level callable, then that pseudo-callable (rather than\n ``__call__()`` dunder method) defines the ``__wrapped__`` instance\n variable providing that callable.\n \n Defaults to :data:`None`, in which case this parameter *actually*\n defaults to ``func``.\n \n Raises\n ------\n BeartypePep563Exception\n If evaluating a postponed annotation on this callable raises an\n exception (e.g., due to that annotation referring to local state no\n longer accessible from this deferred evaluation).\n BeartypeDecorWrappeeException\n If either:\n \n * This callable is uncallable.\n * This callable is neither a pure-Python function *nor* method;\n equivalently, if this callable is either C-based *or* a class or\n object defining the ``__call__()`` dunder method.\n * This configuration is *not* actually a configuration.\n * ``cls_owner`` is neither a class *nor* :data:`None`.\n '''\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # CAUTION: Note this method intentionally avoids creating and passing an\n # \"exception_prefix\" substring to callables called below. Why? Because\n # exhaustive profiling has shown that creating that substring consumes a\n # non-trivial slice of decoration time. In other words, efficiency.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n # If the caller failed to pass a callable to be unwrapped, default that\n # to the callable to be type-checked.\n if wrapper is None:\n wrapper = func\n # Else, the caller passed a callable to be unwrapped. Preserve it up!\n # print(f'Beartyping func {repr(func)} + wrapper {repr(wrapper)}...')\n \n # If the callable to be type-checked is uncallable, raise an exception.\n if not callable(func):\n raise BeartypeDecorWrappeeException(f'{repr(func)} uncallable.')\n # Else, that callable is callable.\n #\n # If the callable to be unwrapped is uncallable, raise an exception.\n elif not callable(wrapper):\n raise BeartypeDecorWrappeeException(f'{repr(wrapper)} uncallable.')\n # Else, that callable is callable.\n #\n # If this configuration is *NOT* a configuration, raise an exception.\n elif not isinstance(conf, BeartypeConf):\n raise BeartypeDecorWrappeeException(\n f'\"conf\" {repr(conf)} not beartype configuration.')\n # Else, this configuration is a configuration.\n #\n # If this class stack is neither a tuple *NOR* \"None\", raise an\n # exception.\n elif not isinstance(cls_stack, NoneTypeOr[tuple]):\n raise BeartypeDecorWrappeeException(\n f'\"cls_stack\" {repr(cls_stack)} neither tuple nor \"None\".')\n # Else, this class stack is either a tuple *OR* \"None\".\n \n # If the caller passed a non-empty class stack...\n if cls_stack:\n # For each item of this class stack...\n for cls_stack_item in cls_stack:\n # If this item is *NOT* a type, raise an exception.\n if not isinstance(cls_stack_item, type):\n raise BeartypeDecorWrappeeException(\n f'\"cls_stack\" item {repr(cls_stack_item)} not type.')\n # Else, this item is a type.\n # Else, the caller either passed no class stack *OR* an empty class\n # stack. In either case, ignore this parameter.\n \n # Classify all passed parameters.\n self.conf = conf\n self.cls_stack = cls_stack\n \n # Wrappee callable currently being decorated.\n self.func_wrappee = func\n \n # Possibly unwrapped callable unwrapped from this wrappee callable.\n self.func_wrappee_wrappee = unwrap_func_all_isomorphic(\n func=func, wrapper=wrapper)\n # print(f'func_wrappee: {self.func_wrappee}')\n # print(f'func_wrappee_wrappee: {self.func_wrappee_wrappee}')\n # print(f'{dir(self.func_wrappee_wrappee)}')\n \n # True only if this wrappee callable is nested. As a minor efficiency\n # gain, we can avoid the slightly expensive call to is_func_nested() by\n # noting that:\n # * If the class stack is non-empty, then this wrappee callable is\n # necessarily nested in one or more classes.\n # * Else, defer to the is_func_nested() tester.\n self.func_wrappee_is_nested = bool(cls_stack) or is_func_nested(func)\n \n # Defer the resolution of both global and local scopes for this wrappee\n # callable until needed to subsequently resolve stringified type hints.\n self.func_wrappee_scope_forward = None\n self.func_wrappee_scope_nested_names = None\n \n # Possibly wrapped callable wrappee code object (i.e., code object\n # underlying the callable currently being type-checked by the\n # @beartype.beartype decorator) if this wrappee is pure-Python *OR*\n # \"None\" otherwise.\n #\n # Note that only the possibly unwrapped callable (i.e.,\n # \"self.func_wrappee_wrappee\") need actually be pure-Python. Whereas the\n # latter is required to have a code object, the \"self.func_wrappee\" is\n # permitted to be C-based and thus *NOT* have a code object.\n func_wrappee_codeobj = get_func_codeobj_or_none(func)\n \n # Possibly unwrapped callable code object.\n self.func_wrappee_wrappee_codeobj = get_func_codeobj(\n func=self.func_wrappee_wrappee,\n exception_cls=BeartypeDecorWrappeeException,\n )\n \n # Efficiently reduce this local scope back to the dictionary of all\n # parameters unconditionally required by *ALL* wrapper functions.\n> self.func_wrapper_scope.clear()\nE AttributeError: 'BeartypeDecorMeta' object has no attribute 'func_wrapper_scope'. Did you mean: 'func_wrapper_name'?\n", "Failure #3: beartype_test/a00_unit/a60_check/a00_metadata/test_metacheck.py::test_metadata_check", "Failure #4: beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py::test_coerce_func_hint_root", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #8: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #9: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #10: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep435", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep663", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #83: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #84: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #85: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #86: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #89: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #90: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #91: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #92: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #93: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #94: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #95: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #96: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #97: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #98: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #99: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 8.080000000000004, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0006844742708050158, "harmonic": 0.0, "bidirectional_harmonic": 0.1767349244322936, "degree": 2 }, "line_count": 17, "code_line_count": 17, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484585/pep484585ref.py", "function_name": "get_hint_pep484585_ref_names_relative_to", "test_info": { "success": false, "failed": 13, "passed": 1117, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py::test_get_hint_pep484585_ref_names_relative_to\nLocation: /tmp/benchmark_9kyp1ftx/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py:165\nError: AssertionError: assert None == (None, 'as_I.lay_asleep.in_Italy')\n + where None = ('as_I.lay_asleep.in_Italy')\n\nTraceback:\n\n> def test_get_hint_pep484585_ref_names_relative_to() -> None:\n '''\n Test\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585ref.get_hint_pep484585_ref_names_relative_to`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintForwardRefException\n from beartype.typing import ForwardRef\n from beartype._util.hint.pep.proposal.pep484585.pep484585ref import (\n get_hint_pep484585_ref_names_relative_to)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n ClassModuleNameFake,\n ClassModuleNameNone,\n function_module_name_fake,\n function_module_name_none,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Fully-qualified name of the current module defining this unit test.\n THIS_MODULE_NAME = __name__\n \n # Arbitrary absolute forward references defined as strings.\n ALAS_ALAS = 'He_overleaps.the.bounds'\n THE_MASK_OF_ANARCHY = 'as_I.lay_asleep.in_Italy'\n WITH_GREAT_POWER_IT = 'And_with.great_power.it_forth.led_me'\n \n # Arbitrary absolute forward reference defined as a non-string.\n WITH_GREAT_POWER = ForwardRef(WITH_GREAT_POWER_IT)\n \n # Arbitrary fully-qualified names of hypothetical modules.\n CASTLEREAGH = 'He_had.a_mask.like_Castlereagh'\n OF_DIM_SLEEP = 'In_the.wide.pathless_desert'\n \n # Arbitrary relative forward references defined as strings.\n VERY_SMOOTH = 'Very_smooth_he_looked_yet_grim'\n THUS_TREACHEROUSLY = 'Lost_lost_for_ever_lost'\n \n # ....................{ CALLABLES }....................\n def and_pendent_mountains():\n '''\n Arbitrary function whose ``__module__`` dunder attribute is preserved as\n the fully-qualified name of this currently importable module.\n '''\n \n pass\n \n # ....................{ CLASSES }....................\n class OfRainbowClouds(object):\n '''\n Arbitrary class whose ``__module__`` dunder attribute is preserved as\n the fully-qualified name of this currently importable module.\n '''\n \n pass\n \n # ....................{ PASS }....................\n # Assert that this getter preserves an absolute forward reference in string\n # format as is.\n> assert get_hint_pep484585_ref_names_relative_to(THE_MASK_OF_ANARCHY) == (\n None, THE_MASK_OF_ANARCHY)\nE AssertionError: assert None == (None, 'as_I.lay_asleep.in_Italy')\nE + where None = ('as_I.lay_asleep.in_Italy')\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_9kyp1ftx/beartype/_util/hint/pep/proposal/pep484585/pep484585ref.py:465\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> return cause_finder(self)\n\n> hint_ref_type = import_pep484585_ref_type(\n\n> def import_pep484585_ref_type(\n # Mandatory parameters.\n hint: Pep484585ForwardRef,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintForwardRefException,\n exception_prefix: str = '',\n **kwargs\n ) -> type:\n '''\n Class referred to by the passed :pep:`484` or :pep:`585`-compliant\n **forward reference type hint** (i.e., object indirectly referring to a\n user-defined class that typically has yet to be defined) canonicalized if\n this hint is unqualified relative to the module declaring the first of\n whichever of the passed owner type and/or callable is *not* :data:`None`.\n \n This getter is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as the passed object is typically a\n :func:`beartype.beartype`-decorated callable passed exactly once to this\n function.\n \n Parameters\n ----------\n hint : Pep484585ForwardRef\n Forward reference type hint to be resolved.\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error. Defaults\n to :exc:`.BeartypeDecorHintForwardRefException`.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to the empty string.\n \n All remaining keyword parameters are passed as is to the lower-level\n :func:`.get_hint_pep484585_ref_names_relative_to` getter.\n \n Returns\n -------\n type\n Class referred to by this forward reference.\n \n Raises\n ------\n exception_cls\n If either:\n \n * This forward reference is *not* actually a forward reference.\n * This forward reference is **relative** (i.e., contains *no* ``.``\n delimiters) and either:\n \n * Neither the passed callable nor class define the ``__module__``\n dunder attribute.\n * The passed callable and/or class define the ``__module__``\n dunder attribute, but the values of those attributes all refer to\n unimportable modules that do *not* appear to physically exist.\n * The object referred to by this forward reference is either:\n \n * Undefined.\n * Defined but not a class.\n \n See Also\n --------\n :func:`.get_hint_pep484585_ref_names_relative_to`\n Further details.\n '''\n \n # Avoid circular import dependencies.\n from beartype._check.forward.reference.fwdrefmake import (\n make_forwardref_indexable_subtype)\n \n # Possibly undefined fully-qualified module name and possibly unqualified\n # classname referred to by this forward reference relative to this type\n # stack and callable.\n> hint_module_name, hint_ref_name = get_hint_pep484585_ref_names_relative_to(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n **kwargs\n )\nE TypeError: cannot unpack non-iterable NoneType object\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #13: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py", "test_get_hint_pep484585_ref_names_relative_to" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 27.85177600000003, "in_degree": 3, "true_in_degree": 9.08, "out_degree": 4, "betweenness": 0.00020322119136391225, "pagerank": 0.0006330695283381551, "harmonic": 0.033854166666666664, "bidirectional_harmonic": 0.25345264202172085, "degree": 7 }, "line_count": 85, "code_line_count": 85, "cyclomatic": 17, "halstead_volume": 209.21505009519265, "halstead_difficulty": 4.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/module/utilmodget.py", "function_name": "get_module_filename", "test_info": { "success": false, "failed": 9, "passed": 1113, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep561.py::test_pep561_pytyped\nLocation: /usr/lib/python3.12/pathlib.py:373\nError: TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'\n\nTraceback:\n\n> def test_pep561_pytyped() -> None:\n '''\n Test :pep:`561` support implemented in the :mod:`beartype` package by\n asserting that this package provides the ``py.typed`` file required by\n :pep:`561`.\n \n Note that this unit test exercises a necessary but *not* sufficient\n condition for this package to comply with :pep:`561`. The comparable\n :mod:`beartype_test.a90_func.pep.test_pep561` submodule defines a\n functional test exercising the remaining necessary condition: **the\n absence of static type-checking errors across this package.**\n '''\n \n # Defer test-specific imports.\n import beartype\n from beartype._util.module.utilmodget import get_module_filename\n from pathlib import Path\n \n # Concrete platform-agnostic path encapsulating the absolute filename of\n # the \"beartype.__init__\" submodule.\n #\n # Note that we intentionally do *NOT* obtain this file via the\n # test-specific \"beartype_test._util.path.pytpathmain\" submodule. Why?\n # Because we want to test that the \"py.typed\" file is actually being\n # installed with the \"beartype\" package, wherever that package may\n # currently be installed (e.g., to a \"tox\"-isolated venv).\n> BEARTYPE_INIT_FILENAME = Path(get_module_filename(beartype))\n\n> super().__init__(*args)\n\n> def __init__(self, *args):\n import ntpath\n paths = []\n for arg in args:\n if isinstance(arg, PurePath):\n if arg._flavour is ntpath and self._flavour is posixpath:\n # GH-103631: Convert separators for backwards compatibility.\n paths.extend(path.replace('\\\\', '/') for path in arg._raw_paths)\n else:\n paths.extend(arg._raw_paths)\n else:\n try:\n path = os.fspath(arg)\n except TypeError:\n path = arg\n if not isinstance(path, str):\n> raise TypeError(\n \"argument should be a str or an os.PathLike \"\n \"object where __fspath__ returns a str, \"\n f\"not {type(path).__name__!r}\")\nE TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a90_claw/a00_core/test_claw_api.py::test_claw_api\nLocation: /usr/lib/python3.12/pathlib.py:373\nError: TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'\n\nTraceback:\n\n> @fixture(autouse=True, scope='function')\n def clean_claws() -> None: # <-- heh. get it... clean *CLAWS*? it is punny.\n '''\n Permanently, silently, and recursively remove all **bytecode files** (i.e.,\n pure-Python bytecode compiled to platform-dependent temporary files residing\n in temporary ``__pycache__/`` subdirectories) of the test-specific\n :mod:`beartype_test.a00_unit.data` subpackage and all subsubpackages of that\n subpackage regardless of depth.\n \n Note that this unit test-scoped fixture is implicitly performed *before*\n each unit test transitively defined in sibling and child submodules of the\n subpackage directly containing this submodule. Why? Because failing to do so\n would invite subtle but easily reproducible desynchronization woes between\n those files and more recent changes to the implementation of the\n :mod:`beartype.claw` subpackage in the main codebase.\n \n See Also\n --------\n :func:`beartype._util.path.utilpathremove.remove_package_bytecode_files`\n Further details.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype.claw._package.clawpkgcontext import packages_trie_cleared\n from beartype._util.module.utilmodget import get_module_dir\n from beartype._util.path.utilpathremove import (\n remove_package_bytecode_files)\n from beartype_test.a00_unit.data import claw\n \n # ....................{ PATHS }....................\n # Path encapsulating the absolute dirname of the \"beartype.claw\" subpackage.\n #\n # Note that we intentionally avoid importing any subsubpackages (e.g.,\n # \"beartype_test.a00_unit.data.claw.intraprocess.hookable_package.beartype_this_package\")\n # above. Why? Because doing so would implicitly install the exact beartype\n # import hook which calling unit tests are attempting to subsequently\n # exercise and which *MUST* be confined to a context manager for test\n # idempotency.\n> claw_dir = get_module_dir(claw)\n\n> module_file = Path(module_filename)\n\n> super().__init__(*args)\n\n> def __init__(self, *args):\n import ntpath\n paths = []\n for arg in args:\n if isinstance(arg, PurePath):\n if arg._flavour is ntpath and self._flavour is posixpath:\n # GH-103631: Convert separators for backwards compatibility.\n paths.extend(path.replace('\\\\', '/') for path in arg._raw_paths)\n else:\n paths.extend(arg._raw_paths)\n else:\n try:\n path = os.fspath(arg)\n except TypeError:\n path = arg\n if not isinstance(path, str):\n> raise TypeError(\n \"argument should be a str or an os.PathLike \"\n \"object where __fspath__ returns a str, \"\n f\"not {type(path).__name__!r}\")\nE TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'\n", "Failure #3: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_extraprocess.py::test_claw_extraprocess_executable_submodule", "Failure #4: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_extraprocess.py::test_claw_extraprocess_executable_package", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #8: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep561.py", "test_pep561_pytyped" ], [ "beartype_test/a00_unit/a90_claw/a00_core/test_claw_api.py", "test_claw_api" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 1, "betweenness": 2.7096158848521633e-06, "pagerank": 0.0004556650246305419, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.14576699798739298, "degree": 2 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep544.py", "function_name": "is_hint_pep484_generic_io", "test_info": { "success": false, "failed": 8, "passed": 1122, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_is_hint_pep544_io_generic\nLocation: /tmp/benchmark_cuek9eze/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py:127\nError: AssertionError: assert None is True\n + where None = ()\n\nTraceback:\n\n> def test_is_hint_pep544_io_generic() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep544.is_hint_pep484_generic_io`\n tester.\n '''\n \n # Defer test-specific imports.\n from beartype.typing import Union\n from beartype._data.cls.datacls import TYPES_PEP484_GENERIC_IO\n from beartype._util.hint.pep.proposal.pep544 import (\n is_hint_pep484_generic_io)\n \n # Assert this tester accepts all standard PEP 484-compliant IO generics.\n for pep484_generic_io in TYPES_PEP484_GENERIC_IO:\n> assert is_hint_pep484_generic_io(pep484_generic_io) is True\nE AssertionError: assert None is True\nE + where None = ()\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol\nLocation: /tmp/benchmark_cuek9eze/beartype/_util/hint/pep/proposal/pep544.py:147\nError: beartype.roar.BeartypeDecorHintPep544Exception: Type hint not PEP 484 IO generic base class (i.e., \"typing.IO\", \"typing.BinaryIO\", or \"typing.TextIO\").\n\nTraceback:\n\n> def test_reduce_hint_pep484_generic_io_to_pep544_protocol() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep544.reduce_hint_pep484_generic_io_to_pep544_protocol`\n reducer.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep544Exception\n from beartype.typing import Union\n from beartype._util.hint.pep.proposal.pep544 import (\n reduce_hint_pep484_generic_io_to_pep544_protocol)\n from beartype._util.hint.pep.proposal.pep593 import is_hint_pep593\n from beartype._data.cls.datacls import TYPES_PEP484_GENERIC_IO\n from pytest import raises\n from typing import Protocol\n \n # ....................{ PASS }....................\n # For each PEP 484-compliant \"typing\" IO generic base class...\n for pep484_generic_io in TYPES_PEP484_GENERIC_IO:\n # Equivalent protocol reduced from this generic.\n pep544_protocol_io = (\n> reduce_hint_pep484_generic_io_to_pep544_protocol(\n pep484_generic_io, ''))\n\n> def reduce_hint_pep484_generic_io_to_pep544_protocol(\n hint: Any, exception_prefix: str) -> Any:\n '''\n :pep:`544`-compliant :mod:`beartype` **IO protocol** (i.e., either\n :class:`._Pep544IO` itself *or* a subclass of that class defined by this\n submodule intentionally designed to be usable at runtime) corresponding to\n the passed :pep:`484`-compliant :mod:`typing` **IO generic base class**\n (i.e., either :class:`typing.IO` itself *or* a subclass of\n :class:`typing.IO` defined by the :mod:`typing` module effectively unusable\n at runtime due to botched implementation details).\n \n This reducer is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as the implementation trivially reduces\n to an efficient one-liner thanks to caching internally performed by this\n reducer.\n \n Parameters\n ----------\n hint : type\n :pep:`484`-compliant :mod:`typing` IO generic base class to be replaced\n by the corresponding :pep:`544`-compliant :mod:`beartype` IO protocol.\n exception_prefix : str\n Human-readable label prefixing the representation of this object in the\n exception message.\n \n Returns\n -------\n Protocol\n :pep:`544`-compliant :mod:`beartype` IO protocol corresponding to this\n :pep:`484`-compliant :mod:`typing` IO generic base class.\n \n Raises\n ------\n BeartypeDecorHintPep544Exception\n If this object is *not* a :pep:`484`-compliant IO generic base class.\n '''\n \n # If this object is *NOT* a PEP 484-compliant \"typing\" IO generic,\n # raise an exception.\n if not is_hint_pep484_generic_io(hint):\n> raise BeartypeDecorHintPep544Exception(\n f'{exception_prefix}type hint {repr(hint)} not '\n f'PEP 484 IO generic base class '\n f'(i.e., \"typing.IO\", \"typing.BinaryIO\", or \"typing.TextIO\").'\n )\nE beartype.roar.BeartypeDecorHintPep544Exception: Type hint not PEP 484 IO generic base class (i.e., \"typing.IO\", \"typing.BinaryIO\", or \"typing.TextIO\").\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py", "test_is_hint_pep544_io_generic" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py", "test_reduce_hint_pep484_generic_io_to_pep544_protocol" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 2, "true_in_degree": 3.5999999999999996, "out_degree": 1, "betweenness": 1.0838463539408653e-05, "pagerank": 0.000569417077175698, "harmonic": 0.0024671052631578946, "bidirectional_harmonic": 0.1802025186071246, "degree": 3 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 1, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/vale/_is/_valeistype.py", "function_name": "_IsInstanceFactory.__getitem__", "test_info": { "success": false, "failed": 41, "passed": 1052, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_pv1t7oyv/beartype_test/a00_unit/data/hint/pep/proposal/_data_pep593.py:161\nError: TypeError: bad operand type for unary ~: 'NoneType'\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> def hints_pep593_meta() -> 'List[HintPepMetadata]':\n '''\n Session-scoped fixture returning a list of :pep:`593`-compliant **type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances describing test-specific :pep:`593`-compliant sample type hints\n with metadata generically leveraged by various PEP-agnostic unit tests).\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype.typing import (\n List,\n Sequence,\n TypeVar,\n Union,\n )\n from beartype.vale import (\n Is,\n IsAttr,\n IsEqual,\n IsInstance,\n IsSubclass,\n )\n from beartype._data.hint.pep.sign.datapepsigns import (\n HintSignAnnotated,\n HintSignList,\n HintSignUnion,\n )\n from beartype._util.api.standard.utiltyping import get_typing_attrs\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n Class,\n Subclass,\n SubclassSubclass,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata,\n HintPithSatisfiedMetadata,\n HintPithUnsatisfiedMetadata,\n )\n from functools import partial\n \n # ..................{ CLASSES }..................\n class TruthSeeker(object):\n def __call__(self, obj: object) -> bool:\n '''\n Tester method returning :data:`True` only if the passed object\n evaluates to :data:`True` when coerced into a boolean and whose\n first parameter is ignorable.\n '''\n \n return bool(obj)\n \n # ..................{ CALLABLES }..................\n def is_true(ignorable_arg, obj):\n '''\n Tester function returning :data:`True` only if the passed object\n evaluates to :data:`True` when coerced into a boolean and whose first\n parameter is ignorable.\n '''\n \n return bool(obj)\n \n \n # Partial of the is_true() tester defined above, effectively ignoring the\n # \"ignorable_arg\" parameter accepted by that tester.\n is_true_partial = partial(\n is_true, 'Drank its inspiring radiance, and the wind')\n \n # ..................{ VALIDATORS ~ is }..................\n # PEP 484-compliant union of all builtin scalar types.\n Number = Union[int, float, complex]\n \n # Generic beartype validators defined as lambda functions.\n IsNonEmpty = Is[lambda obj: bool(obj)]\n \n # Numeric beartype validators defined as lambda functions.\n IsNonNegative = Is[lambda number: number >= 0]\n IsIntNonZero = Is[lambda number: isinstance(number, int) and number != 0]\n \n # Textual beartype validators defined as lambda functions.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Textual beartype validators defined as non-lambda functions.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n def _is_exceptional(obj):\n raise ValueError(f'Colonial. {repr(obj)}')\n IsQuoted = Is[_is_quoted]\n IsExceptional = Is[_is_exceptional]\n \n # Textual beartype validator synthesized from the above validators via the\n # domain-specific language (DSL) implemented by those validators.\n IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n \n # ..................{ VALIDATORS ~ isattr }..................\n # Arbitrary list to validate equality against below.\n AMPLY_IMPISH = ['Amply imp-ish', 'blandishments to']\n \n class CathecticallyEnsconceYouIn(object):\n '''\n Arbitrary class defining an arbitrary attribute whose value has *no*\n accessible attributes but satisfies a validator tested below.\n '''\n \n def __init__(self) -> None:\n '''\n Initialize this object by defining this attribute.\n '''\n \n # Initialize this attribute to a shallow copy of this list rather\n # than this list itself to properly test equality comparison.\n self.this_mobbed_triste_of = AMPLY_IMPISH[:]\n \n # Beartype-specific validator validating equality against that attribute.\n IsAttrThisMobbedTristeOf = IsAttr[\n 'this_mobbed_triste_of', IsEqual[AMPLY_IMPISH]]\n \n # Instance of this class satisfying this validator.\n BOSS_EMBOSSED_ORDERING = CathecticallyEnsconceYouIn()\n \n # Instance of this class *NOT* satisfying this validator.\n SORDIDLY_FLABBY_WRMCASTINGS = CathecticallyEnsconceYouIn()\n SORDIDLY_FLABBY_WRMCASTINGS.this_mobbed_triste_of = [\n 'An atomical caroller', 'carousing Thanatos', '(nucl\u2010eating',]\n \n # ..................{ LOCALS }..................\n # List of all PEP-specific type hint metadata to be returned.\n hints_pep_meta = []\n \n # ..................{ FACTORIES }..................\n # For each PEP-specific type hint factory importable from each currently\n # importable \"typing\" module...\n for Annotated in get_typing_attrs('Annotated'):\n # print(f'Exercising PEP 593 {repr(Annotated)}...')\n \n # ..................{ LOCALS }..................\n # Local variables requiring an \"Annotated\" type hint factory.\n \n # Annotated of an isinstanceable type annotated by one beartype-specific\n # validator defined as a lambda function.\n AnnotatedStrIsLength = Annotated[str, IsLengthy]\n \n # Validator matching any sequence of strings that is itself *NOT* a\n # string. Technically, a string is itself a sequence of characters,\n # which are themselves strings of length 1 in Python. Pragmatically, a\n # string is rarely considered to be a \"sequence of strings\" in the\n # common sense of that term. Validators, save us from the sins of Guido!\n> SequenceNonstrOfStr = Annotated[Sequence[str], ~IsInstance[str]]\nE TypeError: bad operand type for unary ~: 'NoneType'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none\nLocation: /tmp/benchmark_pv1t7oyv/beartype_test/a00_unit/data/hint/pep/proposal/_data_pep593.py:161\nError: TypeError: bad operand type for unary ~: 'NoneType'\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> def hints_pep593_meta() -> 'List[HintPepMetadata]':\n '''\n Session-scoped fixture returning a list of :pep:`593`-compliant **type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances describing test-specific :pep:`593`-compliant sample type hints\n with metadata generically leveraged by various PEP-agnostic unit tests).\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype.typing import (\n List,\n Sequence,\n TypeVar,\n Union,\n )\n from beartype.vale import (\n Is,\n IsAttr,\n IsEqual,\n IsInstance,\n IsSubclass,\n )\n from beartype._data.hint.pep.sign.datapepsigns import (\n HintSignAnnotated,\n HintSignList,\n HintSignUnion,\n )\n from beartype._util.api.standard.utiltyping import get_typing_attrs\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n Class,\n Subclass,\n SubclassSubclass,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata,\n HintPithSatisfiedMetadata,\n HintPithUnsatisfiedMetadata,\n )\n from functools import partial\n \n # ..................{ CLASSES }..................\n class TruthSeeker(object):\n def __call__(self, obj: object) -> bool:\n '''\n Tester method returning :data:`True` only if the passed object\n evaluates to :data:`True` when coerced into a boolean and whose\n first parameter is ignorable.\n '''\n \n return bool(obj)\n \n # ..................{ CALLABLES }..................\n def is_true(ignorable_arg, obj):\n '''\n Tester function returning :data:`True` only if the passed object\n evaluates to :data:`True` when coerced into a boolean and whose first\n parameter is ignorable.\n '''\n \n return bool(obj)\n \n \n # Partial of the is_true() tester defined above, effectively ignoring the\n # \"ignorable_arg\" parameter accepted by that tester.\n is_true_partial = partial(\n is_true, 'Drank its inspiring radiance, and the wind')\n \n # ..................{ VALIDATORS ~ is }..................\n # PEP 484-compliant union of all builtin scalar types.\n Number = Union[int, float, complex]\n \n # Generic beartype validators defined as lambda functions.\n IsNonEmpty = Is[lambda obj: bool(obj)]\n \n # Numeric beartype validators defined as lambda functions.\n IsNonNegative = Is[lambda number: number >= 0]\n IsIntNonZero = Is[lambda number: isinstance(number, int) and number != 0]\n \n # Textual beartype validators defined as lambda functions.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Textual beartype validators defined as non-lambda functions.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n def _is_exceptional(obj):\n raise ValueError(f'Colonial. {repr(obj)}')\n IsQuoted = Is[_is_quoted]\n IsExceptional = Is[_is_exceptional]\n \n # Textual beartype validator synthesized from the above validators via the\n # domain-specific language (DSL) implemented by those validators.\n IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n \n # ..................{ VALIDATORS ~ isattr }..................\n # Arbitrary list to validate equality against below.\n AMPLY_IMPISH = ['Amply imp-ish', 'blandishments to']\n \n class CathecticallyEnsconceYouIn(object):\n '''\n Arbitrary class defining an arbitrary attribute whose value has *no*\n accessible attributes but satisfies a validator tested below.\n '''\n \n def __init__(self) -> None:\n '''\n Initialize this object by defining this attribute.\n '''\n \n # Initialize this attribute to a shallow copy of this list rather\n # than this list itself to properly test equality comparison.\n self.this_mobbed_triste_of = AMPLY_IMPISH[:]\n \n # Beartype-specific validator validating equality against that attribute.\n IsAttrThisMobbedTristeOf = IsAttr[\n 'this_mobbed_triste_of', IsEqual[AMPLY_IMPISH]]\n \n # Instance of this class satisfying this validator.\n BOSS_EMBOSSED_ORDERING = CathecticallyEnsconceYouIn()\n \n # Instance of this class *NOT* satisfying this validator.\n SORDIDLY_FLABBY_WRMCASTINGS = CathecticallyEnsconceYouIn()\n SORDIDLY_FLABBY_WRMCASTINGS.this_mobbed_triste_of = [\n 'An atomical caroller', 'carousing Thanatos', '(nucl\u2010eating',]\n \n # ..................{ LOCALS }..................\n # List of all PEP-specific type hint metadata to be returned.\n hints_pep_meta = []\n \n # ..................{ FACTORIES }..................\n # For each PEP-specific type hint factory importable from each currently\n # importable \"typing\" module...\n for Annotated in get_typing_attrs('Annotated'):\n # print(f'Exercising PEP 593 {repr(Annotated)}...')\n \n # ..................{ LOCALS }..................\n # Local variables requiring an \"Annotated\" type hint factory.\n \n # Annotated of an isinstanceable type annotated by one beartype-specific\n # validator defined as a lambda function.\n AnnotatedStrIsLength = Annotated[str, IsLengthy]\n \n # Validator matching any sequence of strings that is itself *NOT* a\n # string. Technically, a string is itself a sequence of characters,\n # which are themselves strings of length 1 in Python. Pragmatically, a\n # string is rarely considered to be a \"sequence of strings\" in the\n # common sense of that term. Validators, save us from the sins of Guido!\n> SequenceNonstrOfStr = Annotated[Sequence[str], ~IsInstance[str]]\nE TypeError: bad operand type for unary ~: 'NoneType'\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #25: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #29: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #30: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #31: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #32: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #33: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_fail", "Failure #34: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #35: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #36: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #38: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #39: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #40: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #41: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_type_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 20.45584384000001, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 5, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.027177318295739345, "bidirectional_harmonic": 0.23766524502544253, "degree": 5 }, "line_count": 35, "code_line_count": 35, "cyclomatic": 4, "halstead_volume": 19.651484454403228, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/vale/_core/_valecorebinary.py", "function_name": "BeartypeValidatorDisjunction.__init__", "test_info": { "success": false, "failed": 43, "passed": 1050, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_9yxwbhhi/beartype/vale/_core/_valecore.py:321\nError: AttributeError: 'BeartypeValidatorDisjunction' object has no attribute '_get_repr'. Did you mean: 'get_repr'?\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> HintPepMetadata(\n\n> hint_repr = get_hint_repr(self.hint)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return repr(hint)\n\n> \", \".join(repr(a) for a in self.__metadata__)\n\n> \", \".join(repr(a) for a in self.__metadata__)\n\n> def __repr__(self) -> str:\n '''\n Machine-readable representation of this validator.\n \n This function is memoized for efficiency.\n \n Warns\n -----\n BeartypeValeLambdaWarning\n If this validator is implemented as a pure-Python lambda function\n whose definition is *not* parsable from the script or module\n defining that lambda.\n '''\n \n # If the instance variable underlying this dunder method is a callable,\n # reduce this variable to the string returned by this callable.\n> if callable(self._get_repr):\nE AttributeError: 'BeartypeValidatorDisjunction' object has no attribute '_get_repr'. Did you mean: 'get_repr'?\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none\nLocation: /tmp/benchmark_9yxwbhhi/beartype/vale/_core/_valecore.py:321\nError: AttributeError: 'BeartypeValidatorDisjunction' object has no attribute '_get_repr'. Did you mean: 'get_repr'?\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> HintPepMetadata(\n\n> hint_repr = get_hint_repr(self.hint)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return repr(hint)\n\n> \", \".join(repr(a) for a in self.__metadata__)\n\n> \", \".join(repr(a) for a in self.__metadata__)\n\n> def __repr__(self) -> str:\n '''\n Machine-readable representation of this validator.\n \n This function is memoized for efficiency.\n \n Warns\n -----\n BeartypeValeLambdaWarning\n If this validator is implemented as a pure-Python lambda function\n whose definition is *not* parsable from the script or module\n defining that lambda.\n '''\n \n # If the instance variable underlying this dunder method is a callable,\n # reduce this variable to the string returned by this callable.\n> if callable(self._get_repr):\nE AttributeError: 'BeartypeValidatorDisjunction' object has no attribute '_get_repr'. Did you mean: 'get_repr'?\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #25: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #29: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #30: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #31: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #32: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_fail", "Failure #33: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #34: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass", "Failure #35: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_pass", "Failure #36: beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py::test_api_vale_isequal_pass", "Failure #37: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #38: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #39: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #40: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #41: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #42: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #43: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_type_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.7520000000000002, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 2, "betweenness": 8.12884765455649e-06, "pagerank": 0.0004556650246305419, "harmonic": 0.004660087719298245, "bidirectional_harmonic": 0.18539263642059758, "degree": 3 }, "line_count": 20, "code_line_count": 20, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/api/utilbeartype.py", "function_name": "is_func_unbeartypeable", "test_info": { "success": false, "failed": 7, "passed": 1123, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_no_type_check\nLocation: /tmp/benchmark_g8v4wj1s/beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py:44\nError: assert .of_beechen_green at 0x78bb11315e40> is .of_beechen_green at 0x78bb11316160>\n\nTraceback:\n\n> def test_decor_pep484_no_type_check() -> None:\n '''\n Test the :func:`beartype.beartype` decorator against all edge cases of the\n :pep:`484`-compliant :attr:`typing.no_type_check` decorator.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype.typing import (\n Union,\n no_type_check,\n )\n \n # Callable decorated by @typing.no_type_check whose otherwise PEP-compliant\n # type hints *SHOULD* be subsequently ignored by @beartype.\n @no_type_check\n def of_beechen_green(and_shadows_numberless: Union[int, str]) -> str:\n return and_shadows_numberless\n \n # The same callable additionally decorated by @beartype.\n of_beechen_green_beartyped = beartype(of_beechen_green)\n \n # Assert these two callables to be the same, implying @beartype silently\n # reduced to a noop by returning this callable undecorated.\n> assert of_beechen_green is of_beechen_green_beartyped\nE assert .of_beechen_green at 0x78bb11315e40> is .of_beechen_green at 0x78bb11316160>\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized\nLocation: /tmp/benchmark_g8v4wj1s/beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py:71\nError: assert .and_what_am_I at 0x78bb111fd940> is .and_what_am_I at 0x78bb111ffc40>\n\nTraceback:\n\n> def test_decor_noop_python_optimized(monkeypatch: 'pytest.MonkeyPatch') -> None:\n '''\n Test that the :func:`beartype.beartype` decorator efficiently reduces to a\n noop for **optimized Python processes** (i.e., optimized *after* process\n invocation time, typically by the user setting the ``${PYTHONOPTIMIZED}``\n environment variable to a non-zero integer from an interactive REPL).\n \n Parameters\n ----------\n monkeypatch : MonkeyPatch\n :mod:`pytest` fixture allowing various state associated with the active\n Python process to be temporarily changed for the duration of this test.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from pytest import raises\n \n # ....................{ CALLABLES }....................\n def and_what_am_I(that_I: str, should_linger_here: str) -> str:\n '''\n Arbitrary annotated function.\n '''\n \n return that_I + should_linger_here\n \n # ....................{ ASSERTS ~ unoptimized }....................\n # This function decorated by @beartype.\n and_what_am_I_typed = beartype(and_what_am_I)\n \n # Assert that @beartype actually decorated this function rather than\n # reducing to a noop.\n assert and_what_am_I_typed is not and_what_am_I\n \n # Assert that @beartype decorated this function with type-checking by\n # raising the expected exception when passed invalid parameters.\n with raises(BeartypeCallHintParamViolation):\n and_what_am_I_typed(b'With voice far sweeter', b'than thy dying notes,')\n \n # ....................{ ASSERTS ~ optimized }....................\n # Temporarily set the ${PYTHONOPTIMIZE} environment variable governing\n # Python optimization to an arbitrary positive integer.\n monkeypatch.setenv('PYTHONOPTIMIZE', '1')\n \n # This function decorated by @beartype yet again.\n and_what_am_I_typed = beartype(and_what_am_I)\n \n # Assert that @beartype efficiently reduces to a noop (i.e., the identity\n # decorator) when the current Python process is \"optimized.\"\n> assert and_what_am_I_typed is and_what_am_I\nE assert .and_what_am_I at 0x78bb111fd940> is .and_what_am_I at 0x78bb111ffc40>\n", "Failure #3: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #4: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py", "test_decor_pep484_no_type_check" ], [ "beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py", "test_decor_noop_python_optimized" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.08, "in_degree": 1, "true_in_degree": 7.24, "out_degree": 6, "betweenness": 0.00026418754877308593, "pagerank": 0.0003988015705108617, "harmonic": 0.011513157894736841, "bidirectional_harmonic": 0.19898586428191792, "degree": 7 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 6, "halstead_volume": 33.219280948873624, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextansi.py", "function_name": "strip_str_ansi", "test_info": { "success": false, "failed": 50, "passed": 1080, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/text/test_utiltextansi.py::test_strip_str_ansi\nLocation: /tmp/benchmark_c1j2t3hi/beartype_test/a00_unit/a20_util/text/test_utiltextansi.py:49\nError: AssertionError: assert None == 'and suddenly grow gray with fear,'\n + where None = ('and suddenly grow gray with fear,')\n\nTraceback:\n\n> def test_strip_str_ansi() -> None:\n '''\n Test the :func:`beartype._util.text.utiltextansi.strip_str_ansi` stripper.\n '''\n \n # Defer test-specific imports.\n from beartype._util.text.utiltextansi import strip_str_ansi\n \n # String containing *NO* ANSI.\n THY_VOICE = 'and suddenly grow gray with fear,'\n \n # Assert that this stripper preserves strings containing *NO* ANSI as is.\n> assert strip_str_ansi(THY_VOICE) == THY_VOICE\nE AssertionError: assert None == 'and suddenly grow gray with fear,'\nE + where None = ('and suddenly grow gray with fear,')\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_c1j2t3hi/beartype/roar/_roarexc.py:83\nError: AssertionError: None not exception message.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> exception = exception_cls( # type: ignore[call-arg]\n\n> super().__init__(message, culprits, *args, **kwargs)\n\n> def __init__(self, message: str, *args, **kwargs) -> None:\n '''\n Initialize this exception.\n \n This constructor (in order):\n \n #. Passes all passed arguments as is to the superclass constructor.\n #. Sanitizes the fully-qualified module name of this\n exception from the private ``\"beartype.roar._roarexc\"`` submodule to\n the public ``\"beartype.roar\"`` subpackage to both improve the\n readability of exception messages and discourage end users from\n accessing this private submodule. By default, Python emits less\n readable and dangerous exception messages resembling:\n \n beartype.roar._roarexc.BeartypeCallHintParamViolation:\n @beartyped quote_wiggum_safer() parameter lines=[] violates type\n hint typing.Annotated[list[str], Is[lambda lst: bool(lst)]], as\n value [] violates validator Is[lambda lst: bool(lst)].\n \n Parameters\n ----------\n message : str\n Human-readable message describing this exception.\n \n All remaining parameters are passed as is to the superclass\n :meth:`__init__` method.\n '''\n> assert isinstance(message, str), (\n f'{repr(message)} not exception message.')\nE AssertionError: None not exception message.\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #42: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #43: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #44: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #45: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #46: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #47: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #48: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #49: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #50: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/text/test_utiltextansi.py", "test_strip_str_ansi" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 1, "true_in_degree": 1.8, "out_degree": 1, "betweenness": 5.419231769704327e-06, "pagerank": 0.00028151589789520825, "harmonic": 0.0024671052631578946, "bidirectional_harmonic": 0.2076063738892692, "degree": 2 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 3, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/code/_pep/codepep484604.py", "function_name": "_get_hint_pep484604_union_args_flattened", "test_info": { "success": false, "failed": 42, "passed": 1088, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_etnd28cl/beartype/_check/code/_pep/codepep484604.py:166\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n with warns(hint_meta.warning_type):\n is_bearable(pith, hint, conf=conf)\n # print(f'Deprecated type hint {repr(hint)} warned!')\n # Else, this tester is expected to emit *NO* warning for this hint. In\n # this case, call this tester outside of such a context manager.\n else:\n> is_bearable(pith, hint, conf=conf)\n\n> func_tester = make_func_tester(hint, conf)\n\n> return func(*args)\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> return func(*args)\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> return func(*args)\n\n> make_hint_pep484604_check_expr(hints_meta)\n\n> def make_hint_pep484604_check_expr(hints_meta: HintsMeta) -> None:\n '''\n Either a Python code snippet type-checking the current pith against the\n passed :pep:`484`- or :pep:`604`-compliant union type hint if this union is\n **unignorable** (i.e., subscripted by *no* ignorable child type hints) *or*\n :data:`None` otherwise (i.e., if this union is ignorable).\n \n This factory is intentionally *not* memoized (e.g., by the\n :func:`.callable_cached` decorator), due to accepting **context-sensitive\n parameters** (i.e., whose values contextually depend on context unique to\n the code being generated for the currently decorated callable) such as\n ``pith_curr_assign_expr``.\n \n Caveats\n -------\n Unions are non-physical abstractions of physical types and thus *not*\n themselves subject to type-checking; only the subscripted arguments of\n unions are type-checked. This differs from :mod:`typing` pseudo-containers\n like ``List[int]``, in which both the parent :obj:`typing.List` and child\n :class:`int` types represent physical types to be type-checked. Ergo, unions\n themselves impose no narrowing of the current pith expression and thus\n *cannot* by definition benefit from assignment expressions. This differs\n from :mod:`typing` pseudo-containers, which narrow the current pith\n expression and thus do benefit from assignment expressions.\n \n Parameters\n ----------\n hint_meta : HintMeta\n Metadata describing the currently visited hint, appended by the\n previously visited parent hint to the ``hints_meta`` stack.\n hints_meta : HintsMeta\n Stack of metadata describing all visitable hints currently discovered by\n this breadth-first search (BFS).\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n func_wrapper_scope : LexicalScope\n Local scope (i.e., dictionary mapping from the name to value of each\n attribute referenced in the signature) of this wrapper function required\n by this Python code snippet.\n pith_curr_expr : str\n Full Python expression evaluating to the value of the **current pith**\n (i.e., possibly nested object of the current parameter or return value\n to be type-checked against this union type hint).\n pith_curr_assign_expr : str\n Assignment expression assigning this full Python expression to the\n unique local variable assigned the value of this expression.\n pith_curr_var_name_index : int\n Integer suffixing the name of each local variable assigned the value of\n the current pith in a assignment expression, thus uniquifying this\n variable in the body of the current wrapper function.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n '''\n assert isinstance(hints_meta, HintsMeta), (\n f'{repr(hints_meta)} not \"HintsMeta\" object.')\n \n # ....................{ LOCALS }....................\n # Flattened tuple of two or more child hints subscripting this parent union\n # such that *ALL* nested child hints subscripting child unions are expanded\n # directly into this tuple, thus non-destructively eliminating child unions.\n #\n # Note that this getter is memoized and thus requires:\n # * Positional parameters.\n # * \"hint_meta\" instance variables to be explicitly passed rather than the\n # \"hint_meta\" object in entirety. Why? Memoization, of course. Passing the\n # \"hint_meta\" object in entirety would effectively inhibit the memoization\n # of this getter, which entirely defeats the point.\n hint_or_sane_childs = _get_hint_pep484604_union_args_flattened(hints_meta)\n # print(f'Unflattened union {repr(hints_meta.hint_curr_meta.hint)}...')\n # print(f'...child hints {repr(hint_or_sane_childs)}.')\n \n # Dictionary whose keys comprise the set of all PEP-noncompliant child hints\n # subscripting this union and whose values are ignorable. Whereas sets fail\n # to preserve insertion order, dictionaries preserve insertion order. While\n # a set would be preferable for simplicity, the fact that sets are currently\n # unordered leaves us no choice but to abuse dictionaries.\n #\n # The order of union child hints is insignificant in the common case but\n # *NOT* the worst case, where order is significant. Examples include:\n # * A union over classes whose metaclasses define custom type-checking by\n # overriding the __instancecheck__() dunder method. Callers might\n # intentionally order those classes in that union to maximize\n # type-checking efficiency. How? In descending order of the efficiency of\n # those __instancecheck__() implementations. The most efficiently\n # type-checkable classes would be listed first in that union; the least\n # efficiently type-checkable classes, last.\n # * A union over classes registered as pseudo-subclasses with the\n # collections.abc.ABCMeta.register() method. Callers might intentionally\n # order those classes in that union to prevent type-checking code\n # dynamically generated by beartype from raising unexpected exceptions in\n # the event that those classes fail to fully satisfy the API of the ABC\n # they were registered with. See also this issue:\n # https://github.com/beartype/beartype/issues/499#issuecomment-2683400721\n #\n # Since PEP-compliant and -noncompliant child hints require fundamentally\n # different forms of type-checking, prefiltering child hints into these\n # dictionaries *BEFORE* generating code type-checking these child hints\n # improves both efficiency and maintainability.\n hint_childs_nonpep: DictTypeToAny = acquire_instance(dict)\n \n # Dictionary whose keys comprise the set of all PEP-compliant child hints\n # subscripting this union and whose values are ignorable. See above.\n hint_or_sane_childs_pep: DictHintOrHintSanifiedDataToAny = acquire_instance(\n dict)\n \n # ....................{ FILTER }....................\n #FIXME: Optimize by refactoring into a \"while\" loop. Naturally, profile that\n #doing so actually *IS* an optimization before doing so. *sigh*\n \n # For each child hint subscripting this union...\n> for hint_or_sane_child in hint_or_sane_childs:\nE TypeError: 'NoneType' object is not iterable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_etnd28cl/beartype/_check/code/_pep/codepep484604.py:166\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n\n> return func(*args)\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> return func(*args)\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> return func(*args)\n\n> make_hint_pep484604_check_expr(hints_meta)\n\n> def make_hint_pep484604_check_expr(hints_meta: HintsMeta) -> None:\n '''\n Either a Python code snippet type-checking the current pith against the\n passed :pep:`484`- or :pep:`604`-compliant union type hint if this union is\n **unignorable** (i.e., subscripted by *no* ignorable child type hints) *or*\n :data:`None` otherwise (i.e., if this union is ignorable).\n \n This factory is intentionally *not* memoized (e.g., by the\n :func:`.callable_cached` decorator), due to accepting **context-sensitive\n parameters** (i.e., whose values contextually depend on context unique to\n the code being generated for the currently decorated callable) such as\n ``pith_curr_assign_expr``.\n \n Caveats\n -------\n Unions are non-physical abstractions of physical types and thus *not*\n themselves subject to type-checking; only the subscripted arguments of\n unions are type-checked. This differs from :mod:`typing` pseudo-containers\n like ``List[int]``, in which both the parent :obj:`typing.List` and child\n :class:`int` types represent physical types to be type-checked. Ergo, unions\n themselves impose no narrowing of the current pith expression and thus\n *cannot* by definition benefit from assignment expressions. This differs\n from :mod:`typing` pseudo-containers, which narrow the current pith\n expression and thus do benefit from assignment expressions.\n \n Parameters\n ----------\n hint_meta : HintMeta\n Metadata describing the currently visited hint, appended by the\n previously visited parent hint to the ``hints_meta`` stack.\n hints_meta : HintsMeta\n Stack of metadata describing all visitable hints currently discovered by\n this breadth-first search (BFS).\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n func_wrapper_scope : LexicalScope\n Local scope (i.e., dictionary mapping from the name to value of each\n attribute referenced in the signature) of this wrapper function required\n by this Python code snippet.\n pith_curr_expr : str\n Full Python expression evaluating to the value of the **current pith**\n (i.e., possibly nested object of the current parameter or return value\n to be type-checked against this union type hint).\n pith_curr_assign_expr : str\n Assignment expression assigning this full Python expression to the\n unique local variable assigned the value of this expression.\n pith_curr_var_name_index : int\n Integer suffixing the name of each local variable assigned the value of\n the current pith in a assignment expression, thus uniquifying this\n variable in the body of the current wrapper function.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n '''\n assert isinstance(hints_meta, HintsMeta), (\n f'{repr(hints_meta)} not \"HintsMeta\" object.')\n \n # ....................{ LOCALS }....................\n # Flattened tuple of two or more child hints subscripting this parent union\n # such that *ALL* nested child hints subscripting child unions are expanded\n # directly into this tuple, thus non-destructively eliminating child unions.\n #\n # Note that this getter is memoized and thus requires:\n # * Positional parameters.\n # * \"hint_meta\" instance variables to be explicitly passed rather than the\n # \"hint_meta\" object in entirety. Why? Memoization, of course. Passing the\n # \"hint_meta\" object in entirety would effectively inhibit the memoization\n # of this getter, which entirely defeats the point.\n hint_or_sane_childs = _get_hint_pep484604_union_args_flattened(hints_meta)\n # print(f'Unflattened union {repr(hints_meta.hint_curr_meta.hint)}...')\n # print(f'...child hints {repr(hint_or_sane_childs)}.')\n \n # Dictionary whose keys comprise the set of all PEP-noncompliant child hints\n # subscripting this union and whose values are ignorable. Whereas sets fail\n # to preserve insertion order, dictionaries preserve insertion order. While\n # a set would be preferable for simplicity, the fact that sets are currently\n # unordered leaves us no choice but to abuse dictionaries.\n #\n # The order of union child hints is insignificant in the common case but\n # *NOT* the worst case, where order is significant. Examples include:\n # * A union over classes whose metaclasses define custom type-checking by\n # overriding the __instancecheck__() dunder method. Callers might\n # intentionally order those classes in that union to maximize\n # type-checking efficiency. How? In descending order of the efficiency of\n # those __instancecheck__() implementations. The most efficiently\n # type-checkable classes would be listed first in that union; the least\n # efficiently type-checkable classes, last.\n # * A union over classes registered as pseudo-subclasses with the\n # collections.abc.ABCMeta.register() method. Callers might intentionally\n # order those classes in that union to prevent type-checking code\n # dynamically generated by beartype from raising unexpected exceptions in\n # the event that those classes fail to fully satisfy the API of the ABC\n # they were registered with. See also this issue:\n # https://github.com/beartype/beartype/issues/499#issuecomment-2683400721\n #\n # Since PEP-compliant and -noncompliant child hints require fundamentally\n # different forms of type-checking, prefiltering child hints into these\n # dictionaries *BEFORE* generating code type-checking these child hints\n # improves both efficiency and maintainability.\n hint_childs_nonpep: DictTypeToAny = acquire_instance(dict)\n \n # Dictionary whose keys comprise the set of all PEP-compliant child hints\n # subscripting this union and whose values are ignorable. See above.\n hint_or_sane_childs_pep: DictHintOrHintSanifiedDataToAny = acquire_instance(\n dict)\n \n # ....................{ FILTER }....................\n #FIXME: Optimize by refactoring into a \"while\" loop. Naturally, profile that\n #doing so actually *IS* an optimization before doing so. *sigh*\n \n # For each child hint subscripting this union...\n> for hint_or_sane_child in hint_or_sane_childs:\nE TypeError: 'NoneType' object is not iterable\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #36: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #37: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #38: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #39: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #40: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #41: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #42: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 25.87530240000002, "in_degree": 1, "true_in_degree": 3.7200000000000006, "out_degree": 9, "betweenness": 5.012789386976502e-05, "pagerank": 0.0002839434190746063, "harmonic": 0.0362703634085213, "bidirectional_harmonic": 0.2761924935444672, "degree": 10 }, "line_count": 71, "code_line_count": 71, "cyclomatic": 10, "halstead_volume": 41.51317942364757, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextprefix.py", "function_name": "prefix_pith_value", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_co522p0e/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:192\nError: assert ' violates type hint ' in 'Die_if_unbearable() value Noneviolates type hint typing.Hashable, as list [\\'Oboes\u2010obsoleting tines\\', \\'Of language\\'] not instance of .'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n> assert ' violates type hint ' in exception_message\nE assert ' violates type hint ' in 'Die_if_unbearable() value Noneviolates type hint typing.Hashable, as list [\\'Oboes\u2010obsoleting tines\\', \\'Of language\\'] not instance of .'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype\nLocation: /tmp/benchmark_co522p0e/beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py:264\nError: assert None is not None\n + where None = ('\\\\bIn darkness over it\\\\.', \"Function test_beartype.test_beartype.func_untyped() parameter hint_param=Noneviolates type hint typing.FrozenSet[str], as frozenset index 0 item bytes b'In the midst was left,' not instance of str.\")\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_beartype(iter_hints_piths_meta) -> None:\n '''\n Test the :func:`beartype.beartype` decorator with respect to type-checking\n code dynamically generated by the\n :mod:`beartype._decor.wrap.wrapmain` submodule.\n \n This unit test effectively acts as a functional test and is thus the core\n test exercising decorator functionality from the end user perspective --\n the only perspective that matters in the end. Unsurprisingly, this test is\n mildly more involved than most. *Whatevah.*\n \n This test additionally attempts to avoid similar issues to a `prior issue\n `__ of this decorator induced by repeated\n :func:`beartype.beartype` decorations of different callables annotated by\n one or more of the same PEP-compliant type hints.\n \n .. _issue #5:\n https://github.com/beartype/beartype/issues/5\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintViolation\n from beartype._util.text.utiltextansi import strip_str_ansi\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n # HintPepMetadata,\n HintPithUnsatisfiedMetadata,\n )\n from beartype_test._util.pytroar import raises_uncached\n # from pytest import warns\n # from pytest import deprecated_call\n from re import search\n # from warnings import simplefilter\n \n # ....................{ MAIN }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n # simplefilter('always')\n \n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # ....................{ LOCALS }....................\n # Metadata describing this hint.\n hint_meta = hint_pith_meta.hint_meta\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Object to type-check against this hint.\n pith = hint_pith_meta.pith\n \n # Metadata describing this pith.\n pith_meta = hint_pith_meta.pith_meta\n # print(f'Type-checking PEP type hint {repr(hint_meta.hint)}...')\n \n # Beartype decorator configured specifically for this hint.\n beartype_confed = beartype(conf=hint_meta.conf)\n \n def func_untyped(hint_param: hint) -> hint:\n '''\n Undecorated function both accepting a single parameter and returning\n a value annotated by this hint whose implementation trivially\n reduces to the identity function.\n '''\n \n return hint_param\n \n #FIXME: For unknown and probably uninteresting reasons, the\n #pytest.warns() context manager appears to be broken on our\n #local machine. We have no recourse but to unconditionally\n #ignore this warning at the module level. So much rage!\n #FIXME: It's likely this has something to do with the fact that\n #Python filters deprecation warnings by default. This is almost\n #certainly a pytest issue. Since this has become fairly\n #unctuous, we should probably submit a pytest issue report.\n #FIXME: Actually, pytest now appears to have explicit support for\n #testing that a code block emits a deprecation warning:\n # with pytest.deprecated_call():\n # myfunction(17)\n #See also: https://docs.pytest.org/en/6.2.x/warnings.html#ensuring-code-triggers-a-deprecation-warning\n #FIXME: Fascinatingly, warns() still refuses to capture warnings.\n #Although we certainly could call deprecated_call(), doing so is\n #stymied by the fact that\n #\"BeartypeDecorHintPep585DeprecationWarning\" does *NOT* subclass the\n #standard \"DeprecationWarning\" class. *sigh*\n #FIXME: *NONSENSE*! It's 2024 and we *STILL* can't get this to work.\n #It's been bloody years. It just doesn't work and there's *NO*\n #reasonable means for us to debug why. We've tried literally everything:\n #pytest.deprecated_call(), pytest.warns(), warnings.simplefilter().\n #Nuthin'. Pytest simply refuses to catch deprecation warnings. Kinda fed\n #up with the whole thing, honestly.\n #FIXME: *FASCINATING*. The comparable test_decor_pep613() unit test\n #successfully tests deprecation warnings emitted by the @beartype\n #decorator with the trivial pytest.warns() + warnings.simplefilter()\n #combo. So... why does doing so here fail? Some combination of iteration\n #and closures would seem to be the likely culprit. Notably, \"pylint\"\n #complains this about the above definition of func_untyped():\n # cell-var-from-loop: Cell variable \"hint\" defined in loop\n #\n #It seems likely a similar issue is obstructing testing here.\n #FIXME: ...huh. This is Bizarro World stuff. We tried extricating this\n #logic into the comparable test_door_is_bearable() test, which also\n #iterates but *WITHOUT* defining closures. That test still fails to\n #capture deprecation warnings. So... it's iteration? Really? *OH*. The\n #iter_hints_piths_meta() iterator is itself defined as a closure of a\n #session-scoped fixture. Welp, that's almost certainly it. Something\n #about that fundamentally obstructs capturing of deprecation warnings.\n #Our only recourse now is to try:\n #* Defining a new test_hint_warnings() unit test.\n #* Manually iterating over type hints in that test *WITHOUT* calling\n # iter_hints_piths_meta(). Instead, extricate the import aspects of\n # iter_hints_piths_meta() into a simple \"for\" loop. Avoid anything\n # extraneous (e.g., repetition, context managers).\n #FIXME: *THAT WAS IT*. Our new test_hint_warnings() unit test\n #successfully captures deprecation warnings. So. It's our session-scoped\n #iter_hints_piths_meta() fixture closure, huh? Well, at least that sorta\n #makes sense. This is *DEFINITELY* a pytest issue -- but good luck\n #reducing that one to a minimal-length reproducible working example.\n \n # # @beartype-generated wrapper function type-checking that function.\n # func_typed = None\n #\n # # If this beartype decorator emits a warning for this hint...\n # if hint_meta.warning_type is not None:\n # with deprecated_call():\n # # Decorate that function under a context manager asserting this\n # # decoration to emit the expected warning.\n # # with warns(hint_meta.warning_type):\n # func_typed = beartype_confed(func_untyped)\n # # Else, this beartype decorator emits *NO* warning for this hint. In\n # # this case, decorate this callable as is.\n # else:\n # func_typed = beartype_confed(func_untyped)\n func_typed = beartype_confed(func_untyped)\n \n # ....................{ VIOLATE }....................\n # If this pith violates this hint...\n if isinstance(pith_meta, HintPithUnsatisfiedMetadata):\n # ....................{ EXCEPTION ~ type }....................\n # Assert this wrapper function raises the expected exception when\n # type-checking this pith against this hint.\n with raises_uncached(BeartypeCallHintViolation) as exception_info:\n func_typed(pith)\n \n # Exception captured by the prior call to this wrapper function.\n exception = exception_info.value\n \n # Exception type localized for debuggability. Sadly, the\n # pytest.ExceptionInfo.__repr__() dunder method fails to usefully\n # describe its exception metadata.\n exception_type = exception_info.type\n \n # Assert this exception metadata describes the expected exception\n # as a sanity check against upstream pytest issues and/or issues\n # with our raises_uncached() context manager.\n assert issubclass(exception_type, BeartypeCallHintViolation)\n \n # Assert this exception to be public rather than private. The\n # @beartype decorator should *NEVER* raise a private exception.\n assert exception_type.__name__[0] != '_'\n \n # ....................{ EXCEPTION ~ culprits }....................\n # Tuple of the culprits responsible for this exception, localized to\n # avoid inefficiently recomputing these culprits on each access.\n exception_culprits = exception.culprits\n \n # Assert that this tuple both exists *AND* is non-empty.\n assert isinstance(exception_culprits, tuple)\n assert exception_culprits\n \n # First culprit, which *SHOULD* be either:\n # * If this pith can be weakly referenced, this pith.\n # * Else, this pith *CANNOT* be weakly referenced. In this case,\n # fallback to the truncated representation of this pith.\n culprit_pith = exception_culprits[0]\n \n # If the first culprit is a string...\n if isinstance(culprit_pith, str):\n # Assert that this string is non-empty.\n assert culprit_pith\n # Else, the first culprit is *NOT* a string. In this case...\n else:\n # Assert that the first culprit is this pith.\n assert culprit_pith is pith\n \n # If two or more culprits were responsible...\n if len(exception_culprits) >= 2:\n # For each culprit following the first...\n for culprit_nonpith in exception_culprits[1:]:\n # Assert that this subsequent culprit is *NOT* the pith.\n assert culprit_nonpith is not pith\n \n # ....................{ EXCEPTION ~ message }....................\n # Exception message raised by this wrapper function.\n exception_str = str(exception)\n exception_str = strip_str_ansi(exception_str)\n # print('exception message: {}'.format(exception_str))\n \n # Assert this exception message is prefixed by a substring\n # identifying the decorated callable with a human-readable label.\n assert exception_str.startswith('Function ')\n \n # Assert that iterables of uncompiled regular expression expected\n # to match and *NOT* match this message are *NOT* strings, as\n # commonly occurs when accidentally omitting a trailing comma in\n # tuples containing only one string: e.g.,\n # * \"('This is a tuple, yo.',)\" is a 1-tuple containing one string.\n # * \"('This is a string, bro.')\" is a string *NOT* contained in a\n # 1-tuple.\n assert not isinstance(\n pith_meta.exception_str_match_regexes, str)\n assert not isinstance(\n pith_meta.exception_str_not_match_regexes, str)\n \n # For each uncompiled regular expression expected to match this\n # message, assert this expression actually does so.\n #\n # Note that the re.search() rather than re.match() function is\n # called. The latter is rooted at the start of the string and thus\n # *ONLY* matches prefixes, while the former is *NOT* rooted at any\n # string position and thus matches arbitrary substrings as desired.\n for exception_str_match_regex in (\n pith_meta.exception_str_match_regexes):\n> assert search(\n exception_str_match_regex,\n exception_str,\n ) is not None\nE assert None is not None\nE + where None = ('\\\\bIn darkness over it\\\\.', \"Function test_beartype.test_beartype.func_untyped() parameter hint_param=Noneviolates type hint typing.FrozenSet[str], as frozenset index 0 item bytes b'In the midst was left,' not instance of str.\")\n", "Failure #3: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #4: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #5: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py", "test_beartype" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.5136000000000003, "in_degree": 4, "true_in_degree": 4.8, "out_degree": 1, "betweenness": 2.1676927078817306e-05, "pagerank": 0.0005158162598895358, "harmonic": 0.004797149122807018, "bidirectional_harmonic": 0.2234362539872411, "degree": 5 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncwrap.py", "function_name": "unwrap_func_once", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py::test_get_func_args_len_flexible\nLocation: /tmp/benchmark_63vtm9vz/beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py:63\nError: assert 0 == 1\n + where 0 = ()\n\nTraceback:\n\n> def test_get_func_args_len_flexible() -> None:\n '''\n Test the\n :func:`beartype._util.func.arg.utilfuncarglen.get_func_args_flexible_len`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype._util.func.arg.utilfuncarglen import (\n get_func_args_flexible_len)\n from beartype_test.a00_unit.data.data_type import (\n ClassCallable,\n function_partial,\n function_partial_bad,\n )\n from beartype_test.a00_unit.data.func.data_func import (\n func_args_0,\n func_args_1_flex_mandatory,\n func_args_1_varpos,\n func_args_2_flex_mandatory,\n func_args_0_wrapped,\n func_args_1_flex_mandatory_wrapped,\n func_args_1_varpos_wrapped,\n func_args_2_flex_mandatory_wrapped,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Callable object whose class defines the __call__() dunder method.\n callable_object = ClassCallable()\n \n # ....................{ PASS }....................\n # Assert this getter returns the expected lengths of unwrapped callables.\n assert get_func_args_flexible_len(func_args_0) == 0\n assert get_func_args_flexible_len(func_args_1_varpos) == 0\n assert get_func_args_flexible_len(func_args_1_flex_mandatory) == 1\n assert get_func_args_flexible_len(func_args_2_flex_mandatory) == 2\n \n # Assert this getter returns the expected lengths of wrapped callables.\n assert get_func_args_flexible_len(func_args_0_wrapped) == 0\n assert get_func_args_flexible_len(func_args_1_varpos_wrapped) == 0\n> assert get_func_args_flexible_len(func_args_1_flex_mandatory_wrapped) == 1\nE assert 0 == 1\nE + where 0 = ()\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py::test_unwrap_func_all_isomorphic\nLocation: /tmp/benchmark_63vtm9vz/beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py:90\nError: assert is \n + where = ()\n\nTraceback:\n\n> def test_unwrap_func_all_isomorphic() -> None:\n '''\n Test the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all_isomorphic` function.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.func.utilfuncwrap import unwrap_func_all_isomorphic\n from beartype_test.a00_unit.data.data_type import (\n function_wrappee,\n function_wrapper_nonisomarphic,\n function_wrapper_isomarphic,\n function_wrapper_isomarphic_args,\n function_wrapper_isomarphic_kwargs,\n object_callable_wrapper_isomorphic,\n )\n \n # ....................{ ASSERTS }....................\n # Assert this function returns unwrapped callables unmodified.\n assert unwrap_func_all_isomorphic(function_wrappee) is function_wrappee\n assert unwrap_func_all_isomorphic(iter) is iter\n \n # Assert this function returns non-isomorphic wrapper callables unmodified.\n assert unwrap_func_all_isomorphic(function_wrapper_nonisomarphic) is (\n function_wrapper_nonisomarphic)\n \n # Assert this function unwraps isomorphic wrapper callables.\n> assert unwrap_func_all_isomorphic(function_wrapper_isomarphic) is (\n function_wrapper_nonisomarphic)\nE assert is \nE + where = ()\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py", "test_get_func_args_len_flexible" ], [ "beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py", "test_unwrap_func_all_isomorphic" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 3, "true_in_degree": 16.920000000000005, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0009856010494530502, "harmonic": 0.0, "bidirectional_harmonic": 0.1987939783170055, "degree": 3 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/error/_errtype.py", "function_name": "find_cause_type_instance_origin", "test_info": { "success": false, "failed": 19, "passed": 1111, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_dmfj3ad1/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_dmfj3ad1/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #12: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #13: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #14: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #15: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 30.969548800000045, "in_degree": 4, "true_in_degree": 4.0, "out_degree": 2, "betweenness": 4.741827798491286e-05, "pagerank": 0.0003986726874657909, "harmonic": 0.034711779448621555, "bidirectional_harmonic": 0.2260705029619505, "degree": 6 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 3, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/convert/_convcoerce.py", "function_name": "coerce_func_hint_root", "test_info": { "success": false, "failed": 77, "passed": 1053, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: <@beartype(beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory) at 0x71f793cce700>:29\nError: beartype.roar.BeartypeCallHintParamViolation: Function beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory() parameter text='Thou art the path of that unresting sound\u2014' violates type hint None, as str 'Thou art the path of that unresting sound\u2014' not instance of .\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n @beartype\n def _is_exclamatory(text: str):\n return '!' in text\n \n # Dynamically generated lambda function. To exercise in-memory validators\n # dynamically defined outside of a standard on-disk module (e.g., \"smart\"\n # REPLs like IPython), this function's code is intentionally cached with\n # the standard \"linecache\" module.\n _is_commentary = make_func(\n func_name='_is_commentary',\n func_code=(\n \"\"\"_is_commentary = lambda text: text and text[-1] == ','\"\"\"),\n is_debug=True,\n )\n \n # ....................{ VALIDATORS }....................\n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined physically in this on-disk module.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined dynamically in-memory.\n IsCommentary = Is[_is_commentary]\n \n # Validator produced by subscripting this factory with non-lambda functions\n # satisfying the expected API.\n IsQuoted = Is[_is_quoted]\n IsExclamatory = Is[_is_exclamatory]\n IsFalseFake = Is[_is_false_fake]\n \n # Validator synthesized from the above validators with the domain-specific\n # language (DSL) supported by those validators.\n IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n \n # ....................{ ASSERTS ~ instance }....................\n # Assert these validators satisfy the expected API.\n assert isinstance(IsLengthy, BeartypeValidator)\n assert isinstance(IsLengthyOrUnquotedSentence, BeartypeValidator)\n \n # Assert a validator provides both non-empty code and code locals.\n assert isinstance(IsLengthy._is_valid_code, str)\n assert isinstance(IsLengthy._is_valid_code_locals, Mapping)\n assert bool(IsLengthy._is_valid_code)\n assert bool(IsLengthy._is_valid_code_locals)\n \n # ....................{ ASSERTS ~ is_valid }....................\n # Assert that non-composite validators perform the expected validation.\n assert IsLengthy.is_valid('Plunged in the battery-smoke') is False\n assert IsLengthy.is_valid('Right through the line they broke;') is True\n assert IsSentence.is_valid('Theirs not to make reply,') is False\n assert IsSentence.is_valid('Theirs but to do and die.') is True\n assert IsCommentary.is_valid('Remote, serene, and inaccessible:') is False\n assert IsCommentary.is_valid(\n 'Power dwells apart in its tranquillity,') is True\n assert IsQuoted.is_valid('Theirs not to reason why,') is False\n assert IsQuoted.is_valid('\"Forward, the Light Brigade!\"') is True\n> assert IsExclamatory.is_valid(\n 'Thou art the path of that unresting sound\u2014') is False\n\n> is_obj_valid = is_valid(obj)\n\n> > ???\nE beartype.roar.BeartypeCallHintParamViolation: Function beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory() parameter text='Thou art the path of that unresting sound\u2014' violates type hint None, as str 'Thou art the path of that unresting sound\u2014' not instance of .\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py::test_coerce_func_hint_root\nLocation: /tmp/benchmark_7hxjz03_/beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py:48\nError: AssertionError: assert None is str\n + where None = (hint=str, pith_name='return', decor_meta=BeartypeDecorMeta(func=.one_legion_of_wild_thoughts at 0x71f793d67740>, conf=BeartypeConf()), exception_prefix='')\n\nTraceback:\n\n> def test_coerce_func_hint_root() -> None:\n '''\n Test the private\n :func:`beartype._check.convert._convcoerce.coerce_func_hint_root`\n coercer.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype import BeartypeConf\n from beartype._check.metadata.metadecor import BeartypeDecorMeta\n from beartype._check.convert._convcoerce import coerce_func_hint_root\n from beartype._data.func.datafuncarg import ARG_NAME_RETURN\n \n # ..................{ CALLABLES }..................\n def one_legion_of_wild_thoughts() -> str:\n '''\n Arbitrary callable with which to test this coercer.\n '''\n \n return 'whose wandering wings'\n \n # Beartype dataclass describing this callable.\n decor_meta = BeartypeDecorMeta()\n decor_meta.reinit(func=one_legion_of_wild_thoughts, conf=BeartypeConf())\n \n # ..................{ CORE }..................\n # Assert this coercer preserves an isinstanceable type as is.\n> assert coerce_func_hint_root(\n hint=str,\n pith_name=ARG_NAME_RETURN,\n decor_meta=decor_meta,\n exception_prefix='',\n ) is str\nE AssertionError: assert None is str\nE + where None = (hint=str, pith_name='return', decor_meta=BeartypeDecorMeta(func=.one_legion_of_wild_thoughts at 0x71f793d67740>, conf=BeartypeConf()), exception_prefix='')\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #70: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #71: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #72: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #73: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #74: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #75: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #76: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #77: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ], [ "beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py", "test_coerce_func_hint_root" ] ] }, "complexity_info": { "centrality": { "distance_discount": 27.174850560000014, "in_degree": 1, "true_in_degree": 2.6, "out_degree": 2, "betweenness": 0.00012599713864562559, "pagerank": 0.00032861476008027733, "harmonic": 0.030770285087719278, "bidirectional_harmonic": 0.20782757082099257, "degree": 3 }, "line_count": 21, "code_line_count": 21, "cyclomatic": 6, "halstead_volume": 28.529325012980813, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfunccodeobj.py", "function_name": "get_func_codeobj", "test_info": { "success": false, "failed": 179, "passed": 914, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a00_core/test_a00_package.py::test_api_deprecations\nLocation: /tmp/benchmark_tuzqazsd/beartype_test/a00_unit/a00_core/test_a00_package.py:78\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_api_deprecations() -> None:\n '''\n Test all deprecated attributes importable from the public APIs of all\n subpackages of the :mod:`beartype` package (including itself).\n '''\n \n # Defer test-specific imports.\n from beartype._util.module.utilmodimport import import_module_attr\n from pytest import warns\n \n # Tuple of the fully-qualified names of all deprecated attributes.\n DEPRECATED_ATTRIBUTES = (\n 'beartype.abby',\n 'beartype.cave.HintPep585Type',\n 'beartype.roar.BeartypeAbbyException',\n 'beartype.roar.BeartypeAbbyHintViolation',\n 'beartype.roar.BeartypeAbbyTesterException',\n 'beartype.roar.BeartypeCallHintPepException',\n 'beartype.roar.BeartypeCallHintPepParamException',\n 'beartype.roar.BeartypeCallHintPepReturnException',\n 'beartype.roar.BeartypeDecorHintNonPepException',\n 'beartype.roar.BeartypeDecorHintNonPepNumPyException',\n 'beartype.roar.BeartypeDecorHintPep563Exception',\n 'beartype.roar.BeartypeDecorHintPepDeprecatedWarning',\n 'beartype.roar.BeartypeDecorPepException',\n )\n \n # For each deprecated attribute declared by beartype...\n for deprecated_attribute in DEPRECATED_ATTRIBUTES:\n # Assert that importing this attribute both emits the expected warning\n # and returns a non-\"None\" value.\n> with warns(DeprecationWarning):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py::test_method_cached_arg_by_id\nLocation: /tmp/benchmark_tuzqazsd/beartype/_util/func/arg/utilfuncarglen.py:233\nError: AttributeError: 'NoneType' object has no attribute 'co_flags'\n\nTraceback:\n\n> def test_method_cached_arg_by_id() -> None:\n '''\n Test the\n :func:`beartype._util.cache.utilcachecall.method_cached_arg_by_id`\n decorator.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableCachedException\n from beartype._util.cache.utilcachecall import method_cached_arg_by_id\n from pytest import raises\n \n # ..................{ CLASSES }..................\n> class LikeDust(object):\n\n> @method_cached_arg_by_id\n\n> die_unless_func_args_len_flexible_equal(\n\n> func_args_len_flexible_actual = get_func_args_flexible_len(\n\n> func_args_lens = get_func_args_lens(\n\n> def get_func_args_lens(\n # Mandatory parameters.\n func: Codeobjable,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> CallableArgsLens:\n '''\n 4-tuple ``(args_len_posonly_or_flex, args_len_kwonly, args_len_var_pos,\n args_len_var_kw)`` of all **callable parameter length metadata** describing\n the total number of various kinds of parameters accepted by the passed\n pure-Python callable.\n \n This getter is memoized (i.e., cached) via a :mod:`beartype`-specific\n ``__beartype_args_lens`` instance variable on that callable for efficiency.\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n is_unwrap: bool, optional\n :data:`True` only if this getter implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function.\n Defaults to :data:`True` for safety. See :func:`.get_func_codeobj` for\n further commentary.\n exception_cls : type, optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the message of any exception raised in\n the event of a fatal error. Defaults to the empty string.\n \n Returns\n -------\n CallableArgsLens\n 4-tuple ``(args_len_posonly_or_flex, args_len_kwonly, args_len_var_pos,\n args_len_var_kw)`` of all **callable parameter length metadata.** See\n :data:`.CallableArgsLens` for further details.\n \n Raises\n ------\n exception_cls\n If that callable is *not* pure-Python.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.func.utilfuncwrap import unwrap_func_all_isomorphic\n \n # If unwrapping that callable, do so *BEFORE* obtaining the code object of\n # that callable for safety (to avoid desynchronization between the two).\n if is_unwrap:\n func = unwrap_func_all_isomorphic(func) # type: ignore[arg-type]\n # Else, that callable is assumed to have already been unwrapped by the\n # caller. We should probably assert that, but doing so requires an\n # expensive call to hasattr(). What you gonna do?\n \n # Beartype-specific callable parameter length metadata previously computed\n # for this callable if any *OR* \"None\" otherwise.\n func_args_lens = getattr(func, '__beartype_args_lens', None)\n \n # If this metadata has been previously computed, return this metadata.\n if func_args_lens:\n return func_args_lens\n # Else, this metadata has *NOT* been previously computed.\n \n # Code object underlying the passed pure-Python callable unwrapped.\n func_codeobj = get_func_codeobj(\n func=func,\n is_unwrap=False, # <-- \"func\" was already unwrapped above. I sigh.\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # Bit field of OR-ed binary flags describing this callable.\n> func_codeobj_flags = func_codeobj.co_flags\nE AttributeError: 'NoneType' object has no attribute 'co_flags'\n", "Failure #3: beartype_test/a00_unit/a20_util/api/standard/test_utilapicontextlib.py::test_get_func_contextlib_contextmanager_or_none", "Failure #4: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py::test_get_func_arg_name_first_or_none", "Failure #5: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py::test_get_func_arg_names", "Failure #6: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py::test_iter_func_args", "Failure #7: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py::test_get_func_args_len_flexible", "Failure #8: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_argless", "Failure #9: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_variadic", "Failure #10: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name", "Failure #11: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_positional", "Failure #12: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_keyword", "Failure #13: beartype_test/a00_unit/a20_util/func/test_utilfunccode.py::test_get_func_code_or_none", "Failure #14: beartype_test/a00_unit/a20_util/func/test_utilfunccodeobj.py::test_get_func_codeobj", "Failure #15: beartype_test/a00_unit/a20_util/func/test_utilfuncframe.py::test_iter_frames", "Failure #16: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_wrapper_isomorphic", "Failure #17: beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py::test_unwrap_func_all_isomorphic", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #24: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #25: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py::test_get_hint_pep484585_ref_names_relative_to", "Failure #26: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #27: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #28: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #29: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #30: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype", "Failure #31: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #32: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #33: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #34: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #35: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #36: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #37: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #38: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #39: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #40: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #41: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #42: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #43: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #44: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #45: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #46: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #47: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #48: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #49: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_beartypeable_kind", "Failure #50: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_callable", "Failure #51: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_func", "Failure #52: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new", "Failure #53: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #54: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr", "Failure #55: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #56: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #57: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_contains", "Failure #58: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_iter", "Failure #59: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #60: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #61: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #62: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #63: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #64: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #65: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #66: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #67: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_recursion", "Failure #68: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_numpy", "Failure #69: beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py::test_api_vale_validator_pass", "Failure #70: beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py::test_api_vale_validator_fail", "Failure #71: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #72: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_fail", "Failure #73: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #74: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass", "Failure #75: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_pass", "Failure #76: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_fail", "Failure #77: beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py::test_api_vale_isequal_pass", "Failure #78: beartype_test/a00_unit/a60_check/a00_metadata/test_metadecor.py::test_metadata_decor", "Failure #79: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #80: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #81: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #82: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #83: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #84: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #85: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #86: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #87: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #88: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #89: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #90: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #91: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #92: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #93: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #94: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #95: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #96: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #97: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #98: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #99: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #100: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #101: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #102: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #103: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #104: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #105: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #106: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #107: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #108: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #109: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #110: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #111: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #112: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #113: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #114: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #115: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #116: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #117: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep435", "Failure #118: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep663", "Failure #119: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #120: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #121: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #122: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #123: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #124: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #125: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #126: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #127: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #128: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #129: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #130: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #131: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #132: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #133: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #134: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #135: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #136: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #137: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #138: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #139: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #140: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #141: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #142: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #143: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #144: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #145: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #146: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #147: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #148: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #149: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #150: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #151: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #152: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #153: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #154: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #155: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #156: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #157: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #158: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #159: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #160: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #161: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #162: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #163: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #164: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #165: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #166: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #167: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #168: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #169: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #170: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #171: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #172: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #173: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #174: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #175: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #176: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #177: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #178: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #179: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a00_core/test_a00_package.py", "test_api_deprecations" ], [ "beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py", "test_method_cached_arg_by_id" ] ] }, "complexity_info": { "centrality": { "distance_discount": 4.672000000000001, "in_degree": 7, "true_in_degree": 36.76000000000002, "out_degree": 2, "betweenness": 0.0003698625682823203, "pagerank": 0.0024163800744547038, "harmonic": 0.007127192982456142, "bidirectional_harmonic": 0.24113936593377372, "degree": 9 }, "line_count": 17, "code_line_count": 17, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/cls/pep/utilpep3119.py", "function_name": "_die_if_object_uncheckable", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py::test_die_unless_object_isinstanceable\nLocation: /tmp/benchmark_anz55ieb/beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py:50\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_die_unless_object_isinstanceable() -> None:\n '''\n Test the\n :func:`beartype._util.cls.pep.utilpep3119.die_unless_object_isinstanceable`\n validator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep3119Exception\n from beartype._util.cls.pep.utilpep3119 import (\n die_unless_object_isinstanceable)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n Class,\n NonIsinstanceableClass,\n )\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this raiser accepts an isinstanceable type.\n die_unless_object_isinstanceable(Class)\n \n # Assert this raiser accepts a tuple of isinstanceable types.\n die_unless_object_isinstanceable((Class, str))\n \n # ....................{ FAIL }....................\n # Assert this raiser raises the expected exception when passed a\n # non-isinstanceable object.\n> with raises(BeartypeDecorHintPep3119Exception):\nE Failed: DID NOT RAISE \n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py::test_die_unless_object_issubclassable\nLocation: /tmp/benchmark_anz55ieb/beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py:139\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_die_unless_object_issubclassable() -> None:\n '''\n Test the\n :func:`beartype._util.cls.pep.utilpep3119.die_unless_object_issubclassable`\n validator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep3119Exception\n from beartype._util.cls.pep.utilpep3119 import (\n die_unless_object_issubclassable)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from beartype_test.a00_unit.data.data_type import (\n Class,\n NonIssubclassableClass,\n )\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this raiser accepts an issubclassable type.\n die_unless_object_issubclassable(Class)\n \n # Assert this raiser accepts a tuple of issubclassable types.\n die_unless_object_issubclassable((Class, str))\n \n # ....................{ FAIL }....................\n # Assert this raiser raises the expected exception when passed a\n # non-issubclassable object.\n> with raises(BeartypeDecorHintPep3119Exception):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_fail", "Failure #4: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_fail", "Failure #5: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_add_func_scope_types", "Failure #6: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py::test_make_forwardref_indexable_subtype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py", "test_die_unless_object_isinstanceable" ], [ "beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py", "test_die_unless_object_issubclassable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.8400000000000003, "in_degree": 2, "true_in_degree": 9.360000000000001, "out_degree": 4, "betweenness": 9.573976126477645e-05, "pagerank": 0.0008639840896392083, "harmonic": 0.007401315789473684, "bidirectional_harmonic": 0.22882543717247691, "degree": 6 }, "line_count": 64, "code_line_count": 64, "cyclomatic": 11, "halstead_volume": 2.0, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/utilobject.py", "function_name": "get_object_basename_scoped", "test_info": { "success": false, "failed": 29, "passed": 1101, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py::test_is_func_nested\nLocation: /tmp/benchmark_5yv76gsx/beartype/_util/func/utilfuncscope.py:289\nError: AttributeError: 'NoneType' object has no attribute 'rsplit'\n\nTraceback:\n\n> def test_is_func_nested() -> None:\n '''\n Test the\n :func:`beartype._util.func.utilfuncscope.is_func_nested` tester.\n '''\n \n # Defer test-specific imports.\n from beartype._util.func.utilfunctest import is_func_nested\n \n # Nested callable returned by the above callable.\n when_the_ash_and_oak_and_the_birch_and_yew = (\n> when_in_the_springtime_of_the_year())\n\n> @attach_func_locals(func_stack_frames_ignore=1)\n\n> func.func_locals = get_func_locals(func=func, **kwargs)\n\n> def get_func_locals(\n # Mandatory parameters.\n func: Callable,\n \n # Optional parameters.\n func_scope_names_ignore: int = 0,\n func_stack_frames_ignore: int = 0,\n exception_cls: TypeException = _BeartypeUtilCallableScopeException,\n ) -> LexicalScope:\n '''\n **Local scope** for the passed callable.\n \n This getter returns either:\n \n * If that callable is **nested** (i.e., is a method *or* is a non-method\n callable declared in the body of another callable), a dictionary mapping\n from the name to value of each **locally scoped attribute** (i.e., local\n attribute declared by a parent callable transitively declaring that\n callable) accessible to that callable.\n * Else, the empty dictionary otherwise (i.e., if that callable is a\n function directly declared by a module).\n \n This getter transparently supports methods, which in Python are lexically\n nested in the scope encapsulating all previously declared **class\n variables** (i.e., variables declared from class scope and thus accessible\n as type hints when annotating the methods of that class). When declaring a\n class, Python creates a stack frame for the declaration of that class whose\n local scope is the set of all class-scoped attributes declared in the body\n of that class -- including class variables, class methods, static methods,\n and instance methods. When passed any method, this getter finds and returns\n that local scope. When passed the ``MuhClass.muh_method` method declared by\n the following example, for example, this getter returns the local scope\n containing the key ``'muh_class_var'`` with value ``int``:\n \n .. code-block:: pycon\n \n >>> from typing import ClassVar\n >>> class MuhClass(object):\n ... # Class variable declared in class scope.\n ... muh_class_var: ClassVar[type] = int\n ... # Instance method annotated by this class variable.\n ... def muh_method(self) -> muh_class_var: return 42\n \n However, note that this getter's transparent support for methods does *not*\n extend to methods of the currently decorated class. Why? Because that class\n has yet to be declared and thus added to the call stack.\n \n Caveats\n -------\n **This high-level getter requires the private low-level**\n :func:`sys._getframe` **getter.** If that getter is undefined, this getter\n unconditionally treats the passed callable as module-scoped by returning the\n empty dictionary rather than raising an exception. Since all standard\n Python implementations (e.g., CPython, PyPy) define that getter, this\n should typically *not* be a real-world concern.\n \n **This high-level getter is inefficient and should thus only be called if\n absolutely necessary.** Specifically, deciding the local scope for any\n callable exhibits worst-case linear time complexity :math:`O(k)` for the\n distance :math:`k` in call stack frames from the call of the current\n function to the call of the top-most parent scope transitively declaring the\n passed callable in its submodule. Ergo, this decision problem should be\n deferred as long as feasible to minimize space and time consumption.\n \n Parameters\n ----------\n func : Callable\n Callable to be inspected.\n func_scope_names_ignore : int, optional\n Number of parent lexical scopes in the fully-qualified name of that\n callable to be ignored (i.e., silently incremented past), such that the\n next non-ignored lexical scope preceding the first ignored lexical scope\n is that of the parent callable or module directly declaring the passed\n callable. This parameter is typically used to ignore the parent lexical\n scopes of parent classes lexically nesting that callable that have yet\n to be fully declared and thus encapsulated by stack frames on the call\n stack (e.g., due to being currently decorated by\n :func:`beartype.beartype`). See the :mod:`beartype._decor._pep.pep563`\n submodule for the standard use case. Defaults to 0.\n func_stack_frames_ignore : int, optional\n Number of frames on the call stack to be ignored (i.e., silently\n incremented past), such that the next non-ignored frame following the\n last ignored frame is the parent callable or module directly declaring\n the passed callable. Defaults to 0.\n exception_cls : Type[Exception], optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableScopeException`.\n \n Returns\n -------\n LexicalScope\n Local scope for this callable.\n \n Raises\n ------\n exception_cls\n If the next non-ignored frame following the last ignored frame is *not*\n the parent callable or module directly declaring the passed callable.\n _BeartypeUtilCallableScopeNotFoundException\n If this lexical scope cannot be found (i.e., if this getter found the\n lexical scope of the module declaring the passed callable *before* that\n of the parent callable or class declaring that callable), enabling\n callers to identify this common edge case.\n '''\n assert callable(func), f'{repr(func)} not callable.'\n assert isinstance(func_scope_names_ignore, int), (\n f'{func_scope_names_ignore} not integer.')\n assert func_scope_names_ignore >= 0, (\n f'{func_scope_names_ignore} negative.')\n assert isinstance(func_stack_frames_ignore, int), (\n f'{func_stack_frames_ignore} not integer.')\n assert func_stack_frames_ignore >= 0, (\n f'{func_stack_frames_ignore} negative.')\n # print(f'\\n--------- Capturing nested {func.__qualname__}() local scope...')\n \n # ..................{ IMPORTS }..................\n # Avoid circular import dependencies.\n from beartype._util.func.utilfunccodeobj import get_func_codeobj_or_none\n from beartype._util.func.utilfuncframe import iter_frames\n from beartype._util.func.utilfunctest import is_func_nested\n from beartype._util.module.utilmodget import get_object_module_name_or_none\n \n # ..................{ NOOP }..................\n # Note that we intentionally return the local scope for this wrapper rather\n # than wrappee callable, as a local scope can *ONLY* be obtained by\n # dynamically inspecting local attributes bound to call frames on the\n # current call stack. However, this wrapper was called at a higher call\n # frame than this wrappee. All local attributes declared within the body of\n # this wrapper callable are irrelevant to this wrappee callable, as Python\n # syntactically parsed the latter at a later time than the former. If we\n # returned the local scope for this wrappee rather than wrapper callable,\n # we would erroneously return local attributes that this wrappee callable\n # originally had no lexical access to. That's bad. So, we don't do that.\n \n # Fully-qualified name of the module declaring the passed callable if that\n # callable was physically declared by an on-disk module *OR* \"None\"\n # otherwise (i.e., if that callable was dynamically declared in-memory).\n func_module_name = get_object_module_name_or_none(func)\n \n # If either...\n if (\n # The passed callable is dynamically declared in-memory...\n func_module_name is None or\n # The passed callable is module-scoped rather than nested *OR*...\n not is_func_nested(func)\n # Then silently reduce to a noop by treating this nested callable as\n # module-scoped by preserving \"func_locals\" as the empty dictionary.\n ):\n return FROZENDICT_EMPTY\n # Else, all of the following constraints hold:\n # * The passed callable is physically declared on-disk.\n # * The passed callable is nested.\n \n # ..................{ LOCALS ~ scope }..................\n # Local scope of the passed callable to be returned.\n func_scope: LexicalScope = {}\n \n # ..................{ LOCALS ~ scope : name }..................\n # Unqualified name of this nested callable.\n func_name_unqualified = func.__name__\n \n # Fully-qualified name of this nested callable. If this nested callable is\n # a non-method, this name contains one or more meaningless placeholders\n # \"\" -- each identifying one parent callable lexically containing\n # this nested callable: e.g.,\n # >>> def muh_func():\n # ... def muh_closure(): pass\n # ... return muh_closure()\n # >>> muh_func().__qualname__\n # 'muh_func..muh_closure'\n func_name_qualified = get_object_basename_scoped(func)\n \n # Non-empty list of the unqualified names of all parent callables lexically\n # containing that nested callable (including that nested callable itself).\n #\n # Note that:\n # * The set of all callables embodied by the current runtime call stack is a\n # (usually proper) superset of the set of all callables embodied by the\n # lexical scopes encapsulating this nested callable. Ergo:\n # * Some stack frames have no corresponding lexical scopes (e.g., stack\n # frames embodying callables defined by different modules).\n # * *ALL* lexical scopes have a corresponding stack frame.\n # * Stack frames are only efficiently accessible relative to the initial\n # stack frame embodying this nested callable, which resides at the end of\n # the call stack. This implies we *MUST* iteratively search up the call\n # stack for frames with relevant lexical scopes and ignore intervening\n # frames with irrelevant lexical scopes, starting at the stack top (end).\n> func_scope_names = func_name_qualified.rsplit(sep='.')\nE AttributeError: 'NoneType' object has no attribute 'rsplit'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py::test_get_func_locals\nLocation: /tmp/benchmark_5yv76gsx/beartype/_util/func/utilfuncscope.py:289\nError: AttributeError: 'NoneType' object has no attribute 'rsplit'\n\nTraceback:\n\n> def test_get_func_locals() -> None:\n '''\n Test the\n :func:`beartype._util.func.utilfuncscope.get_func_locals` getter.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype.typing import Union\n from beartype._util.func.utilfuncmake import make_func\n from beartype._util.func.utilfuncscope import get_func_locals\n from pytest import raises\n \n # ..................{ CALLABLES }..................\n def and_summon_the_shadows_there():\n '''\n Arbitrary nested callable.\n '''\n \n return 'And tie a ribbon on those sheltering arms'\n \n # Arbitrary nested callable dynamically declared in-memory.\n when_the_ash_and_oak_and_the_birch_and_yew = make_func(\n func_name='when_the_ash_and_oak_and_the_birch_and_yew',\n func_code='''def when_the_ash_and_oak_and_the_birch_and_yew(): pass''',\n )\n \n # Arbitrary nested callables whose unqualified and fully-qualified names\n # are maliciously desynchronized below, exercising edge cases.\n def are_dressed_in_ribbons_fair(): pass\n def who_will_go_down_to_the_shady_groves(): pass\n are_dressed_in_ribbons_fair.__qualname__ = (\n 'when_owls_call.the_breathless_moon')\n who_will_go_down_to_the_shady_groves.__qualname__ = (\n '.who_will_go_down_to_the_shady_groves')\n \n # ..................{ PASS ~ noop }..................\n # Assert this getter returns the empty dictionary for callables dynamically\n # declared in-memory.\n assert get_func_locals(when_the_ash_and_oak_and_the_birch_and_yew) == {}\n \n # Assert this getter returns the empty dictionary for unnested callables.\n assert get_func_locals(when_in_the_springtime_of_the_year) == {}\n \n # Assert this getter returns the empty dictionary for nested callables\n # ignoring *ALL* of their parent lexical scopes.\n> assert get_func_locals(\n func=and_summon_the_shadows_there, func_scope_names_ignore=1) == {}\n\n> def get_func_locals(\n # Mandatory parameters.\n func: Callable,\n \n # Optional parameters.\n func_scope_names_ignore: int = 0,\n func_stack_frames_ignore: int = 0,\n exception_cls: TypeException = _BeartypeUtilCallableScopeException,\n ) -> LexicalScope:\n '''\n **Local scope** for the passed callable.\n \n This getter returns either:\n \n * If that callable is **nested** (i.e., is a method *or* is a non-method\n callable declared in the body of another callable), a dictionary mapping\n from the name to value of each **locally scoped attribute** (i.e., local\n attribute declared by a parent callable transitively declaring that\n callable) accessible to that callable.\n * Else, the empty dictionary otherwise (i.e., if that callable is a\n function directly declared by a module).\n \n This getter transparently supports methods, which in Python are lexically\n nested in the scope encapsulating all previously declared **class\n variables** (i.e., variables declared from class scope and thus accessible\n as type hints when annotating the methods of that class). When declaring a\n class, Python creates a stack frame for the declaration of that class whose\n local scope is the set of all class-scoped attributes declared in the body\n of that class -- including class variables, class methods, static methods,\n and instance methods. When passed any method, this getter finds and returns\n that local scope. When passed the ``MuhClass.muh_method` method declared by\n the following example, for example, this getter returns the local scope\n containing the key ``'muh_class_var'`` with value ``int``:\n \n .. code-block:: pycon\n \n >>> from typing import ClassVar\n >>> class MuhClass(object):\n ... # Class variable declared in class scope.\n ... muh_class_var: ClassVar[type] = int\n ... # Instance method annotated by this class variable.\n ... def muh_method(self) -> muh_class_var: return 42\n \n However, note that this getter's transparent support for methods does *not*\n extend to methods of the currently decorated class. Why? Because that class\n has yet to be declared and thus added to the call stack.\n \n Caveats\n -------\n **This high-level getter requires the private low-level**\n :func:`sys._getframe` **getter.** If that getter is undefined, this getter\n unconditionally treats the passed callable as module-scoped by returning the\n empty dictionary rather than raising an exception. Since all standard\n Python implementations (e.g., CPython, PyPy) define that getter, this\n should typically *not* be a real-world concern.\n \n **This high-level getter is inefficient and should thus only be called if\n absolutely necessary.** Specifically, deciding the local scope for any\n callable exhibits worst-case linear time complexity :math:`O(k)` for the\n distance :math:`k` in call stack frames from the call of the current\n function to the call of the top-most parent scope transitively declaring the\n passed callable in its submodule. Ergo, this decision problem should be\n deferred as long as feasible to minimize space and time consumption.\n \n Parameters\n ----------\n func : Callable\n Callable to be inspected.\n func_scope_names_ignore : int, optional\n Number of parent lexical scopes in the fully-qualified name of that\n callable to be ignored (i.e., silently incremented past), such that the\n next non-ignored lexical scope preceding the first ignored lexical scope\n is that of the parent callable or module directly declaring the passed\n callable. This parameter is typically used to ignore the parent lexical\n scopes of parent classes lexically nesting that callable that have yet\n to be fully declared and thus encapsulated by stack frames on the call\n stack (e.g., due to being currently decorated by\n :func:`beartype.beartype`). See the :mod:`beartype._decor._pep.pep563`\n submodule for the standard use case. Defaults to 0.\n func_stack_frames_ignore : int, optional\n Number of frames on the call stack to be ignored (i.e., silently\n incremented past), such that the next non-ignored frame following the\n last ignored frame is the parent callable or module directly declaring\n the passed callable. Defaults to 0.\n exception_cls : Type[Exception], optional\n Type of exception to be raised in the event of a fatal error. Defaults\n to :class:`._BeartypeUtilCallableScopeException`.\n \n Returns\n -------\n LexicalScope\n Local scope for this callable.\n \n Raises\n ------\n exception_cls\n If the next non-ignored frame following the last ignored frame is *not*\n the parent callable or module directly declaring the passed callable.\n _BeartypeUtilCallableScopeNotFoundException\n If this lexical scope cannot be found (i.e., if this getter found the\n lexical scope of the module declaring the passed callable *before* that\n of the parent callable or class declaring that callable), enabling\n callers to identify this common edge case.\n '''\n assert callable(func), f'{repr(func)} not callable.'\n assert isinstance(func_scope_names_ignore, int), (\n f'{func_scope_names_ignore} not integer.')\n assert func_scope_names_ignore >= 0, (\n f'{func_scope_names_ignore} negative.')\n assert isinstance(func_stack_frames_ignore, int), (\n f'{func_stack_frames_ignore} not integer.')\n assert func_stack_frames_ignore >= 0, (\n f'{func_stack_frames_ignore} negative.')\n # print(f'\\n--------- Capturing nested {func.__qualname__}() local scope...')\n \n # ..................{ IMPORTS }..................\n # Avoid circular import dependencies.\n from beartype._util.func.utilfunccodeobj import get_func_codeobj_or_none\n from beartype._util.func.utilfuncframe import iter_frames\n from beartype._util.func.utilfunctest import is_func_nested\n from beartype._util.module.utilmodget import get_object_module_name_or_none\n \n # ..................{ NOOP }..................\n # Note that we intentionally return the local scope for this wrapper rather\n # than wrappee callable, as a local scope can *ONLY* be obtained by\n # dynamically inspecting local attributes bound to call frames on the\n # current call stack. However, this wrapper was called at a higher call\n # frame than this wrappee. All local attributes declared within the body of\n # this wrapper callable are irrelevant to this wrappee callable, as Python\n # syntactically parsed the latter at a later time than the former. If we\n # returned the local scope for this wrappee rather than wrapper callable,\n # we would erroneously return local attributes that this wrappee callable\n # originally had no lexical access to. That's bad. So, we don't do that.\n \n # Fully-qualified name of the module declaring the passed callable if that\n # callable was physically declared by an on-disk module *OR* \"None\"\n # otherwise (i.e., if that callable was dynamically declared in-memory).\n func_module_name = get_object_module_name_or_none(func)\n \n # If either...\n if (\n # The passed callable is dynamically declared in-memory...\n func_module_name is None or\n # The passed callable is module-scoped rather than nested *OR*...\n not is_func_nested(func)\n # Then silently reduce to a noop by treating this nested callable as\n # module-scoped by preserving \"func_locals\" as the empty dictionary.\n ):\n return FROZENDICT_EMPTY\n # Else, all of the following constraints hold:\n # * The passed callable is physically declared on-disk.\n # * The passed callable is nested.\n \n # ..................{ LOCALS ~ scope }..................\n # Local scope of the passed callable to be returned.\n func_scope: LexicalScope = {}\n \n # ..................{ LOCALS ~ scope : name }..................\n # Unqualified name of this nested callable.\n func_name_unqualified = func.__name__\n \n # Fully-qualified name of this nested callable. If this nested callable is\n # a non-method, this name contains one or more meaningless placeholders\n # \"\" -- each identifying one parent callable lexically containing\n # this nested callable: e.g.,\n # >>> def muh_func():\n # ... def muh_closure(): pass\n # ... return muh_closure()\n # >>> muh_func().__qualname__\n # 'muh_func..muh_closure'\n func_name_qualified = get_object_basename_scoped(func)\n \n # Non-empty list of the unqualified names of all parent callables lexically\n # containing that nested callable (including that nested callable itself).\n #\n # Note that:\n # * The set of all callables embodied by the current runtime call stack is a\n # (usually proper) superset of the set of all callables embodied by the\n # lexical scopes encapsulating this nested callable. Ergo:\n # * Some stack frames have no corresponding lexical scopes (e.g., stack\n # frames embodying callables defined by different modules).\n # * *ALL* lexical scopes have a corresponding stack frame.\n # * Stack frames are only efficiently accessible relative to the initial\n # stack frame embodying this nested callable, which resides at the end of\n # the call stack. This implies we *MUST* iteratively search up the call\n # stack for frames with relevant lexical scopes and ignore intervening\n # frames with irrelevant lexical scopes, starting at the stack top (end).\n> func_scope_names = func_name_qualified.rsplit(sep='.')\nE AttributeError: 'NoneType' object has no attribute 'rsplit'\n", "Failure #3: beartype_test/a00_unit/a20_util/test_utilobject.py::test_get_object_basename_scoped", "Failure #4: beartype_test/a00_unit/a20_util/test_utilobject.py::test_get_object_name", "Failure #5: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_callable", "Failure #6: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_func", "Failure #7: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #8: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #25: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #26: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #27: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #28: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #29: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py", "test_is_func_nested" ], [ "beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py", "test_get_func_locals" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 2, "true_in_degree": 13.840000000000005, "out_degree": 1, "betweenness": 0.00014631925778201682, "pagerank": 0.0004988364376897315, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.20446760841497758, "degree": 3 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484/pep484generic.py", "function_name": "get_hint_pep484_generic_bases_unerased", "test_info": { "success": false, "failed": 19, "passed": 1111, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_0450hdk0/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:1049\nError: beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic subclasses no superclasses.\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> hint_child_bases = get_hint_pep484585_generic_bases_unerased(\n\n> def get_hint_pep484585_generic_bases_unerased(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> tuple:\n '''\n Tuple of the one or more **unerased pseudo-superclasses** (i.e.,\n PEP-compliant objects originally listed as superclasses prior to their\n implicit type erasure under :pep:`560`) of the passed :pep:`484`- or\n :pep:`585`-compliant **generic** (i.e., class superficially subclassing at\n least one PEP-compliant type hint that is possibly *not* an actual class) if\n this object is a generic *or* raise an exception otherwise (i.e., if this\n object is *not* a generic).\n \n This getter is guaranteed to return a non-empty tuple. By definition, a\n generic is a type subclassing one or more generic superclasses.\n \n This getter is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator), as the implementation trivially reduces\n to an efficient one-liner.\n \n Caveats\n -------\n **This getter should always be called in lieu of attempting to directly\n access the low-level** ``__orig_bases__`` **dunder instance variable.**\n Most PEP-compliant type hints fail to declare that variable, guaranteeing\n :class:`AttributeError` exceptions from all general-purpose logic\n attempting to directly access that variable. Thus this function, which\n \"fills in the gaps\" by implementing this oversight.\n \n **This getter returns tuples possibly containing a mixture of actual\n superclasses and pseudo-superclasses superficially masquerading as actual\n superclasses subscripted by one or more PEP-compliant child hints or type\n variables** (e.g., ``(typing.Iterable[T], typing.Sized[T])``). Indeed, most\n type hints used as superclasses produced by subscripting PEP-compliant type\n hint factories are *not* actually types but singleton objects devilishly\n masquerading as types. Most actual :mod:`typing` superclasses are private,\n fragile, and prone to alteration or even removal between Python versions.\n \n Motivation\n ----------\n :pep:`560` (i.e., \"Core support for typing module and generic types)\n formalizes the ``__orig_bases__`` dunder attribute first informally\n introduced by the :mod:`typing` module's implementation of :pep:`484`.\n Naturally, :pep:`560` remains as unusable as :pep:`484` itself. Ideally,\n :pep:`560` would have generalized the core intention of preserving each\n original user-specified subclass tuple of superclasses as a full-blown\n ``__orig_mro__`` dunder attribute listing the original method resolution\n order (MRO) of that subclass had that tuple *not* been modified.\n \n Naturally, :pep:`560` did no such thing. The original MRO remains obfuscated\n and effectively inaccessible. While computing that MRO would technically be\n feasible, doing so would also be highly non-trivial, expensive, and fragile.\n Instead, this function retrieves *only* the tuple of :mod:`typing`-specific\n pseudo-superclasses that this object's class originally attempted (but\n failed) to subclass.\n \n You are probably now agitatedly cogitating to yourself in the darkness: \"But\n @leycec: what do you mean :pep:`560`? Wasn't :pep:`560` released *after*\n :pep:`484`? Surely no public API defined by the Python stdlib would be so\n malicious as to silently alter the tuple of base classes listed by a\n user-defined subclass?\"\n \n As we've established both above and elsewhere throughout the codebase,\n everything developed for :pep:`484` -- including :pep:`560`, which derives\n its entire raison d'etre from :pep:`484` -- are fundamentally insane. In\n this case, :pep:`484` is insane by subjecting parametrized :mod:`typing`\n types employed as base classes to \"type erasure,\" because:\n \n ...it is common practice in languages with generics (e.g. Java,\n TypeScript).\n \n Since Java and TypeScript are both terrible languages, blindly\n recapitulating bad mistakes baked into such languages is an equally bad\n mistake. In this case, \"type erasure\" means that the :mod:`typing` module\n *intentionally* destroys runtime type information for nebulous and largely\n unjustifiable reasons (i.e., Big Daddy Java and TypeScript do it, so it\n must be unquestionably good).\n \n Specifically, the :mod:`typing` module intentionally munges :mod:`typing`\n types listed as base classes in user-defined subclasses as follows:\n \n * All base classes whose origin is a builtin container (e.g.,\n ``typing.List[T]``) are reduced to that container (e.g., :class:`list`).\n * All base classes derived from an abstract base class declared by the\n :mod:`collections.abc` subpackage (e.g., ``typing.Iterable[T]``) are\n reduced to that abstract base class (e.g., ``collections.abc.Iterable``).\n * All surviving base classes that are parametrized (e.g.,\n ``typing.Generic[S, T]``) are stripped of that parametrization (e.g.,\n :class:`typing.Generic`).\n \n Since there exists no counterpart to the :class:`typing.Generic` superclass,\n the :mod:`typing` module preserves that superclass in unparametrized form.\n Naturally, this is useless, as an unparametrized :class:`typing.Generic`\n superclass conveys no meaningful type information. All other superclasses\n are reduced to their non-:mod:`typing` counterparts: e.g.,\n \n .. code-block:: pycon\n \n >>> from typing import TypeVar, Generic, Iterable, List\n >>> T = TypeVar('T')\n >>> class UserDefinedGeneric(List[T], Iterable[T], Generic[T]): pass\n # This is type erasure.\n >>> UserDefinedGeneric.__mro__\n (list, collections.abc.Iterable, Generic)\n # This is type preservation -- except the original MRO is discarded.\n # So, it's not preservation; it's reduction! We take what we can get.\n >>> UserDefinedGeneric.__orig_bases__\n (typing.List[T], typing.Iterable[T], typing.Generic[T])\n # Guess which we prefer?\n \n So, we prefer the generally useful ``__orig_bases__`` dunder tuple over the\n generally useless ``__mro__`` dunder tuple. Note, however, that the latter\n *is* still occasionally useful and thus occasionally returned by this\n getter. For inexplicable reasons, **single-inherited protocols** (i.e.,\n classes directly subclassing *only* the :pep:`544`-compliant\n :attr:`typing.Protocol` abstract base class (ABC)) are *not* subject to type\n erasure and thus constitute a notable exception to this heuristic:\n \n .. code-block:: pycon\n \n >>> from typing import Protocol\n >>> class UserDefinedProtocol(Protocol): pass\n >>> UserDefinedProtocol.__mro__\n (__main__.UserDefinedProtocol, typing.Protocol, typing.Generic, object)\n >>> UserDefinedProtocol.__orig_bases__\n AttributeError: type object 'UserDefinedProtocol' has no attribute\n '__orig_bases__'\n \n Welcome to :mod:`typing` hell, where even :mod:`typing` types lie broken and\n misshapen on the killing floor of overzealous theory-crafting purists.\n \n Parameters\n ----------\n hint : Hint\n Generic type hint to be inspected.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n tuple\n Tuple of the one or more unerased pseudo-superclasses of this generic.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * Neither a :pep:`484`- nor :pep:`585`-compliant generic.\n * A :pep:`484`- or :pep:`585`-compliant generic subclassing *no*\n pseudo-superclasses.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.typing import Container, Iterable, TypeVar\n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_bases_unerased)\n \n >>> T = TypeVar('T')\n >>> class MuhIterable(Iterable[T], Container[T]): pass\n \n >>> get_hint_pep585_generic_bases_unerased(MuhIterable)\n (typing.Iterable[~T], typing.Container[~T])\n \n >>> MuhIterable.__mro__\n (MuhIterable,\n collections.abc.Iterable,\n collections.abc.Container,\n typing.Generic,\n object)\n '''\n \n # ....................{ IMPORTS }....................\n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic_user)\n \n # ....................{ LOCALS }....................\n # Tuple of either...\n #\n # Note this implicitly raises a \"BeartypeDecorHintPepException\" if this\n # object is *NOT* a PEP-compliant generic. Ergo, we need not explicitly\n # validate that above.\n hint_pep_generic_bases_unerased = (\n # If this is a PEP 585-compliant generic, all unerased\n # pseudo-superclasses of this PEP 585-compliant generic.\n #\n # Note that this unmemoized getter accepts keyword arguments.\n get_hint_pep585_generic_bases_unerased(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n if is_hint_pep585_generic(hint) else\n # Else, this *MUST* be a PEP 484-compliant generic. In this case, all\n # unerased pseudo-superclasses of this PEP 484-compliant generic.\n #\n # Note that this memoized getter prohibits keyword arguments.\n get_hint_pep484_generic_bases_unerased(\n hint,\n exception_cls,\n exception_prefix,\n )\n )\n \n # ....................{ RETURN }....................\n # If this generic....\n if (\n # Subclasses no pseudo-superclasses *AND*...\n not hint_pep_generic_bases_unerased and\n # Is user-defined by a third-party downstream codebase.\n is_hint_pep484585_generic_user(hint)\n ):\n # Raise an exception. By definition, *ALL* user-defined generics should\n # subclass at least one pseudo-superclass. Note that this constraint:\n # * Does *NOT* apply to standard generics defined by either:\n # * The standard \"typing\" module (e.g., \"typing.Generic[S, T]\").\n # * The Python interpreter itself (e.g., \"list[T]\").\n # Why? Because these generics are the root superclasses that other\n # user-defined generics subclass. Clearly, they have no\n # pseudo-superclasses.\n # * Should have already been guaranteed on our behalf by:\n # * If this generic is PEP 484-compliant, the standard \"typing\" module.\n # * If this generic is PEP 585-compliant, the Python interpreter itself.\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n> raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'subclasses no superclasses.'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: PEP 484 or 585 generic subclasses no superclasses.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_0450hdk0/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py:178\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_get_hint_pep484585_generic_bases_unerased(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._data.hint.pep.sign.datapepsignset import HINT_SIGNS_GENERIC\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_bases_unerased)\n from beartype._util.hint.pep.utilpeptest import is_hint_pep_type_typing\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # For each PEP-compliant hint to be tested...\n for hint_pep_meta in hints_pep_meta:\n # If this is a generic hint, assert that this getter returns the\n # expected unerased pseudo-superclasses of this generic.\n if hint_pep_meta.pep_sign in HINT_SIGNS_GENERIC:\n hint_pep_bases = get_hint_pep484585_generic_bases_unerased(\n hint_pep_meta.hint)\n assert isinstance(hint_pep_bases, tuple)\n assert hint_pep_bases\n # Else, this is *NOT* a generic hint.\n #\n # If this hint is *NOT* defined by the \"typing\" module, assert that this\n # getter raises the expected exception.\n elif not is_hint_pep_type_typing(hint_pep_meta.hint):\n # print(f'hint_pep_meta: {repr(hint_pep_meta)}')\n> with raises(BeartypeDecorHintPepException):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_base_in_module_first", "Failure #4: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #19: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.5200000000000005, "in_degree": 1, "true_in_degree": 5.960000000000003, "out_degree": 2, "betweenness": 2.3483337668718746e-05, "pagerank": 0.00034115285356872043, "harmonic": 0.005756578947368421, "bidirectional_harmonic": 0.20317863788258594, "degree": 3 }, "line_count": 37, "code_line_count": 37, "cyclomatic": 7, "halstead_volume": 92.0, "halstead_difficulty": 3.1818181818181817 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/vale/_is/_valeistype.py", "function_name": "_IsSubclassFactory.__getitem__", "test_info": { "success": false, "failed": 7, "passed": 1123, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass\nLocation: /tmp/benchmark_10hpwd7p/beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py:176\nError: AssertionError: assert False\n + where False = isinstance(None, )\n\nTraceback:\n\n> def test_api_vale_issubclass_pass() -> None:\n '''\n Test successful usage of the :class:`beartype.vale.IsSubclass` factory.\n '''\n \n # Defer test-specific imports.\n from beartype.vale import IsSubclass\n from beartype.vale._core._valecore import BeartypeValidator\n from beartype._util.utilobject import get_object_name\n from beartype_test.a00_unit.data.data_type import (\n Class, Subclass, SubclassSubclass)\n \n # Subclasses of classes subscripting this factory below.\n class UnicodeStr(str): pass\n class ByteStr(bytes): pass\n \n # Validators produced by subscripting this factory with one superclass.\n IsClassSubclass = IsSubclass[Class]\n IsSubclassSubclass = IsSubclass[Subclass]\n \n # Validator produced by subscripting this factory with two or more\n # superclasses.\n IsStrOrBytesSubclass = IsSubclass[str, bytes]\n \n # Assert these validators satisfy the expected API.\n> assert isinstance(IsClassSubclass, BeartypeValidator)\nE AssertionError: assert False\nE + where False = isinstance(None, )\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_fail\nLocation: /tmp/benchmark_10hpwd7p/beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py:249\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_api_vale_issubclass_fail() -> None:\n '''\n Test unsuccessful usage of the :class:`beartype.vale.IsSubclass` factory.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeValeSubscriptionException\n from beartype.vale import IsSubclass\n from beartype_test.a00_unit.data.data_type import NonIssubclassableClass\n from pytest import raises\n \n # Assert that subscripting this factory with the empty tuple raises the\n # expected exception.\n> with raises(BeartypeValeSubscriptionException):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #7: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py", "test_api_vale_issubclass_pass" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py", "test_api_vale_issubclass_fail" ] ] }, "complexity_info": { "centrality": { "distance_discount": 21.25584384000001, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 6, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.02882205513784461, "bidirectional_harmonic": 0.24328476256930218, "degree": 6 }, "line_count": 35, "code_line_count": 35, "cyclomatic": 4, "halstead_volume": 19.651484454403228, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep593.py", "function_name": "is_hint_pep593_beartype", "test_info": { "success": false, "failed": 11, "passed": 1119, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype\nLocation: /tmp/benchmark_0nns5axq/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py:63\nError: AssertionError: assert None is False\n + where None = (typing.Annotated[str, 'And may there be no sadness of farewell'])\n\nTraceback:\n\n> def test_is_hint_pep593_beartype() -> None:\n '''\n Test usage of the private\n :mod:`beartype._util.hint.pep.proposal.pep593.is_hint_pep593_beartype`\n tester.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype.typing import Annotated\n from beartype.vale import Is\n from beartype._util.hint.pep.proposal.pep593 import is_hint_pep593_beartype\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this tester rejects beartype-agnostic metahints.\n> assert is_hint_pep593_beartype(\n Annotated[str, 'And may there be no sadness of farewell']) is False\nE AssertionError: assert None is False\nE + where None = (typing.Annotated[str, 'And may there be no sadness of farewell'])\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable\nLocation: /tmp/benchmark_0nns5axq/beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py:454\nError: AssertionError: assert True is False\n + where True = AnnotatedTypeHint(typing.Annotated[object, beartype.vale.Is[lambda obj: hasattr(obj, 'this_mobbed_triste_of')]]).is_ignorable\n + where AnnotatedTypeHint(typing.Annotated[object, beartype.vale.Is[lambda obj: hasattr(obj, 'this_mobbed_triste_of')]]) = (typing.Annotated[object, beartype.vale.Is[lambda obj: hasattr(obj, 'this_mobbed_triste_of')]])\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_is_ignorable(hints_pep_meta, hints_ignorable) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.is_ignorable` property.\n \n Parameters\n ----------\n hints_pep_meta : tuple[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n Tuple of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n hints_ignorable : frozenset\n Frozen set of ignorable PEP-agnostic type hints.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import BeartypeDoorException, BeartypeDoorNonpepException\n from beartype.typing import (\n Any,\n TypeVar,\n )\n from beartype._check.convert.convsanify import sanify_hint_child\n from beartype._util.hint.pep.proposal.pep484.pep484typevar import (\n get_hint_pep484_typevar_bound_or_none)\n from contextlib import suppress\n \n # ....................{ PASS }....................\n # Assert this property accepts ignorable type hints.\n for hint_ignorable in hints_ignorable:\n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n assert TypeHint(hint_ignorable).is_ignorable is True\n \n # Assert this property:\n # * Accepts unignorable PEP-compliant type hints.\n # * Rejects ignorable PEP-compliant type hints.\n for hint_pep_meta in hints_pep_meta:\n # Hint to be tested.\n hint = hint_pep_meta.hint\n \n # True only if the @beartype decorator currently ignores this hint.\n hint_is_ignorable = hint_pep_meta.is_ignorable\n \n # If this hint is a type variable...\n #\n # Note that the @beartype decorator and the \"beartype.door\" API\n # currently disagree as to whether type variables are ignorable. From:\n # the perspective of:\n # * The low-level @beartype decorator, they mostly are.\n # * The high-level \"beartype.door\" API, they mostly are *NOT*.\n #\n # Since the \"hint_pep_meta.is_ignorable\" variable reflects the\n # perspective of the @beartype decorator rather than the \"beartype.door\"\n # API, further logic is needed to decide whether this type variable is\n # actually ignorable from the \"beartype.door\" perspective.\n if isinstance(hint, TypeVar):\n # Type hint synthesized from all bounded constraints parametrizing\n # this type variable if any *OR* \"None\" otherwise.\n hint_typevar_bound = get_hint_pep484_typevar_bound_or_none(hint)\n \n # This type hint is ignorable only if either...\n hint_is_ignorable = (\n # This type hint is unconstrained *OR*...\n hint_typevar_bound is None or\n # This type hint is constrained by one or more ignorable\n # constraints.\n sanify_hint_child(hint_typevar_bound) is Any\n )\n # Else, this hint is *NOT* a type variable.\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints. Most of these will be\n #\"BeartypeDoorNonpepException\", but there are some covariant type hints\n #(e.g. numpy.dtype[+ScalarType]) that will raise a \"not invariant\"\n #exception in the \"TypeVarTypeHint\" subclass.\n with suppress(BeartypeDoorException):\n> assert TypeHint(hint).is_ignorable is hint_is_ignorable\nE AssertionError: assert True is False\nE + where True = AnnotatedTypeHint(typing.Annotated[object, beartype.vale.Is[lambda obj: hasattr(obj, 'this_mobbed_triste_of')]]).is_ignorable\nE + where AnnotatedTypeHint(typing.Annotated[object, beartype.vale.Is[lambda obj: hasattr(obj, 'this_mobbed_triste_of')]]) = (typing.Annotated[object, beartype.vale.Is[lambda obj: hasattr(obj, 'this_mobbed_triste_of')]])\n", "Failure #3: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #4: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #11: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py", "test_is_hint_pep593_beartype" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_is_ignorable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 10.331238400000004, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 2, "betweenness": 8.12884765455649e-06, "pagerank": 0.00035098522167487686, "harmonic": 0.012339442355889726, "bidirectional_harmonic": 0.1896297918090687, "degree": 3 }, "line_count": 10, "code_line_count": 10, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_decor/wrap/_wraputil.py", "function_name": "unmemoize_func_wrapper_code", "test_info": { "success": false, "failed": 44, "passed": 1086, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic\nLocation: /tmp/benchmark_al1o7c1g/beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py:72\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_decor_type_basic() -> None:\n '''\n Test decoration of user-defined classes by the :func:`beartype.beartype`\n decorator from the perspective of basic usability.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from pytest import raises\n \n # ....................{ CLASSES }....................\n # Intentionally redecorate a class twice by the @beartype decorator,\n # exercising an edge case in class decoration.\n @beartype\n @beartype\n class FromHisInnocuousHand(object):\n '''\n Arbitrary class defining one or more arbitrary annotated methods.\n '''\n \n # ....................{ METHODS }....................\n def his_bloodless_food(self, lured_by_the_gentle_meaning: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(lured_by_the_gentle_meaning)\n \n # ....................{ LOCALS }....................\n # Arbitrary instance of this class.\n of_his_looks = FromHisInnocuousHand()\n \n # ....................{ PASS }....................\n # Assert that this method returns the expected length of the passed string.\n assert of_his_looks.his_bloodless_food(\n 'Lured by the gentle meaning of his looks,') == 41\n \n # Assert that the __sizeof__() dunder method internally monkey-patched by\n # the @beartype decorator returns the expected size.\n of_his_looks_size_new = of_his_looks.__sizeof__()\n of_his_looks_size_old = of_his_looks.__sizeof__.__wrapped__(of_his_looks)\n assert isinstance(of_his_looks_size_new, int)\n assert of_his_looks_size_new >= 0\n assert of_his_looks_size_new == of_his_looks_size_old\n \n # ....................{ FAIL }....................\n # Assert that this method raises the expected exception when passed a\n # invalid parameter.\n> with raises(BeartypeCallHintParamViolation):\nE Failed: DID NOT RAISE \n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested\nLocation: /tmp/benchmark_al1o7c1g/beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py:208\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_decor_type_nested() -> None:\n '''\n Test decoration of user-defined classes nested inside user-defined classes\n by the :func:`beartype.beartype` decorator.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from pytest import raises\n \n # ....................{ LOCALS }....................\n class ForHisCouch(object):\n '''\n Arbitrary class *not* decorated by :func:`beartype.beartype`.\n '''\n \n def and_stole(self, from_duties_and_repose: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(from_duties_and_repose)\n \n \n # Intentionally redecorate a class twice by the @beartype decorator,\n # exercising an edge case in class decoration.\n @beartype\n @beartype\n class TheThrillingSecretsOf(object):\n '''\n Arbitrary parent class decorated by :func:`beartype.beartype` containing\n an arbitrary nested child class *not* decorated by\n :func:`beartype.beartype`, exercising that the decoration of this parent\n class implicitly decorates this child class.\n '''\n \n # ....................{ CLASS VARIABLES }....................\n from_her_fathers_tent: type = object\n '''\n Class variable whose value is the root :class:`object` superclass.\n \n This variable exercises an edge cases in :func:`beartype.beartype`.\n Previously, :func:`beartype.beartype` erroneously conflated class\n variables whose values are types with nested classes by decorating the\n former as if they were the latter. In the best case, doing so decorated\n external classes *not* intended to be decorated; in the worst case,\n doing so provoked infinite recursion.\n \n This variable exercises that worst case. Notably:\n \n * :class:`enum.Enum` subclasses as follows:\n \n #. *All* :class:`enum.Enum` subclasses define a private\n ``_member_type_`` attribute whose value is the :class:`object`\n superclass, which :func:`beartype.beartype` then decorated.\n #. However, the :class:`object` superclass defines the ``__class__``\n dunder attribute whose value is the :class:`type` superclass, which\n :func:`beartype.beartype` then decorated.\n #. However, the :class:`type` superclass defines the ``__base__``\n dunder attribute whose value is the :class:`object` superclass,\n which :func:`beartype.beartype` then decorated.\n #. **INFINITE FRIGGIN' RECURSION.** Anarchy today.\n '''\n \n \n and_spread_her_matting: type = type\n '''\n Class variable whose value is the root :class:`type` superclass,\n exercising the same edge case as the prior class variable.\n '''\n \n \n to_tend_his_steps: type = ForHisCouch\n '''\n Class variable whose value is a user-defined class that is neither the\n root :class:`object` nor :class:`type` superclasses.\n \n This variable exercises the aforementioned best case: namely, that\n :func:`beartype.beartype` no longer erroneously decorates external\n classes *not* intended to be decorated when those classes are the values\n of class variables.\n '''\n \n # ....................{ METHODS }....................\n def of_the_birth(self, of_time: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(of_time)\n \n # ....................{ NESTED }....................\n class MeanwhileAMaiden(object):\n '''\n Arbitrary nested child class *not* decorated by\n :func:`beartype.beartype`.\n '''\n \n def brought_his_feed(self, her_daily_portion: str) -> int:\n '''\n Arbitrary annotated method.\n '''\n \n return len(her_daily_portion)\n \n \n # Arbitrary instance of these classes.\n enamoured = ForHisCouch()\n yet_not_daring = TheThrillingSecretsOf()\n for_deep_awe = TheThrillingSecretsOf.MeanwhileAMaiden()\n \n # ....................{ PASS }....................\n # Assert that these methods passed arbitrary parameters return the expected\n # values from those parameters.\n assert enamoured.and_stole(\n 'To speak her love:\u2014and watched his nightly sleep,') == 49\n assert yet_not_daring.of_the_birth(\n 'Sleepless herself, to gaze upon his lips') == 40\n assert for_deep_awe.brought_his_feed(\n 'Parted in slumber, whence the regular breath') == 44\n \n # ....................{ FAIL }....................\n # Assert that this undecorated method raises a standard exception rather\n # than a beartype-specific violation when passed an invalid parameter.\n with raises(TypeError):\n enamoured.and_stole(True)\n \n # Assert that these methods all raise the expected exception when passed\n # invalid parameters.\n> with raises(BeartypeCallHintParamViolation):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #36: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #37: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #38: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #39: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #40: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #41: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #42: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #43: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #44: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py", "test_decor_type_basic" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py", "test_decor_type_nested" ] ] }, "complexity_info": { "centrality": { "distance_discount": 26.883020800000025, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 3, "betweenness": 4.335385415763461e-05, "pagerank": 0.00029050355774493705, "harmonic": 0.031120770676691722, "bidirectional_harmonic": 0.23478363285106732, "degree": 5 }, "line_count": 47, "code_line_count": 47, "cyclomatic": 7, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextmunge.py", "function_name": "suffix_str_unless_suffixed", "test_info": { "success": false, "failed": 9, "passed": 1121, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py::test_suffix_str_unless_suffixed\nLocation: /tmp/benchmark_brb1cawn/beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py:130\nError: AssertionError: assert None == 'somefile.py'\n\nTraceback:\n\n> def test_suffix_str_unless_suffixed():\n '''\n Test the\n :func:`beartype._util.text.utiltextmunge.suffix_str_unless_suffixed`\n function.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.text.utiltextmunge import suffix_str_unless_suffixed\n from pytest import raises\n \n # ....................{ LOCALS }....................\n not_suffixed_text = \"somefile\"\n suffix = \".py\"\n \n # ....................{ PASS }....................\n suffixed_text = suffix_str_unless_suffixed(\n text=not_suffixed_text, suffix=suffix)\n \n # Confirm text is suffixed\n> assert suffixed_text == \"somefile.py\"\nE AssertionError: assert None == 'somefile.py'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_brb1cawn/beartype/_util/text/utiltextmunge.py:68\nError: AssertionError: None not string.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> ).find_cause()\n\n> return cause_finder(self)\n\n> '\\n'.join(\n\n> uppercase_str_char_first(\n\n> def uppercase_str_char_first(text: str) -> str:\n '''\n Uppercase *only* the first character of the passed string.\n \n Whereas the standard :meth:`str.capitalize` method both uppercases the\n first character of this string *and* lowercases all remaining characters,\n this function *only* uppercases the first character. All remaining\n characters remain unmodified.\n \n Parameters\n ----------\n text : str\n String whose first character is to be uppercased.\n \n Returns\n -------\n str\n This string with the first character uppercased.\n '''\n> assert isinstance(text, str), f'{repr(text)} not string.'\nE AssertionError: None not string.\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #5: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #6: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #7: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #8: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py", "test_suffix_str_unless_suffixed" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 2.8, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.00030477807632980046, "harmonic": 0.0, "bidirectional_harmonic": 0.21100092798283632, "degree": 2 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 4, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfunccode.py", "function_name": "_LambdaNodeUnparser.visit_Lambda", "test_info": { "success": false, "failed": 43, "passed": 1050, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/test_utilfunccode.py::test_get_func_code_or_none\nLocation: /tmp/benchmark_2z46pa61/beartype/_util/error/utilerrwarn.py:83\nError: beartype.roar._BeartypeUtilCallableWarning: lambda function accepting 0 argument(s) beartype_test.a00_unit.data.util.func.data_utilfunccode.() in file \"/tmp/benchmark_2z46pa61/beartype_test/a00_unit/data/util/func/data_utilfunccode.py\" line 44 not parsable:\nTraceback (most recent call last):\n File \"/tmp/benchmark_2z46pa61/beartype/_util/func/utilfunccode.py\", line 453, in get_func_code_or_none\n issue_warning(\n File \"/tmp/benchmark_2z46pa61/beartype/_util/error/utilerrwarn.py\", line 83, in issue_warning\n warn(message, cls, skip_file_prefixes=_ISSUE_WARNING_IGNORE_DIRNAMES) # type: ignore[call-overload]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nbeartype.roar._BeartypeUtilCallableWarning: lambda function accepting 0 argument(s) beartype_test.a00_unit.data.util.func.data_utilfunccode.() in file \"/tmp/benchmark_2z46pa61/beartype_test/a00_unit/data/util/func/data_utilfunccode.py\" line 44 not found.\n\nTraceback:\n\n> def test_get_func_code_or_none() -> None:\n '''\n Test usage of the\n :func:`beartype._util.func.utilfunccode.get_func_code_or_none`\n function.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype.roar._roarwarn import _BeartypeUtilCallableWarning\n from beartype._util.func.utilfunccode import get_func_code_or_none\n from beartype._util.py.utilpyversion import (\n IS_PYTHON_AT_LEAST_3_11,\n )\n from beartype_test.a00_unit.data.util.func.data_utilfunccode import (\n of_vapours,\n will_be_the_dome,\n thou_dirge,\n yellow,\n )\n from collections.abc import Callable\n from pytest import warns\n from re import escape, search\n \n # ..................{ NON-LAMBDA }..................\n # Assert this getter accepts C-based callables with \"None\"\n assert get_func_code_or_none(iter) is None\n \n # Assert this getter accepts a dynamically declared callable with \"None\".\n assert get_func_code_or_none(of_vapours) is None\n \n # Assert this getter accepts a physically declared pure-Python non-lambda\n # callable with the full definition of that callable.\n assert get_func_code_or_none(will_be_the_dome) == \"\"\"def will_be_the_dome():\n '''\n Arbitrary non-lambda function physically declared by this submodule.\n '''\n \n return 'of a vast sepulchre'\n \"\"\"\n \n # ..................{ LAMBDA }..................\n def _assert_lambda_args_0_body_is(\n func: Callable,\n func_code_body: str,\n ) -> None:\n '''\n Test-specific function asserting that the body of the passed\n **argumentless lambda function** (i.e., lambda function accepting *no*\n parameters) is exactly the passed string.\n \n This function enables the bodies of lambda functions to be portably\n tested across distinct Python versions.\n \n Parameters\n ----------\n func : Callable\n Lambda function to test this string against.\n func_code_body : str\n Expected body of this lambda function to be tested for.\n '''\n \n # Regular expression matching the leading prefix of the source code\n # underlying this lambda.\n LAMBDA_ARGS_0_CODE_PREFIX = (\n # Under Python >= 3.11, this code is no longer erroneously prefixed\n # by an assignment statement globalizing this lambda.\n r'lambda: '\n if IS_PYTHON_AT_LEAST_3_11 else\n # Under Python 3.9 and 3.10, this code is typically erroneously\n # prefixed by an assignment statement globalizing this lambda but\n # nonetheless has an accidental space inserted inappropriately.\n r'lambda : '\n )\n \n # Regular expression matching this prefix followed by this body,\n # escaped to avoid unsafe interpretation as regular expressions.\n func_code_regex = (\n fr'^{LAMBDA_ARGS_0_CODE_PREFIX}{escape(func_code_body)}$')\n \n # Original source code of this lambda.\n func_code = get_func_code_or_none(func)\n \n # Assert this code is prefixed by the expected substring followed by the\n # passed body of this lambda.\n assert search(pattern=func_code_regex, string=func_code) is not None\n \n # ..................{ PASS }..................\n # Assert this getter accepts a physically declared pure-Python lambda\n # function in which only one lambda is declared on its source code line\n # with the embedded definition of that function.\n> _assert_lambda_args_0_body_is(\n func=thou_dirge,\n func_code_body=\"'Of the dying year, to which this closing night'\",\n )\n\n> func_code = get_func_code_or_none(func)\n\n> issue_warning(\n\n> def issue_warning(cls: TypeWarning, message: str) -> None:\n # The warning you gave us is surely our last!\n> warn(message, cls, skip_file_prefixes=_ISSUE_WARNING_IGNORE_DIRNAMES) # type: ignore[call-overload]\nE beartype.roar._BeartypeUtilCallableWarning: lambda function accepting 0 argument(s) beartype_test.a00_unit.data.util.func.data_utilfunccode.() in file \"/tmp/benchmark_2z46pa61/beartype_test/a00_unit/data/util/func/data_utilfunccode.py\" line 44 not parsable:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_2z46pa61/beartype/_util/func/utilfunccode.py\", line 453, in get_func_code_or_none\nE issue_warning(\nE File \"/tmp/benchmark_2z46pa61/beartype/_util/error/utilerrwarn.py\", line 83, in issue_warning\nE warn(message, cls, skip_file_prefixes=_ISSUE_WARNING_IGNORE_DIRNAMES) # type: ignore[call-overload]\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE beartype.roar._BeartypeUtilCallableWarning: lambda function accepting 0 argument(s) beartype_test.a00_unit.data.util.func.data_utilfunccode.() in file \"/tmp/benchmark_2z46pa61/beartype_test/a00_unit/data/util/func/data_utilfunccode.py\" line 44 not found.\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_2z46pa61/beartype/_util/error/utilerrwarn.py:83\nError: beartype.roar.BeartypeValeLambdaWarning: lambda function accepting 1 argument(s) beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta.() in file \"/tmp/benchmark_2z46pa61/beartype_test/a00_unit/data/hint/pep/proposal/_data_pep593.py\" line 229 not parsable:\nTraceback (most recent call last):\n File \"/tmp/benchmark_2z46pa61/beartype/_util/func/utilfunccode.py\", line 453, in get_func_code_or_none\n issue_warning(\n File \"/tmp/benchmark_2z46pa61/beartype/_util/error/utilerrwarn.py\", line 83, in issue_warning\n warn(message, cls, skip_file_prefixes=_ISSUE_WARNING_IGNORE_DIRNAMES) # type: ignore[call-overload]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nbeartype.roar.BeartypeValeLambdaWarning: lambda function accepting 1 argument(s) beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta.() in file \"/tmp/benchmark_2z46pa61/beartype_test/a00_unit/data/hint/pep/proposal/_data_pep593.py\" line 229 not found.\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> HintPepMetadata(\n\n> hint_repr = get_hint_repr(self.hint)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return repr(hint)\n\n> \", \".join(repr(a) for a in self.__metadata__)\n\n> \", \".join(repr(a) for a in self.__metadata__)\n\n> self._get_repr = self._get_repr()\n\n> f'{represent_func(func=is_valid, warning_cls=BeartypeValeLambdaWarning)}'\n\n> get_func_code_or_none(func=func, warning_cls=warning_cls) or\n\n> issue_warning(\n\n> def issue_warning(cls: TypeWarning, message: str) -> None:\n # The warning you gave us is surely our last!\n> warn(message, cls, skip_file_prefixes=_ISSUE_WARNING_IGNORE_DIRNAMES) # type: ignore[call-overload]\nE beartype.roar.BeartypeValeLambdaWarning: lambda function accepting 1 argument(s) beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta.() in file \"/tmp/benchmark_2z46pa61/beartype_test/a00_unit/data/hint/pep/proposal/_data_pep593.py\" line 229 not parsable:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_2z46pa61/beartype/_util/func/utilfunccode.py\", line 453, in get_func_code_or_none\nE issue_warning(\nE File \"/tmp/benchmark_2z46pa61/beartype/_util/error/utilerrwarn.py\", line 83, in issue_warning\nE warn(message, cls, skip_file_prefixes=_ISSUE_WARNING_IGNORE_DIRNAMES) # type: ignore[call-overload]\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE beartype.roar.BeartypeValeLambdaWarning: lambda function accepting 1 argument(s) beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta.() in file \"/tmp/benchmark_2z46pa61/beartype_test/a00_unit/data/hint/pep/proposal/_data_pep593.py\" line 229 not found.\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #25: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #26: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #29: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #30: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #31: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_func", "Failure #32: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #33: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #34: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #35: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #36: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #38: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #39: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #40: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #43: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/test_utilfunccode.py", "test_get_func_code_or_none" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.7520000000000002, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.004660087719298245, "bidirectional_harmonic": 0.21775348646236853, "degree": 2 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 3, "halstead_volume": 12.0, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/text/utiltextmunge.py", "function_name": "replace_str_substrs", "test_info": { "success": false, "failed": 50, "passed": 1080, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py::test_replace_str_substrs\nLocation: /tmp/benchmark_nbb6hrfm/beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py:86\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_replace_str_substrs():\n '''\n Test the :func:`beartype._util.text.utiltextmunge.replace_str_substrs`\n function.\n '''\n \n # Defer test-specific imports.\n from beartype._util.text.utiltextmunge import replace_str_substrs\n from beartype.roar._roarexc import _BeartypeUtilTextException\n from pytest import raises\n \n> with raises(AssertionError):\nE Failed: DID NOT RAISE \n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_nbb6hrfm/beartype/_check/error/errget.py:479\nError: beartype.roar._BeartypeCallHintPepRaiseDesynchronizationException: Die_if_unbearable() value \"Oh, importunate \u0398 Fortuna'd afforded\" violates type hint typing.Hashable, but violation factory get_hint_object_violation() erroneously suggests this object satisfies this hint. Please report this desynchronization failure to the beartype issue tracker (https://github.com/beartype/beartype/issues) with the accompanying exception traceback and the representation of this object:\n \"Oh, importunate \u0398 Fortuna'd afforded\"\nThe bear groans in disappointment. If you feel similarly, know that you are not alone.\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n if not violation_cause.cause_str_or_none:\n pith_value_repr = represent_object(\n obj=obj, max_len=_CAUSE_TRIM_OBJECT_REPR_MAX_LEN)\n> raise _BeartypeCallHintPepRaiseDesynchronizationException(\n f'{exception_prefix}violates type hint {repr(hint)}, '\n f'but violation factory get_hint_object_violation() '\n f'erroneously suggests this object satisfies this hint. '\n f'Please report this desynchronization failure to '\n f'the beartype issue tracker ({URL_ISSUES}) with '\n f'the accompanying exception traceback and '\n f'the representation of this object:\\n'\n f' {pith_value_repr}\\n'\n f'The bear groans in disappointment. If you feel similarly, '\n f'know that you are not alone.'\n )\nE beartype.roar._BeartypeCallHintPepRaiseDesynchronizationException: Die_if_unbearable() value \"Oh, importunate \u0398 Fortuna'd afforded\" violates type hint typing.Hashable, but violation factory get_hint_object_violation() erroneously suggests this object satisfies this hint. Please report this desynchronization failure to the beartype issue tracker (https://github.com/beartype/beartype/issues) with the accompanying exception traceback and the representation of this object:\nE \"Oh, importunate \u0398 Fortuna'd afforded\"\nE The bear groans in disappointment. If you feel similarly, know that you are not alone.\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #42: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #43: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #44: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #45: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #46: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #47: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #48: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #49: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #50: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py", "test_replace_str_substrs" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 5.999999999999999, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.00034798934386973183, "harmonic": 0.0, "bidirectional_harmonic": 0.24088025461380722, "degree": 2 }, "line_count": 10, "code_line_count": 10, "cyclomatic": 5, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfunccodeobj.py", "function_name": "get_func_codeobj_or_none", "test_info": { "success": false, "failed": 176, "passed": 917, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a00_core/test_a00_package.py::test_api_deprecations\nLocation: /tmp/benchmark_hpmi8glj/beartype_test/a00_unit/a00_core/test_a00_package.py:78\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_api_deprecations() -> None:\n '''\n Test all deprecated attributes importable from the public APIs of all\n subpackages of the :mod:`beartype` package (including itself).\n '''\n \n # Defer test-specific imports.\n from beartype._util.module.utilmodimport import import_module_attr\n from pytest import warns\n \n # Tuple of the fully-qualified names of all deprecated attributes.\n DEPRECATED_ATTRIBUTES = (\n 'beartype.abby',\n 'beartype.cave.HintPep585Type',\n 'beartype.roar.BeartypeAbbyException',\n 'beartype.roar.BeartypeAbbyHintViolation',\n 'beartype.roar.BeartypeAbbyTesterException',\n 'beartype.roar.BeartypeCallHintPepException',\n 'beartype.roar.BeartypeCallHintPepParamException',\n 'beartype.roar.BeartypeCallHintPepReturnException',\n 'beartype.roar.BeartypeDecorHintNonPepException',\n 'beartype.roar.BeartypeDecorHintNonPepNumPyException',\n 'beartype.roar.BeartypeDecorHintPep563Exception',\n 'beartype.roar.BeartypeDecorHintPepDeprecatedWarning',\n 'beartype.roar.BeartypeDecorPepException',\n )\n \n # For each deprecated attribute declared by beartype...\n for deprecated_attribute in DEPRECATED_ATTRIBUTES:\n # Assert that importing this attribute both emits the expected warning\n # and returns a non-\"None\" value.\n> with warns(DeprecationWarning):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py::test_method_cached_arg_by_id\nLocation: /tmp/benchmark_hpmi8glj/beartype/_util/func/utilfunctest.py:175\nError: beartype.roar._BeartypeUtilCallableCachedException: not C-based bound instance method descriptor.\n\nTraceback:\n\n> def test_method_cached_arg_by_id() -> None:\n '''\n Test the\n :func:`beartype._util.cache.utilcachecall.method_cached_arg_by_id`\n decorator.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableCachedException\n from beartype._util.cache.utilcachecall import method_cached_arg_by_id\n from pytest import raises\n \n # ..................{ CLASSES }..................\n> class LikeDust(object):\n\n> @method_cached_arg_by_id\n\n> die_unless_func_args_len_flexible_equal(\n\n> func_args_len_flexible_actual = get_func_args_flexible_len(\n\n> return _get_func_boundmethod_args_flexible_len(\n\n> wrappee = unwrap_func_boundmethod_once(\n\n> die_unless_func_boundmethod(\n\n> def die_unless_func_boundmethod(\n # Mandatory parameters.\n func: Any,\n \n # Optional parameters.\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> None:\n '''\n Raise an exception unless the passed object is a **C-based bound instance\n method descriptor** callable implicitly instantiated and assigned on the\n instantiation of an object whose class declares an instance function (whose\n first parameter is typically named ``self``) as an instance variable of that\n object such that that callable unconditionally passes that object as the\n value of that first parameter on all calls to that callable).\n \n Parameters\n ----------\n func : Any\n Object to be inspected.\n exception_cls : TypeException, optional\n Type of exception to be raised. Defaults to\n :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to the empty string.\n \n Raises\n ------\n exception_cls\n If the passed object is *not* a bound method descriptor.\n \n See Also\n --------\n :func:`.is_func_boundmethod`\n Further details.\n '''\n \n # If this object is *NOT* a bound method descriptor, raise an exception.\n if not is_func_boundmethod(func):\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not class.')\n assert issubclass(exception_cls, Exception), (\n f'{repr(exception_cls)} not exception subclass.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Raise a human-readable exception.\n> raise exception_cls(\n f'{exception_prefix}{repr(func)} not '\n f'C-based bound instance method descriptor.'\n )\nE beartype.roar._BeartypeUtilCallableCachedException: not C-based bound instance method descriptor.\n", "Failure #3: beartype_test/a00_unit/a20_util/api/standard/test_utilapicontextlib.py::test_get_func_contextlib_contextmanager_or_none", "Failure #4: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped", "Failure #5: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py::test_get_func_arg_name_first_or_none", "Failure #6: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py::test_get_func_arg_names", "Failure #7: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py::test_iter_func_args", "Failure #8: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py::test_get_func_args_len_flexible", "Failure #9: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_argless", "Failure #10: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_variadic", "Failure #11: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name", "Failure #12: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_positional", "Failure #13: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_keyword", "Failure #14: beartype_test/a00_unit/a20_util/func/test_utilfunccode.py::test_get_func_code_or_none", "Failure #15: beartype_test/a00_unit/a20_util/func/test_utilfunccodeobj.py::test_get_func_codeobj", "Failure #16: beartype_test/a00_unit/a20_util/func/test_utilfunccodeobj.py::test_get_func_codeobj_or_none", "Failure #17: beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py::test_is_func_file", "Failure #18: beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py::test_get_func_filename_or_none", "Failure #19: beartype_test/a00_unit/a20_util/func/test_utilfuncframe.py::test_get_frame_or_none", "Failure #20: beartype_test/a00_unit/a20_util/func/test_utilfuncframe.py::test_iter_frames", "Failure #21: beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py::test_get_func_locals", "Failure #22: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_lambda", "Failure #23: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_async", "Failure #24: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_coro", "Failure #25: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_async_generator", "Failure #26: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_sync_generator", "Failure #27: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_die_unless_func_python", "Failure #28: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_codeobjable", "Failure #29: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_wrapper_isomorphic", "Failure #30: beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py::test_unwrap_func_all_isomorphic", "Failure #31: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased", "Failure #32: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #33: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #34: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #35: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #36: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #37: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #38: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #39: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #40: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #41: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #42: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype", "Failure #43: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #44: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #45: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #46: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #47: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #48: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #49: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #50: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #51: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #52: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #53: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #54: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #55: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #56: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #57: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #58: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #59: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #60: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #61: beartype_test/a00_unit/a20_util/module/test_utilmodget.py::test_get_object_module_line_number_begin", "Failure #62: beartype_test/a00_unit/a20_util/test_utilobject.py::test_get_object_filename_or_none", "Failure #63: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_beartypeable_kind", "Failure #64: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_callable", "Failure #65: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new", "Failure #66: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #67: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr", "Failure #68: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #69: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #70: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_contains", "Failure #71: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_iter", "Failure #72: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #73: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #74: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #75: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #76: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #77: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #78: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #79: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #80: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_recursion", "Failure #81: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_numpy", "Failure #82: beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py::test_api_vale_validator_pass", "Failure #83: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #84: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_fail", "Failure #85: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #86: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass", "Failure #87: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_pass", "Failure #88: beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py::test_api_vale_isequal_pass", "Failure #89: beartype_test/a00_unit/a60_check/a00_metadata/test_metacheck.py::test_metadata_check", "Failure #90: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #91: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #92: beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py::test_coerce_func_hint_root", "Failure #93: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #94: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #95: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #96: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #97: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #98: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #99: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #100: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #101: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #102: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #103: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #104: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #105: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #106: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #107: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #108: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #109: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #110: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #111: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #112: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #113: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #114: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #115: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #116: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_no_type_check", "Failure #117: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #118: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #119: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #120: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #121: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #122: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #123: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #124: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #125: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #126: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #127: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #128: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #129: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #130: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #131: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #132: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #133: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #134: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #135: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #136: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #137: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #138: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #139: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #140: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #141: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #142: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #143: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #144: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #145: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #146: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #147: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #148: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #149: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #150: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #151: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #152: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #153: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #154: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #155: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #156: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #157: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #158: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #159: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #160: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #161: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #162: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #163: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #164: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #165: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #166: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #167: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #168: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #169: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #170: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #171: beartype_test/a00_unit/a90_claw/a00_core/test_claw_api.py::test_claw_api", "Failure #172: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #173: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #174: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #175: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #176: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a00_core/test_a00_package.py", "test_api_deprecations" ], [ "beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py", "test_method_cached_arg_by_id" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.0400000000000005, "in_degree": 12, "true_in_degree": 45.28000000000003, "out_degree": 3, "betweenness": 0.000845400156073875, "pagerank": 0.0062334745850124, "harmonic": 0.005756578947368421, "bidirectional_harmonic": 0.23910427109440247, "degree": 15 }, "line_count": 24, "code_line_count": 24, "cyclomatic": 8, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/utilpepget.py", "function_name": "get_hint_pep_typevars", "test_info": { "success": false, "failed": 12, "passed": 1118, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars\nLocation: /tmp/benchmark_np2c3_2j/beartype/_util/kind/map/utilmapset.py:382\nError: TypeError: object of type 'NoneType' has no len()\n\nTraceback:\n\n> def test_get_hint_pep585_generic_typevars(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep585.get_hint_pep585_generic_typevars`\n function.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of type hint metadata describing sample type hints exercising edge\n cases in the :mod:`beartype` codebase.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep585Exception\n from beartype._data.hint.pep.sign.datapepsigns import HintSignTypeVar\n from beartype._util.hint.pep.proposal.pep585 import (\n get_hint_pep585_generic_typevars)\n from beartype._util.hint.pep.utilpepget import get_hint_pep_sign_or_none\n from pytest import raises\n \n # ....................{ ASSERTS }....................\n # For each PEP-compliant test hint...\n for hint_pep_meta in hints_pep_meta:\n # If this hint is a PEP 585-compliant generic...\n if hint_pep_meta.is_pep585_generic:\n # Tuple of all type variables discovered by this getter.\n> hint_typevars = get_hint_pep585_generic_typevars(hint_pep_meta.hint)\n\n> return func(*args)\n\n> update_mapping_keys(hint_typevars_to_none, hint_base_typevars)\n\n> def update_mapping_keys(\n # Mandatory parameters.\n mapping: MutableMapping,\n keys: Collection[Hashable],\n \n # Optional parameters.\n value: object = None,\n ) -> None:\n '''\n Map the passed keys to the same passed value in the passed mapping.\n \n This function is an efficient alternative to the standard idiom for adding\n multiple keys to a mapping when those keys *all* share the same value:\n \n .. code-block:: python\n \n # This function effectively does this -- except *WAY* faster. \"for\" loops\n # are excrutiatingly slow, due to raising \"StopIteration\" exceptions on\n # normal loop termination.\n for key in keys:\n mapping[key] = value\n \n This function is principally useful for efficiently creating and maintaining\n an **insertion-order mimic set** (i.e., a set-like object that preserves\n insertion order despite not actually being a set). While neither the builtin\n :class:`set` nor :class:`frozenset` types preserve insertion order, the\n builtin :class:`dict` type *does*. An insertion-order mimic set can thus be\n trivially constructed as a dictionary whose:\n \n * Keys are the desired ordered-preserving set members.\n * Values are ignorable (e.g., :data:`None`).\n \n Parameters\n ----------\n mapping : MutableMapping\n Mapping to add these key-value pairs to.\n keys : Iterable[Hashable]\n Collection of all keys to be added to this mapping.\n value : object, optional\n Singular value to map *all* of these keys to. Defaults to :data:`None`\n to trivialize insertion-order sets.\n '''\n assert isinstance(mapping, MutableMapping), (\n f'{repr(mapping)} not mutable mapping.')\n \n # Efficiently map *ALL* of these keys to this same value in this mapping.\n # Dismantled, this is:\n # * \"(value,) * len(keys)\", a tuple of the same length as the passed\n # collection of keys whose items are *ALL* the passed value repeated\n # verbatim. Since Python optimizes tuple creation, this operation is\n # highly efficient despite superficially appearing to be insane.\n # * \"zip(...)\", an iterable pairing each of these keys with each of these\n # duplicate values. If this iterable was itself a tuple, its contents\n # would resemble:\n # ((keys[0], value), (keys[1], value), ..., (keys[N], value))\n #\n # Note that this logic also implicitly handles the edge case of the caller\n # passing an empty iterable of keys. Why? Because the zip() builtin\n # dynamically generates an iterable whose length is the minimum of the\n # lengths of the passed iterables. If one of the passed iterables is empty,\n # the iterable that zip() generates will also be empty. Hallelujah, Python!\n> mapping.update(zip(keys, (value,) * len(keys)))\nE TypeError: object of type 'NoneType' has no len()\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars\nLocation: /tmp/benchmark_np2c3_2j/beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py:100\nError: assert False\n + where False = isinstance(None, tuple)\n\nTraceback:\n\n> def test_get_hint_pep_typevars(hints_pep_meta) -> None:\n '''\n Test the :func:`beartype._util.hint.pep.utilpepget.get_hint_pep_typevars`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._data.hint.pep.sign.datapepsigns import HintSignTypeVar\n from beartype._util.hint.pep.utilpepget import (\n get_hint_pep_typevars,\n get_hint_pep_sign_or_none,\n )\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n \n # ....................{ ASSERTS }....................\n # For each PEP-compliant test hint...\n for hint_pep_meta in hints_pep_meta:\n # Tuple of all type variables discovered by this getter.\n hint_typevars = get_hint_pep_typevars(hint_pep_meta.hint)\n> assert isinstance(hint_typevars, tuple)\nE assert False\nE + where False = isinstance(None, tuple)\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #4: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #5: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redpep484typevar.py::test_reduce_hint_pep484_subscripted_typevar_to_hint", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #12: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py", "test_get_hint_pep585_generic_typevars" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py", "test_get_hint_pep_typevars" ] ] }, "complexity_info": { "centrality": { "distance_discount": 10.141184000000003, "in_degree": 4, "true_in_degree": 9.120000000000001, "out_degree": 2, "betweenness": 0.00027096158848521635, "pagerank": 0.0007163567728138266, "harmonic": 0.012911184210526316, "bidirectional_harmonic": 0.20204880097972253, "degree": 6 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 3, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncframe.py", "function_name": "get_frame_caller_module_name_or_none", "test_info": { "success": false, "failed": 12, "passed": 1118, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563\nLocation: /tmp/benchmark_qzze6tqi/beartype/_check/forward/fwdmain.py:855\nError: beartype.roar.BeartypePep563Exception: Stringified type hint 'OfPearl' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_qzze6tqi/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \n File \"/tmp/benchmark_qzze6tqi/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\n raise AttributeError(f'{exception_message}not found')\nAttributeError: Forward reference scope \"beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve\" attribute \"OfPearl\" not found\n\nTraceback:\n\n> def test_resolve_pep563() -> None:\n '''\n Test the :func:`beartype.peps.resolve_pep563` resolver.\n '''\n \n # .....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.peps import resolve_pep563\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n BeartypePep563Exception,\n )\n from beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve import (\n ToAvariceOrPride,\n FrequentWith,\n their_starry_domes,\n )\n from pytest import raises\n \n # .....................{ LOCALS }....................\n # Arbitrary instance of the generic accepted by the function called below.\n numberless_and_immeasurable_halls = ToAvariceOrPride()\n \n # Arbitrary instance of the class defining various problematic methods\n # called below.\n and_thrones_radiant_with_chrysolite = FrequentWith()\n \n # .....................{ PASS }....................\n # Assert that this function unsuccessfully raises the expected exception\n # *BEFORE* resolving all PEP 563-postponed type hints annotating these\n # callables.\n with raises(BeartypeDecorHintForwardRefException):\n their_starry_domes(numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.until_the_doves(\n numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.crystal_column(\n 'Nor had that scene of ampler majesty')\n \n # Resolve all PEP 563-postponed type hints annotating these callables.\n resolve_pep563(their_starry_domes)\n resolve_pep563(FrequentWith.until_the_doves)\n> resolve_pep563(FrequentWith.crystal_column)\n\n> arg_name_to_hint[arg_name] = resolve_hint(\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypePep563Exception: Stringified type hint 'OfPearl' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_qzze6tqi/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE File \"/tmp/benchmark_qzze6tqi/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\nE raise AttributeError(f'{exception_message}not found')\nE AttributeError: Forward reference scope \"beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve\" attribute \"OfPearl\" not found\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487\nLocation: /tmp/benchmark_qzze6tqi/beartype/_check/forward/fwdmain.py:855\nError: beartype.roar.BeartypeDecorHintForwardRefException: Method a00_type.test_decortype_descriptor.test_decor_type_descriptor_custom_pep487.AndAllThoseActs.doth_ease_its() return stringified type hint 'Optional[HeartOfLove]' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_qzze6tqi/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \n File \"/tmp/benchmark_qzze6tqi/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\n raise AttributeError(f'{exception_message}not found')\nAttributeError: Forward reference scope \"a00_type.test_decortype_descriptor\" attribute \"HeartOfLove\" not found\n\nTraceback:\n\n> def test_decor_type_descriptor_custom_pep487() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on :pep:`487`-compliant\n **custom pure-Python method descriptors** (i.e., methods decorated by\n pure-Python types satisfying the :pep:`487`-compliant descriptor protocol by\n declaring at least the ``__set_name__()`` dunder method).\n \n This unit test exercises an inscrutable `edge case`_ induced by\n :func:`beartype.beartype`-decorated classes defining at least two kinds of\n seemingly unrelated methods that nonetheless *could* interact harmfully:\n \n * A method decorated by a :pep:`487`-compliant custom pure-Python method\n descriptor declaring at least the ``__set_name__()`` dunder method.\n * A method annotated by a stringified forward reference to a currently\n undefined type, which :func:`beartype.beartype` then internally coerces\n into a **forward reference proxy** (i.e.,\n :class:`beartype._check.forward.reference.fwdrefabc.BeartypeForwardRefABC`\n subclass) encapsulating that undefined type.\n \n For obscure reasons that are difficult to fully explain within the expected\n lifetime of the Universe, this interaction causes the ``__set_name__()``\n dunder method of the descriptor decorating the first method to be\n erroneously called multiple times with erroneous owners. Although seemingly\n innocuous, this issue is indicative of an explosive increase in the space\n and time complexity associated with forward reference proxies. Ergo, this\n issue is actually quite serious. It is imperative this *never* happen again.\n \n .. _edge case:\n https://github.com/beartype/beartype/issues/488#issuecomment-2650865299\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.typing import Optional\n from collections.abc import Callable\n \n # ....................{ DESCRIPTORS }....................\n class setname_descriptor(object):\n '''\n **Setname method descriptor** (i.e., pure-Python object whose\n :pep:`487`-compliant :meth:`__set_name__` dunder method raises an\n exception when called more than once as a regression check against this\n issue silently reverting).\n \n Attributes\n ----------\n _is_set_name_called : bool\n :data:`True` only if Python has already called the\n :pep:`487`-compliant :meth:`__set_name__` dunder method.\n '''\n \n def __init__(self, func: Callable) -> None:\n '''\n Initialize this method descriptor by doing... absolutely nothing.\n '''\n \n # Record that Python has yet to call __set_name__().\n self._is_set_name_called = False\n \n \n def __call__(self) -> None:\n '''\n Call this method descriptor by doing... absolutely nothing.\n '''\n \n # Doing nothing never felt so good, so right, so... clean.\n pass\n \n \n def __set_name__(self, owner: type, name: str) -> None:\n '''\n :pep:`487`-compliant callback called by Python itself with metadata\n describing the current decoration of an external method by this\n descriptor.\n \n Parameters\n ----------\n owner : type\n Parent class declaring that external method.\n name : str\n Unqualified basename of that external method.\n '''\n \n # If Python has already called this dunder method, this issue has\n # reverted. In this case, raise an exception.\n if self._is_set_name_called:\n raise ValueError(\n 'PEP 487 setname_descriptor.__set_name__() dunder method '\n 'already called.'\n )\n # Else, this is Python's first call of this dunder method.\n \n # Record that Python has already called this dunder method.\n self._is_set_name_called = True\n \n # ....................{ CLASSES }....................\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_type(obj, **kwargs) # type: ignore[return-value]\n\n> attr_value_beartyped = beartype_object( # type: ignore[type-var]\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> hint_or_sane = sanify_hint_root_func(\n\n> hint = decor_meta.func_arg_name_to_hint[pith_name] = coerce_func_hint_root(\n\n> hint = resolve_hint( # pyright: ignore\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypeDecorHintForwardRefException: Method a00_type.test_decortype_descriptor.test_decor_type_descriptor_custom_pep487.AndAllThoseActs.doth_ease_its() return stringified type hint 'Optional[HeartOfLove]' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_qzze6tqi/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE File \"/tmp/benchmark_qzze6tqi/beartype/_check/forward/fwdscope.py\", line 353, in __missing__\nE raise AttributeError(f'{exception_message}not found')\nE AttributeError: Forward reference scope \"a00_type.test_decortype_descriptor\" attribute \"HeartOfLove\" not found\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #8: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #10: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #11: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #12: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py", "test_resolve_pep563" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py", "test_decor_type_descriptor_custom_pep487" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.6, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 2, "betweenness": 1.0838463539408653e-05, "pagerank": 0.0005524938423645321, "harmonic": 0.003289473684210526, "bidirectional_harmonic": 0.16086000987316815, "degree": 4 }, "line_count": 13, "code_line_count": 13, "cyclomatic": 2, "halstead_volume": 15.509775004326936, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncwrap.py", "function_name": "unwrap_func_all_isomorphic", "test_info": { "success": false, "failed": 171, "passed": 922, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a00_core/test_a00_package.py::test_api_deprecations\nLocation: /tmp/benchmark_6u8sefak/beartype_test/a00_unit/a00_core/test_a00_package.py:78\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_api_deprecations() -> None:\n '''\n Test all deprecated attributes importable from the public APIs of all\n subpackages of the :mod:`beartype` package (including itself).\n '''\n \n # Defer test-specific imports.\n from beartype._util.module.utilmodimport import import_module_attr\n from pytest import warns\n \n # Tuple of the fully-qualified names of all deprecated attributes.\n DEPRECATED_ATTRIBUTES = (\n 'beartype.abby',\n 'beartype.cave.HintPep585Type',\n 'beartype.roar.BeartypeAbbyException',\n 'beartype.roar.BeartypeAbbyHintViolation',\n 'beartype.roar.BeartypeAbbyTesterException',\n 'beartype.roar.BeartypeCallHintPepException',\n 'beartype.roar.BeartypeCallHintPepParamException',\n 'beartype.roar.BeartypeCallHintPepReturnException',\n 'beartype.roar.BeartypeDecorHintNonPepException',\n 'beartype.roar.BeartypeDecorHintNonPepNumPyException',\n 'beartype.roar.BeartypeDecorHintPep563Exception',\n 'beartype.roar.BeartypeDecorHintPepDeprecatedWarning',\n 'beartype.roar.BeartypeDecorPepException',\n )\n \n # For each deprecated attribute declared by beartype...\n for deprecated_attribute in DEPRECATED_ATTRIBUTES:\n # Assert that importing this attribute both emits the expected warning\n # and returns a non-\"None\" value.\n> with warns(DeprecationWarning):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py::test_method_cached_arg_by_id\nLocation: /tmp/benchmark_6u8sefak/beartype/_util/func/utilfunctest.py:117\nError: beartype.roar._BeartypeUtilCallableException: None not callable.\n\nTraceback:\n\n> def test_method_cached_arg_by_id() -> None:\n '''\n Test the\n :func:`beartype._util.cache.utilcachecall.method_cached_arg_by_id`\n decorator.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableCachedException\n from beartype._util.cache.utilcachecall import method_cached_arg_by_id\n from pytest import raises\n \n # ..................{ CLASSES }..................\n> class LikeDust(object):\n\n> @method_cached_arg_by_id\n\n> if is_func_arg_variadic(func_wrappee):\n\n> func_args_lens = get_func_args_lens(*args, **kwargs)\n\n> func_codeobj = get_func_codeobj(\n\n> die_unless_func_python(\n\n> def die_unless_func_python(\n # Mandatory parameters.\n func: Codeobjable,\n \n # Optional parameters.\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> None:\n '''\n Raise an exception if the passed callable is **C-based** (i.e., implemented\n in C as either a builtin bundled with the active Python interpreter *or*\n third-party C extension function).\n \n Equivalently, this validator raises an exception unless the passed function\n is **pure-Python** (i.e., implemented in Python as either a function or\n method).\n \n Parameters\n ----------\n func : Codeobjable\n Callable to be inspected.\n exception_cls : TypeException, optional\n Type of exception to be raised. Defaults to\n :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to the empty string.\n \n Raises\n ------\n exception_cls\n If the passed callable is C-based.\n \n See Also\n --------\n :func:`.is_func_codeobjable`\n Further details.\n '''\n \n # If that callable is *NOT* pure-Python, raise an exception.\n if not is_func_codeobjable(func):\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not class.')\n assert issubclass(exception_cls, Exception), (\n f'{repr(exception_cls)} not exception subclass.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # If that callable is uncallable, raise an appropriate exception.\n if not callable(func):\n> raise exception_cls(f'{exception_prefix}{repr(func)} not callable.')\nE beartype.roar._BeartypeUtilCallableException: None not callable.\n", "Failure #3: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped", "Failure #4: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py::test_iter_func_args", "Failure #5: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py::test_get_func_args_len_flexible", "Failure #6: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_variadic", "Failure #7: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_positional", "Failure #8: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py::test_is_func_arg_name_is_func_arg_name_variadic_keyword", "Failure #9: beartype_test/a00_unit/a20_util/func/test_utilfunccode.py::test_get_func_code_or_none", "Failure #10: beartype_test/a00_unit/a20_util/func/test_utilfunctest.py::test_is_func_wrapper_isomorphic", "Failure #11: beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py::test_unwrap_func_all_isomorphic", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype", "Failure #24: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #25: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #26: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #27: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #28: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #29: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #30: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #31: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #32: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #33: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #34: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #35: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #36: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #37: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #38: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #39: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #40: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #41: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #42: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_callable", "Failure #43: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new", "Failure #44: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #45: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr", "Failure #46: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #47: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #48: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_contains", "Failure #49: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_iter", "Failure #50: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_getitem", "Failure #51: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_bool", "Failure #52: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_len", "Failure #53: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #54: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #55: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #56: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #57: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #58: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_recursion", "Failure #59: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_numpy", "Failure #60: beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py::test_api_vale_validator_pass", "Failure #61: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #62: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_fail", "Failure #63: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #64: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass", "Failure #65: beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py::test_api_vale_isattr_pass", "Failure #66: beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py::test_api_vale_isequal_pass", "Failure #67: beartype_test/a00_unit/a60_check/a00_metadata/test_metacheck.py::test_metadata_check", "Failure #68: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #69: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #70: beartype_test/a00_unit/a60_check/a40_convert/test_convcoerce.py::test_coerce_func_hint_root", "Failure #71: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #72: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #73: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #74: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #75: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #76: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #77: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #78: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #79: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #80: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #81: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #83: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #84: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #85: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #86: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #89: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #90: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #91: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #92: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #93: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #94: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #95: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #96: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #97: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #98: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #99: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #100: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #101: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #102: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #103: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #104: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #105: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #106: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #107: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #108: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #109: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep435", "Failure #110: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep435663.py::test_decor_pep663", "Failure #111: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #112: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #113: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #114: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #115: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #116: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #117: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #118: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #119: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #120: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #121: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #122: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #123: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #124: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #125: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #126: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #127: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #128: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #129: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #130: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #131: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #132: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #133: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #134: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #135: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #136: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #137: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #138: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #139: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #140: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #141: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #142: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #143: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #144: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #145: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #146: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #147: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #148: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #149: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #150: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #151: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #152: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #153: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_type", "Failure #154: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #155: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_sync", "Failure #156: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #157: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_unhinted_async", "Failure #158: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #159: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #160: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_order", "Failure #161: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #162: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #163: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #164: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #165: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #166: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #167: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #168: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #169: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #170: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #171: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a00_core/test_a00_package.py", "test_api_deprecations" ], [ "beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py", "test_method_cached_arg_by_id" ] ] }, "complexity_info": { "centrality": { "distance_discount": 9.153280000000004, "in_degree": 5, "true_in_degree": 23.560000000000013, "out_degree": 3, "betweenness": 0.0007216610306656262, "pagerank": 0.001822703391881523, "harmonic": 0.013075657894736841, "bidirectional_harmonic": 0.24401635006075773, "degree": 8 }, "line_count": 21, "code_line_count": 21, "cyclomatic": 5, "halstead_volume": 11.60964047443681, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/error/errget.py", "function_name": "get_hint_object_violation", "test_info": { "success": false, "failed": 52, "passed": 1078, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: <@beartype(__beartype_checker_331) at 0x183e7ed0>:21\nError: TypeError: exceptions must derive from BaseException\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> > ???\nE TypeError: exceptions must derive from BaseException\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: <@beartype(__beartype_checker_331) at 0x183e7ed0>:21\nError: TypeError: exceptions must derive from BaseException\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> > ???\nE TypeError: exceptions must derive from BaseException\n", "Failure #3: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_hint_object_violation", "Failure #8: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #43: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #44: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #45: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #46: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #47: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #48: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #49: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #50: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #51: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #52: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 47.415678976000024, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 11, "betweenness": 4.064423827278245e-05, "pagerank": 0.0004556650246305419, "harmonic": 0.06016538742690057, "bidirectional_harmonic": 0.2673494816586921, "degree": 12 }, "line_count": 117, "code_line_count": 117, "cyclomatic": 9, "halstead_volume": 74.00879436282185, "halstead_difficulty": 2.888888888888889 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/func/utilfuncmake.py", "function_name": "make_func", "test_info": { "success": false, "failed": 88, "passed": 1042, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_xmcm_u9v/beartype/_util/api/utilbeartype.py:116\nError: AttributeError: 'NoneType' object has no attribute '__beartype_wrapper'\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> set_func_beartyped(func_wrapper)\n\n> def set_func_beartyped(func: Callable) -> None:\n '''\n Declare the passed callable to be a **beartype-generated wrapper function**\n (i.e., function dynamically generated by the :func:`beartype.beartype`\n decorator for a user-defined callable decorated by that decorator, wrapping\n that callable with constant-time type-checking).\n \n Parameters\n ----------\n func : Callable\n Callable to be modified.\n '''\n \n # Declare this callable to be generated by @beartype, which tests for the\n # existence of this attribute above to avoid re-decorating callables\n # already decorated by @beartype by efficiently reducing to a noop.\n> func.__beartype_wrapper = True # type: ignore[attr-defined]\nE AttributeError: 'NoneType' object has no attribute '__beartype_wrapper'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py::test_get_func_filename_or_none\nLocation: /tmp/benchmark_xmcm_u9v/beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py:93\nError: AttributeError: 'NoneType' object has no attribute '__code__'. Did you mean: '__bool__'?\n\nTraceback:\n\n> def test_get_func_filename_or_none() -> None:\n '''\n Test the\n :func:`beartype._util.func.utilfuncfile.get_func_filename_or_none` getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.func.utilfuncfile import get_func_filename_or_none\n from beartype._util.func.utilfuncmake import make_func\n \n # ....................{ CALLABLES }....................\n # Arbitrary pure-Python callable declared on-disk.\n def and_this_the_naked_countenance_of_earth():\n return 'On which I gaze, even these primeval mountains'\n \n # Arbitrary pure-Python callable declared in-memory cached by the standard\n # \"linecache\" module.\n like_snakes_that_watch_their_prey = make_func(\n func_name='like_snakes_that_watch_their_prey',\n func_code=(\n \"\"\"\n like_snakes_that_watch_their_prey = lambda: (\n 'from their far fountains,')\n \"\"\"),\n is_debug=True,\n )\n \n # Arbitrary pure-Python callable declared in-memory *WITHOUT* being cached\n # by the standard \"linecache\" module.\n teach_the_adverting_mind = eval('lambda: \"The glaciers creep\"')\n \n # ....................{ ASSERTS }....................\n # Assert this getter returns \"None\" when passed a C-based callable.\n assert get_func_filename_or_none(iter) is None\n \n # Assert this getter returns the absolute filename of this submodule when\n # passed an on-disk pure-Python callable defined by this submodule.\n assert get_func_filename_or_none(\n and_this_the_naked_countenance_of_earth) == __file__\n \n # Assert this getter returns the placeholder filename associated with the\n # code object of a pure-Python callable defined in-memory cached by the\n # standard \"linecache\" module.\n assert get_func_filename_or_none(\n like_snakes_that_watch_their_prey) == (\n> like_snakes_that_watch_their_prey.__code__.co_filename)\nE AttributeError: 'NoneType' object has no attribute '__code__'. Did you mean: '__bool__'?\n", "Failure #3: beartype_test/a00_unit/a20_util/func/test_utilfuncmake.py::test_make_func", "Failure #4: beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py::test_get_func_locals", "Failure #5: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #78: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #79: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #80: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #81: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #82: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #83: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #84: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #85: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #86: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #87: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #88: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py", "test_get_func_filename_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.496000000000002, "in_degree": 2, "true_in_degree": 11.120000000000001, "out_degree": 3, "betweenness": 0.00022083369461545132, "pagerank": 0.0005442011937222152, "harmonic": 0.009868421052631578, "bidirectional_harmonic": 0.22457908502316445, "degree": 5 }, "line_count": 96, "code_line_count": 96, "cyclomatic": 32, "halstead_volume": 219.61587113893805, "halstead_difficulty": 6.6 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/checkmake.py", "function_name": "_make_code_raiser_violation", "test_info": { "success": false, "failed": 80, "passed": 1050, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_b5b5bqgb/beartype/_util/func/utilfuncmake.py:286\nError: beartype.roar.BeartypeDecorWrapperException: @beartyped where_that_or() wrapper unparseable, as @beartype generated invalid code raising:\n\tbuiltins.IndentationError: unexpected indent (<@beartype(beartype_test.a00_unit.a20_util.api.test_utilapibeartype.test_is_func_beartyped.where_that_or) at 0x759e3c68ca40>, line 23)\n\n(line 0001) def where_that_or(\n(line 0002) *args,\n(line 0003) __beartype_get_violation=__beartype_get_violation,\n(line 0004) __beartype_check_meta=__beartype_check_meta,\n(line 0005) __beartype_func=__beartype_func,\n(line 0006) **kwargs\n(line 0007) ):\n(line 0008) # Call this function with all passed parameters and localize the value\n(line 0009) # returned from this call.\n(line 0010) __beartype_pith_0 = __beartype_func(*args, **kwargs)\n(line 0011) \n(line 0012) # Noop required to artificially increase indentation level. Note that\n(line 0013) # CPython implicitly optimizes this conditional away. Isn't that nice?\n(line 0014) if True:\n(line 0015) # Type-check this parameter or return against this type hint.\n(line 0016) if not isinstance(__beartype_pith_0, str):\n(line 0017) __beartype_violation = __beartype_get_violation(\n(line 0018) check_meta=__beartype_check_meta,\n(line 0019) pith_name='return',\n(line 0020) pith_value=__beartype_pith_0,\n(line 0021) )\n(line 0022) None\n(line 0023) return __beartype_pith_0\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper = make_func(\n\n> def make_func(\n # Mandatory arguments.\n func_name: str,\n func_code: str,\n \n # Optional arguments.\n func_globals: Optional[LexicalScope] = None,\n func_locals: Optional[LexicalScope] = None,\n func_doc: Optional[str] = None,\n func_label: Optional[str] = None,\n func_labeller: Optional[Callable[[], str]] = None,\n func_wrapped: Optional[Callable] = None,\n is_debug: bool = False,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n ) -> Callable:\n '''\n Dynamically create and return a new function with the passed name declared\n by the passed code snippet and internally accessing the passed dictionaries\n of globally and locally scoped variables.\n \n Parameters\n ----------\n func_name : str\n Name of the function to be created.\n func_code : str\n Code snippet defining this function, including both this function's\n signature prefixed by zero or more decorations *and* body. **This\n snippet must be unindented.** If this snippet is indented, this factory\n raises a syntax error.\n func_globals : dict[str, Any] | None\n Dictionary mapping from the name to value of each **globally scoped\n attribute** (i.e., internally referenced in the body of the function\n declared by this code snippet). Defaults to the empty dictionary.\n func_locals : dict[str, Any] | None\n Dictionary mapping from the name to value of each **locally scoped\n attribute** (i.e., internally referenced either in the signature of\n the function declared by this code snippet *or* as decorators\n decorating that function). **Note that this factory necessarily\n modifies the contents of this dictionary.** Defaults to the empty\n dictionary.\n func_doc : str | None\n Human-readable docstring documenting this function. Defaults to\n :data:`None`, in which case this function remains undocumented.\n func_label : str | None\n Human-readable label describing this function for error-handling\n purposes. Note that this parameter is mutually exclusive with the\n competing ``func_labeller`` parameter; if both are non-:data:`None`, an\n exception is raised. Defaults to :data:`None`, in which case this label\n effectively defaults to ``\"{func_name}()\"``.\n func_labeller : Callable[[], str] | None\n Callback accepting *no* parameters and returning a human-readable label\n describing this function for error-handling purposes, intended for use\n cases in which simply passing this label as the ``func_label`` parameter\n is prohibitively expensive (e.g., due to the cost of string munging).\n Note that this parameter is mutually exclusive with the competing\n ``func_label`` parameter; if both are non-:data:`None`, an exception is\n raised. Defaults to :data:`None`, in which case this label effectively\n defaults to ``\"{func_name}()\"``.\n func_wrapped : Callable | None\n Callable wrapped by the function to be created. If non-:data:`None`,\n special dunder attributes will be propagated (i.e., copied) from this\n wrapped callable into this created function; these include:\n \n * ``__name__``, this function's unqualified name.\n * ``__doc__``, this function's docstring.\n * ``__module__``, the fully-qualified name of this function's module.\n \n Defaults to :data:`None`.\n is_debug : bool, optional\n :data:`True` only if this function is being debugged. If :data:`True`,\n then the definition (including signature and body) of this function is:\n \n * Printed to standard output.\n * Cached with the standard :mod:`linecache` module under a fake\n filename uniquely synthesized by this factory for this function.\n External callers may then subsequently access the definition of this\n function from that module as:\n \n .. code-block:: python\n \n from linecache import cache as linecache_cache\n func_source = linecache_cache[func.__code__.co_filename]\n \n Defaults to :data:`False`.\n exception_cls : Type[Exception], optional\n Type of exception to raise in the event of a fatal error. Defaults to\n :exc:`._BeartypeUtilCallableException`.\n \n Returns\n -------\n Callable\n Function with this name declared by this snippet.\n \n Raises\n ------\n exception_cls\n If either:\n \n * ``func_locals`` contains a key whose value is that of ``func_name``,\n implying the caller already declared a local attribute whose name\n collides with that of this function.\n * ``func_label`` and ``func_labeller`` are both non-:data:`None`.\n * This code snippet is syntactically invalid.\n * This code snippet is syntactically valid but fails to declare a\n function with this name.\n '''\n \n # ..................{ VALIDATION ~ pre }..................\n assert isinstance(func_name, str), f'{repr(func_name)} not string.'\n assert isinstance(func_code, str), f'{repr(func_code)} not string.'\n assert isinstance(is_debug, bool), f'{repr(is_debug)} not bool.'\n assert func_name, 'Parameter \"func_name\" empty.'\n assert func_code, 'Parameter \"func_code\" empty.'\n assert func_label is None or func_labeller is None, (\n f'Parameters \"func_label\" and \"func_labeller\" both non-\"None\".')\n \n # Default all unpassed parameters.\n if func_globals is None:\n func_globals = {}\n if func_locals is None:\n func_locals = {}\n assert isinstance(func_globals, dict), (\n f'{repr(func_globals)} not dictionary.')\n assert isinstance(func_locals, dict), (\n f'{repr(func_locals)} not dictionary.')\n \n # If \"func_labeller\" is unpassed...\n if func_labeller is None:\n # If both \"func_label\" *AND* \"func_labeller\" are unpassed, default\n # \"func_label\" to a sensible label.\n if func_label is None:\n func_label = f'{func_name}()'\n # Else, only \"func_labeller\" is unpassed.\n #\n # In either case, \"func_label\" should now be a valid label.\n \n assert isinstance(func_label, str), f'{repr(func_label)} not string.'\n # Else, \"func_labeller\" is passed. In this case...\n else:\n assert callable(func_labeller), f'{repr(func_labeller)} uncallable.'\n \n # If that function's name is already in this local scope, the caller\n # already declared a local attribute whose name collides with that\n # function's. In this case, raise an exception for safety.\n if func_name in func_locals:\n raise exception_cls(\n f'{func_label or func_labeller()} ' # type: ignore[misc]\n f'already defined by caller locals:\\n'\n f'{repr(func_locals)}'\n )\n # Else, that function's name is *NOT* already in this local scope.\n \n # ..................{ STARTUP ~ filename }..................\n # Note that this logic is intentionally performed *BEFORE* munging the\n # \"func_code\" string in-place below, as this logic depends upon the unique\n # ID of that string. Reassignment obliterates that uniqueness.\n \n # Arbitrary object uniquely associated with this function.\n func_filename_object: object = None\n \n # Possibly fully-qualified name of an arbitrary object uniquely associated\n # with this function.\n func_filename_name: str = None # type: ignore[assignment]\n \n # If this function is a high-level wrapper wrapping a lower-level\n # wrappee, uniquify the subsequent filename against this wrappee. This\n # wrappee's fully-qualified name guarantees the uniqueness of this\n # filename. Ergo, this is the ideal case.\n if func_wrapped:\n func_filename_name = get_object_name(func_wrapped)\n func_filename_object = func_wrapped\n # Else, this function is *NOT* such a wrapper. In this less ideal case,\n # fallback to a poor man's uniquification against the unqualified name and\n # code string underlying this function.\n else:\n func_filename_name = func_name\n func_filename_object = func_code\n \n # Fake in-memory filename hopefully unique to this function.\n # Optimistically, a fully-qualified object name and ID *SHOULD* be unique\n # for the lifetime of the active Python process.\n #\n # Specifically, this filename guarantees the uniqueness of the 3-tuple\n # ``({func_filename}, {func_file_line_number}, {func_name})`` commonly\n # leveraged by profilers (e.g., \"cProfile\") to identify arbitrary callables,\n # where:\n # * `{func_filename}` is this filename (e.g.,\n # `\"\"`).\n # * `{func_file_line_number}`, is *ALWAYS* 0 and thus *NEVER* unique.\n # * `{func_name}`, is identical to that of the decorated callable and also\n # thus *NEVER* unique.\n #\n # Ergo, uniquifying this filename is the *ONLY* means of uniquifying\n # metadata identifying this wrapper function via runtime inspection. Failure\n # to do so reduces tracebacks induced by exceptions raised by this wrapper\n # to non-human-readability, which is less than ideal: e.g.,\n #\n # Traceback (most recent call last):\n # File \"/home/leycec/py/betsee/betsee/gui/simconf/stack/widget/mixin/guisimconfwdgeditscalar.py\", line 313, in _set_alias_to_widget_value_if_sim_conf_open\n # widget=self, value_old=self._widget_value_last)\n # File \"\", line 25, in func_beartyped\n # File \"/home/leycec/py/betsee/betsee/gui/simconf/stack/widget/mixin/guisimconfwdgeditscalar.py\", line 409, in __init__\n # *args, widget=widget, synopsis=widget.undo_synopsis, **kwargs)\n # File \"\", line 13, in func_beartyped\n #\n # See the final traceback line, which is effectively useless.\n func_filename = (\n f'<@beartype({func_filename_name}) at {id(func_filename_object):#x}>')\n \n # ..................{ STARTUP ~ code }..................\n # Code snippet defining this function, stripped of all leading and trailing\n # whitespace to improve both readability and disambiguity. Since this\n # whitespace is safely ignorable, the original snippet is safely\n # replaceable by this stripped snippet.\n func_code = func_code.strip()\n \n # If debugging this function, print the definition of this function.\n if is_debug:\n print(f'{number_str_lines(func_code)}')\n # else:\n # print('!!!!!!!!!PRINTING NOTHING!!!!!!!!!!!')\n # Else, leave that definition obscured by the voracious bitbuckets of time.\n \n # ..................{ CREATION }..................\n # Attempt to...\n try:\n # Call the more verbose and obfuscatory compile() builtin instead of\n # simply calling \"exec(func_code, func_globals, func_locals)\". Why?\n # Because the exec() builtin does *NOT* provide a means to set this\n # function's \"__code__.co_filename\" read-only attribute.\n #\n # Note that we could pass \"single\" instead of \"exec\" here if we were\n # willing to constrain the passed \"func_code\" to a single statement. In\n # casual testing, there is very little performance difference between\n # the two (with an imperceptibly slight edge going to \"single\").\n func_code_compiled = compile(func_code, func_filename, 'exec')\n assert func_name not in func_locals\n \n # Define that function. For obscure and likely uninteresting reasons,\n # Python fails to capture that function (i.e., expose that function to\n # this factory) when the locals() dictionary is passed; instead, a\n # unique local dictionary *MUST* be passed.\n exec(func_code_compiled, func_globals, func_locals)\n # If doing so fails for *ANY* reason whatsoever, wrap that low-level\n # exception with a higher-level exception exhibiting the exact issue. Doing\n # so enables users to submit meaningful issues to our tracker.\n except Exception as exception:\n # Raise an exception suffixed by that function's declaration such that\n # each line of that declaration is prefixed by that line's number. This\n # renders \"SyntaxError\" exceptions referencing arbitrary line numbers\n # human-readable: e.g.,\n # File \"\", line 56\n # if not (\n # ^\n # SyntaxError: invalid syntax\n> raise exception_cls(\n f'{func_label or func_labeller()} ' # type: ignore[misc]\n f'unparseable, as @beartype generated invalid code raising:\\n'\n f'\\t{label_exception(exception)}\\n\\n'\n f'{number_str_lines(func_code)}'\n ) from exception\nE beartype.roar.BeartypeDecorWrapperException: @beartyped where_that_or() wrapper unparseable, as @beartype generated invalid code raising:\nE \tbuiltins.IndentationError: unexpected indent (<@beartype(beartype_test.a00_unit.a20_util.api.test_utilapibeartype.test_is_func_beartyped.where_that_or) at 0x759e3c68ca40>, line 23)\nE \nE (line 0001) def where_that_or(\nE (line 0002) *args,\nE (line 0003) __beartype_get_violation=__beartype_get_violation,\nE (line 0004) __beartype_check_meta=__beartype_check_meta,\nE (line 0005) __beartype_func=__beartype_func,\nE (line 0006) **kwargs\nE (line 0007) ):\nE (line 0008) # Call this function with all passed parameters and localize the value\nE (line 0009) # returned from this call.\nE (line 0010) __beartype_pith_0 = __beartype_func(*args, **kwargs)\nE (line 0011) \nE (line 0012) # Noop required to artificially increase indentation level. Note that\nE (line 0013) # CPython implicitly optimizes this conditional away. Isn't that nice?\nE (line 0014) if True:\nE (line 0015) # Type-check this parameter or return against this type hint.\nE (line 0016) if not isinstance(__beartype_pith_0, str):\nE (line 0017) __beartype_violation = __beartype_get_violation(\nE (line 0018) check_meta=__beartype_check_meta,\nE (line 0019) pith_name='return',\nE (line 0020) pith_value=__beartype_pith_0,\nE (line 0021) )\nE (line 0022) None\nE (line 0023) return __beartype_pith_0\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark_b5b5bqgb/beartype/_util/func/utilfuncmake.py:286\nError: beartype.roar.BeartypeDecorWrapperException: @beartyped _is_exclamatory() wrapper unparseable, as @beartype generated invalid code raising:\n\tbuiltins.IndentationError: unexpected indent (<@beartype(beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory) at 0x759e3c2e6d40>, line 29)\n\n(line 0001) def _is_exclamatory(\n(line 0002) *args,\n(line 0003) __beartype_get_violation=__beartype_get_violation,\n(line 0004) __beartype_check_meta=__beartype_check_meta,\n(line 0005) __beartype_func=__beartype_func,\n(line 0006) **kwargs\n(line 0007) ):\n(line 0008) # Localize the number of passed positional arguments for efficiency.\n(line 0009) __beartype_args_len = len(args)\n(line 0010) # Localize this positional or keyword parameter if passed *OR* to the\n(line 0011) # sentinel \"__beartype_raise_exception\" guaranteed to never be passed.\n(line 0012) __beartype_pith_0 = (\n(line 0013) args[0] if __beartype_args_len > 0 else\n(line 0014) kwargs.get('text', __beartype_get_violation)\n(line 0015) )\n(line 0016) \n(line 0017) # If this parameter was passed...\n(line 0018) if __beartype_pith_0 is not __beartype_get_violation:\n(line 0019) # Type-check this parameter or return against this type hint.\n(line 0020) if not isinstance(__beartype_pith_0, str):\n(line 0021) __beartype_violation = __beartype_get_violation(\n(line 0022) check_meta=__beartype_check_meta,\n(line 0023) pith_name='text',\n(line 0024) pith_value=__beartype_pith_0,\n(line 0025) )\n(line 0026) None\n(line 0027) # Call this function with all passed parameters and return the value\n(line 0028) # returned from this call as is (without being type-checked).\n(line 0029) return __beartype_func(*args, **kwargs)\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper = make_func(\n\n> def make_func(\n # Mandatory arguments.\n func_name: str,\n func_code: str,\n \n # Optional arguments.\n func_globals: Optional[LexicalScope] = None,\n func_locals: Optional[LexicalScope] = None,\n func_doc: Optional[str] = None,\n func_label: Optional[str] = None,\n func_labeller: Optional[Callable[[], str]] = None,\n func_wrapped: Optional[Callable] = None,\n is_debug: bool = False,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n ) -> Callable:\n '''\n Dynamically create and return a new function with the passed name declared\n by the passed code snippet and internally accessing the passed dictionaries\n of globally and locally scoped variables.\n \n Parameters\n ----------\n func_name : str\n Name of the function to be created.\n func_code : str\n Code snippet defining this function, including both this function's\n signature prefixed by zero or more decorations *and* body. **This\n snippet must be unindented.** If this snippet is indented, this factory\n raises a syntax error.\n func_globals : dict[str, Any] | None\n Dictionary mapping from the name to value of each **globally scoped\n attribute** (i.e., internally referenced in the body of the function\n declared by this code snippet). Defaults to the empty dictionary.\n func_locals : dict[str, Any] | None\n Dictionary mapping from the name to value of each **locally scoped\n attribute** (i.e., internally referenced either in the signature of\n the function declared by this code snippet *or* as decorators\n decorating that function). **Note that this factory necessarily\n modifies the contents of this dictionary.** Defaults to the empty\n dictionary.\n func_doc : str | None\n Human-readable docstring documenting this function. Defaults to\n :data:`None`, in which case this function remains undocumented.\n func_label : str | None\n Human-readable label describing this function for error-handling\n purposes. Note that this parameter is mutually exclusive with the\n competing ``func_labeller`` parameter; if both are non-:data:`None`, an\n exception is raised. Defaults to :data:`None`, in which case this label\n effectively defaults to ``\"{func_name}()\"``.\n func_labeller : Callable[[], str] | None\n Callback accepting *no* parameters and returning a human-readable label\n describing this function for error-handling purposes, intended for use\n cases in which simply passing this label as the ``func_label`` parameter\n is prohibitively expensive (e.g., due to the cost of string munging).\n Note that this parameter is mutually exclusive with the competing\n ``func_label`` parameter; if both are non-:data:`None`, an exception is\n raised. Defaults to :data:`None`, in which case this label effectively\n defaults to ``\"{func_name}()\"``.\n func_wrapped : Callable | None\n Callable wrapped by the function to be created. If non-:data:`None`,\n special dunder attributes will be propagated (i.e., copied) from this\n wrapped callable into this created function; these include:\n \n * ``__name__``, this function's unqualified name.\n * ``__doc__``, this function's docstring.\n * ``__module__``, the fully-qualified name of this function's module.\n \n Defaults to :data:`None`.\n is_debug : bool, optional\n :data:`True` only if this function is being debugged. If :data:`True`,\n then the definition (including signature and body) of this function is:\n \n * Printed to standard output.\n * Cached with the standard :mod:`linecache` module under a fake\n filename uniquely synthesized by this factory for this function.\n External callers may then subsequently access the definition of this\n function from that module as:\n \n .. code-block:: python\n \n from linecache import cache as linecache_cache\n func_source = linecache_cache[func.__code__.co_filename]\n \n Defaults to :data:`False`.\n exception_cls : Type[Exception], optional\n Type of exception to raise in the event of a fatal error. Defaults to\n :exc:`._BeartypeUtilCallableException`.\n \n Returns\n -------\n Callable\n Function with this name declared by this snippet.\n \n Raises\n ------\n exception_cls\n If either:\n \n * ``func_locals`` contains a key whose value is that of ``func_name``,\n implying the caller already declared a local attribute whose name\n collides with that of this function.\n * ``func_label`` and ``func_labeller`` are both non-:data:`None`.\n * This code snippet is syntactically invalid.\n * This code snippet is syntactically valid but fails to declare a\n function with this name.\n '''\n \n # ..................{ VALIDATION ~ pre }..................\n assert isinstance(func_name, str), f'{repr(func_name)} not string.'\n assert isinstance(func_code, str), f'{repr(func_code)} not string.'\n assert isinstance(is_debug, bool), f'{repr(is_debug)} not bool.'\n assert func_name, 'Parameter \"func_name\" empty.'\n assert func_code, 'Parameter \"func_code\" empty.'\n assert func_label is None or func_labeller is None, (\n f'Parameters \"func_label\" and \"func_labeller\" both non-\"None\".')\n \n # Default all unpassed parameters.\n if func_globals is None:\n func_globals = {}\n if func_locals is None:\n func_locals = {}\n assert isinstance(func_globals, dict), (\n f'{repr(func_globals)} not dictionary.')\n assert isinstance(func_locals, dict), (\n f'{repr(func_locals)} not dictionary.')\n \n # If \"func_labeller\" is unpassed...\n if func_labeller is None:\n # If both \"func_label\" *AND* \"func_labeller\" are unpassed, default\n # \"func_label\" to a sensible label.\n if func_label is None:\n func_label = f'{func_name}()'\n # Else, only \"func_labeller\" is unpassed.\n #\n # In either case, \"func_label\" should now be a valid label.\n \n assert isinstance(func_label, str), f'{repr(func_label)} not string.'\n # Else, \"func_labeller\" is passed. In this case...\n else:\n assert callable(func_labeller), f'{repr(func_labeller)} uncallable.'\n \n # If that function's name is already in this local scope, the caller\n # already declared a local attribute whose name collides with that\n # function's. In this case, raise an exception for safety.\n if func_name in func_locals:\n raise exception_cls(\n f'{func_label or func_labeller()} ' # type: ignore[misc]\n f'already defined by caller locals:\\n'\n f'{repr(func_locals)}'\n )\n # Else, that function's name is *NOT* already in this local scope.\n \n # ..................{ STARTUP ~ filename }..................\n # Note that this logic is intentionally performed *BEFORE* munging the\n # \"func_code\" string in-place below, as this logic depends upon the unique\n # ID of that string. Reassignment obliterates that uniqueness.\n \n # Arbitrary object uniquely associated with this function.\n func_filename_object: object = None\n \n # Possibly fully-qualified name of an arbitrary object uniquely associated\n # with this function.\n func_filename_name: str = None # type: ignore[assignment]\n \n # If this function is a high-level wrapper wrapping a lower-level\n # wrappee, uniquify the subsequent filename against this wrappee. This\n # wrappee's fully-qualified name guarantees the uniqueness of this\n # filename. Ergo, this is the ideal case.\n if func_wrapped:\n func_filename_name = get_object_name(func_wrapped)\n func_filename_object = func_wrapped\n # Else, this function is *NOT* such a wrapper. In this less ideal case,\n # fallback to a poor man's uniquification against the unqualified name and\n # code string underlying this function.\n else:\n func_filename_name = func_name\n func_filename_object = func_code\n \n # Fake in-memory filename hopefully unique to this function.\n # Optimistically, a fully-qualified object name and ID *SHOULD* be unique\n # for the lifetime of the active Python process.\n #\n # Specifically, this filename guarantees the uniqueness of the 3-tuple\n # ``({func_filename}, {func_file_line_number}, {func_name})`` commonly\n # leveraged by profilers (e.g., \"cProfile\") to identify arbitrary callables,\n # where:\n # * `{func_filename}` is this filename (e.g.,\n # `\"\"`).\n # * `{func_file_line_number}`, is *ALWAYS* 0 and thus *NEVER* unique.\n # * `{func_name}`, is identical to that of the decorated callable and also\n # thus *NEVER* unique.\n #\n # Ergo, uniquifying this filename is the *ONLY* means of uniquifying\n # metadata identifying this wrapper function via runtime inspection. Failure\n # to do so reduces tracebacks induced by exceptions raised by this wrapper\n # to non-human-readability, which is less than ideal: e.g.,\n #\n # Traceback (most recent call last):\n # File \"/home/leycec/py/betsee/betsee/gui/simconf/stack/widget/mixin/guisimconfwdgeditscalar.py\", line 313, in _set_alias_to_widget_value_if_sim_conf_open\n # widget=self, value_old=self._widget_value_last)\n # File \"\", line 25, in func_beartyped\n # File \"/home/leycec/py/betsee/betsee/gui/simconf/stack/widget/mixin/guisimconfwdgeditscalar.py\", line 409, in __init__\n # *args, widget=widget, synopsis=widget.undo_synopsis, **kwargs)\n # File \"\", line 13, in func_beartyped\n #\n # See the final traceback line, which is effectively useless.\n func_filename = (\n f'<@beartype({func_filename_name}) at {id(func_filename_object):#x}>')\n \n # ..................{ STARTUP ~ code }..................\n # Code snippet defining this function, stripped of all leading and trailing\n # whitespace to improve both readability and disambiguity. Since this\n # whitespace is safely ignorable, the original snippet is safely\n # replaceable by this stripped snippet.\n func_code = func_code.strip()\n \n # If debugging this function, print the definition of this function.\n if is_debug:\n print(f'{number_str_lines(func_code)}')\n # else:\n # print('!!!!!!!!!PRINTING NOTHING!!!!!!!!!!!')\n # Else, leave that definition obscured by the voracious bitbuckets of time.\n \n # ..................{ CREATION }..................\n # Attempt to...\n try:\n # Call the more verbose and obfuscatory compile() builtin instead of\n # simply calling \"exec(func_code, func_globals, func_locals)\". Why?\n # Because the exec() builtin does *NOT* provide a means to set this\n # function's \"__code__.co_filename\" read-only attribute.\n #\n # Note that we could pass \"single\" instead of \"exec\" here if we were\n # willing to constrain the passed \"func_code\" to a single statement. In\n # casual testing, there is very little performance difference between\n # the two (with an imperceptibly slight edge going to \"single\").\n func_code_compiled = compile(func_code, func_filename, 'exec')\n assert func_name not in func_locals\n \n # Define that function. For obscure and likely uninteresting reasons,\n # Python fails to capture that function (i.e., expose that function to\n # this factory) when the locals() dictionary is passed; instead, a\n # unique local dictionary *MUST* be passed.\n exec(func_code_compiled, func_globals, func_locals)\n # If doing so fails for *ANY* reason whatsoever, wrap that low-level\n # exception with a higher-level exception exhibiting the exact issue. Doing\n # so enables users to submit meaningful issues to our tracker.\n except Exception as exception:\n # Raise an exception suffixed by that function's declaration such that\n # each line of that declaration is prefixed by that line's number. This\n # renders \"SyntaxError\" exceptions referencing arbitrary line numbers\n # human-readable: e.g.,\n # File \"\", line 56\n # if not (\n # ^\n # SyntaxError: invalid syntax\n> raise exception_cls(\n f'{func_label or func_labeller()} ' # type: ignore[misc]\n f'unparseable, as @beartype generated invalid code raising:\\n'\n f'\\t{label_exception(exception)}\\n\\n'\n f'{number_str_lines(func_code)}'\n ) from exception\nE beartype.roar.BeartypeDecorWrapperException: @beartyped _is_exclamatory() wrapper unparseable, as @beartype generated invalid code raising:\nE \tbuiltins.IndentationError: unexpected indent (<@beartype(beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory) at 0x759e3c2e6d40>, line 29)\nE \nE (line 0001) def _is_exclamatory(\nE (line 0002) *args,\nE (line 0003) __beartype_get_violation=__beartype_get_violation,\nE (line 0004) __beartype_check_meta=__beartype_check_meta,\nE (line 0005) __beartype_func=__beartype_func,\nE (line 0006) **kwargs\nE (line 0007) ):\nE (line 0008) # Localize the number of passed positional arguments for efficiency.\nE (line 0009) __beartype_args_len = len(args)\nE (line 0010) # Localize this positional or keyword parameter if passed *OR* to the\nE (line 0011) # sentinel \"__beartype_raise_exception\" guaranteed to never be passed.\nE (line 0012) __beartype_pith_0 = (\nE (line 0013) args[0] if __beartype_args_len > 0 else\nE (line 0014) kwargs.get('text', __beartype_get_violation)\nE (line 0015) )\nE (line 0016) \nE (line 0017) # If this parameter was passed...\nE (line 0018) if __beartype_pith_0 is not __beartype_get_violation:\nE (line 0019) # Type-check this parameter or return against this type hint.\nE (line 0020) if not isinstance(__beartype_pith_0, str):\nE (line 0021) __beartype_violation = __beartype_get_violation(\nE (line 0022) check_meta=__beartype_check_meta,\nE (line 0023) pith_name='text',\nE (line 0024) pith_value=__beartype_pith_0,\nE (line 0025) )\nE (line 0026) None\nE (line 0027) # Call this function with all passed parameters and return the value\nE (line 0028) # returned from this call as is (without being type-checked).\nE (line 0029) return __beartype_func(*args, **kwargs)\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #70: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #71: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #72: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #73: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #74: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #75: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #76: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #77: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #78: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #79: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #80: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 3, "true_in_degree": 4.6, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0007035816912972085, "harmonic": 0.0, "bidirectional_harmonic": 0.19208710697197598, "degree": 3 }, "line_count": 24, "code_line_count": 24, "cyclomatic": 7, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/api/standard/utilfunctools.py", "function_name": "get_func_functools_partial_args_flexible_len", "test_info": { "success": false, "failed": 38, "passed": 1055, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py::test_get_func_args_len_flexible\nLocation: /tmp/benchmark_hirvsess/beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py:67\nError: AssertionError: assert None == 0\n + where None = (functools.partial(, 'The breath and blood of distant lands, for ever', that_mighty_shadow_loves='The slimy caverns of the populous deep.'))\n\nTraceback:\n\n> def test_get_func_args_len_flexible() -> None:\n '''\n Test the\n :func:`beartype._util.func.arg.utilfuncarglen.get_func_args_flexible_len`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype._util.func.arg.utilfuncarglen import (\n get_func_args_flexible_len)\n from beartype_test.a00_unit.data.data_type import (\n ClassCallable,\n function_partial,\n function_partial_bad,\n )\n from beartype_test.a00_unit.data.func.data_func import (\n func_args_0,\n func_args_1_flex_mandatory,\n func_args_1_varpos,\n func_args_2_flex_mandatory,\n func_args_0_wrapped,\n func_args_1_flex_mandatory_wrapped,\n func_args_1_varpos_wrapped,\n func_args_2_flex_mandatory_wrapped,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Callable object whose class defines the __call__() dunder method.\n callable_object = ClassCallable()\n \n # ....................{ PASS }....................\n # Assert this getter returns the expected lengths of unwrapped callables.\n assert get_func_args_flexible_len(func_args_0) == 0\n assert get_func_args_flexible_len(func_args_1_varpos) == 0\n assert get_func_args_flexible_len(func_args_1_flex_mandatory) == 1\n assert get_func_args_flexible_len(func_args_2_flex_mandatory) == 2\n \n # Assert this getter returns the expected lengths of wrapped callables.\n assert get_func_args_flexible_len(func_args_0_wrapped) == 0\n assert get_func_args_flexible_len(func_args_1_varpos_wrapped) == 0\n assert get_func_args_flexible_len(func_args_1_flex_mandatory_wrapped) == 1\n assert get_func_args_flexible_len(func_args_2_flex_mandatory_wrapped) == 2\n \n # Assert this getter returns the expected length of a partial callable.\n> assert get_func_args_flexible_len(function_partial) == 0\nE AssertionError: assert None == 0\nE + where None = (functools.partial(, 'The breath and blood of distant lands, for ever', that_mighty_shadow_loves='The slimy caverns of the populous deep.'))\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_hirvsess/beartype/_util/func/arg/utilfuncargtest.py:105\nError: beartype.roar.BeartypeValeSubscriptionException: Callable functools.partial(.is_true at 0x7a8ee0a78a40>, 'Drank its inspiring radiance, and the wind') flexible argument count None != 1 (i.e., functools.partial(.is_true at 0x7a8ee0a78a40>, 'Drank its inspiring radiance, and the wind') accepts None rather than 1 positional and/or keyword parameters).\n\nTraceback:\n\n> @fixture(scope='session')\n def hints_pep_meta() -> 'Tuple[HintPepMetadata]':\n '''\n Session-scoped fixture yielding a tuple of **PEP-compliant type hint\n metadata** (i.e.,\n :class:`beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata`\n instances, each describing a sample PEP-compliant type hint exercising an\n edge case in the :mod:`beartype` codebase).\n \n Design\n ------\n This tuple was initially designed as a dictionary mapping from PEP-compliant\n type hints to :class:`HintPepMetadata` instances describing those hints,\n until :mod:`beartype` added support for PEPs enabling unhashable\n PEP-compliant type hints (e.g., ``typing.Annotated[list, []]`` under\n :pep:`593`) impermissible for use as dictionary keys or set members.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer fixture-specific imports.\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPepMetadata)\n from beartype_test._util.kind.pytkindmake import make_container_from_funcs\n \n # ..................{ LIST }..................\n> _hints_pep_meta = make_container_from_funcs((\n # PEP-compliant type hints.\n 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484.hints_pep484_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep544.hints_pep544_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep585.hints_pep585_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep586.hints_pep586_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep589.hints_pep589_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep593.hints_pep593_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep604.hints_pep604_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep675.hints_pep675_meta',\n 'beartype_test.a00_unit.data.hint.pep.proposal._data_pep695.hints_pep695_meta',\n \n # PEP-noncompliant type hints defined by both standard and third-party\n # packages internally treated by @beartype as PEP-compliant to\n # streamline code generation.\n #\n # PEP-noncompliant type hints are intentionally tested *AFTER*\n # PEP-compliant type hints to simplify debugging in the event that core\n # functionality is catastrophically broken. *gulp*\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodnumpy.hints_pep_meta_numpy',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodos.hints_pep_meta_os',\n 'beartype_test.a00_unit.data.hint.pep.api._data_hintmodweakref.hints_pep_meta_weakref',\n ))\n\n> func_list = func()\n\n> hint=Annotated[object, Is[is_true_partial]],\n\n> die_unless_validator_tester(is_valid)\n\n> die_unless_func_args_len_flexible_equal(\n\n> def die_unless_func_args_len_flexible_equal(\n # Mandatory parameters.\n func: Codeobjable,\n func_args_len_flexible: int,\n \n # Optional parameters.\n is_unwrap: bool = True,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n exception_prefix: str = '',\n ) -> None:\n '''\n Raise an exception unless the passed pure-Python callable accepts the passed\n number of **flexible parameters** (i.e., parameters passable as either\n positional or keyword arguments).\n \n Parameters\n ----------\n func : Codeobjable\n Pure-Python callable, frame, or code object to be inspected.\n func_args_len_flexible : int\n Number of flexible parameters to validate this callable as accepting.\n is_unwrap: bool, optional\n :data:`True` only if this validator implicitly calls the\n :func:`beartype._util.func.utilfuncwrap.unwrap_func_all` function to\n unwrap this possibly higher-level wrapper into its possibly lowest-level\n wrappee *before* returning the code object of that wrappee. Note that\n doing so incurs worst-case time complexity :math:`O(n)` for :math:`n`\n the number of lower-level wrappees wrapped by this wrapper. Defaults to\n :data:`True` for robustness. Why? Because this validator *must* always\n introspect lowest-level wrappees rather than higher-level wrappers. The\n latter typically do *not* accurately replicate the signatures of the\n former. In particular, decorator wrappers typically wrap decorated\n callables with variadic positional and keyword parameters (e.g., ``def\n _decorator_wrapper(*args, **kwargs)``). Since neither constitutes a\n flexible parameter, this validator raises an exception when passed such\n a wrapper with this boolean set to :data:`False`. Only set this boolean\n to :data:`False` if you pretend to know what you're doing.\n exception_cls : type, optional\n Type of exception to be raised. Defaults to\n :class:`._BeartypeUtilCallableException`.\n exception_prefix : str, optional\n Human-readable label prefixing this exception message. Defaults to the\n empty string.\n \n Raises\n ------\n exception_cls\n If this callable either:\n \n * Is *not* callable.\n * Is callable but is *not* pure-Python.\n * Is a pure-Python callable accepting either more or less than this\n Number of flexible parameters.\n '''\n assert isinstance(func_args_len_flexible, int)\n \n # Number of flexible parameters accepted by this callable.\n func_args_len_flexible_actual = get_func_args_flexible_len(\n func=func,\n is_unwrap=is_unwrap,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # If this callable accepts more or less than this number of flexible\n # parameters, raise an exception.\n if func_args_len_flexible_actual != func_args_len_flexible:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n> raise exception_cls(\n f'{exception_prefix}callable {repr(func)} flexible argument count '\n f'{func_args_len_flexible_actual} != {func_args_len_flexible} '\n f'(i.e., {repr(func)} accepts {func_args_len_flexible_actual} '\n f'rather than {func_args_len_flexible} positional and/or keyword '\n f'parameters).'\n )\nE beartype.roar.BeartypeValeSubscriptionException: Callable functools.partial(.is_true at 0x7a8ee0a78a40>, 'Drank its inspiring radiance, and the wind') flexible argument count None != 1 (i.e., functools.partial(.is_true at 0x7a8ee0a78a40>, 'Drank its inspiring radiance, and the wind') accepts None rather than 1 positional and/or keyword parameters).\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #23: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #24: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #25: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #26: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #27: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #28: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #29: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #30: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #31: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #32: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #33: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #34: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #35: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #36: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #37: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #38: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py", "test_get_func_args_len_flexible" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 10.776320000000004, "in_degree": 1, "true_in_degree": 9.160000000000005, "out_degree": 3, "betweenness": 0.00029263851556403364, "pagerank": 0.0004946666128106095, "harmonic": 0.014199561403508771, "bidirectional_harmonic": 0.17994668891050541, "degree": 4 }, "line_count": 33, "code_line_count": 33, "cyclomatic": 3, "halstead_volume": 28.529325012980813, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/code/codescope.py", "function_name": "add_func_scope_ref", "test_info": { "success": false, "failed": 15, "passed": 1115, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_express_func_scope_type_ref\nLocation: /tmp/benchmark_e2r09iei/beartype_test/a00_unit/a60_check/a20_code/test_codescope.py:323\nError: KeyError: None\n\nTraceback:\n\n> def test_express_func_scope_type_ref() -> None:\n '''\n Test the\n :func:`beartype._check.code.codescope.express_func_scope_type_ref`\n function.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintForwardRefException\n from beartype.typing import ForwardRef\n from beartype._check.code.codescope import express_func_scope_type_ref\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Arbitrary scope to be added to below.\n func_scope = {}\n \n # Set of the unqualified classnames referred to by all relative forward\n # references relative to this scope if any *OR* \"None\" otherwise (i.e., if\n # no such references have been expressed relative to this scope yet).\n refs_type_basename = None\n \n # Fully-qualified classname of a non-existing class.\n CLASSNAME_QUALIFIED = 'Thy.giant.brood.of.pines.around.thee.clinging'\n \n # Unqualified classname of a non-existing class.\n CLASSNAME_UNQUALIFIED = 'Children_of_elder_time_in_whose_devotion'\n \n # Tuple of all PEP-compliant forward references to this fully-qualified\n # class, including...\n FORWARDREFS_QUALIFIED = (\n # PEP 484-compliant forward reference to this class.\n ForwardRef(CLASSNAME_QUALIFIED),\n # PEP 585-compliant forward reference to this class.\n CLASSNAME_QUALIFIED,\n )\n \n # Tuple of all PEP-compliant forward references to this unqualified class,\n # including...\n FORWARDREFS_UNQUALIFIED = (\n # PEP 484-compliant forward reference to this class.\n ForwardRef(CLASSNAME_UNQUALIFIED),\n # PEP 585-compliant forward reference to this class.\n CLASSNAME_UNQUALIFIED,\n )\n \n # ....................{ PASS }....................\n # For each absolute forward reference...\n for forwardref_qualified in FORWARDREFS_QUALIFIED:\n # Express a fully-qualified forward reference to a non-existing class.\n forwardref_expr, refs_type_basename = (\n express_func_scope_type_ref(\n forwardref=forwardref_qualified,\n refs_type_basename=refs_type_basename,\n func_scope=func_scope,\n ))\n \n # Assert this set remains empty.\n assert refs_type_basename is None\n \n # Forward reference proxy added to this scope by the above call.\n> forwardref = func_scope[forwardref_expr]\nE KeyError: None\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_e2r09iei/beartype/_check/code/codemake.py:1671\nError: AssertionError: Is_bearable() type hint 'beartype_test.a00_unit.data.data_type.Subclass' expression undefined.\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n with warns(hint_meta.warning_type):\n is_bearable(pith, hint, conf=conf)\n # print(f'Deprecated type hint {repr(hint)} warned!')\n # Else, this tester is expected to emit *NO* warning for this hint. In\n # this case, call this tester outside of such a context manager.\n else:\n> is_bearable(pith, hint, conf=conf)\n\n> func_tester = make_func_tester(hint, conf)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def make_check_expr(\n # ..................{ ARGS ~ mandatory }..................\n hint_or_sane: HintOrHintSanifiedData,\n conf: BeartypeConf,\n \n # ..................{ ARGS ~ optional }..................\n cls_stack: TypeStack = None,\n ) -> CodeGenerated:\n '''\n **Type-checking expression factory** (i.e., low-level callable dynamically\n generating a pure-Python boolean expression type-checking an arbitrary\n object against the passed PEP-compliant type hint).\n \n This code factory performs a breadth-first search (BFS) over the abstract\n graph of nested type hints reachable from the subscripted arguments of the\n passed root type hint. For each such (possibly nested) hint, this factory\n embeds one or more boolean subexpressions validating a (possibly nested\n sub)object of an arbitrary object against that hint into the full boolean\n expression created and returned by this factory. In short, this factory is\n the beating heart of :mod:`beartype`. We applaud you for your perseverance.\n You finally found the essence of the Great Bear. You did it!! Now, we clap.\n \n This code factory is memoized for efficiency.\n \n Caveats\n -------\n **This factory intentionally accepts no** ``exception_prefix``\n **parameter.** Why? Since that parameter is typically specific to the\n context-sensitive use case of the caller, accepting that parameter would\n prevent this factory from memoizing the passed hint with the returned code,\n which would rather defeat the point. Instead, this factory only:\n \n * Returns generic non-working code containing the placeholder\n :data:`VAR_NAME_PITH_ROOT` substring that the caller is required to\n globally replace by either the name of the current parameter *or*\n ``return`` for return values (e.g., by calling the builtin\n :meth:`str.replace` method) to generate the desired non-generic working\n code type-checking that parameter or return value.\n * Raises generic non-human-readable exceptions containing the placeholder\n :attr:`beartype._util.error.utilerrraise.EXCEPTION_PLACEHOLDER` substring\n that the caller is required to explicitly catch and raise non-generic\n human-readable exceptions from by calling the\n :func:`beartype._util.error.utilerrraise.reraise_exception_placeholder`\n function.\n \n Parameters\n ----------\n hint_or_sane : HintOrHintSanifiedData\n Either a type hint *or* **sanified type hint metadata** (i.e.,\n :data:`.HintSanifiedData` object) to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n \n Returns\n -------\n CodeGenerated\n Tuple containing the Python code snippet dynamically generated by this\n code generator and metadata describing that code. See also the\n :attr:`beartype._data.hint.datahinttyping.CodeGenerated` type hint.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If this object is *not* a PEP-compliant type hint.\n BeartypeDecorHintPepUnsupportedException\n If this object is a PEP-compliant type hint currently unsupported by\n the :func:`beartype.beartype` decorator.\n BeartypeDecorHintPep484Exception\n If one or more PEP-compliant type hints visitable from this object are\n nested :attr:`typing.NoReturn` child hints, since\n :attr:`typing.NoReturn` is valid *only* as a non-nested return hint.\n BeartypeDecorHintPep593Exception\n If one or more PEP-compliant type hints visitable from this object\n subscript the :pep:`593`-compliant :class:`typing.Annotated` class such\n that:\n \n * The second argument subscripting that class is an instance of the\n :class:`beartype.vale.Is` class.\n * One or more further arguments subscripting that class are *not*\n instances of the :class:`beartype.vale.Is` class.\n \n Warns\n -----\n BeartypeDecorHintPep585DeprecationWarning\n If one or more :pep:`484`-compliant type hints visitable from this\n object have been deprecated by :pep:`585`.\n '''\n \n # ..................{ LOCALS ~ hint : root }..................\n # Unpack the passed sanified hint metadata into:\n # * \"hint_root\", the top-level hint to be type-checked.\n # * \"typevar_to_hint_root\", the top-level type variable lookup table (i.e.,\n # dictionary mapping from each type variable parametrizing the origin of\n # this top-level hint to the child hint subscripting this top-level hint).\n hint_root, typevar_to_hint_root = unpack_hint_or_sane(hint_or_sane)\n # print(f'Received root hint {repr(hint_root)} and type variable lookup table {repr(typevar_to_hint_root)}.')\n \n # ..................{ LOCALS ~ hint : current }..................\n # Currently visited hint.\n hint_curr: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this hint (e.g.,\n # \"Union\" if \"hint_curr == Union[int, str]\").\n hint_curr_sign: HintSign = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : child }..................\n # Currently iterated child hint subscripting the currently visited hint.\n hint_child: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this child hint\n # (e.g., \"Union\" if \"hint_child == Union[int, str]\").\n hint_child_sign: Optional[HintSign] = None\n \n # Currently iterated child hint subscripting the currently visited hint *OR*\n # sanified child hint metadata** (i.e., \"HintSanifiedData\" object describing\n # that child hint).\n hint_or_sane_child: HintOrHintSanifiedData = None # pyright: ignore\n \n # ..................{ LOCALS ~ hint : childs }..................\n # Current tuple of all child hints subscripting the currently visited hint\n # (e.g., \"(int, str)\" if \"hint_curr == Union[int, str]\").\n hint_childs: tuple = None # type: ignore[assignment]\n \n # Number of child hints subscripting the currently visited hint.\n hint_childs_len: int = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : metadata }..................\n # Fixed list of all metadata describing all visitable hints currently\n # discovered by the breadth-first search (BFS) below. This list acts as a\n # standard First In First Out (FILO) queue, enabling this BFS to be\n # implemented as an efficient imperative algorithm rather than an\n # inefficient (and dangerous, due to both unavoidable stack exhaustion and\n # avoidable infinite recursion) recursive algorithm.\n #\n # Note that this list is guaranteed by the previously called\n # _die_if_hint_repr_exceeds_child_limit() function to be larger than the\n # number of hints transitively visitable from this root hint. Ergo, *ALL*\n # indexation into this list performed by this BFS is guaranteed to be safe.\n # Ergo, avoid explicitly testing below that the \"hints_meta.index_last\"\n # integer maintained by this BFS is strictly less than\n # \"FIXED_LIST_SIZE_MEDIUM\", as this constraint is already guaranteed to be\n # the case.\n hints_meta = acquire_instance(HintsMeta)\n \n # Initialize this fixed list.\n hints_meta.reinit(cls_stack=cls_stack, conf=conf)\n \n # 0-based index of metadata describing the currently visited hint in this\n # fixed list.\n hints_meta_index_curr = 0\n \n # ..................{ LOCALS ~ pep : 484 }..................\n # Set of the unqualified classnames referred to by all relative forward\n # references visitable from this root hint if any *OR* \"None\" otherwise\n # (i.e., if no such forward references are visitable).\n hint_refs_type_basename: Optional[set] = None\n \n # ..................{ LOCALS ~ func : code }..................\n # Python code snippet type-checking the root pith against the root hint:\n # * Localized separately from the \"func_wrapper_code\" snippet to enable this\n # function to validate this code to be valid *BEFORE* returning this code.\n # * Initialized to a placeholder string to be globally replaced in the\n # Python code snippet to be returned (i.e., \"func_wrapper_code\") by a\n # Python code snippet type-checking the root pith expression (i.e.,\n # \"VAR_NAME_PITH_ROOT\") against the root hint (i.e., \"hint_root\").\n func_root_code = hints_meta.enqueue_hint_child(\n hint=hint_root,\n # 1-based indentation level describing the initial level of indentation\n # appropriate for the root hint.\n indent_level=1,\n pith_expr=VAR_NAME_PITH_ROOT,\n pith_var_name_index=hints_meta.pith_curr_var_name_index,\n typevar_to_hint=typevar_to_hint_root,\n )\n \n # Python code snippet to be returned, seeded with a placeholder to be\n # replaced on the first iteration of the breadth-first search performed\n # below with a snippet type-checking the root pith against the root hint.\n #\n # Note that, shockingly, brute-force string concatenation has been\n # personally profiled by @leycec to be substantially faster than *ALL*\n # alternatives under CPython up to a large number of iterations (e.g.,\n # 100,000). This includes these popular alternatives, *ALL* of which are\n # orders of magnitude slower than brute-force string concatenation:\n # * deque.append().\n # * list.append().\n func_wrapper_code = func_root_code\n \n # ..................{ SEARCH }..................\n # While the 0-based index of metadata describing the next visited hint in\n # the \"hints_meta\" list does *NOT* exceed that describing the last\n # visitable hint in this list, there remains at least one hint to be\n # visited in the breadth-first search performed by this iteration.\n while hints_meta_index_curr <= hints_meta.index_last:\n # Update instance variables of this queue to reflect that this hint is\n # now the currently visited hint.\n hints_meta.set_hint_curr_meta(\n hint_curr_meta=hints_meta[hints_meta_index_curr])\n \n # Localize metadata for both efficiency and f-string purposes.\n hint_curr = hints_meta.hint_curr_meta.hint\n # print(f'Visiting type hint {repr(hint_curr)}...')\n \n # ................{ PEP }................\n # If this hint is PEP-compliant...\n if is_hint_pep(hint_curr):\n #FIXME: Refactor to call warn_if_hint_pep_unsupported() instead.\n #Actually...wait. This is probably still a valid test here. We'll\n #need to instead augment the is_hint_ignorable() function to\n #additionally test whether the passed hint is unsupported, in which\n #case that function should return false as well as emit a non-fatal\n #warning ala the new warn_if_hint_pep_unsupported() function --\n #which should probably simply be removed now. *sigh*\n #FIXME: Actually, in that case, we can simply reduce the following\n #two calls to simply:\n # die_if_hint_pep_ignorable(\n # hint=hint_curr, exception_prefix=hint_curr_exception_prefix)\n #\n #Of course, this implies we want to refactor the\n #die_if_hint_pep_unsupported() function into\n #die_if_hint_pep_ignorable()... probably.\n \n # If this hint is currently unsupported, raise an exception.\n #\n # Note the human-readable label prefixing the representations of\n # child PEP-compliant type hints is unconditionally passed. Since\n # the root hint has already been validated to be supported by\n # the above call to the same function, this call is guaranteed to\n # *NEVER* raise an exception for that hint.\n die_if_hint_pep_unsupported(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n # Else, this hint is supported.\n \n # Assert that this hint is unignorable. Iteration below generating\n # code for child hints of the current parent hint is *REQUIRED* to\n # explicitly ignore ignorable child hints. Since the caller has\n # explicitly ignored ignorable root hints, these two guarantees\n # together ensure that all hints visited by this breadth-first\n # search *SHOULD* be unignorable. Naturally, we validate that here.\n assert hint_curr is not Any, (\n f'{EXCEPTION_PREFIX}ignorable type hint '\n f'{repr(hint_curr)} not ignored.'\n )\n \n # Sign uniquely identifying this hint.\n hint_curr_sign = get_hint_pep_sign(hint_curr)\n # print(f'Visiting PEP type hint {repr(hint_curr)} sign {repr(hint_curr_sign)}...')\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # NOTE: Whenever adding support for (i.e., when generating code\n # type-checking) a new \"typing\" attribute below, similar support\n # for that attribute *MUST* also be added to the parallel:\n # * \"beartype._check.error\" subpackage, which raises exceptions on\n # the current pith failing this check.\n # * \"beartype._data.hint.pep.sign.datapepsignset.HINT_SIGNS_SUPPORTED_DEEP\"\n # frozen set of all signs for which this function generates deeply\n # type-checking code.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n #FIXME: Python 3.10 provides proper syntactic support for \"case\"\n #statements, which should allow us to dramatically optimize this\n #\"if\" logic into equivalent \"case\" logic *AFTER* we drop support\n #for Python 3.9. Of course, that will be basically never, so we'll\n #have to preserve this for basically forever. What you gonna do?\n #FIXME: Actually, we should probably just leverage a hypothetical\n #\"beartype.vale.IsInline[...]\" validator to coerce this slow O(n)\n #procedural logic into fast O(1) object-oriented logic. Of course,\n #object-oriented logic is itself slow -- so we only do this if we\n #can sufficiently memoize that logic. Consideration!\n \n # Switch on (as in, pretend Python provides a \"case\" statement)\n # the sign identifying this hint to decide which type of code to\n # generate to type-check the current pith against the current hint.\n #\n # This decision is intentionally implemented as a linear series of\n # tests ordered in descending likelihood for efficiency. While\n # alternative implementations (that are more readily readable and\n # maintainable) do exist, these alternatives all appear to be\n # substantially less efficient.\n #\n # Consider the standard alternative of sequestering the body of\n # each test implemented below into either:\n #\n # * A discrete private function called by this function. This\n # approach requires maintaining a global private dictionary\n # mapping from each support unsubscripted typing attribute to\n # the function generating code for that attribute: e.g.,\n # def pep_code_check_union(...): ...\n # _HINT_TYPING_ATTR_ARGLESS_TO_CODER = {\n # typing.Union: pep_code_check_union,\n # }\n # Each iteration of this loop then looks up the function\n # generating code for the current attribute from this dictionary\n # and calls that function to do so. Function calls come with\n # substantial overhead in Python, impacting performance more\n # than the comparable linear series of tests implemented below.\n # Additionally, these functions *MUST* mutate local variables of\n # this function by some arcane means -- either:\n # * Passing these locals to each such function, returning these\n # locals from each such function, and assigning these return\n # values to these locals in this function after each such call.\n # * Passing a single composite fixed list of these locals to each\n # such function, which then mutates these locals in-place,\n # which then necessitates this function permanently store these\n # locals in such a list rather than as local variables.\n # * A discrete closure of this function, which adequately resolves\n # the aforementioned locality issue via the \"nonlocal\" keyword at\n # a substantial up-front performance cost of redeclaring these\n # closures on each invocation of this function.\n #\n # ..............{ SHALLOW }..............\n # Perform shallow type-checking logic (i.e., logic that does *NOT*\n # recurse and thus \"bottoms out\" at this hint) *BEFORE* deep\n # type-checking logic. The latter needs additional setup (e.g.,\n # generation of assignment expressions) *NOT* needed by the former,\n # whose requirements are more understandably minimalist.\n #\n # Note that:\n # * Shallow type-checking code should access this pith via\n # \"pith_curr_expr\". Since this code does *NOT* recurse,\n # \"pith_curr_expr\" accesses this pith optimally efficiently.\n # * Deep type-checking code should access this pith via\n # \"pith_assign_expr\". Since that code *DOES* recurse, only\n # \"pith_assign_expr\" accesses this pith optimally efficiently;\n # \"pith_curr_expr\" accesses this pith extremely inefficiently.\n # * Ignorable type-checking code (i.e., code ignoring this hint but\n # otherwise unsuitable for implementation as a reducer called by\n # the \"beartype._check.convert._reduce.redhint\" submodule, typically\n # due to useful side effects intentionally interacting with this\n # BFS) should follow the design pattern established by the\n # \"HintSignPep695TypeAliasSubscripted\" branch below.\n #\n # ..............{ ORIGIN }..............\n # If this hint both...\n if (\n # Originates from an origin type and may thus be shallowly\n # type-checked against that type *AND is either...\n hint_curr_sign in HINT_SIGNS_ORIGIN_ISINSTANCEABLE and (\n # Unsubscripted *OR*...\n not get_hint_pep_args(hint_curr) or\n # Currently unsupported with deep type-checking...\n hint_curr_sign not in HINT_SIGNS_SUPPORTED_DEEP\n )\n ):\n # Then generate trivial code shallowly type-checking the current\n # pith as an instance of the origin type originating this sign\n # (e.g., \"list\" for the hint \"typing.List[int]\").\n # print(f'Shallow checking unsubscripted hint {repr(hint_curr)}...')\n \n # Code type-checking the current pith against this origin type.\n hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n pith_curr_expr=hints_meta.pith_curr_expr,\n # Python expression evaluating to this origin type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n # Origin type of this hint if any *OR* raise an\n # exception -- which should *NEVER* happen, as this hint\n # was validated above to be supported.\n get_hint_pep_origin_type_isinstanceable(hint_curr)),\n )\n # Else, this hint is either subscripted, not shallowly\n # type-checkable, *OR* deeply type-checkable.\n #\n # ..............{ FORWARDREF }..............\n # If this hint is a forward reference...\n elif hint_curr_sign is HintSignForwardRef:\n # Render this forward reference accessible to the body of this\n # wrapper function by populating:\n # * A Python expression evaluating to the class referred to by\n # this forward reference when accessed via the private\n # \"__beartypistry\" parameter.\n # * A set of the unqualified classnames referred to by all\n # relative forward references, including this reference if\n # relative. If this set was previously uninstantiated (i.e.,\n # \"None\"), this assignment initializes this local to the new\n # set instantiated by this call; else, this assignment\n # preserves this local set as is.\n (\n hints_meta.hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_curr, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n \n #FIXME: *REDUNDANT.* Shallow type-checking code defined below\n #already performs this exact same logic. Excise us up, please.\n # # Code type-checking the current pith against this class.\n # hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n # pith_curr_expr=hints_meta.pith_curr_expr,\n # hint_curr_expr=hints_meta.hint_curr_expr,\n # )\n # Else, this hint is *NOT* a forward reference.\n #\n # Since this hint is *NOT* shallowly type-checkable, this hint\n # *MUST* be deeply type-checkable. So, we do so now.\n #\n # ..............{ DEEP }..............\n # Perform deep type-checking logic (i.e., logic that is guaranteed\n # to recurse and thus *NOT* \"bottom out\" at this hint).\n else:\n # Tuple of all child hints subscripting this hint if any *OR*\n # the empty tuple otherwise (e.g., if this hint is its own\n # unsubscripted \"typing\" attribute).\n #\n # Note that the \"__args__\" dunder attribute is *NOT* guaranteed\n # to exist for arbitrary PEP-compliant type hints. Ergo, we\n # obtain this attribute via a higher-level utility getter.\n hint_childs = get_hint_pep_args(hint_curr)\n \n # Number of these child hints.\n hint_childs_len = len(hint_childs)\n \n # ............{ DEEP ~ expression }............\n #FIXME: Unit test that this is behaving as expected. Doing so\n #will require further generalizations, including:\n #* In the \"beartype._decor.decormain\" submodule:\n # * Detect when running under tests.\n # * When running under tests, define a new\n # \"func_wrapper.__beartype_wrapper_code\" attribute added to\n # decorated callables to be the \"func_wrapper_code\" string\n # rather than True. Note that this obviously isn't the right way\n # to do source code association. Ideally, we'd at least\n # interface with the stdlib \"linecache\" module (e.g., by calling\n # the linecache.lazycache() function intended to be used to\n # cache the source code for non-file-based modules) and possibly\n # even go so far as to define a PEP 302-compatible beartype\n # module loader. That's out of scope, so this suffices for now.\n #* In the \"beartype_test.a00_unit.data._data_hint_pep\" submodule:\n # * Add a new \"_PepHintMetadata.code_str_match_regexes\" field,\n # defined as an iterable of regular expressions matching\n # substrings of the \"func_wrapper.__beartype_wrapper_code\"\n # attribute that are expected to exist.\n # * For most \"HINTS_PEP_META\" entries, default this field to\n # merely the empty tuple.\n # * For deeply nested \"HINTS_PEP_META\" entries, define this\n # field as follows:\n # code_str_match_regexes=(r'\\s+:=\\s+',)\n #* In the \"beartype_test.a00_unit.pep.p484.test_p484\" submodule:\n # * Match the \"pep_hinted.__beartype_wrapper_code\" string against\n # all regular expressions in the \"code_str_match_regexes\"\n # iterable for the currently iterated \"pep_hint_meta\".\n #\n #This is fairly important, as we have no other reusable means of\n #ascertaining whether this is actually being applied in general.\n #FIXME: That's all great, except for the\n #\"func_wrapper.__beartype_wrapper_code\" part. Don't do that,\n #please. We really do just want to do this right the first time. As\n #expected, the key to doing so is the linecache.lazycache()\n #function, whose implementation under Python 3.7 reads:\n #\n # def lazycache(filename, module_globals):\n # \"\"\"Seed the cache for filename with module_globals.\n #\n # The module loader will be asked for the source only when getlines is\n # called, not immediately.\n #\n # If there is an entry in the cache already, it is not altered.\n #\n # :return: True if a lazy load is registered in the cache,\n # otherwise False. To register such a load a module loader with a\n # get_source method must be found, the filename must be a cachable\n # filename, and the filename must not be already cached.\n # \"\"\"\n # if filename in cache:\n # if len(cache[filename]) == 1:\n # return True\n # else:\n # return False\n # if not filename or (filename.startswith('<') and filename.endswith('>')):\n # return False\n # # Try for a __loader__, if available\n # if module_globals and '__loader__' in module_globals:\n # name = module_globals.get('__name__')\n # loader = module_globals['__loader__']\n # get_source = getattr(loader, 'get_source', None)\n #\n # if name and get_source:\n # get_lines = functools.partial(get_source, name)\n # cache[filename] = (get_lines,)\n # return True\n # return False\n #\n #Given that, what we need to do is:\n #* Define a new \"beartype._decor._pep302\" submodule implementing a\n # PEP 302-compatible loader for @beartype-generated wrapper\n # functions, enabling external callers (including the stdlib\n # \"linecache\" module) to obtain the source for these functions.\n # For space efficiency, this submodule should internally store\n # code in a compressed format -- which probably means \"gzip\" for\n # maximal portability. This submodule should at least define these\n # attributes:\n # * \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\", a dictionary mapping from\n # the unique fake module names assigned to @beartype-generated\n # wrapper functions by the @beartype decorator to the compressed\n # source strings for those fake modules.\n # * get_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator and returning the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally access the\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has *NOT* already been registered\n # to that dictionary, raise an exception.\n # * Else, uncompress the compressed source string previously\n # registered under that module name with that dictionary and\n # return that uncompressed string. Don't worry about caching\n # uncompressed strings here; that's exactly what the stdlib\n # \"linecache\" module already does on our behalf.\n # Ergo, this function should have signature resembling:\n # def get_source(func_wrapper_module_name: str) -> str:\n # * set_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator as well as as the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has already been registered to\n # that dictionary, raise an exception.\n # * Else, compress the passed uncompressed source string and\n # register that compressed string under that module name with\n # that dictionary.\n #* In the \"beartype._decor.decormain\" submodule:\n # * Do... something? Oh, boy. Why didn't we finish this comment?\n \n # If the expression yielding the current pith is neither...\n #\n # Note that we explicitly test against piths rather than\n # seemingly equivalent metadata to account for edge cases.\n # Notably, child hints of unions (and possibly other \"typing\"\n # objects) do *NOT* narrow the current pith and are *NOT* the\n # root hint. Ergo, a seemingly equivalent test like\n # \"hints_meta_index_curr != 0\" would generate false positives\n # and thus unnecessarily inefficient code.\n if not (\n # The root pith *NOR*...\n #\n # Note that this is merely a negligible optimization for the\n # common case in which the current pith is the root pith\n # (i.e., this is the first iteration of the outermost loop).\n # The subsequent call to the str.isidentifier() method is\n # *MUCH* more expensive than this object identity test.\n hints_meta.pith_curr_expr is VAR_NAME_PITH_ROOT or\n # A simple Python identifier *NOR*...\n hints_meta.pith_curr_expr.isidentifier() or\n # A complex Python expression already containing the\n # assignment expression-specific walrus operator \":=\". Since\n # this implies this expression to already be an assignment\n # expression, needlessly reassigning the local variable to\n # which this assignment expression was previously assigned\n # as yet another redundant local variable only harms\n # efficiency for *NO* tangible gain (e.g., expanding the\n # efficient assignment expression \"__beartype_pith_1 :=\n # next(iter(__beartype_pith_0))\" to the inefficient\n # assignment expression \"__beartype_pith_2 :=\n # __beartype_pith_1 := next(iter(__beartype_pith_0))\").\n #\n # Note that this edge case is induced by method calls\n # performed below of the form:\n # hints_meta.enqueue_hint_child(\n # ..., pith_expr=pith_curr_assign_expr, ...)\n #\n # As of this writing, the only such edge cases are:\n # * PEP 484- or 604-compliant unions containing *ONLY* two\n # or more PEP-compliant type hints (e.g., \"list[str] |\n # set[bytes]\").\n # * PEP 695-compliant subscripted type aliases.\n ':=' in hints_meta.pith_curr_expr\n ):\n # Then the current pith is ideally assigned to a unique\n # local variable via an assignment expression.\n # print(f'Incrementing hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index} by one.')\n \n # Increment the integer suffixing the name of this variable\n # *BEFORE* defining this variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n hints_meta.pith_curr_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Assignment expression assigning this full expression to\n # this local variable.\n hints_meta.pith_curr_assign_expr = (\n CODE_PEP572_PITH_ASSIGN_EXPR_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n pith_curr_expr=hints_meta.pith_curr_expr,\n ))\n # Else, the current pith is *NOT* safely assignable to a unique\n # local variable via an assignment expression. Since the\n # expression yielding the current pith is a simple Python\n # identifier, there is *NO* benefit to assigning that to another\n # local variable via another assignment expression, which would\n # just be an alias of the existing local variable assigned via\n # the existing assignment expression. Moreover, whereas chained\n # assignments are syntactically valid, chained assignment\n # expressions are syntactically invalid unless explicitly\n # protected by parens: e.g.,\n # >>> a = b = 'Mother*Teacher*Destroyer' # <-- fine\n # >>> (a := \"Mother's Abomination\") # <-- fine\n # >>> (a :=\n # ... (b := \"Mother's Illumination\")) # <-- fine\n # >>> (a := b := \"Mother's Illumination\") # <-- not fine\n # SyntaxError: invalid syntax\n #\n # In this case...\n else:\n # print(f'Preserving hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index}.')\n \n # Preserve the Python code snippet evaluating to the value\n # of the current pith as is.\n hints_meta.pith_curr_assign_expr = hints_meta.pith_curr_expr\n \n # ............{ UNION }............\n # If this hint is a union (e.g., \"typing.Union[bool, str]\",\n # typing.Optional[float]\")...\n if hint_curr_sign in HINT_SIGNS_UNION:\n # Python code snippet type-checking the current pith against\n # this union if this union is unignorable *OR* \"None\".\n make_hint_pep484604_check_expr(hints_meta)\n # Else, this hint is *NOT* a union.\n #\n # ..........{ CONTAINERS }............\n # If this hint is either:\n # * A single-argument container like list[int] or set[str].\n # * A similar hint semantically resembling a single-argument\n # container subscripted by one argument and one or more\n # ignorable arguments like tuple[str, ...].\n #\n # Then this hint is effectively (for all intents and purposes) a\n # standard single-argument container. In this case...\n elif hint_curr_sign in HINT_SIGNS_CONTAINER_ARGS_1:\n # Python code snippet type-checking the current pith against\n # this hint if the child hint subscripting this parent\n # container hint is unignorable *OR* \"None\" otherwise.\n make_hint_pep484585_container_check_expr(hints_meta)\n # Else, this hint is *NOT* a standard single-argument container.\n #\n # ............{ SEQUENCES ~ tuple : fixed }............\n # If this hint is a fixed-length tuple (e.g., \"tuple[int,\n # str]\")...\n #\n # Note that if this hint is a:\n # * PEP 484-compliant \"typing.Tuple\"-based hint, this hint is\n # guaranteed to contain one or more child hints. Moreover, if\n # this hint contains exactly one child hint that is the empty\n # tuple, this hint is the empty fixed-length form\n # \"typing.Tuple[()]\".\n # * PEP 585-compliant \"tuple\"-based hint, this hint is *NOT*\n # guaranteed to contain one or more child hints. If this hint\n # contains *NO* child hints, this hint is equivalent to the\n # empty fixed-length PEP 484-compliant form\n # \"typing.Tuple[()]\". Yes, PEP 585 even managed to violate\n # PEP 484-compliance. UUUURGH!\n #\n # While tuples are sequences, the \"typing.Tuple\" singleton that\n # types tuples violates the syntactic norms established for\n # other standard sequences by concurrently supporting two\n # different syntaxes with equally different semantics:\n # * \"typing.Tuple[{typename}, ...]\", typing a tuple whose items\n # all satisfy the \"{typename}\" child hint. Note that the\n # \"...\" substring here is a literal ellipses.\n # * \"typing.Tuple[{typename1}, {typename2}, ..., {typenameN}]\",\n # typing a tuple whose:\n # * First item satisfies the \"{typename1}\" child hint.\n # * Second item satisfies the \"{typename2}\" child hint.\n # * Last item satisfies the \"{typenameN}\" child hint.\n # Note that the \"...\" substring here is *NOT* a literal\n # ellipses.\n #\n # This is what happens when unreadable APIs are promoted.\n elif hint_curr_sign is HintSignTupleFixed:\n # Initialize the code type-checking this pith against this\n # tuple to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_TUPLE_FIXED_PREFIX\n \n # If this hint is the empty fixed-length tuple, generate\n # and append code type-checking the current pith to be the\n # empty tuple. This edge case constitutes a code smell.\n if is_hint_pep484585_tuple_empty(hint_curr):\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_EMPTY_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name))\n # Else, that ridiculous edge case does *NOT* apply. In this\n # case...\n else:\n # Append code type-checking the length of this pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_LEN_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_childs_len=hint_childs_len,\n ))\n \n #FIXME: Optimize by refactoring into a \"while\" loop.\n # For each possibly ignorable insane child hint of this\n # parent tuple...\n for hint_child_index, hint_child in enumerate(\n hint_childs):\n #FIXME: Refactor most (or even *ALL*) calls to\n #sanify_hint_child() to a new\n #hints_meta.sanify_hint() method. The repetition\n #here is becoming... unnerving.\n \n # Unignorable sane child hint sanified from this\n # possibly ignorable insane child hint *OR* \"None\"\n # otherwise (i.e., if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=hint_child,\n cls_stack=hints_meta.cls_stack,\n conf=hints_meta.conf,\n typevar_to_hint=(\n hints_meta.hint_curr_meta.typevar_to_hint),\n exception_prefix=hints_meta.exception_prefix,\n )\n # print(f'Sanified fixed tuple {hints_meta.hint_curr_meta}...')\n # print(f'...child hint {hint_child} -> {hint_or_sane_child}!')\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Python expression yielding the value of the\n # currently indexed item of this tuple to be\n # type-checked against this child hint.\n pith_child_expr = (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_child_index=hint_child_index,\n ))\n \n # Deeply type-check this child pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_child_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n ))\n # Else, this child hint is ignorable.\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_TUPLE_FIXED_SUFFIX}'\n # Format...\n ).format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n )\n # Else, this hint is *NOT* a fixed-length tuple.\n #\n # ..........{ MAPPINGS }............\n # If this hint is a standard mapping (e.g., \"dict[str, int]\")...\n elif hint_curr_sign in HINT_SIGNS_MAPPING:\n # Python expression evaluating to the origin type of this\n # mapping hint as a hidden beartype-specific parameter\n # injected into the signature of this wrapper function.\n hints_meta.hint_curr_expr = (\n hints_meta.add_func_scope_type_or_types(\n get_hint_pep_origin_type_isinstanceable(hint_curr)))\n \n # 2-tuple of the possibly ignorable insane child key and\n # value hints subscripting this mapping hint, defined as\n # either...\n hint_childs = (\n #FIXME: Note that a similar effect can also be achieved\n #through a reduction from type hints the form\n #\"{collections,typing}.Counter[{hint_child}]\" to:\n # typing.Annotated[\n # collections.abc.MutableMapping[{hint_child}, int],\n # beartype.vale.IsInstance[collections.Counter]\n # ]\n #However, the current approach is even *MORE* trivial\n #than that reduction. So, we currently prefer this.\n \n # If this hint describes a \"collections.Counter\"\n # dictionary subclass:\n # * The \"typing.Counter[...]\" type hint factory is\n # subscriptable by only a single key child type hint\n # and assumes the value child type hint typically\n # subscripting dictionary type hint factories to be\n # the standard \"int\" type (e.g., \"typing.Counter[str]\"\n # effectively expands to \"typing.Counter[str, int]\").\n # * The \"collections.Counter[...]\" type hint factory is\n # technically subscriptable by an arbitrary number of\n # child type hints but pragmatically subscriptable by\n # only a single key child type hint. Why? Static\n # type-checkers, which enforce that constraint.\n #\n # Despite these type-checking assumptions and\n # constraints, the \"collections.Counter\" type is itself\n # unconstrained. As of Python 3.13, the\n # collections.Counter.__init__() initializer accepts\n # arbitrary values that are *NOT* integers: e.g.,\n # >>> from collections import Counter\n # >>> c = Counter({'red': 'no, blue!', 'blue': 4.2})\n # >>> print(c)\n # Counter({'red': 'no, blue!', 'blue': 4.2}) # lol\n #\n # That permissiveness arguably constitutes a bug in both\n # CPython itself *AND* user code attempting such\n # shenanigans. Static type-checkers believe this to be\n # the case, anyway -- and that's good enough for us.\n # @beartype thus explicitly catches these bugs by\n # defaulting the undeclared value child type hint for\n # counter type hints to be the \"int\" type.\n (\n get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=EXCEPTION_PREFIX,\n ),\n int,\n )\n if hint_curr_sign is HintSignCounter else\n # Else, this hint does *NOT* describe a\n # \"collections.Counter\" dictionary subclass. In this\n # case, introspect the child key and value type hints\n # subscripting this parent hint in the standard way.\n get_hint_pep484585_args( # type: ignore[assignment]\n hint=hint_curr,\n args_len=2,\n exception_prefix=EXCEPTION_PREFIX,\n )\n )\n \n #FIXME: Consider also contextually considering child key\n #hints that reduce to \"Hashable\" to be ignorable. This\n #includes complex type hints like \"Union[Hashable, str]\",\n #which reduces to \"Hashable\". We can't particularly be\n #bothered at the moment. This is a microoptimization and\n #will probably require a non-trivial amount of work. *sigh*\n # Unignorable sane child key and value hints sanified from\n # these possibly ignorable insane child key and value hints\n # *OR* \"None\" otherwise (i.e., if ignorable).\n hint_or_sane_child_key = (\n sanify_hint_child(\n hint=hint_childs[0],\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n hint_or_sane_child_value = (\n sanify_hint_child(\n hint=hint_childs[1], # type: ignore[has-type]\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n \n # If at least one of these child hints are unignorable...\n if not (\n hint_or_sane_child_key is Any and\n hint_or_sane_child_value is Any\n ):\n # If this child key hint is unignorable...\n if hint_or_sane_child_key is not Any:\n # If this child value hint is also unignorable...\n if hint_or_sane_child_value is not Any:\n # Increase the indentation level of code\n # type-checking this child value pith.\n hints_meta.indent_level_child += 1\n \n # Increment the integer suffixing the name of a\n # unique local variable storing the value of\n # this child key pith *BEFORE* defining this\n # variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n pith_key_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child key pith\n # against this hint.\n hint_key_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_key,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_key_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child value pith\n # against this hint.\n hint_value_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_VALUE_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_key_var_name=pith_key_var_name,\n ),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Code deeply type-checking these child key and\n # value piths against these hints.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_VALUE_format(\n indent_curr=hints_meta.indent_curr,\n pith_key_var_name=pith_key_var_name, # pyright: ignore\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n hint_key_placeholder=(\n hint_key_placeholder),\n hint_value_placeholder=(\n hint_value_placeholder),\n ))\n # Else, this child value hint is ignorable. In this\n # case...\n else:\n # Code deeply type-checking only this child key\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child key pith against this hint.\n hint_key_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=(\n hint_or_sane_child_key),\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n # Else, this child key hint is ignorable. By process\n # of elimination, this child value hint *MUST* be\n # unignorable. In this case...\n else:\n # Code deeply type-checking only this child value\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_VALUE_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child value pith against this hint.\n hint_value_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_VALUE_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Code deeply type-checking this pith as well as at\n # least one of these child key and value piths.\n hints_meta.func_curr_code = CODE_PEP484585_MAPPING_format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hints_meta.hint_curr_expr,\n func_curr_code_key_value=func_curr_code_key_value,\n )\n # Else, these child key *AND* value hints are both\n # ignorable. In this case, fallback to trivial code\n # shallowly type-checking this pith as an instance of this\n # origin type.\n # Else, this hint is *NOT* a mapping.\n #\n # ............{ ANNOTATED }............\n # If this hint is a PEP 593-compliant type metahint, this\n # metahint is guaranteed by the reduction performed above to be\n # beartype-specific (i.e., metahint whose second argument is a\n # beartype validator produced by subscripting a beartype\n # validator factory). In this case...\n elif hint_curr_sign is HintSignAnnotated:\n # Defer heavyweight imports.\n from beartype.vale._core._valecore import BeartypeValidator\n \n # Initialize the code type-checking this pith against this\n # metahint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP593_VALIDATOR_PREFIX\n \n # Unignorable sane metahint annotating this parent hint\n # sanified from this possibly ignorable insane metahint *OR*\n # \"None\" otherwise (i.e., if this metahint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=get_hint_pep593_metahint(hint_curr),\n conf=conf,\n cls_stack=cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # print(f'[593] metahint: {repr(get_hint_pep593_metahint(hint_curr))}')\n # print(f'[593] hint_curr_meta: {repr(hints_meta.hint_curr_meta)}')\n # print(f'[593] hint_curr: {repr(hint_curr)}; hint_or_sane_child: {repr(hint_or_sane_child)}')\n \n # Tuple of the one or more beartype validators annotating\n # this metahint.\n hints_child = get_hint_pep593_metadata(hint_curr)\n # print(f'hints_child: {repr(hints_child)}')\n \n # If this metahint is ignorable...\n if hint_or_sane_child is Any:\n # Expression yielding the value of the current pith,\n # defined as either...\n hint_curr_expr = (\n hints_meta.pith_curr_expr\n # If this metahint is annotated by only one beartype\n # validator, the most efficient expression yielding\n # the value of the current pith is simply the full\n # Python expression *WITHOUT* assigning that value\n # to a reusable local variable in an assignment\n # expression. *NO* assignment expression is needed\n # in this case.\n #\n # Why? Because beartype validators are *NEVER*\n # recursed into. Each beartype validator is\n # guaranteed to be the leaf of a type-checking\n # subtree, guaranteeing this pith to be evaluated\n # only once.\n if len(hints_child) == 1 else\n # Else, this metahint is annotated by two or more\n # beartype validators. In this case, the most\n # efficient expression yielding the value of the\n # current pith is the assignment expression\n # assigning this value to a reusable local variable.\n hints_meta.pith_curr_assign_expr\n )\n # Else, this metahint is unignorable. In this case...\n else:\n # Python expression yielding the value of the current\n # pith, defaulting to the name of the local variable\n # assigned to by the assignment expression performed\n # below.\n hint_curr_expr = hints_meta.pith_curr_var_name\n \n # Code deeply type-checking this metahint.\n hints_meta.func_curr_code += (\n CODE_PEP593_VALIDATOR_METAHINT_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression yielding the value of the\n # current pith assigned to a local variable\n # efficiently reused by code generated by the\n # following iteration.\n #\n # Note this child hint is guaranteed to be followed\n # by at least one more test expression referencing\n # this local variable. Why? Because the \"typing\"\n # module forces metahints to be subscripted by one\n # child hint and one or more arbitrary objects.\n # Ergo, we need *NOT* explicitly validate that here.\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=hints_meta.pith_curr_assign_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n #FIXME: Optimize by refactoring into a \"while\" loop. *sigh*\n # For the 0-based index and each beartype validator\n # annotating this metahint...\n for hint_child_index, hint_child in enumerate(hints_child):\n # print(f'Type-checking PEP 593 type hint {repr(hint_curr)} argument {repr(hint_child)}...')\n # If this is *NOT* a beartype validator, raise an\n # exception.\n #\n # Note that the previously called sanify_hint_child()\n # function validated only the first such to be a\n # beartype validator. All remaining arguments have yet\n # to be validated, so we do so now for consistency and\n # safety.\n if not isinstance(hint_child, BeartypeValidator):\n raise BeartypeDecorHintPep593Exception(\n f'{EXCEPTION_PREFIX}PEP 593 type hint '\n f'{repr(hint_curr)} subscripted by both '\n f'@beartype-specific and -agnostic metadata '\n f'(i.e., {represent_object(hint_child)} not '\n f'beartype validator).'\n )\n # Else, this argument is beartype-specific.\n #\n # If this is any beartype validator *EXCEPT* the first,\n # set the Python expression yielding the value of the\n # current pith to the name of the local variable\n # assigned to by the prior assignment expression. By\n # deduction, it *MUST* be the case now that either:\n # * This metahint was unignorable, in which case this\n # assignment uselessly reduplicates the exact same\n # assignment performed above. While non-ideal, this\n # assignment is sufficiently efficient to make any\n # optimizations here effectively worthless.\n # * This metahint was ignorable, in which case this\n # expression was set above to the assignment\n # expression assigning this pith for the first\n # beartype validator. Since this iteration has already\n # processed the first beartype validator, this\n # assignment expression has already been performed.\n # Avoid inefficiently re-performing this assignment\n # expression for each additional beartype validator by\n # efficiently reusing the previously assigned local.\n elif hint_child_index:\n hint_curr_expr = hints_meta.pith_curr_var_name\n # Else, this is the first beartype validator. See above.\n \n # Code deeply type-checking this validator.\n hints_meta.func_curr_code += CODE_PEP593_VALIDATOR_IS_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression formatting the current pith into\n # the \"{obj}\" format substring previously embedded\n # by this validator into this code string.\n hint_child_expr=hint_child._is_valid_code.format(\n indent=hints_meta.indent_child,\n obj=hint_curr_expr,\n ),\n )\n \n # Generate locals safely merging the locals required by\n # both this validator code *AND* the current code\n # type-checking this entire root hint.\n update_mapping(\n mapping_trg=hints_meta.func_wrapper_scope,\n mapping_src=hint_child._is_valid_code_locals,\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP593_VALIDATOR_SUFFIX_format(indent_curr=hints_meta.indent_curr)}'\n )\n # Else, this hint is *NOT* a metahint.\n #\n # ............{ SUBCLASS }............\n # If this hint is either a PEP 484- or 585-compliant subclass\n # type hint...\n elif hint_curr_sign is HintSignType:\n # Unignorable sane child hint sanified from this possibly\n # ignorable insane child hint *OR* \"None\" otherwise (i.e.,\n # if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n # Possibly ignorable insane child hint subscripting\n # this parent hint, validated to be the *ONLY* child\n # hint subscripting this parent hint.\n hint=get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=hints_meta.exception_prefix,\n ),\n conf=conf,\n cls_stack=hints_meta.cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=hints_meta.exception_prefix,\n )\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Child hint encapsulated by this metadata.\n hint_child = get_hint_or_sane_hint(hint_or_sane_child)\n \n # Sign identifying this child hint.\n hint_child_sign = get_hint_pep_sign_or_none(hint_child)\n \n # If this child hint is a forward reference to a\n # superclass, expose this forward reference to the body\n # of this wrapper function. See above for commentary.\n if hint_child_sign is HintSignForwardRef:\n (\n hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_child, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # Else, this child hint is *NOT* a forward reference. In\n # this case...\n else:\n # If this child hint is a union of superclasses,\n # reduce this union to a tuple of superclasses. Only\n # the latter is safely passable as the second\n # parameter to the issubclass() builtin under all\n # supported Python versions.\n if hint_child_sign is HintSignUnion:\n hint_child = get_hint_pep_args(hint_child) # pyright: ignore\n # Else, this child hint is *NOT* a union.\n \n # If this child hint is *NOT* an issubclassable\n # object, raise an exception.\n #\n # Note that the is_object_issubclassable() tester is\n # considerably faster and thus called before the\n # considerably slower\n # die_unless_object_issubclassable() raiser.\n if not is_object_issubclassable(hint_child): # type: ignore[arg-type]\n die_unless_object_issubclassable(\n obj=hint_child, # type: ignore[arg-type]\n exception_prefix=(\n f'{EXCEPTION_PREFIX}PEP 484 or 585 '\n f'subclass type hint {repr(hint_curr)} '\n f'child type hint '\n ),\n )\n # Else, this child hint is an issubclassable object.\n \n # Python expression evaluating to this child hint.\n hint_curr_expr = hints_meta.add_func_scope_type_or_types(\n hint_child) # pyright: ignore\n \n # Code type-checking this pith against this superclass.\n hints_meta.func_curr_code = CODE_PEP484585_SUBCLASS_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hint_curr_expr,\n indent_curr=hints_meta.indent_curr,\n )\n # Else, this child hint is ignorable. In this case...\n else:\n # Python expression evaluating to the origin type of\n # this hint -- which, by definition, is the \"type\"\n # superclass. Since this superclass is a builtin (i.e.,\n # universally accessible object), we efficiently\n # hardcode the access of this superclass rather than\n # inject a hidden beartype-specific parameter into the\n # signature of this wrapper function as we usually do.\n hints_meta.hint_curr_expr = 'type'\n \n # Fallback to trivial code shallowly type-checking this\n # pith as an instance of this origin type.\n # Else, this hint is *NOT* a subclass type hint.\n #\n # ............{ GENERIC or PROTOCOL }............\n # If this hint is either a:\n # * PEP 484-compliant generic (i.e., user-defined class\n # subclassing a combination of one or more of the\n # \"typing.Generic\" superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 544-compliant protocol (i.e., class subclassing a\n # combination of one or more of the \"typing.Protocol\"\n # superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 585-compliant generic (i.e., user-defined class\n # subclassing at least one non-class PEP 585-compliant\n # pseudo-superclasses) *OR*...\n #\n # ...then this hint is a PEP-compliant generic. In this case...\n elif hint_curr_sign is HintSignPep484585GenericUnsubscripted:\n # print(f'Visiting generic type {repr(hint_curr)}...')\n \n # Initialize the code type-checking this pith against this\n # generic to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_GENERIC_PREFIX\n \n # For each unignorable unerased transitive pseudo-superclass\n # originally declared as a superclass of this generic...\n for hint_or_sane_child in (\n iter_hint_pep484585_generic_bases_unerased(\n hint=hint_curr, # pyright: ignore\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )):\n # print(f'Visiting generic type hint {repr(hint_curr)}...')\n # print(f'...unerased base {repr(hint_child)}...')\n \n # Generate and append code type-checking this pith\n # against this pseudo-superclass.\n hints_meta.func_curr_code += (\n CODE_PEP484585_GENERIC_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n # Python expression efficiently reusing\n # the value of this pith previously\n # assigned to a local variable by the\n # prior expression.\n pith_expr=hints_meta.pith_curr_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_GENERIC_SUFFIX}'\n # Format...\n ).format(\n # Indentation deferred above for efficiency.\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n # Python expression evaluating to this generic type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n hint_curr), # pyright: ignore\n )\n # print(f'{hint_curr_exception_prefix} PEP generic {repr(hint)} handled.')\n # Else, this hint is *NOT* a generic.\n #\n # ............{ PEP 484 ~ type variable }............\n # If this hint is a PEP 484-compliant type variable (i.e.,\n # \"typing.TypeVar\" object), this hint is both dependent on and\n # less common than .PEP 484- and 585-compliant generics and thus\n # intentionally detected immediately after generics. In this\n # case...\n \n #FIXME: Preserved for posterity, once we begin generating\n #call-time type variable type-checking.\n #FIXME: Unit test us up, please.\n #FIXME: Implement corresponding \"beartype._check.error\"\n #validation, please. *sigh*\n # elif hint_curr_sign is HintSignTypeVar:\n # # Either the unignorable hint this type variable reduces to\n # # if any *OR* \"None\" if this type variable is ignorable.\n # hint_child = make_hint_pep484_typevar_check_expr( # type: ignore[assignment]\n # hint_meta=hint_curr_meta,\n # conf=conf,\n # pith_curr_assign_expr=pith_curr_assign_expr,\n # pith_curr_var_name_index=pith_curr_var_name_index,\n # cls_stack=cls_stack,\n # exception_prefix=EXCEPTION_PREFIX,\n # )\n #\n # # If this type variable is reducible to an unignorable\n # # hint, revisit this hint metadata in the outermost \"while\"\n # # loop. Doing so avoids the \"CLEANUP\" logic below, which\n # # assumes this hint to be unignorable and thus\n # # type-checkable.\n # if hint_child is not None:\n # continue\n # # Else, this type variable is *NOT* reducible to an\n # # unignorable hint. Since @beartype currently fails to\n # # generate type-checking code for type variables in and of\n # # themselves, type variables have *NO* intrinsic semantic\n # # meaning and are thus ignorable. In this case, prepare this\n # # BFS to visit the next enqueued hint by incrementing the\n # # 0-based index of metadata describing the next visited hint\n # # in the \"hints_meta\" list *BEFORE* visiting that hint.\n # else:\n # #FIXME: Insufficient. The parent type hint thought this\n # #type variable was unignorable and thus... ugh.\n # hints_meta_index_curr += 1\n # ............{ PEP 586 ~ typing.Literal }............\n # If this hint is a PEP 586-compliant type hint (i.e., the\n # \"typing.Literal\" singleton subscripted by one or more literal\n # objects), this hint is largely useless and thus intentionally\n # detected late. Why? Because \"typing.Literal\" is subscriptable\n # by objects that are instances of only *SIX* possible types,\n # which is sufficiently limiting as to render this singleton\n # patently absurd and a farce that we weep to even implement.\n # In this case...\n elif hint_curr_sign is HintSignLiteral:\n # Tuple of zero or more literal objects subscripting this\n # hint, intentionally replacing the current such tuple due\n # to the non-standard implementation of the third-party\n # \"typing_extensions.Literal\" type hint factory.\n hint_childs = get_hint_pep586_literals(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n \n # Initialize the code type-checking this pith against this\n # hint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP586_PREFIX_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n \n #FIXME: If \"typing.Literal\" is ever extended to support\n #substantially more types (and thus actually becomes\n #useful), optimize the construction of the \"types\" set\n #below to instead leverage a similar\n #\"acquire_instance(set)\" caching solution as that\n #currently employed for unions. For now, we only shrug.\n \n # Python expression evaluating to a tuple of the unique\n # types of all literal objects subscripting this hint.\n hint_child_types_expr=hints_meta.add_func_scope_type_or_types({\n #FIXME: Optimize by refactoring into a \"while\"\n #loop. Also, this should probably be a \"frozenset\"\n #rather than \"set\". *sigh*\n # Set comprehension of all unique literal objects\n # subscripting this hint, implicitly discarding all\n # duplicate such objects.\n type(hint_child) for hint_child in hint_childs}),\n )\n \n #FIXME: Optimize by refactoring into a \"while\" loop. *sigh*\n # For each literal object subscripting this hint...\n for hint_child in hint_childs:\n # Generate and append efficient code type-checking\n # this data validator by embedding this code as is.\n hints_meta.func_curr_code += CODE_PEP586_LITERAL_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n # Python expression evaluating to this object.\n hint_child_expr=add_func_scope_attr(\n attr=hint_child,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=(\n EXCEPTION_PREFIX_FUNC_WRAPPER_LOCAL),\n ),\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" or\" suffix appended by the last\n # child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_OR]}'\n # Suffix this code by the appropriate substring.\n f'{CODE_PEP586_SUFFIX}'\n ).format(indent_curr=hints_meta.indent_curr)\n # Else, this hint is *NOT* a PEP 586-compliant type hint.\n #\n # ............{ UNSUPPORTED }............\n # Else, this hint is neither shallowly nor deeply supported and\n # is thus unsupported. Since an exception should have already\n # been raised above in this case, this conditional branch\n # *NEVER* be triggered. Nonetheless, raise an exception.\n else:\n raise BeartypeDecorHintPepUnsupportedException(\n f'{EXCEPTION_PREFIX_HINT}'\n f'{repr(hint_curr)} unsupported but '\n f'erroneously detected as supported under '\n f'beartype sign {repr(hint_curr_sign)}.'\n )\n \n # ................{ NON-PEP }................\n # Else, this hint is *NOT* PEP-compliant.\n #\n # ................{ NON-PEP ~ type }................\n # If this hint is a non-\"typing\" class...\n #\n # Note that:\n # * This test is intentionally performed *AFTER* that testing whether\n # this hint is PEP-compliant, thus guaranteeing this hint to be a\n # PEP-noncompliant non-\"typing\" class rather than a PEP-compliant\n # type hint originating from such a class. Since many hints are both\n # PEP-compliant *AND* originate from such a class (e.g., the \"List\"\n # in \"List[int]\", PEP-compliant but originating from the\n # PEP-noncompliant builtin class \"list\"), testing these hints first\n # for PEP-compliance ensures we generate non-trivial code deeply\n # type-checking these hints instead of trivial code only shallowly\n # type-checking the non-\"typing\" classes from which they originate.\n # * This class is guaranteed to be a subscripted argument of a\n # PEP-compliant type hint (e.g., the \"int\" in \"Union[Dict[str, str],\n # int]\") rather than the root type hint. Why? Because if this class\n # were the root type hint, it would have already been passed into a\n # faster submodule generating PEP-noncompliant code instead.\n elif isinstance(hint_curr, type):\n # Python expression evaluating to this type.\n hints_meta.hint_curr_expr = hints_meta.add_func_scope_type_or_types(\n hint_curr)\n # ................{ NON-PEP ~ bad }................\n # Else, this hint is neither PEP-compliant *NOR* a class. In this case,\n # raise an exception. Note that:\n # * This should *NEVER* happen, as the \"typing\" module goes to great\n # lengths to validate the integrity of PEP-compliant types at\n # declaration time.\n # * The higher-level die_unless_hint_nonpep() validator is\n # intentionally *NOT* called here, as doing so would permit both:\n # * PEP-noncompliant forward references, which could admittedly be\n # disabled by passing \"is_forwardref_valid=False\" to that call.\n # * PEP-noncompliant tuple unions, which currently *CANNOT* be\n # disabled by passing such an option to that call.\n else: # pragma: no cover\n raise BeartypeDecorHintPepException(\n f'{EXCEPTION_PREFIX_HINT}{repr(hint_curr)} unrecognized '\n f'(i.e., either PEP-noncompliant or '\n f'PEP-compliant but currently unsupported by @beartype).'\n )\n \n # ................{ CLEANUP }................\n # If prior logic generated *NO* code snippet type-checking the current\n # pith against the currently visited hint.\n if hints_meta.func_curr_code is None:\n # Assert that a branch above defined the code snippet used below.\n> assert hints_meta.hint_curr_expr is not None, (\n f'{EXCEPTION_PREFIX_HINT}{repr(hint_curr)} '\n f'expression undefined.'\n )\nE AssertionError: Is_bearable() type hint 'beartype_test.a00_unit.data.data_type.Subclass' expression undefined.\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #15: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a20_code/test_codescope.py", "test_express_func_scope_type_ref" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.6736000000000004, "in_degree": 2, "true_in_degree": 6.32, "out_degree": 2, "betweenness": 5.1482701812191104e-05, "pagerank": 0.00044152876114646053, "harmonic": 0.005619517543859649, "bidirectional_harmonic": 0.22335211845902667, "degree": 4 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/utilobject.py", "function_name": "get_object_basename_scoped_or_none", "test_info": { "success": false, "failed": 141, "passed": 952, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_sdi1bar1/beartype/_util/utilobject.py:221\nError: beartype.roar._BeartypeUtilObjectNameException: .where_that_or at 0x796f58898b80> unnamed (i.e., declares neither \"__name__\" nor \"__qualname__\" dunder attributes).\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper = make_func(\n\n> func_filename_name = get_object_name(func_wrapped)\n\n> object_scopes_name = get_object_basename_scoped(obj)\n\n> def get_object_basename_scoped(obj: Any) -> str:\n '''\n **Lexically scoped name** (i.e., ``.``-delimited string unambiguously\n identifying all lexical scopes encapsulating) the passed object if this\n object defines either the ``__qualname__`` or ``__name__`` dunder attributes\n *or* raise an exception otherwise (i.e., if this object defines *no* such\n attributes).\n \n Parameters\n ----------\n obj : object\n Object to be inspected.\n \n Returns\n -------\n str\n Lexically scoped name of this object.\n \n Raises\n ------\n _BeartypeUtilObjectNameException\n If this object defines neither ``__qualname__`` *nor* ``__name__``\n dunder attributes.\n \n See Also\n --------\n :func:`.get_object_basename_scoped_or_none`\n Further details.\n '''\n \n # Fully-qualified name of this object excluding its module name.\n object_scoped_name = get_object_basename_scoped_or_none(obj)\n \n # If this object is unnamed, raise a human-readable exception. The default\n # \"AttributeError\" exception raised by attempting to directly access either\n # the \"obj.__name__\" or \"obj.__qualname__\" attributes is sufficiently\n # non-explanatory to warrant replacement by our explanatory exception.\n if object_scoped_name is None:\n> raise _BeartypeUtilObjectNameException(\n f'{repr(obj)} unnamed '\n f'(i.e., declares neither \"__name__\" nor \"__qualname__\" '\n f'dunder attributes).'\n )\nE beartype.roar._BeartypeUtilObjectNameException: .where_that_or at 0x796f58898b80> unnamed (i.e., declares neither \"__name__\" nor \"__qualname__\" dunder attributes).\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/func/test_utilfunccode.py::test_get_func_code_or_none\nLocation: /tmp/benchmark_sdi1bar1/beartype_test/a00_unit/a20_util/func/test_utilfunccode.py:122\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_get_func_code_or_none() -> None:\n '''\n Test usage of the\n :func:`beartype._util.func.utilfunccode.get_func_code_or_none`\n function.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilCallableException\n from beartype.roar._roarwarn import _BeartypeUtilCallableWarning\n from beartype._util.func.utilfunccode import get_func_code_or_none\n from beartype._util.py.utilpyversion import (\n IS_PYTHON_AT_LEAST_3_11,\n )\n from beartype_test.a00_unit.data.util.func.data_utilfunccode import (\n of_vapours,\n will_be_the_dome,\n thou_dirge,\n yellow,\n )\n from collections.abc import Callable\n from pytest import warns\n from re import escape, search\n \n # ..................{ NON-LAMBDA }..................\n # Assert this getter accepts C-based callables with \"None\"\n assert get_func_code_or_none(iter) is None\n \n # Assert this getter accepts a dynamically declared callable with \"None\".\n assert get_func_code_or_none(of_vapours) is None\n \n # Assert this getter accepts a physically declared pure-Python non-lambda\n # callable with the full definition of that callable.\n assert get_func_code_or_none(will_be_the_dome) == \"\"\"def will_be_the_dome():\n '''\n Arbitrary non-lambda function physically declared by this submodule.\n '''\n \n return 'of a vast sepulchre'\n \"\"\"\n \n # ..................{ LAMBDA }..................\n def _assert_lambda_args_0_body_is(\n func: Callable,\n func_code_body: str,\n ) -> None:\n '''\n Test-specific function asserting that the body of the passed\n **argumentless lambda function** (i.e., lambda function accepting *no*\n parameters) is exactly the passed string.\n \n This function enables the bodies of lambda functions to be portably\n tested across distinct Python versions.\n \n Parameters\n ----------\n func : Callable\n Lambda function to test this string against.\n func_code_body : str\n Expected body of this lambda function to be tested for.\n '''\n \n # Regular expression matching the leading prefix of the source code\n # underlying this lambda.\n LAMBDA_ARGS_0_CODE_PREFIX = (\n # Under Python >= 3.11, this code is no longer erroneously prefixed\n # by an assignment statement globalizing this lambda.\n r'lambda: '\n if IS_PYTHON_AT_LEAST_3_11 else\n # Under Python 3.9 and 3.10, this code is typically erroneously\n # prefixed by an assignment statement globalizing this lambda but\n # nonetheless has an accidental space inserted inappropriately.\n r'lambda : '\n )\n \n # Regular expression matching this prefix followed by this body,\n # escaped to avoid unsafe interpretation as regular expressions.\n func_code_regex = (\n fr'^{LAMBDA_ARGS_0_CODE_PREFIX}{escape(func_code_body)}$')\n \n # Original source code of this lambda.\n func_code = get_func_code_or_none(func)\n \n # Assert this code is prefixed by the expected substring followed by the\n # passed body of this lambda.\n assert search(pattern=func_code_regex, string=func_code) is not None\n \n # ..................{ PASS }..................\n # Assert this getter accepts a physically declared pure-Python lambda\n # function in which only one lambda is declared on its source code line\n # with the embedded definition of that function.\n _assert_lambda_args_0_body_is(\n func=thou_dirge,\n func_code_body=\"'Of the dying year, to which this closing night'\",\n )\n \n # ..................{ FAIL }..................\n # Assert this getter accepts a physically declared pure-Python lambda\n # functions in which multiple lambdas are declared on the same source code\n # line with the embedded definition of the first such function and a\n # non-fatal warning disclosing this inconvenience to the caller.\n> with warns(_BeartypeUtilCallableWarning):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "Failure #3: beartype_test/a00_unit/a20_util/func/test_utilfuncmake.py::test_make_func", "Failure #4: beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py::test_is_func_nested", "Failure #5: beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py::test_get_func_locals", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py::test_get_hint_pep484585_ref_names_relative_to", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #24: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #25: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #26: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #27: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #28: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #29: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #30: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #31: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #32: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #33: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #34: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #35: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #36: beartype_test/a00_unit/a20_util/test_utilobject.py::test_get_object_basename_scoped", "Failure #37: beartype_test/a00_unit/a20_util/test_utilobject.py::test_get_object_name", "Failure #38: beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py::test_label_callable", "Failure #39: beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py::test_represent_func", "Failure #40: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #41: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #42: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #43: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_numpy", "Failure #44: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #45: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_isinstance_pass", "Failure #46: beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py::test_api_vale_issubclass_pass", "Failure #47: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #48: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #49: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #50: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #51: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #52: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #53: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #54: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #55: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #56: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #57: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #58: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #59: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_decor_fail", "Failure #83: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #84: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #85: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #86: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #89: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #90: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #91: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #92: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #93: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #94: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #95: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #96: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #97: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #98: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #99: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #100: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #101: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #102: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #103: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #104: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #105: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #106: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #107: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #108: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #109: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #110: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #111: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #112: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #113: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #114: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #115: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #116: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #117: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #118: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #119: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #120: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #121: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #122: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #123: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #124: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #125: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #126: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #127: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #128: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #129: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #130: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #131: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #132: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #133: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #134: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #135: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #136: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #137: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #138: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #139: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #140: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #141: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a20_util/func/test_utilfunccode.py", "test_get_func_code_or_none" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 8.240000000000002, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0007499893845751499, "harmonic": 0.0, "bidirectional_harmonic": 0.18256786616161697, "degree": 2 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/module/utilmodimport.py", "function_name": "import_module_or_none", "test_info": { "success": false, "failed": 65, "passed": 1027, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a00_core/test_a00_package.py::test_api_deprecations\nLocation: /tmp/benchmark_cpkt1796/beartype_test/a00_unit/a00_core/test_a00_package.py:78\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_api_deprecations() -> None:\n '''\n Test all deprecated attributes importable from the public APIs of all\n subpackages of the :mod:`beartype` package (including itself).\n '''\n \n # Defer test-specific imports.\n from beartype._util.module.utilmodimport import import_module_attr\n from pytest import warns\n \n # Tuple of the fully-qualified names of all deprecated attributes.\n DEPRECATED_ATTRIBUTES = (\n 'beartype.abby',\n 'beartype.cave.HintPep585Type',\n 'beartype.roar.BeartypeAbbyException',\n 'beartype.roar.BeartypeAbbyHintViolation',\n 'beartype.roar.BeartypeAbbyTesterException',\n 'beartype.roar.BeartypeCallHintPepException',\n 'beartype.roar.BeartypeCallHintPepParamException',\n 'beartype.roar.BeartypeCallHintPepReturnException',\n 'beartype.roar.BeartypeDecorHintNonPepException',\n 'beartype.roar.BeartypeDecorHintNonPepNumPyException',\n 'beartype.roar.BeartypeDecorHintPep563Exception',\n 'beartype.roar.BeartypeDecorHintPepDeprecatedWarning',\n 'beartype.roar.BeartypeDecorPepException',\n )\n \n # For each deprecated attribute declared by beartype...\n for deprecated_attribute in DEPRECATED_ATTRIBUTES:\n # Assert that importing this attribute both emits the expected warning\n # and returns a non-\"None\" value.\n> with warns(DeprecationWarning):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/api/standard/test_utilapityping.py::test_import_typing_attr\nLocation: /tmp/benchmark_cpkt1796/beartype/_util/api/standard/utiltyping.py:169\nError: beartype.roar._BeartypeUtilModuleException: Typing attributes \"typing.Union\" and \"typing_extensions.Union\" not found. Please either (A) install the \"typing_extensions\" package or (B) update to a newer Python version. We apologize for the inconvenience and hope you had a great dev cycle flying with Air Beartype, \"Your Grizzled Pal in the Friendly Skies.\"\n\nTraceback:\n\n> def test_import_typing_attr() -> None:\n '''\n Test the :func:`beartype._util.api.standard.utiltyping.import_typing_attr`\n importer.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar._roarexc import _BeartypeUtilModuleException\n from beartype._util.api.standard.utiltyping import import_typing_attr\n from beartype._util.module.utilmodimport import (\n import_module_attr_or_sentinel)\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_13\n from beartype._util.utilobject import SENTINEL\n from pytest import raises\n from typing import Union\n \n # ....................{ PASS }....................\n # Assert that dynamically importing \"typing.Union\" attribute (guaranteed to\n # be importable under all supported Python versions) is that attribute.\n> assert import_typing_attr('Union') is Union\n\n> def import_typing_attr(\n # Mandatory parameters.\n typing_attr_basename: str,\n \n # Optional parameters.\n exception_cls: TypeException = _BeartypeUtilModuleException,\n ) -> Any:\n '''\n Dynamically import and return the **typing attribute** (i.e., object\n declared at module scope by either the :mod:`typing` or\n :mod:`typing_extensions` modules) with the passed unqualified name if\n importable from one or more of these modules *or* raise an exception\n otherwise (i.e., if this attribute is *not* importable from these modules).\n \n This function is effectively memoized for efficiency.\n \n Parameters\n ----------\n typing_attr_basename : str\n Unqualified name of the attribute to be imported from a typing module.\n exception_cls : Type[Exception]\n Type of exception to be raised by this function. Defaults to\n :class:`._BeartypeUtilModuleException`.\n \n Returns\n -------\n object\n Attribute with this name dynamically imported from a typing module.\n \n Raises\n ------\n exception_cls\n If either:\n \n * This name is syntactically invalid.\n * Neither the :mod:`typing` nor :mod:`typing_extensions` modules\n declare an attribute with this name.\n \n Warns\n -----\n BeartypeModuleUnimportableWarning\n If any of these modules raise module-scoped exceptions at importation\n time. That said, the :mod:`typing` and :mod:`typing_extensions` modules\n are scrupulously tested and thus unlikely to raise such exceptions.\n \n See Also\n --------\n :func:`beartype._util.module.utilmodimport.import_module_typing_any_attr_or_none`\n Further details.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.module.utilmodtest import is_module\n \n # Attribute with this name imported from either the \"typing\" or\n # \"typing_extensions\" modules if one or more of these modules declare this\n # attribute *OR* \"None\" otherwise.\n #\n # Note that positional rather than keyword arguments are intentionally\n # passed to optimize memoization efficiency.\n typing_attr = import_typing_attr_or_none(\n typing_attr_basename, exception_cls)\n \n # If none of these modules declare this attribute...\n if typing_attr is None:\n # Substrings prefixing and suffixing exception messages raised below.\n EXCEPTION_PREFIX = (\n f'Typing attributes \"typing.{typing_attr_basename}\" and '\n f'\"typing_extensions.{typing_attr_basename}\" not found. '\n )\n EXCEPTION_SUFFIX = (\n 'We apologize for the inconvenience and hope you had a '\n 'great dev cycle flying with Air Beartype, '\n '\"Your Grizzled Pal in the Friendly Skies.\"'\n )\n \n # If the \"typing_extensions\" module is importable, raise an\n # appropriate exception.\n if is_module('typing_extensions'):\n raise exception_cls(\n f'{EXCEPTION_PREFIX} Please either '\n f'(A) update the \"typing_extensions\" package or '\n f'(B) update to a newer Python version. {EXCEPTION_SUFFIX}'\n )\n # Else, the \"typing_extensions\" module is unimportable. In this\n # case, raise an appropriate exception.\n else:\n> raise exception_cls(\n f'{EXCEPTION_PREFIX} Please either '\n f'(A) install the \"typing_extensions\" package or '\n f'(B) update to a newer Python version. {EXCEPTION_SUFFIX}'\n )\nE beartype.roar._BeartypeUtilModuleException: Typing attributes \"typing.Union\" and \"typing_extensions.Union\" not found. Please either (A) install the \"typing_extensions\" package or (B) update to a newer Python version. We apologize for the inconvenience and hope you had a great dev cycle flying with Air Beartype, \"Your Grizzled Pal in the Friendly Skies.\"\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_type_or_none", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py::test_get_hint_pep484585_ref_names_relative_to", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_generic", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_get_hint_pep585_generic_typevars", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep612.py::test_make_hint_pep612_concatenate_list_or_none", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars", "Failure #17: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #18: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #19: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #20: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #21: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing", "Failure #22: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #23: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_subscripted", "Failure #24: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #25: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #26: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #27: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #28: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple", "Failure #29: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr", "Failure #30: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #31: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #32: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack", "Failure #33: beartype_test/a00_unit/a20_util/module/test_utilmodimport.py::test_import_module_or_none", "Failure #34: beartype_test/a00_unit/a20_util/module/test_utilmodimport.py::test_import_module_attr", "Failure #35: beartype_test/a00_unit/a20_util/module/test_utilmodimport.py::test_import_module_attr_or_none", "Failure #36: beartype_test/a00_unit/a20_util/module/test_utilmodimport.py::test_import_module_attr_or_sentinel", "Failure #37: beartype_test/a00_unit/a20_util/module/test_utilmodtest.py::test_is_module", "Failure #38: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #39: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #40: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint", "Failure #41: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func_infer_hint.py::test_door_infer_hint_numpy", "Failure #42: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #43: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py::test_make_forwardref_indexable_subtype", "Failure #44: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #45: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #46: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #47: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #48: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #61: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #62: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #63: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #64: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #65: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a00_core/test_a00_package.py", "test_api_deprecations" ], [ "beartype_test/a00_unit/a20_util/api/standard/test_utilapityping.py", "test_import_typing_attr" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.0400000000000005, "in_degree": 2, "true_in_degree": 11.280000000000003, "out_degree": 3, "betweenness": 0.00023031735021243388, "pagerank": 0.0012721439579766198, "harmonic": 0.005756578947368421, "bidirectional_harmonic": 0.21762550315181964, "degree": 5 }, "line_count": 29, "code_line_count": 29, "cyclomatic": 4, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/kind/map/utilmapset.py", "function_name": "update_mapping", "test_info": { "success": false, "failed": 77, "passed": 1053, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/kind/map/test_utilmapset.py::test_update_mapping\nLocation: /tmp/benchmark_fye5xysn/beartype_test/a00_unit/a20_util/kind/map/test_utilmapset.py:164\nError: AssertionError: assert {'At the': 'd...waited.', ...} == {'At the': 'd...waited.', ...}\n \n Omitting 5 identical items, use -vv to show\n Right contains 5 more items:\n {'I am': 'going, O Nokomis,',\n 'Of the Northwest-Wind,': 'Keewaydin.',\n 'On a': 'long and distant journey,',\n 'To the portals': 'of the Sunset,',...\n \n ...Full output truncated (15 lines hidden), use '-vv' to show\n\nTraceback:\n\n> def test_update_mapping() -> None:\n '''\n Test the :func:`beartype._util.kind.map.utilmapset.update_mapping` function.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype._util.kind.map.utilmapset import update_mapping\n from beartype_test.a00_unit.data.kind.data_kindmap import (\n FAREWELL_O_HIAWATHA,\n IN_THE_LODGE_OF_HIAWATHA,\n IN_THE_LODGE_OF_HIAWATHA_FAREWELL_O_HIAWATHA,\n THE_SONG_OF_HIAWATHA,\n THE_SONG_OF_HIAWATHA_IN_THE_LODGE_OF_HIAWATHA,\n )\n \n # ....................{ LOCALS }....................\n # Shallow copies of arbitrary mappings to be modified below.\n farewell_o_hiawatha = FAREWELL_O_HIAWATHA.copy()\n the_song_of_hiawatha = THE_SONG_OF_HIAWATHA.copy()\n \n # ....................{ ASSERTS }....................\n # Assert this updater preserves this mapping when updated from an empty\n # mapping.\n update_mapping(farewell_o_hiawatha, {})\n assert farewell_o_hiawatha == FAREWELL_O_HIAWATHA\n \n # Assert this updater updates this mapping as expected when updating from a\n # non-empty mapping containing no key or key-value collisions.\n update_mapping(the_song_of_hiawatha, IN_THE_LODGE_OF_HIAWATHA)\n> assert the_song_of_hiawatha == (\n THE_SONG_OF_HIAWATHA_IN_THE_LODGE_OF_HIAWATHA)\nE AssertionError: assert {'At the': 'd...waited.', ...} == {'At the': 'd...waited.', ...}\nE \nE Omitting 5 identical items, use -vv to show\nE Right contains 5 more items:\nE {'I am': 'going, O Nokomis,',\nE 'Of the Northwest-Wind,': 'Keewaydin.',\nE 'On a': 'long and distant journey,',\nE 'To the portals': 'of the Sunset,',...\nE \nE ...Full output truncated (15 lines hidden), use '-vv' to show\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: <@beartype(beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory) at 0x753dcfa6eb60>:17\nError: NameError: name '__beartype_get_violation' is not defined\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n @beartype\n def _is_exclamatory(text: str):\n return '!' in text\n \n # Dynamically generated lambda function. To exercise in-memory validators\n # dynamically defined outside of a standard on-disk module (e.g., \"smart\"\n # REPLs like IPython), this function's code is intentionally cached with\n # the standard \"linecache\" module.\n _is_commentary = make_func(\n func_name='_is_commentary',\n func_code=(\n \"\"\"_is_commentary = lambda text: text and text[-1] == ','\"\"\"),\n is_debug=True,\n )\n \n # ....................{ VALIDATORS }....................\n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined physically in this on-disk module.\n IsLengthy = Is[lambda text: len(text) > 30]\n IsSentence = Is[lambda text: text and text[-1] == '.']\n \n # Validators produced by subscripting this factory with lambda functions\n # satisfying the expected API defined dynamically in-memory.\n IsCommentary = Is[_is_commentary]\n \n # Validator produced by subscripting this factory with non-lambda functions\n # satisfying the expected API.\n IsQuoted = Is[_is_quoted]\n IsExclamatory = Is[_is_exclamatory]\n IsFalseFake = Is[_is_false_fake]\n \n # Validator synthesized from the above validators with the domain-specific\n # language (DSL) supported by those validators.\n IsLengthyOrUnquotedSentence = IsLengthy | (IsSentence & ~IsQuoted)\n \n # ....................{ ASSERTS ~ instance }....................\n # Assert these validators satisfy the expected API.\n assert isinstance(IsLengthy, BeartypeValidator)\n assert isinstance(IsLengthyOrUnquotedSentence, BeartypeValidator)\n \n # Assert a validator provides both non-empty code and code locals.\n assert isinstance(IsLengthy._is_valid_code, str)\n assert isinstance(IsLengthy._is_valid_code_locals, Mapping)\n assert bool(IsLengthy._is_valid_code)\n assert bool(IsLengthy._is_valid_code_locals)\n \n # ....................{ ASSERTS ~ is_valid }....................\n # Assert that non-composite validators perform the expected validation.\n assert IsLengthy.is_valid('Plunged in the battery-smoke') is False\n assert IsLengthy.is_valid('Right through the line they broke;') is True\n assert IsSentence.is_valid('Theirs not to make reply,') is False\n assert IsSentence.is_valid('Theirs but to do and die.') is True\n assert IsCommentary.is_valid('Remote, serene, and inaccessible:') is False\n assert IsCommentary.is_valid(\n 'Power dwells apart in its tranquillity,') is True\n assert IsQuoted.is_valid('Theirs not to reason why,') is False\n assert IsQuoted.is_valid('\"Forward, the Light Brigade!\"') is True\n> assert IsExclamatory.is_valid(\n 'Thou art the path of that unresting sound\u2014') is False\n\n> is_obj_valid = is_valid(obj)\n\n> > ???\nE NameError: name '__beartype_get_violation' is not defined\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #69: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #70: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #71: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #72: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #73: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #74: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #75: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #76: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #77: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/kind/map/test_utilmapset.py", "test_update_mapping" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.6, "in_degree": 4, "true_in_degree": 6.3999999999999995, "out_degree": 2, "betweenness": 3.793462238793029e-05, "pagerank": 0.00035175006271665756, "harmonic": 0.003289473684210526, "bidirectional_harmonic": 0.2617605210944026, "degree": 6 }, "line_count": 13, "code_line_count": 13, "cyclomatic": 4, "halstead_volume": 2.0, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py", "function_name": "get_hint_pep484585_generic_type", "test_info": { "success": false, "failed": 41, "passed": 1089, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_wpl21gw8/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585gentest.py:295\nError: AttributeError: 'NoneType' object has no attribute '__mro__'. Did you mean: '__bool__'?\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> is_hint_pep484585_generic_user(hint_base) # pyright: ignore\n\n> is_hint_pep484585_generic(hint) and not (\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> not _is_hint_pep484585_generic_blacklisted(hint)\n\n> raise exception\n\n> return_value = args_flat_to_return_value[args_flat] = func(\n\n> @callable_cached\n def _is_hint_pep484585_generic_blacklisted(hint: Hint) -> bool:\n '''\n :data:`True` only if the passed :pep:`484`- or :pep:`585`-compliant generic\n is **beartype-blacklisted** (i.e., defined in a third-party package or\n module known to be hostile to runtime type-checking).\n \n This tester is memoized for efficiency.\n \n Parameters\n ----------\n hint : Hint\n Generic to be inspected.\n \n Returns\n -------\n bool\n :data:`True` only if this generic is beartype-blacklisted.\n \n See Also\n --------\n :func:`.is_object_module_thirdparty_blacklisted`\n Further details on beartype-blacklisting.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_type)\n \n # Either:\n # * If this generic is already unsubscripted, this generic as is.\n # * Else, this generic is subscripted. In this case, the unsubscripted\n # generic underlying this subscripted generic.\n hint_type = get_hint_pep484585_generic_type(hint)\n \n # For each possibly erased superclass of this generic, arbitrarily iterated\n # according to the method resolution order (MRO) for this generic...\n> for hint_base in hint_type.__mro__:\nE AttributeError: 'NoneType' object has no attribute '__mro__'. Did you mean: '__bool__'?\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_base_in_module_first\nLocation: /tmp/benchmark_wpl21gw8/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:1207\nError: AttributeError: 'NoneType' object has no attribute '__mro__'. Did you mean: '__bool__'?\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_base_in_module_first() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_base_in_module_first`\n finder.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import Generic\n from beartype._data.hint.datahinttyping import T\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_base_in_module_first)\n from pytest import raises\n \n # ....................{ CLASSES }....................\n class ToWhichThisClosingNight(object):\n '''\n Arbitrary superclass.\n '''\n \n pass\n \n \n class OfTheDyingYear(Generic[T], str, ToWhichThisClosingNight):\n '''\n Arbitrary generic subclassing:\n \n * The generic superclass subscripted by a type variable.\n * An arbitrary type *not* defined by the :mod:`beartype_test` package.\n * An arbitrary type defined by the :mod:`beartype_test` package.\n '''\n \n pass\n \n # ....................{ LOCALS }....................\n # Tuple of all generic type hints to be tested below, including...\n TEST_GENERICS = (\n # An unsubscripted generic.\n OfTheDyingYear,\n # A subscripted generic (subscripted by an arbitrary type).\n OfTheDyingYear[int],\n )\n \n # ....................{ ASSERTS }....................\n # For each such generic type hint...\n for test_generic in TEST_GENERICS:\n # ....................{ PASS }....................\n # Assert that this finder passed this generic returns the first unerased\n # superclass of this generic declared by this package.\n assert get_hint_pep484585_generic_base_in_module_first(\n hint=test_generic, module_name='beartype_test') is (\n ToWhichThisClosingNight)\n \n # ....................{ FAIL }....................\n # Assert that this finder passed this generic and the name of a\n # hypothetical module guaranteed *NOT* to exist raises the expected\n # exception.\n with raises(BeartypeDecorHintPep484585Exception):\n> get_hint_pep484585_generic_base_in_module_first(\n hint=test_generic,\n module_name='will_be.the.dome_of.a_vast_sepulchre',\n )\n\n> def get_hint_pep484585_generic_base_in_module_first(\n # Mandatory parameters.\n hint: Hint,\n module_name: str,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> type:\n '''\n Iteratively find and return the first **unerased superclass** (i.e.,\n unerased pseudo-superclass that is an actual superclass) transitively\n defined under the third-party package or module with the passed name\n subclassed by the unsubscripted generic type underlying the passed\n :pep:`484`- or :pep:`585`-compliant **generic** (i.e., object that may *not*\n actually be a class despite subclassing at least one PEP-compliant type hint\n that also may *not* actually be a class).\n \n This finder is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Although doing so *would* dramatically\n improve the efficiency of this getter, doing so:\n \n * Would require all passed parameters be passed positionally, which becomes\n rather cumbersome given the number of requisite parameters.\n * Is (currently) unnecessary, as all callers of this function are themselves\n already memoized.\n \n Motivation\n ----------\n This finder is typically called to reduce **descriptive generics** (i.e.,\n generics defined in third-party packages intended to be used *only* as\n descriptive type hints rather than actually instantiated as objects as most\n generics are) to the isinstanceable classes those generics describe.\n Although the mere existence of descriptive generics should be considered to\n be a semantic (if not syntactic) violation of :pep:`484`, the widespread\n proliferation of descriptive generics leaves :mod:`beartype` with little\n choice but to grin wanly and bear the pain they subject us to. As example,\n this finder is currently called elsewhere to:\n \n * Reduce Pandera type hints (e.g., `pandera.typing.DataFrame[...]`) to the\n Pandas types they describe (e.g., `pandas.DataFrame`).\n * Reduce NumPy type hints (e.g., `numpy.typing.NDArray[...]`) to the\n NumPy types they describe (e.g., `numpy.ndarray`).\n \n See examples below for further discussion.\n \n Parameters\n ----------\n hint : Hint\n Generic type hint to be inspected.\n module_name : str\n Fully-qualified name of the third-party package or module to find the\n first class in this generic type hint of.\n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`.BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n type\n First unerased superclass transitively defined under this package or\n module subclassed by the unsubscripted generic type underlying this\n generic type hint.\n \n Examples\n --------\n .. code-block:: python\n \n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_base_in_module_first)\n \n # Reduce a Pandera type hint to the Pandas type it describes.\n >>> from pandera import DataFrameModel\n >>> from pandera.typing import DataFrame\n >>> class MuhModel(DataFrameModel): pass\n >>> get_hint_pep484585_generic_base_in_module_first(\n ... hint=DataFrame[MuhModel], module_name='pandas', ...)\n \n '''\n assert isinstance(module_name, str), f'{repr(module_name)} not string.'\n \n # Avoid circular import dependencies.\n from beartype._util.module.utilmodget import get_object_module_name_or_none\n \n # Either:\n # * If this generic is unsubscripted, this unsubscripted generic type as is.\n # * If this generic is subscripted, the unsubscripted generic type\n # underlying this subscripted generic (e.g., the type\n # \"pandera.typing.pandas.DataFrame\" given the type hint\n # \"pandera.typing.DataFrame[...]\").\n hint_type = get_hint_pep484585_generic_type(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # Fully-qualified name of the module to be searched for suffixed by a \".\"\n # delimiter. This is a micro-optimization improving lookup speed below.\n module_name_prefix = f'{module_name}.'\n \n # Tuple of the one or more unerased pseudo-superclasses which this\n # unsubscripted generic type originally subclassed prior to type erasure.\n #\n # Note that we could also inspect the method-resolution order (MRO) of this\n # type via the \"hint.__mro__\" dunder tuple, but that doing so would only\n # needlessly reduce the efficiency of the following iteration by\n # substantially increasing the number of iterations required to find the\n # desired superclass and thus the worst-case complexity of that iteration.\n hint_type_bases = get_hint_pep484585_generic_bases_unerased(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # For each unerased pseudo-superclass of this unsubscripted generic type...\n for hint_base in hint_type_bases:\n # If this pseudo-superclass is *NOT* an actual superclass, silently\n # ignore this non-superclass and continue to the next pseudo-superclass.\n if not isinstance(hint_base, type):\n continue\n # Else, this pseudo-superclass is an actual superclass.\n \n # Fully-qualified name of the module declaring this superclass if any\n # *OR* \"None\" otherwise (i.e., if this type is only defined in-memory).\n hint_base_module_name = get_object_module_name_or_none(hint_base)\n \n # If this module exists *AND* either...\n if hint_base_module_name and (\n # This module is the desired module itself *OR*...\n hint_base_module_name == module_name_prefix or\n # This module is a submodule of the desired module...\n hint_base_module_name.startswith(module_name_prefix)\n # Then return this superclass.\n ):\n # print(f'Found generic {repr(hint)} type {repr(hint_type)} \"{module_name}\" superclass {repr(hint_base)}!')\n return hint_base\n # Else, this is *NOT* the desired module. In this case, continue to the\n # next superclass.\n # Else, *NO* superclass of this generic resides in the desired module.\n \n # Raise an exception of the passed type.\n raise exception_cls(\n f'{exception_prefix}PEP 484 or 585 generic {repr(hint)} '\n f'type {repr(hint_type)} subclasses no \"{module_name}\" type '\n f'(i.e., type with module name prefixed by \"{module_name}\" not '\n> f'found in method resolution order (MRO) {repr(hint_type.__mro__)}).'\n )\nE AttributeError: 'NoneType' object has no attribute '__mro__'. Did you mean: '__bool__'?\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_unsubscripted", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_subscripted", "Failure #6: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585gentest.py::test_is_hint_pep484585_generic_user", "Failure #7: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return", "Failure #8: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py::test_reduce_hint_pep484_generic_io_to_pep544_protocol", "Failure #9: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py::test_is_hint_pep585_builtin", "Failure #10: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #11: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable", "Failure #12: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none", "Failure #13: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing", "Failure #14: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep", "Failure #15: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #16: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #17: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep", "Failure #18: beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep", "Failure #19: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #20: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #21: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #22: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #23: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #24: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #25: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #26: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #27: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #28: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #29: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #30: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #41: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_base_in_module_first" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 5, "true_in_degree": 11.560000000000002, "out_degree": 1, "betweenness": 0.00037753981328940146, "pagerank": 0.001022590723762585, "harmonic": 0.0024671052631578946, "bidirectional_harmonic": 0.23207770847573508, "degree": 6 }, "line_count": 14, "code_line_count": 14, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/metadata/metasane.py", "function_name": "unpack_hint_or_sane", "test_info": { "success": false, "failed": 103, "passed": 1027, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark_mdrhdbwv/beartype/_check/convert/_reduce/redhint.py:401\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> hint_or_sane = sanify_hint_root_func(\n\n> hint_or_sane = reduce_hint(\n\n> def reduce_hint(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n arg_kind: Optional[ArgKind] = None,\n cls_stack: TypeStack = None,\n conf: BeartypeConf = BEARTYPE_CONF_DEFAULT,\n decor_meta: Optional[BeartypeDecorMeta] = None,\n hints_overridden: Optional[SetHints] = None,\n pith_name: Optional[str] = None,\n reductions_count: int = 0,\n typevar_to_hint: TypeVarToHint = FROZENDICT_EMPTY,\n exception_prefix: str = '',\n ) -> HintOrHintSanifiedData:\n '''\n Lower-level type hint reduced (i.e., converted) from the passed higher-level\n type hint if this hint is reducible *or* this hint as is otherwise (i.e., if\n this hint is irreducible).\n \n This reducer *cannot* be meaningfully memoized, since multiple passed\n parameters (e.g., ``pith_name``, ``cls_stack``) are typically isolated to a\n handful of callables across the codebase currently being decorated by\n :mod:`beartype`. Memoizing this reducer would needlessly consume space and\n time. To improve efficiency, this reducer is instead implemented in terms of\n two lower-level private reducers:\n \n * The memoized :func:`._reduce_hint_cached` reducer, responsible for\n efficiently reducing *most* (but not all) type hints.\n * The unmemoized :func:`._reduce_hint_uncached` reducer, responsible for\n inefficiently reducing the small subset of type hints contextually\n requiring these problematic parameters.\n \n Parameters\n ----------\n hint : Hint\n Type hint to be possibly reduced.\n arg_kind : Optional[ArgKind]\n Either:\n \n * If this hint annotates a parameter of some callable, that parameter's\n **kind** (i.e., :class:`.ArgKind` enumeration member conveying the\n syntactic class of that parameter, constraining how the callable\n declaring that parameter requires that parameter to be passed).\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n conf : BeartypeConf, optional\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object). Defaults\n to the default beartype configuration.\n decor_meta : Optional[BeartypeDecorMeta], optional\n Either:\n \n * If this hint annotates a parameter or return of some callable, the\n :mod:`beartype`-specific decorator metadata describing that callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n hints_overridden : set[Hint], optional\n Mutable set of all previously **overridden hints** (i.e., hints reduced\n to user-defined hint overrides configured by the\n :attr:`beartype.BeartypeConf.hint_overrides` dictionary) reduced by a\n prior call to this function, guarding against accidental infinite\n recursion between lower-level reducers and this higher-level function.\n If a hint has already been overridden in the current call stack rooted\n at the top-most call to this function, this function avoids dangerously\n re-overriding nested instances of the same hint. Defaults to the empty\n set.\n pith_name : Optional[str], optional\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n reductions_count : int, optional\n Current number of total reductions internally performed by *all* calls\n to this function rooted at this function in the current call stack,\n guarding against accidental infinite recursion between lower-level\n reducers and this higher-level function. Defaults to 0.\n typevar_to_hint : TypeVarToHint, optional\n **Type variable lookup table** (i.e., immutable dictionary mapping from\n the :pep:`484`-compliant **type variables** (i.e.,\n :class:`typing.TypeVar` objects) originally parametrizing the origins of\n all transitive parent hints of this hint to the corresponding child\n hints subscripting these parent hints). Defaults to\n :data:`.FROZENDICT_EMPTY`.\n exception_prefix : str, optional\n Human-readable substring prefixing exception messages raised by this\n reducer. Defaults to the empty string.\n \n Returns\n -------\n HintOrHintSanifiedData\n Either:\n \n * If this hint is reducible, either:\n \n * If reducing this hint to a lower-level hint generates supplementary\n metadata, that metadata including that lower-level hint.\n * Else, that lower-level hint alone.\n \n * Else, this hint is irreducible. In this case, this hint unmodified.\n \n Raises\n ------\n BeartypeDecorHintReduceException\n If the number of total reductions internally performed by the current\n call to this function exceeds the maximum. This exception guards against\n accidental infinite recursion between lower-level PEP-specific reducers\n internally called by this higher-level reducer.\n '''\n \n # ....................{ PREAMBLE }....................\n # If passed *NO* hint overrides, default this set to the empty set.\n if hints_overridden is None:\n hints_overridden = set()\n # Else, hint overrides were passed. Preserve these hint overrides as is.\n \n # Validate passed parameters *AFTER* establishing defaults above.\n assert isinstance(conf, BeartypeConf), f'{repr(conf)} not configuration.'\n assert isinstance(hints_overridden, set), (\n f'{repr(hints_overridden)} not set.')\n assert isinstance(reductions_count, int), (\n f'{repr(reductions_count)} not integer.')\n assert isinstance(typevar_to_hint, FrozenDict), (\n f'{repr(typevar_to_hint)} not frozen dictionary.')\n \n # ....................{ LOCALS }....................\n # Original unreduced hint passed to this reducer, preserved so as to be\n # embedded in human-readable exception messages.\n hint_old = hint\n \n # Previously reduced instance of this hint, initialized to the sentinel to\n # guarantee that the passed hint is *NEVER* equal to the previously reduced\n # instance of this hint unless actually reduced below. This is necessary, as\n # \"None\" is a valid type hint reduced to \"type(None)\" below.\n hint_or_sane_prev: HintOrHintSanifiedData = SENTINEL # pyright: ignore\n \n # BeartypeHintOverrides.get() method bound to the user-defined\n # \"hint_overrides\" dictionary of this beartype configuration, localized as a\n # negligible efficiency gain.\n conf_hint_overrides_get = conf.hint_overrides.get\n \n # ....................{ REDUCTION }....................\n # Repeatedly reduce this hint to increasingly irreducible hints until this\n # hint is no longer reducible.\n #\n # Note that this algorithm iteratively reduces this hint with a battery of\n # increasingly non-trivial reductions. For efficiency, reductions are\n # intentionally ordered from most to least efficient.\n while True:\n # print(f'[reduce_hint] Reducing {repr(hint)} with type variable lookup table {repr(typevar_to_hint)}...')\n \n # ....................{ PHASE ~ shallow }....................\n # Attempt to shallowly reduce this hint to the ignorable \"typing.Any\"\n # singleton *BEFORE* attempting reductions that deeply inspect the\n # contents of this hint. Why? Several reasons:\n # * This shallow reduction is an O(1) constant-time operation with\n # negligible constants and thus *INCREDIBLY* fast.\n # * Okay. That's all I've got. It's late, people. I exhaustedly sigh.\n \n # Machine-readable representation of this hint.\n hint_repr = get_hint_repr(hint)\n \n #FIXME: Preserved for posterity, as this seems generically useful. *sigh*\n # # If this hint is beartype-blacklisted (i.e., defined in a third-party\n # # package or module that is hostile to runtime type-checking), return true.\n # # print(f'Testing hint {repr(hint)} third-party blacklisting...')\n # if is_object_module_thirdparty_blacklisted(hint):\n # # print('Blacklisted!')\n # return True\n # # Else, this hint is *NOT* beartype-blacklisted.\n \n # If this hint is shallowly ignorable, reduce this hint to the ignorable\n # \"typing.Any\" singleton.\n #\n # Note that this reduction efficiently applies to multiple signs\n # concurrently, including the \"None\", \"HintSignOptional\", and\n # \"HintSignUnion\". Ergo, this reduction *CANNOT* be trivially\n # implemented as a standard reduction assigned a single sign.\n if hint_repr in HINTS_REPR_IGNORABLE_SHALLOW:\n return Any # pyright: ignore\n # Else, this hint is *NOT* shallowly ignorable.\n \n # ....................{ PHASE ~ override }....................\n # Attempt to reduce this hint to another hint configured by a\n # user-defined hint override *BEFORE* attempting standard reduction.\n # User preference takes precedence over standard precedent.\n \n # Attempt to...\n #\n # Note that the is_object_hashable() tester is internally implemented\n # with the same Easier to Ask for Permission than Forgiveness\n # (EAFP)-based \"try-except\" block and is thus equally inefficient. In\n # fact, the current approach avoids an extraneous call to that tester\n # and is thus marginally faster. (Emphasis on \"marginally.\")\n try:\n # If this hint has *NOT* already been overridden by a previously\n # performed reduction in this recursive tree of all previously\n # performed reductions...\n if hint not in hints_overridden:\n # User-defined hint overriding this hint if this beartype\n # configuration overrides this hint *OR* the sentinel placeholder\n # otherwise (i.e., if this hist is *NOT* overridden).\n # print(f'Overriding hint {repr(hint)} via {repr(conf.hint_overrides)}...')\n hint_reduced = conf_hint_overrides_get(hint, SENTINEL)\n \n # If this hint was overridden...\n if hint_reduced is not SENTINEL:\n # Record this hint as already having been overridden\n # *BEFORE* reducing (and thus obliterating) this hint.\n hints_overridden.add(hint)\n \n # Reduce this hint to this user-defined hint override.\n hint = hint_reduced\n # Else, this hint was *NOT* overridden. In this case, preserve\n # this hint as is.\n # Else, this hint has already been overridden by a previously\n # performed reduction in this recursive tree of all previously\n # performed reductions. In this case, avoid overriding this hint yet\n # again. Doing so would (almost certainly) provoke infinite\n # recursion (e.g., overriding \"float\" with \"int | float\").\n # If doing so raises a \"TypeError\", this hint is unhashable and thus\n # inapplicable for hint overriding. In this case, ignore this hint.\n except TypeError:\n pass\n \n # ....................{ PHASE ~ uncached }....................\n # Attempt to deeply reduce this possibly contextual hint to another hint\n # *BEFORE* attempting to context-free reductions. Why? Because the\n # former depends on context and is thus \"lower-level\" than the latter,\n # which depends on *NO* context and is thus \"higher-level\" in a sense.\n #\n # In theory, order of reduction *SHOULD* be insignificant; in practice,\n # we suspect unforeseen and unpredictable interactions between these two\n # reductions. To reduce the likelihood of fire-breathing dragons here,\n # we reduce contextual hints first.\n hint = _reduce_hint_uncached(\n hint=hint,\n arg_kind=arg_kind,\n cls_stack=cls_stack,\n conf=conf,\n decor_meta=decor_meta,\n hints_overridden=hints_overridden,\n pith_name=pith_name,\n reductions_count=reductions_count,\n typevar_to_hint=typevar_to_hint,\n exception_prefix=exception_prefix,\n )\n \n # If this hint reduces to the PEP 484-compliant \"typing.Any\" singleton,\n # this hint is ignorable. In this case, halt reducing.\n #\n # Note that this is an optional short-circuiting optimization avoiding\n # multiple repetitious reductions for each ignorable hint.\n if hint is Any:\n return Any\n # Else, this hint is currently unignorable. Continue reducing.\n \n # ....................{ PHASE ~ cached }....................\n # Sane hint reduced from this possibly insane hint if reducing this hint\n # did not generate supplementary metadata *OR* that metadata otherwise\n # (i.e., if reducing this hint generated supplementary metadata).\n hint_or_sane = _reduce_hint_cached(hint, conf, exception_prefix)\n \n # If this hint reduces to the PEP 484-compliant \"typing.Any\" singleton,\n # this hint is ignorable. In this case, halt reducing.\n #\n # Note that, unlike the similar test above, this test is required rather\n # than merely an optimization.\n if hint_or_sane is Any:\n return Any # pyright: ignore\n # Else, this hint is currently unignorable. Continue reducing.\n #\n # If the current and previously reduced instances of this hint are\n # identical, the above reductions all preserved this hint as is rather\n # than reducing this hint. This implies this hint to now be irreducible.\n # Halt reducing.\n elif hint_or_sane is hint_or_sane_prev:\n break\n # Else, the current and previously reduced instances of this hint\n # differ, implying this hint to still be reducible. Continue reducing.\n \n # This possibly context-free hint efficiently reduced to another hint\n # and the resulting type variable lookup table.\n> hint, typevar_to_hint = unpack_hint_or_sane(\n hint_or_sane=hint_or_sane, typevar_to_hint=typevar_to_hint)\nE TypeError: cannot unpack non-iterable NoneType object\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals\nLocation: /tmp/benchmark_mdrhdbwv/beartype/_check/convert/_reduce/redhint.py:401\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_door_typehint_equals(\n door_cases_equality: 'Iterable[Tuple[object, object, bool]]') -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.__equals__` dunder method.\n \n Parameters\n ----------\n door_cases_equality : Iterable[Tuple[object, object, bool]]\n Iterable of one or more 3-tuples ``(hint_a, hint_b, is_equal)``,\n declared by the :func:`hint_subhint_cases` fixture.\n '''\n \n # Defer test-specific imports.\n from beartype.door import TypeHint\n \n # Intentionally import from \"typing\" rather than \"beartype.typing\" to\n # guarantee PEP 484-compliant type hints.\n from typing import (\n Generator,\n Union,\n )\n \n # Arbitrary hint guaranteed to be unequal to every other hint listed in the\n # \"hint_equality_cases\" iterable.\n typehint_unequal = TypeHint(Generator[Union[list, str], str, None])\n \n # Arbitrary non-hint object. Note that strings are valid type hints!\n nonhint = b'Of insects, beasts, and birds, becomes its spoil;'\n \n # For each equality relation to be tested...\n for hint_a, hint_b, IS_EQUAL in door_cases_equality:\n # \"TypeHint\" instances encapsulating these hints.\n typehint_a = TypeHint(hint_a)\n typehint_b = TypeHint(hint_b)\n \n # Assert this tester returns the expected boolean for these hints.\n is_equal = (typehint_a == typehint_b)\n assert is_equal is IS_EQUAL\n \n # Assert this tester returns the expected boolean for each such hint and\n # another arbitrary hint guaranteed to be unequal to these hints. In\n # other words, perform a smoke test.\n> assert typehint_a != typehint_unequal\n\n> return not (self == other)\n\n> return func(self_or_cls, arg)\n\n> return self._is_equal(other)\n\n> self.is_subhint(other) and\n\n> return func(self_or_cls, arg)\n\n> self._is_subhint(other)\n\n> self._is_subhint_branch(other_branch)\n\n> branch._is_args_ignorable and\n\n> ???\n\n> return all(\n\n> hint_child.is_ignorable for hint_child in self._args_wrapped_tuple)\n\n> return sanify_hint_child(self._hint) is Any # pyright: ignore\n\n> hint_or_sane = reduce_hint(\n\n> hint = _reduce_hint_uncached(\n\n> hint = hint_reducer(\n\n> hint_or_sane_child = reduce_hint_child(hint_child, kwargs)\n\n> return reduce_hint(hint=hint, **kwargs)\n\n> def reduce_hint(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n arg_kind: Optional[ArgKind] = None,\n cls_stack: TypeStack = None,\n conf: BeartypeConf = BEARTYPE_CONF_DEFAULT,\n decor_meta: Optional[BeartypeDecorMeta] = None,\n hints_overridden: Optional[SetHints] = None,\n pith_name: Optional[str] = None,\n reductions_count: int = 0,\n typevar_to_hint: TypeVarToHint = FROZENDICT_EMPTY,\n exception_prefix: str = '',\n ) -> HintOrHintSanifiedData:\n '''\n Lower-level type hint reduced (i.e., converted) from the passed higher-level\n type hint if this hint is reducible *or* this hint as is otherwise (i.e., if\n this hint is irreducible).\n \n This reducer *cannot* be meaningfully memoized, since multiple passed\n parameters (e.g., ``pith_name``, ``cls_stack``) are typically isolated to a\n handful of callables across the codebase currently being decorated by\n :mod:`beartype`. Memoizing this reducer would needlessly consume space and\n time. To improve efficiency, this reducer is instead implemented in terms of\n two lower-level private reducers:\n \n * The memoized :func:`._reduce_hint_cached` reducer, responsible for\n efficiently reducing *most* (but not all) type hints.\n * The unmemoized :func:`._reduce_hint_uncached` reducer, responsible for\n inefficiently reducing the small subset of type hints contextually\n requiring these problematic parameters.\n \n Parameters\n ----------\n hint : Hint\n Type hint to be possibly reduced.\n arg_kind : Optional[ArgKind]\n Either:\n \n * If this hint annotates a parameter of some callable, that parameter's\n **kind** (i.e., :class:`.ArgKind` enumeration member conveying the\n syntactic class of that parameter, constraining how the callable\n declaring that parameter requires that parameter to be passed).\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n conf : BeartypeConf, optional\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object). Defaults\n to the default beartype configuration.\n decor_meta : Optional[BeartypeDecorMeta], optional\n Either:\n \n * If this hint annotates a parameter or return of some callable, the\n :mod:`beartype`-specific decorator metadata describing that callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n hints_overridden : set[Hint], optional\n Mutable set of all previously **overridden hints** (i.e., hints reduced\n to user-defined hint overrides configured by the\n :attr:`beartype.BeartypeConf.hint_overrides` dictionary) reduced by a\n prior call to this function, guarding against accidental infinite\n recursion between lower-level reducers and this higher-level function.\n If a hint has already been overridden in the current call stack rooted\n at the top-most call to this function, this function avoids dangerously\n re-overriding nested instances of the same hint. Defaults to the empty\n set.\n pith_name : Optional[str], optional\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n reductions_count : int, optional\n Current number of total reductions internally performed by *all* calls\n to this function rooted at this function in the current call stack,\n guarding against accidental infinite recursion between lower-level\n reducers and this higher-level function. Defaults to 0.\n typevar_to_hint : TypeVarToHint, optional\n **Type variable lookup table** (i.e., immutable dictionary mapping from\n the :pep:`484`-compliant **type variables** (i.e.,\n :class:`typing.TypeVar` objects) originally parametrizing the origins of\n all transitive parent hints of this hint to the corresponding child\n hints subscripting these parent hints). Defaults to\n :data:`.FROZENDICT_EMPTY`.\n exception_prefix : str, optional\n Human-readable substring prefixing exception messages raised by this\n reducer. Defaults to the empty string.\n \n Returns\n -------\n HintOrHintSanifiedData\n Either:\n \n * If this hint is reducible, either:\n \n * If reducing this hint to a lower-level hint generates supplementary\n metadata, that metadata including that lower-level hint.\n * Else, that lower-level hint alone.\n \n * Else, this hint is irreducible. In this case, this hint unmodified.\n \n Raises\n ------\n BeartypeDecorHintReduceException\n If the number of total reductions internally performed by the current\n call to this function exceeds the maximum. This exception guards against\n accidental infinite recursion between lower-level PEP-specific reducers\n internally called by this higher-level reducer.\n '''\n \n # ....................{ PREAMBLE }....................\n # If passed *NO* hint overrides, default this set to the empty set.\n if hints_overridden is None:\n hints_overridden = set()\n # Else, hint overrides were passed. Preserve these hint overrides as is.\n \n # Validate passed parameters *AFTER* establishing defaults above.\n assert isinstance(conf, BeartypeConf), f'{repr(conf)} not configuration.'\n assert isinstance(hints_overridden, set), (\n f'{repr(hints_overridden)} not set.')\n assert isinstance(reductions_count, int), (\n f'{repr(reductions_count)} not integer.')\n assert isinstance(typevar_to_hint, FrozenDict), (\n f'{repr(typevar_to_hint)} not frozen dictionary.')\n \n # ....................{ LOCALS }....................\n # Original unreduced hint passed to this reducer, preserved so as to be\n # embedded in human-readable exception messages.\n hint_old = hint\n \n # Previously reduced instance of this hint, initialized to the sentinel to\n # guarantee that the passed hint is *NEVER* equal to the previously reduced\n # instance of this hint unless actually reduced below. This is necessary, as\n # \"None\" is a valid type hint reduced to \"type(None)\" below.\n hint_or_sane_prev: HintOrHintSanifiedData = SENTINEL # pyright: ignore\n \n # BeartypeHintOverrides.get() method bound to the user-defined\n # \"hint_overrides\" dictionary of this beartype configuration, localized as a\n # negligible efficiency gain.\n conf_hint_overrides_get = conf.hint_overrides.get\n \n # ....................{ REDUCTION }....................\n # Repeatedly reduce this hint to increasingly irreducible hints until this\n # hint is no longer reducible.\n #\n # Note that this algorithm iteratively reduces this hint with a battery of\n # increasingly non-trivial reductions. For efficiency, reductions are\n # intentionally ordered from most to least efficient.\n while True:\n # print(f'[reduce_hint] Reducing {repr(hint)} with type variable lookup table {repr(typevar_to_hint)}...')\n \n # ....................{ PHASE ~ shallow }....................\n # Attempt to shallowly reduce this hint to the ignorable \"typing.Any\"\n # singleton *BEFORE* attempting reductions that deeply inspect the\n # contents of this hint. Why? Several reasons:\n # * This shallow reduction is an O(1) constant-time operation with\n # negligible constants and thus *INCREDIBLY* fast.\n # * Okay. That's all I've got. It's late, people. I exhaustedly sigh.\n \n # Machine-readable representation of this hint.\n hint_repr = get_hint_repr(hint)\n \n #FIXME: Preserved for posterity, as this seems generically useful. *sigh*\n # # If this hint is beartype-blacklisted (i.e., defined in a third-party\n # # package or module that is hostile to runtime type-checking), return true.\n # # print(f'Testing hint {repr(hint)} third-party blacklisting...')\n # if is_object_module_thirdparty_blacklisted(hint):\n # # print('Blacklisted!')\n # return True\n # # Else, this hint is *NOT* beartype-blacklisted.\n \n # If this hint is shallowly ignorable, reduce this hint to the ignorable\n # \"typing.Any\" singleton.\n #\n # Note that this reduction efficiently applies to multiple signs\n # concurrently, including the \"None\", \"HintSignOptional\", and\n # \"HintSignUnion\". Ergo, this reduction *CANNOT* be trivially\n # implemented as a standard reduction assigned a single sign.\n if hint_repr in HINTS_REPR_IGNORABLE_SHALLOW:\n return Any # pyright: ignore\n # Else, this hint is *NOT* shallowly ignorable.\n \n # ....................{ PHASE ~ override }....................\n # Attempt to reduce this hint to another hint configured by a\n # user-defined hint override *BEFORE* attempting standard reduction.\n # User preference takes precedence over standard precedent.\n \n # Attempt to...\n #\n # Note that the is_object_hashable() tester is internally implemented\n # with the same Easier to Ask for Permission than Forgiveness\n # (EAFP)-based \"try-except\" block and is thus equally inefficient. In\n # fact, the current approach avoids an extraneous call to that tester\n # and is thus marginally faster. (Emphasis on \"marginally.\")\n try:\n # If this hint has *NOT* already been overridden by a previously\n # performed reduction in this recursive tree of all previously\n # performed reductions...\n if hint not in hints_overridden:\n # User-defined hint overriding this hint if this beartype\n # configuration overrides this hint *OR* the sentinel placeholder\n # otherwise (i.e., if this hist is *NOT* overridden).\n # print(f'Overriding hint {repr(hint)} via {repr(conf.hint_overrides)}...')\n hint_reduced = conf_hint_overrides_get(hint, SENTINEL)\n \n # If this hint was overridden...\n if hint_reduced is not SENTINEL:\n # Record this hint as already having been overridden\n # *BEFORE* reducing (and thus obliterating) this hint.\n hints_overridden.add(hint)\n \n # Reduce this hint to this user-defined hint override.\n hint = hint_reduced\n # Else, this hint was *NOT* overridden. In this case, preserve\n # this hint as is.\n # Else, this hint has already been overridden by a previously\n # performed reduction in this recursive tree of all previously\n # performed reductions. In this case, avoid overriding this hint yet\n # again. Doing so would (almost certainly) provoke infinite\n # recursion (e.g., overriding \"float\" with \"int | float\").\n # If doing so raises a \"TypeError\", this hint is unhashable and thus\n # inapplicable for hint overriding. In this case, ignore this hint.\n except TypeError:\n pass\n \n # ....................{ PHASE ~ uncached }....................\n # Attempt to deeply reduce this possibly contextual hint to another hint\n # *BEFORE* attempting to context-free reductions. Why? Because the\n # former depends on context and is thus \"lower-level\" than the latter,\n # which depends on *NO* context and is thus \"higher-level\" in a sense.\n #\n # In theory, order of reduction *SHOULD* be insignificant; in practice,\n # we suspect unforeseen and unpredictable interactions between these two\n # reductions. To reduce the likelihood of fire-breathing dragons here,\n # we reduce contextual hints first.\n hint = _reduce_hint_uncached(\n hint=hint,\n arg_kind=arg_kind,\n cls_stack=cls_stack,\n conf=conf,\n decor_meta=decor_meta,\n hints_overridden=hints_overridden,\n pith_name=pith_name,\n reductions_count=reductions_count,\n typevar_to_hint=typevar_to_hint,\n exception_prefix=exception_prefix,\n )\n \n # If this hint reduces to the PEP 484-compliant \"typing.Any\" singleton,\n # this hint is ignorable. In this case, halt reducing.\n #\n # Note that this is an optional short-circuiting optimization avoiding\n # multiple repetitious reductions for each ignorable hint.\n if hint is Any:\n return Any\n # Else, this hint is currently unignorable. Continue reducing.\n \n # ....................{ PHASE ~ cached }....................\n # Sane hint reduced from this possibly insane hint if reducing this hint\n # did not generate supplementary metadata *OR* that metadata otherwise\n # (i.e., if reducing this hint generated supplementary metadata).\n hint_or_sane = _reduce_hint_cached(hint, conf, exception_prefix)\n \n # If this hint reduces to the PEP 484-compliant \"typing.Any\" singleton,\n # this hint is ignorable. In this case, halt reducing.\n #\n # Note that, unlike the similar test above, this test is required rather\n # than merely an optimization.\n if hint_or_sane is Any:\n return Any # pyright: ignore\n # Else, this hint is currently unignorable. Continue reducing.\n #\n # If the current and previously reduced instances of this hint are\n # identical, the above reductions all preserved this hint as is rather\n # than reducing this hint. This implies this hint to now be irreducible.\n # Halt reducing.\n elif hint_or_sane is hint_or_sane_prev:\n break\n # Else, the current and previously reduced instances of this hint\n # differ, implying this hint to still be reducible. Continue reducing.\n \n # This possibly context-free hint efficiently reduced to another hint\n # and the resulting type variable lookup table.\n> hint, typevar_to_hint = unpack_hint_or_sane(\n hint_or_sane=hint_or_sane, typevar_to_hint=typevar_to_hint)\nE TypeError: cannot unpack non-iterable NoneType object\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #4: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #5: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #6: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass", "Failure #7: beartype_test/a00_unit/a60_check/a20_code/test_codemake.py::test_make_check_code_decoration", "Failure #8: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #9: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #12: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #13: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #14: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #15: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #16: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #17: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #18: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #19: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #20: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_hint_invalid_fail", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_hint_nonpep", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep613.py::test_decor_pep613", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #75: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #76: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #77: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #78: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #79: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_name_fail", "Failure #80: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #81: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #82: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #83: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #84: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #85: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #86: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #87: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #88: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #89: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #90: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #91: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #92: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #93: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #94: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #95: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #96: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #97: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #98: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #99: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #100: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #101: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #102: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #103: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py", "test_door_typehint_equals" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 5, "true_in_degree": 20.20000000000001, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0008075588541379738, "harmonic": 0.0, "bidirectional_harmonic": 0.2442963469279258, "degree": 5 }, "line_count": 21, "code_line_count": 21, "cyclomatic": 5, "halstead_volume": 7.924812503605781, "halstead_difficulty": 3.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep593.py", "function_name": "get_hint_pep593_metadata", "test_info": { "success": false, "failed": 14, "passed": 1116, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_is_hint_pep593_beartype\nLocation: /tmp/benchmark_rn5o9p8d/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py:74\nError: assert False is True\n + where False = (typing.Annotated[str, beartype.vale.Is[lambda text: bool(text)]])\n\nTraceback:\n\n> def test_is_hint_pep593_beartype() -> None:\n '''\n Test usage of the private\n :mod:`beartype._util.hint.pep.proposal.pep593.is_hint_pep593_beartype`\n tester.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype.typing import Annotated\n from beartype.vale import Is\n from beartype._util.hint.pep.proposal.pep593 import is_hint_pep593_beartype\n from beartype._util.py.utilpyversion import IS_PYTHON_AT_LEAST_3_10\n from pytest import raises\n \n # ....................{ PASS }....................\n # Assert this tester rejects beartype-agnostic metahints.\n assert is_hint_pep593_beartype(\n Annotated[str, 'And may there be no sadness of farewell']) is False\n \n # If the active Python interpreter targets Python >= 3.10, assert this\n # tester accepts a beartype-specific metahint annotated by a beartype\n # validator defined as a lambda function. For unknown reasons, the obsolete\n # Python 3.9-specific implementation of the standard \"inspect\" module fails\n # to inspect the definition of this lambda function; this then induces\n # unexpected warnings. Although we *COULD* catch these warnings here, it's\n # simpler to simply ignore Python 3.9 for now. Yo! Laziness prevails.\n if IS_PYTHON_AT_LEAST_3_10:\n> assert is_hint_pep593_beartype(\n Annotated[str, Is[lambda text: bool(text)]]) is True\nE assert False is True\nE + where False = (typing.Annotated[str, beartype.vale.Is[lambda text: bool(text)]])\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py::test_get_hint_pep593_metadata\nLocation: /tmp/benchmark_rn5o9p8d/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py:102\nError: assert None == ('Thy', 'caverns', 'echoing', 'to', 'the', \"Arve's\", ...)\n + where None = (typing.Annotated[typing.Optional[str], 'Thy', 'caverns', 'echoing', 'to', 'the', \"Arve's\", 'commotion,'])\n\nTraceback:\n\n> def test_get_hint_pep593_metadata() -> None:\n '''\n Test the\n :beartype._util.hint.pep.proposal.pep593.get_hint_pep593_metadata`\n getter.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep593Exception\n from beartype.typing import (\n Annotated,\n Optional,\n )\n from beartype._util.hint.pep.proposal.pep593 import get_hint_pep593_metadata\n from pytest import raises\n \n # Assert this getter returns the expected tuple for an arbitrary PEP\n # 593-compliant type hint.\n> assert get_hint_pep593_metadata(Annotated[\n Optional[str],\n 'Thy', 'caverns', 'echoing', 'to', 'the', \"Arve's\", 'commotion,'\n ]) == (\n 'Thy', 'caverns', 'echoing', 'to', 'the', \"Arve's\", 'commotion,')\nE assert None == ('Thy', 'caverns', 'echoing', 'to', 'the', \"Arve's\", ...)\nE + where None = (typing.Annotated[typing.Optional[str], 'Thy', 'caverns', 'echoing', 'to', 'the', \"Arve's\", 'commotion,'])\n", "Failure #3: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals", "Failure #4: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #5: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #6: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint", "Failure #7: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #11: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #14: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py", "test_is_hint_pep593_beartype" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py", "test_get_hint_pep593_metadata" ] ] }, "complexity_info": { "centrality": { "distance_discount": 9.531238400000001, "in_degree": 4, "true_in_degree": 8.48, "out_degree": 1, "betweenness": 2.438654296366947e-05, "pagerank": 0.0005265071782065316, "harmonic": 0.010694705513784463, "bidirectional_harmonic": 0.24106430849851876, "degree": 5 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/checkmake.py", "function_name": "make_code_raiser_func_pep484_noreturn_check", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin\nLocation: /tmp/benchmark_omq39omn/beartype/_decor/wrap/_wrapreturn.py:154\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_decor_type_descriptor_builtin() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on **C-based unbound builtin\n method descriptors** (i.e., methods decorated by builtin method decorators).\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from beartype.typing import NoReturn\n from pytest import raises\n \n # ....................{ CLASSES }....................\n> class OrDidASeaOfFire(object):\n\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_decorator(obj, **kwargs) # type: ignore[return-value]\n\n> descriptor_deleter = beartype_func(descriptor_deleter, **kwargs)\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> def code_check_return(decor_meta: BeartypeDecorMeta) -> str:\n '''\n Generate a Python code snippet type-checking the annotated return declared\n by the decorated callable if any *or* the empty string otherwise (i.e., if\n this return is unannotated).\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to be type-checked.\n \n Returns\n -------\n str\n Code type-checking any annotated return of the decorated callable.\n \n Raises\n ------\n BeartypeDecorHintPep484585Exception\n If this callable is either:\n \n * A coroutine *not* annotated by a :obj:`typing.Coroutine` type hint.\n * A generator *not* annotated by a :obj:`typing.Generator` type hint.\n * An asynchronous generator *not* annotated by a\n :obj:`typing.AsyncGenerator` type hint.\n BeartypeDecorHintNonpepException\n If the type hint annotating this return (if any) of this callable is\n neither:\n \n * **PEP-compliant** (i.e., :mod:`beartype`-agnostic hint compliant with\n annotation-centric PEPs).\n * **PEP-noncompliant** (i.e., :mod:`beartype`-specific type hint *not*\n compliant with annotation-centric PEPs)).\n '''\n assert isinstance(decor_meta, BeartypeDecorMeta), (\n f'{repr(decor_meta)} not beartype call.')\n \n # ..................{ LOCALS }..................\n # Possibly insane hint annotating this callable's return if any *OR* the\n # sentinel placeholder otherwise (i.e., if this return is unannotated).\n #\n # Note that \"None\" is a semantically meaningful PEP 484-compliant hint\n # equivalent to \"type(None)\". Ergo, we *MUST* explicitly distinguish between\n # \"None\" and an unannotated return with a sentinel.\n hint_insane: Hint = decor_meta.func_arg_name_to_hint_get( # pyright: ignore\n ARG_NAME_RETURN, SENTINEL)\n # print(f'func {decor_meta} return hint_insane: {hint_insane}')\n \n # If this return is unannotated, silently reduce to a noop.\n if hint_insane is SENTINEL:\n return ''\n # Else, this return is annotated.\n \n # Python code snippet to be returned, defaulting to the empty string\n # implying this callable's return to either be unannotated *OR* annotated by\n # a safely ignorable type hint.\n func_wrapper_code = ''\n \n # Lexical scope (i.e., dictionary mapping from the relative unqualified name\n # to value of each locally or globally scoped attribute accessible to a\n # callable or class), initialized to \"None\" for safety.\n func_scope: LexicalScope = None # type: ignore[assignment]\n \n # ..................{ GENERATE }..................\n # Attempt to...\n try:\n # With a context manager \"catching\" *ALL* non-fatal warnings emitted\n # during this logic for subsequent \"playrback\" below...\n with catch_warnings(record=True) as warnings_issued:\n # Sane hint sanified from this possibly insane return hint if\n # sanifying this hint generated no supplementary metadata *OR*\n # that metadata otherwise. Additionally, if this hint is unsupported\n # by @beartype, raise an exception.\n #\n # Note that:\n # * This hint must sanitized *BEFORE* testing this hint. Why? The\n # PEP 484-compliant \"typing.NoReturn\" return hint in conjunction\n # with PEP 563. If this return hint is \"typing.NoReturn\" *AND*\n # this submodule enables PEP 563 via \"from __future__ import\n # annotations, then this hint will be the useless string\n # \"NoReturn\" rather than the useful hint \"typing.NoReturn\". In\n # this case, this hist *MUST* be sanitized first; doing so\n # destringifies this string into a usable hint, enabling this hint\n # to then be detected below.\n # * For the exact same reason, this sanitization *CANNOT* be\n # performed in the low-level make_check_expr() dynamically\n # generating code type-checking this hint.\n hint_or_sane = sanify_hint_root_func(\n decor_meta=decor_meta,\n hint=hint_insane,\n pith_name=ARG_NAME_RETURN,\n exception_prefix=EXCEPTION_PLACEHOLDER,\n )\n # print(f'Sanified {repr(decor_meta.func_wrappee)} return hint {repr(hint_insane)} to {repr(hint)}...')\n \n # If this is the PEP 484-compliant \"typing.NoReturn\" type hint\n # allowed *ONLY* as a return annotation...\n if hint_or_sane is NoReturn:\n # Pre-generated code snippet validating this callable to *NEVER*\n # successfully return by unconditionally generating a violation.\n code_noreturn_check = PEP484_CODE_CHECK_NORETURN.format(\n func_call_prefix=decor_meta.func_wrapper_code_call_prefix)\n \n # Code snippet handling the previously generated violation by\n # either raising that violation as a fatal exception or emitting\n # that violation as a non-fatal warning.\n> (\n code_noreturn_violation,\n func_scope,\n _\n ) = make_code_raiser_func_pep484_noreturn_check(decor_meta.conf)\nE TypeError: cannot unpack non-iterable NoneType object\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn\nLocation: /tmp/benchmark_omq39omn/beartype/_decor/wrap/_wrapreturn.py:154\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_decor_pep484_hint_noreturn() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on synchronous callables\n against all edge cases of the :pep:`484`-compliant :attr:`typing.NoReturn`\n type hint, which is valid *only* as an unsubscripted return annotation.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import (\n BeartypeCallHintViolation,\n BeartypeDecorHintPep484Exception,\n )\n from beartype.typing import (\n NoReturn,\n Union,\n )\n from beartype_test._util.pytroar import raises_uncached\n \n # ..................{ LOCALS }..................\n # Exception guaranteed to be raised *ONLY* by the mending_wall() function.\n class BeforeIBuiltAWallIdAskToKnow(Exception): pass\n \n # Synchronous callable unconditionally raising an exception correctly\n # annotating its return as \"NoReturn\".\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> def code_check_return(decor_meta: BeartypeDecorMeta) -> str:\n '''\n Generate a Python code snippet type-checking the annotated return declared\n by the decorated callable if any *or* the empty string otherwise (i.e., if\n this return is unannotated).\n \n Parameters\n ----------\n decor_meta : BeartypeDecorMeta\n Decorated callable to be type-checked.\n \n Returns\n -------\n str\n Code type-checking any annotated return of the decorated callable.\n \n Raises\n ------\n BeartypeDecorHintPep484585Exception\n If this callable is either:\n \n * A coroutine *not* annotated by a :obj:`typing.Coroutine` type hint.\n * A generator *not* annotated by a :obj:`typing.Generator` type hint.\n * An asynchronous generator *not* annotated by a\n :obj:`typing.AsyncGenerator` type hint.\n BeartypeDecorHintNonpepException\n If the type hint annotating this return (if any) of this callable is\n neither:\n \n * **PEP-compliant** (i.e., :mod:`beartype`-agnostic hint compliant with\n annotation-centric PEPs).\n * **PEP-noncompliant** (i.e., :mod:`beartype`-specific type hint *not*\n compliant with annotation-centric PEPs)).\n '''\n assert isinstance(decor_meta, BeartypeDecorMeta), (\n f'{repr(decor_meta)} not beartype call.')\n \n # ..................{ LOCALS }..................\n # Possibly insane hint annotating this callable's return if any *OR* the\n # sentinel placeholder otherwise (i.e., if this return is unannotated).\n #\n # Note that \"None\" is a semantically meaningful PEP 484-compliant hint\n # equivalent to \"type(None)\". Ergo, we *MUST* explicitly distinguish between\n # \"None\" and an unannotated return with a sentinel.\n hint_insane: Hint = decor_meta.func_arg_name_to_hint_get( # pyright: ignore\n ARG_NAME_RETURN, SENTINEL)\n # print(f'func {decor_meta} return hint_insane: {hint_insane}')\n \n # If this return is unannotated, silently reduce to a noop.\n if hint_insane is SENTINEL:\n return ''\n # Else, this return is annotated.\n \n # Python code snippet to be returned, defaulting to the empty string\n # implying this callable's return to either be unannotated *OR* annotated by\n # a safely ignorable type hint.\n func_wrapper_code = ''\n \n # Lexical scope (i.e., dictionary mapping from the relative unqualified name\n # to value of each locally or globally scoped attribute accessible to a\n # callable or class), initialized to \"None\" for safety.\n func_scope: LexicalScope = None # type: ignore[assignment]\n \n # ..................{ GENERATE }..................\n # Attempt to...\n try:\n # With a context manager \"catching\" *ALL* non-fatal warnings emitted\n # during this logic for subsequent \"playrback\" below...\n with catch_warnings(record=True) as warnings_issued:\n # Sane hint sanified from this possibly insane return hint if\n # sanifying this hint generated no supplementary metadata *OR*\n # that metadata otherwise. Additionally, if this hint is unsupported\n # by @beartype, raise an exception.\n #\n # Note that:\n # * This hint must sanitized *BEFORE* testing this hint. Why? The\n # PEP 484-compliant \"typing.NoReturn\" return hint in conjunction\n # with PEP 563. If this return hint is \"typing.NoReturn\" *AND*\n # this submodule enables PEP 563 via \"from __future__ import\n # annotations, then this hint will be the useless string\n # \"NoReturn\" rather than the useful hint \"typing.NoReturn\". In\n # this case, this hist *MUST* be sanitized first; doing so\n # destringifies this string into a usable hint, enabling this hint\n # to then be detected below.\n # * For the exact same reason, this sanitization *CANNOT* be\n # performed in the low-level make_check_expr() dynamically\n # generating code type-checking this hint.\n hint_or_sane = sanify_hint_root_func(\n decor_meta=decor_meta,\n hint=hint_insane,\n pith_name=ARG_NAME_RETURN,\n exception_prefix=EXCEPTION_PLACEHOLDER,\n )\n # print(f'Sanified {repr(decor_meta.func_wrappee)} return hint {repr(hint_insane)} to {repr(hint)}...')\n \n # If this is the PEP 484-compliant \"typing.NoReturn\" type hint\n # allowed *ONLY* as a return annotation...\n if hint_or_sane is NoReturn:\n # Pre-generated code snippet validating this callable to *NEVER*\n # successfully return by unconditionally generating a violation.\n code_noreturn_check = PEP484_CODE_CHECK_NORETURN.format(\n func_call_prefix=decor_meta.func_wrapper_code_call_prefix)\n \n # Code snippet handling the previously generated violation by\n # either raising that violation as a fatal exception or emitting\n # that violation as a non-fatal warning.\n> (\n code_noreturn_violation,\n func_scope,\n _\n ) = make_code_raiser_func_pep484_noreturn_check(decor_meta.conf)\nE TypeError: cannot unpack non-iterable NoneType object\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py", "test_decor_type_descriptor_builtin" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py", "test_decor_pep484_hint_noreturn" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 1, "betweenness": 1.3548079424260817e-06, "pagerank": 0.00026956759715380407, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.1828673838953454, "degree": 2 }, "line_count": 18, "code_line_count": 18, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_decor/_decornontype.py", "function_name": "_beartype_descriptor_decorator_builtin_class_or_static_method", "test_info": { "success": false, "failed": 12, "passed": 1118, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin\nLocation: /tmp/benchmark_sdurxeal/beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py:157\nError: TypeError: 'NoneType' object is not callable\n\nTraceback:\n\n> def test_decor_type_descriptor_builtin() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on **C-based unbound builtin\n method descriptors** (i.e., methods decorated by builtin method decorators).\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from beartype.typing import NoReturn\n from pytest import raises\n \n # ....................{ CLASSES }....................\n class OrDidASeaOfFire(object):\n '''\n Arbitrary class declaring a class method, static method, property\n getter, property setter, and property deleter -- all decorated by the\n :func:`beartype.beartype` decorator.\n '''\n \n # ....................{ CLASS VARS }....................\n so_much_of_life_and_joy_is_lost = 'all seems eternal now.'\n '''\n Arbitrary class variable.\n '''\n \n # ....................{ DUNDERS }....................\n def __init__(self) -> None:\n '''\n Arbitrary constructor, defined merely to set an instance variable\n subsequently manipulated by property methods defined below.\n '''\n \n self._taught_her_young_ruin = (\n 'Ruin? Were these their toys? or did a sea')\n \n # ....................{ CLASS METHODS }....................\n @beartype\n @classmethod\n def envelop_once_this_silent_snow(cls) -> str:\n '''\n Arbitrary class method decorated first by the builtin\n :class:`classmethod` descriptor and then by the\n :func:`beartype.beartype` decorator, exercising an edge case in the\n :func:`beartype.beartype` decorator.\n \n Note that reversing this order of decoration does *not* exercise an\n edge case in the :func:`beartype.beartype` decorator and is thus\n omitted from testing.\n '''\n \n return f'None can reply\u2014{cls.so_much_of_life_and_joy_is_lost}'\n \n # ....................{ STATIC METHODS }....................\n @beartype\n @staticmethod\n def the_wilderness_has_a_mysterious_tongue(\n of_man_flies_far_in_dread: str = '') -> str:\n '''\n Arbitrary static method decorated first by the builtin\n :class:`staticmethod` descriptor and then by the\n :func:`beartype.beartype` decorator, exercising an edge case in the\n :func:`beartype.beartype` decorator.\n \n Note that reversing this order of decoration does *not* exercise an\n edge case in the :func:`beartype.beartype` decorator and is thus\n omitted from testing.\n '''\n \n return f'Which teaches awful doubt,{of_man_flies_far_in_dread}'\n \n # ....................{ PROPERTIES }....................\n @beartype\n @property\n def where_the_old_earthquake_daemon(self) -> str:\n '''\n Arbitrary property getter method decorated first by the builtin\n :class:`staticmethod` descriptor and then by the\n :func:`beartype.beartype` decorator, exercising an edge case in the\n :func:`beartype.beartype` decorator.\n \n Note that reversing this order of decoration does *not* exercise an\n edge case in the :func:`beartype.beartype` decorator and is thus\n omitted from testing.\n '''\n \n return self._taught_her_young_ruin\n \n \n @beartype\n @where_the_old_earthquake_daemon.setter\n def where_the_old_earthquake_daemon(self, vanish: str) -> None:\n '''\n Arbitrary property setter method decorated first by the builtin\n :class:`staticmethod` descriptor and then by the\n :func:`beartype.beartype` decorator, exercising an edge case in the\n :func:`beartype.beartype` decorator.\n \n Note that reversing this order of decoration does *not* exercise an\n edge case in the :func:`beartype.beartype` decorator and is thus\n omitted from testing.\n '''\n \n self._taught_her_young_ruin = vanish\n \n \n @beartype\n @where_the_old_earthquake_daemon.deleter\n def where_the_old_earthquake_daemon(self) -> NoReturn:\n '''\n Arbitrary property deleter method decorated first by the builtin\n :class:`staticmethod` descriptor and then by the\n :func:`beartype.beartype` decorator, exercising an edge case in the\n :func:`beartype.beartype` decorator.\n \n Note that reversing this order of decoration does *not* exercise an\n edge case in the :func:`beartype.beartype` decorator and is thus\n omitted from testing.\n '''\n \n raise ValueError('And their place is not known.')\n \n # ....................{ LOCALS }....................\n # Instance of this class.\n the_race = OrDidASeaOfFire()\n \n # ....................{ PASS }....................\n # Assert this class method accessed on both this instance and this class\n # returns the expected value.\n assert (\n> OrDidASeaOfFire.envelop_once_this_silent_snow() ==\n the_race.envelop_once_this_silent_snow() ==\n 'None can reply\u2014all seems eternal now.'\n )\nE TypeError: 'NoneType' object is not callable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple\nLocation: /tmp/benchmark_sdurxeal/beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py:172\nError: TypeError: 'NoneType' object is not callable\n\nTraceback:\n\n> def test_decor_pep484_namedtuple() -> None:\n '''\n Test the :func:`beartype.beartype` decorator against all edge cases of\n instances of user-defined subclasses of the :pep:`484`-compliant\n :attr:`typing.NamedTuple` superclass, which are instances rather than types\n and thus invalid as actual type hints.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.roar import BeartypeCallHintParamViolation\n from typing import (\n NamedTuple,\n Optional,\n )\n from pytest import raises\n \n # ..................{ LOCALS }..................\n @beartype\n class WindsContend(NamedTuple):\n '''\n Arbitrary named tuple type-checked by :func:`beartype.beartype`.\n '''\n \n starbeams: Optional[str]\n '''\n Standard instance variable passed by the :class:`NamedTuple` metaclass\n to the the implicit ``__new__()`` method synthesized for this subclass.\n '''\n \n # Arbitrary instance of this named tuple exercising all edge cases.\n> dart_through_them = WindsContend(\n starbeams='Or the star-beams dart through them. Winds contend')\nE TypeError: 'NoneType' object is not callable\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #8: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #9: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #10: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #11: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #12: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py", "test_decor_type_descriptor_builtin" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py", "test_decor_pep484_namedtuple" ] ] }, "complexity_info": { "centrality": { "distance_discount": 34.573545472, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.03829756683375102, "bidirectional_harmonic": 0.16209945482149474, "degree": 2 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep586.py", "function_name": "get_hint_pep586_literals", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_ahu17qdp/beartype/_check/code/codemake.py:1572\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n with warns(hint_meta.warning_type):\n is_bearable(pith, hint, conf=conf)\n # print(f'Deprecated type hint {repr(hint)} warned!')\n # Else, this tester is expected to emit *NO* warning for this hint. In\n # this case, call this tester outside of such a context manager.\n else:\n> is_bearable(pith, hint, conf=conf)\n\n> func_tester = make_func_tester(hint, conf)\n\n> return func(*args)\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> return func(*args)\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> return func(*args)\n\n> @callable_cached\n def make_check_expr(\n # ..................{ ARGS ~ mandatory }..................\n hint_or_sane: HintOrHintSanifiedData,\n conf: BeartypeConf,\n \n # ..................{ ARGS ~ optional }..................\n cls_stack: TypeStack = None,\n ) -> CodeGenerated:\n '''\n **Type-checking expression factory** (i.e., low-level callable dynamically\n generating a pure-Python boolean expression type-checking an arbitrary\n object against the passed PEP-compliant type hint).\n \n This code factory performs a breadth-first search (BFS) over the abstract\n graph of nested type hints reachable from the subscripted arguments of the\n passed root type hint. For each such (possibly nested) hint, this factory\n embeds one or more boolean subexpressions validating a (possibly nested\n sub)object of an arbitrary object against that hint into the full boolean\n expression created and returned by this factory. In short, this factory is\n the beating heart of :mod:`beartype`. We applaud you for your perseverance.\n You finally found the essence of the Great Bear. You did it!! Now, we clap.\n \n This code factory is memoized for efficiency.\n \n Caveats\n -------\n **This factory intentionally accepts no** ``exception_prefix``\n **parameter.** Why? Since that parameter is typically specific to the\n context-sensitive use case of the caller, accepting that parameter would\n prevent this factory from memoizing the passed hint with the returned code,\n which would rather defeat the point. Instead, this factory only:\n \n * Returns generic non-working code containing the placeholder\n :data:`VAR_NAME_PITH_ROOT` substring that the caller is required to\n globally replace by either the name of the current parameter *or*\n ``return`` for return values (e.g., by calling the builtin\n :meth:`str.replace` method) to generate the desired non-generic working\n code type-checking that parameter or return value.\n * Raises generic non-human-readable exceptions containing the placeholder\n :attr:`beartype._util.error.utilerrraise.EXCEPTION_PLACEHOLDER` substring\n that the caller is required to explicitly catch and raise non-generic\n human-readable exceptions from by calling the\n :func:`beartype._util.error.utilerrraise.reraise_exception_placeholder`\n function.\n \n Parameters\n ----------\n hint_or_sane : HintOrHintSanifiedData\n Either a type hint *or* **sanified type hint metadata** (i.e.,\n :data:`.HintSanifiedData` object) to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n \n Returns\n -------\n CodeGenerated\n Tuple containing the Python code snippet dynamically generated by this\n code generator and metadata describing that code. See also the\n :attr:`beartype._data.hint.datahinttyping.CodeGenerated` type hint.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If this object is *not* a PEP-compliant type hint.\n BeartypeDecorHintPepUnsupportedException\n If this object is a PEP-compliant type hint currently unsupported by\n the :func:`beartype.beartype` decorator.\n BeartypeDecorHintPep484Exception\n If one or more PEP-compliant type hints visitable from this object are\n nested :attr:`typing.NoReturn` child hints, since\n :attr:`typing.NoReturn` is valid *only* as a non-nested return hint.\n BeartypeDecorHintPep593Exception\n If one or more PEP-compliant type hints visitable from this object\n subscript the :pep:`593`-compliant :class:`typing.Annotated` class such\n that:\n \n * The second argument subscripting that class is an instance of the\n :class:`beartype.vale.Is` class.\n * One or more further arguments subscripting that class are *not*\n instances of the :class:`beartype.vale.Is` class.\n \n Warns\n -----\n BeartypeDecorHintPep585DeprecationWarning\n If one or more :pep:`484`-compliant type hints visitable from this\n object have been deprecated by :pep:`585`.\n '''\n \n # ..................{ LOCALS ~ hint : root }..................\n # Unpack the passed sanified hint metadata into:\n # * \"hint_root\", the top-level hint to be type-checked.\n # * \"typevar_to_hint_root\", the top-level type variable lookup table (i.e.,\n # dictionary mapping from each type variable parametrizing the origin of\n # this top-level hint to the child hint subscripting this top-level hint).\n hint_root, typevar_to_hint_root = unpack_hint_or_sane(hint_or_sane)\n # print(f'Received root hint {repr(hint_root)} and type variable lookup table {repr(typevar_to_hint_root)}.')\n \n # ..................{ LOCALS ~ hint : current }..................\n # Currently visited hint.\n hint_curr: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this hint (e.g.,\n # \"Union\" if \"hint_curr == Union[int, str]\").\n hint_curr_sign: HintSign = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : child }..................\n # Currently iterated child hint subscripting the currently visited hint.\n hint_child: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this child hint\n # (e.g., \"Union\" if \"hint_child == Union[int, str]\").\n hint_child_sign: Optional[HintSign] = None\n \n # Currently iterated child hint subscripting the currently visited hint *OR*\n # sanified child hint metadata** (i.e., \"HintSanifiedData\" object describing\n # that child hint).\n hint_or_sane_child: HintOrHintSanifiedData = None # pyright: ignore\n \n # ..................{ LOCALS ~ hint : childs }..................\n # Current tuple of all child hints subscripting the currently visited hint\n # (e.g., \"(int, str)\" if \"hint_curr == Union[int, str]\").\n hint_childs: tuple = None # type: ignore[assignment]\n \n # Number of child hints subscripting the currently visited hint.\n hint_childs_len: int = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : metadata }..................\n # Fixed list of all metadata describing all visitable hints currently\n # discovered by the breadth-first search (BFS) below. This list acts as a\n # standard First In First Out (FILO) queue, enabling this BFS to be\n # implemented as an efficient imperative algorithm rather than an\n # inefficient (and dangerous, due to both unavoidable stack exhaustion and\n # avoidable infinite recursion) recursive algorithm.\n #\n # Note that this list is guaranteed by the previously called\n # _die_if_hint_repr_exceeds_child_limit() function to be larger than the\n # number of hints transitively visitable from this root hint. Ergo, *ALL*\n # indexation into this list performed by this BFS is guaranteed to be safe.\n # Ergo, avoid explicitly testing below that the \"hints_meta.index_last\"\n # integer maintained by this BFS is strictly less than\n # \"FIXED_LIST_SIZE_MEDIUM\", as this constraint is already guaranteed to be\n # the case.\n hints_meta = acquire_instance(HintsMeta)\n \n # Initialize this fixed list.\n hints_meta.reinit(cls_stack=cls_stack, conf=conf)\n \n # 0-based index of metadata describing the currently visited hint in this\n # fixed list.\n hints_meta_index_curr = 0\n \n # ..................{ LOCALS ~ pep : 484 }..................\n # Set of the unqualified classnames referred to by all relative forward\n # references visitable from this root hint if any *OR* \"None\" otherwise\n # (i.e., if no such forward references are visitable).\n hint_refs_type_basename: Optional[set] = None\n \n # ..................{ LOCALS ~ func : code }..................\n # Python code snippet type-checking the root pith against the root hint:\n # * Localized separately from the \"func_wrapper_code\" snippet to enable this\n # function to validate this code to be valid *BEFORE* returning this code.\n # * Initialized to a placeholder string to be globally replaced in the\n # Python code snippet to be returned (i.e., \"func_wrapper_code\") by a\n # Python code snippet type-checking the root pith expression (i.e.,\n # \"VAR_NAME_PITH_ROOT\") against the root hint (i.e., \"hint_root\").\n func_root_code = hints_meta.enqueue_hint_child(\n hint=hint_root,\n # 1-based indentation level describing the initial level of indentation\n # appropriate for the root hint.\n indent_level=1,\n pith_expr=VAR_NAME_PITH_ROOT,\n pith_var_name_index=hints_meta.pith_curr_var_name_index,\n typevar_to_hint=typevar_to_hint_root,\n )\n \n # Python code snippet to be returned, seeded with a placeholder to be\n # replaced on the first iteration of the breadth-first search performed\n # below with a snippet type-checking the root pith against the root hint.\n #\n # Note that, shockingly, brute-force string concatenation has been\n # personally profiled by @leycec to be substantially faster than *ALL*\n # alternatives under CPython up to a large number of iterations (e.g.,\n # 100,000). This includes these popular alternatives, *ALL* of which are\n # orders of magnitude slower than brute-force string concatenation:\n # * deque.append().\n # * list.append().\n func_wrapper_code = func_root_code\n \n # ..................{ SEARCH }..................\n # While the 0-based index of metadata describing the next visited hint in\n # the \"hints_meta\" list does *NOT* exceed that describing the last\n # visitable hint in this list, there remains at least one hint to be\n # visited in the breadth-first search performed by this iteration.\n while hints_meta_index_curr <= hints_meta.index_last:\n # Update instance variables of this queue to reflect that this hint is\n # now the currently visited hint.\n hints_meta.set_hint_curr_meta(\n hint_curr_meta=hints_meta[hints_meta_index_curr])\n \n # Localize metadata for both efficiency and f-string purposes.\n hint_curr = hints_meta.hint_curr_meta.hint\n # print(f'Visiting type hint {repr(hint_curr)}...')\n \n # ................{ PEP }................\n # If this hint is PEP-compliant...\n if is_hint_pep(hint_curr):\n #FIXME: Refactor to call warn_if_hint_pep_unsupported() instead.\n #Actually...wait. This is probably still a valid test here. We'll\n #need to instead augment the is_hint_ignorable() function to\n #additionally test whether the passed hint is unsupported, in which\n #case that function should return false as well as emit a non-fatal\n #warning ala the new warn_if_hint_pep_unsupported() function --\n #which should probably simply be removed now. *sigh*\n #FIXME: Actually, in that case, we can simply reduce the following\n #two calls to simply:\n # die_if_hint_pep_ignorable(\n # hint=hint_curr, exception_prefix=hint_curr_exception_prefix)\n #\n #Of course, this implies we want to refactor the\n #die_if_hint_pep_unsupported() function into\n #die_if_hint_pep_ignorable()... probably.\n \n # If this hint is currently unsupported, raise an exception.\n #\n # Note the human-readable label prefixing the representations of\n # child PEP-compliant type hints is unconditionally passed. Since\n # the root hint has already been validated to be supported by\n # the above call to the same function, this call is guaranteed to\n # *NEVER* raise an exception for that hint.\n die_if_hint_pep_unsupported(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n # Else, this hint is supported.\n \n # Assert that this hint is unignorable. Iteration below generating\n # code for child hints of the current parent hint is *REQUIRED* to\n # explicitly ignore ignorable child hints. Since the caller has\n # explicitly ignored ignorable root hints, these two guarantees\n # together ensure that all hints visited by this breadth-first\n # search *SHOULD* be unignorable. Naturally, we validate that here.\n assert hint_curr is not Any, (\n f'{EXCEPTION_PREFIX}ignorable type hint '\n f'{repr(hint_curr)} not ignored.'\n )\n \n # Sign uniquely identifying this hint.\n hint_curr_sign = get_hint_pep_sign(hint_curr)\n # print(f'Visiting PEP type hint {repr(hint_curr)} sign {repr(hint_curr_sign)}...')\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # NOTE: Whenever adding support for (i.e., when generating code\n # type-checking) a new \"typing\" attribute below, similar support\n # for that attribute *MUST* also be added to the parallel:\n # * \"beartype._check.error\" subpackage, which raises exceptions on\n # the current pith failing this check.\n # * \"beartype._data.hint.pep.sign.datapepsignset.HINT_SIGNS_SUPPORTED_DEEP\"\n # frozen set of all signs for which this function generates deeply\n # type-checking code.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n #FIXME: Python 3.10 provides proper syntactic support for \"case\"\n #statements, which should allow us to dramatically optimize this\n #\"if\" logic into equivalent \"case\" logic *AFTER* we drop support\n #for Python 3.9. Of course, that will be basically never, so we'll\n #have to preserve this for basically forever. What you gonna do?\n #FIXME: Actually, we should probably just leverage a hypothetical\n #\"beartype.vale.IsInline[...]\" validator to coerce this slow O(n)\n #procedural logic into fast O(1) object-oriented logic. Of course,\n #object-oriented logic is itself slow -- so we only do this if we\n #can sufficiently memoize that logic. Consideration!\n \n # Switch on (as in, pretend Python provides a \"case\" statement)\n # the sign identifying this hint to decide which type of code to\n # generate to type-check the current pith against the current hint.\n #\n # This decision is intentionally implemented as a linear series of\n # tests ordered in descending likelihood for efficiency. While\n # alternative implementations (that are more readily readable and\n # maintainable) do exist, these alternatives all appear to be\n # substantially less efficient.\n #\n # Consider the standard alternative of sequestering the body of\n # each test implemented below into either:\n #\n # * A discrete private function called by this function. This\n # approach requires maintaining a global private dictionary\n # mapping from each support unsubscripted typing attribute to\n # the function generating code for that attribute: e.g.,\n # def pep_code_check_union(...): ...\n # _HINT_TYPING_ATTR_ARGLESS_TO_CODER = {\n # typing.Union: pep_code_check_union,\n # }\n # Each iteration of this loop then looks up the function\n # generating code for the current attribute from this dictionary\n # and calls that function to do so. Function calls come with\n # substantial overhead in Python, impacting performance more\n # than the comparable linear series of tests implemented below.\n # Additionally, these functions *MUST* mutate local variables of\n # this function by some arcane means -- either:\n # * Passing these locals to each such function, returning these\n # locals from each such function, and assigning these return\n # values to these locals in this function after each such call.\n # * Passing a single composite fixed list of these locals to each\n # such function, which then mutates these locals in-place,\n # which then necessitates this function permanently store these\n # locals in such a list rather than as local variables.\n # * A discrete closure of this function, which adequately resolves\n # the aforementioned locality issue via the \"nonlocal\" keyword at\n # a substantial up-front performance cost of redeclaring these\n # closures on each invocation of this function.\n #\n # ..............{ SHALLOW }..............\n # Perform shallow type-checking logic (i.e., logic that does *NOT*\n # recurse and thus \"bottoms out\" at this hint) *BEFORE* deep\n # type-checking logic. The latter needs additional setup (e.g.,\n # generation of assignment expressions) *NOT* needed by the former,\n # whose requirements are more understandably minimalist.\n #\n # Note that:\n # * Shallow type-checking code should access this pith via\n # \"pith_curr_expr\". Since this code does *NOT* recurse,\n # \"pith_curr_expr\" accesses this pith optimally efficiently.\n # * Deep type-checking code should access this pith via\n # \"pith_assign_expr\". Since that code *DOES* recurse, only\n # \"pith_assign_expr\" accesses this pith optimally efficiently;\n # \"pith_curr_expr\" accesses this pith extremely inefficiently.\n # * Ignorable type-checking code (i.e., code ignoring this hint but\n # otherwise unsuitable for implementation as a reducer called by\n # the \"beartype._check.convert._reduce.redhint\" submodule, typically\n # due to useful side effects intentionally interacting with this\n # BFS) should follow the design pattern established by the\n # \"HintSignPep695TypeAliasSubscripted\" branch below.\n #\n # ..............{ ORIGIN }..............\n # If this hint both...\n if (\n # Originates from an origin type and may thus be shallowly\n # type-checked against that type *AND is either...\n hint_curr_sign in HINT_SIGNS_ORIGIN_ISINSTANCEABLE and (\n # Unsubscripted *OR*...\n not get_hint_pep_args(hint_curr) or\n # Currently unsupported with deep type-checking...\n hint_curr_sign not in HINT_SIGNS_SUPPORTED_DEEP\n )\n ):\n # Then generate trivial code shallowly type-checking the current\n # pith as an instance of the origin type originating this sign\n # (e.g., \"list\" for the hint \"typing.List[int]\").\n # print(f'Shallow checking unsubscripted hint {repr(hint_curr)}...')\n \n # Code type-checking the current pith against this origin type.\n hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n pith_curr_expr=hints_meta.pith_curr_expr,\n # Python expression evaluating to this origin type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n # Origin type of this hint if any *OR* raise an\n # exception -- which should *NEVER* happen, as this hint\n # was validated above to be supported.\n get_hint_pep_origin_type_isinstanceable(hint_curr)),\n )\n # Else, this hint is either subscripted, not shallowly\n # type-checkable, *OR* deeply type-checkable.\n #\n # ..............{ FORWARDREF }..............\n # If this hint is a forward reference...\n elif hint_curr_sign is HintSignForwardRef:\n # Render this forward reference accessible to the body of this\n # wrapper function by populating:\n # * A Python expression evaluating to the class referred to by\n # this forward reference when accessed via the private\n # \"__beartypistry\" parameter.\n # * A set of the unqualified classnames referred to by all\n # relative forward references, including this reference if\n # relative. If this set was previously uninstantiated (i.e.,\n # \"None\"), this assignment initializes this local to the new\n # set instantiated by this call; else, this assignment\n # preserves this local set as is.\n (\n hints_meta.hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_curr, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n \n #FIXME: *REDUNDANT.* Shallow type-checking code defined below\n #already performs this exact same logic. Excise us up, please.\n # # Code type-checking the current pith against this class.\n # hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n # pith_curr_expr=hints_meta.pith_curr_expr,\n # hint_curr_expr=hints_meta.hint_curr_expr,\n # )\n # Else, this hint is *NOT* a forward reference.\n #\n # Since this hint is *NOT* shallowly type-checkable, this hint\n # *MUST* be deeply type-checkable. So, we do so now.\n #\n # ..............{ DEEP }..............\n # Perform deep type-checking logic (i.e., logic that is guaranteed\n # to recurse and thus *NOT* \"bottom out\" at this hint).\n else:\n # Tuple of all child hints subscripting this hint if any *OR*\n # the empty tuple otherwise (e.g., if this hint is its own\n # unsubscripted \"typing\" attribute).\n #\n # Note that the \"__args__\" dunder attribute is *NOT* guaranteed\n # to exist for arbitrary PEP-compliant type hints. Ergo, we\n # obtain this attribute via a higher-level utility getter.\n hint_childs = get_hint_pep_args(hint_curr)\n \n # Number of these child hints.\n hint_childs_len = len(hint_childs)\n \n # ............{ DEEP ~ expression }............\n #FIXME: Unit test that this is behaving as expected. Doing so\n #will require further generalizations, including:\n #* In the \"beartype._decor.decormain\" submodule:\n # * Detect when running under tests.\n # * When running under tests, define a new\n # \"func_wrapper.__beartype_wrapper_code\" attribute added to\n # decorated callables to be the \"func_wrapper_code\" string\n # rather than True. Note that this obviously isn't the right way\n # to do source code association. Ideally, we'd at least\n # interface with the stdlib \"linecache\" module (e.g., by calling\n # the linecache.lazycache() function intended to be used to\n # cache the source code for non-file-based modules) and possibly\n # even go so far as to define a PEP 302-compatible beartype\n # module loader. That's out of scope, so this suffices for now.\n #* In the \"beartype_test.a00_unit.data._data_hint_pep\" submodule:\n # * Add a new \"_PepHintMetadata.code_str_match_regexes\" field,\n # defined as an iterable of regular expressions matching\n # substrings of the \"func_wrapper.__beartype_wrapper_code\"\n # attribute that are expected to exist.\n # * For most \"HINTS_PEP_META\" entries, default this field to\n # merely the empty tuple.\n # * For deeply nested \"HINTS_PEP_META\" entries, define this\n # field as follows:\n # code_str_match_regexes=(r'\\s+:=\\s+',)\n #* In the \"beartype_test.a00_unit.pep.p484.test_p484\" submodule:\n # * Match the \"pep_hinted.__beartype_wrapper_code\" string against\n # all regular expressions in the \"code_str_match_regexes\"\n # iterable for the currently iterated \"pep_hint_meta\".\n #\n #This is fairly important, as we have no other reusable means of\n #ascertaining whether this is actually being applied in general.\n #FIXME: That's all great, except for the\n #\"func_wrapper.__beartype_wrapper_code\" part. Don't do that,\n #please. We really do just want to do this right the first time. As\n #expected, the key to doing so is the linecache.lazycache()\n #function, whose implementation under Python 3.7 reads:\n #\n # def lazycache(filename, module_globals):\n # \"\"\"Seed the cache for filename with module_globals.\n #\n # The module loader will be asked for the source only when getlines is\n # called, not immediately.\n #\n # If there is an entry in the cache already, it is not altered.\n #\n # :return: True if a lazy load is registered in the cache,\n # otherwise False. To register such a load a module loader with a\n # get_source method must be found, the filename must be a cachable\n # filename, and the filename must not be already cached.\n # \"\"\"\n # if filename in cache:\n # if len(cache[filename]) == 1:\n # return True\n # else:\n # return False\n # if not filename or (filename.startswith('<') and filename.endswith('>')):\n # return False\n # # Try for a __loader__, if available\n # if module_globals and '__loader__' in module_globals:\n # name = module_globals.get('__name__')\n # loader = module_globals['__loader__']\n # get_source = getattr(loader, 'get_source', None)\n #\n # if name and get_source:\n # get_lines = functools.partial(get_source, name)\n # cache[filename] = (get_lines,)\n # return True\n # return False\n #\n #Given that, what we need to do is:\n #* Define a new \"beartype._decor._pep302\" submodule implementing a\n # PEP 302-compatible loader for @beartype-generated wrapper\n # functions, enabling external callers (including the stdlib\n # \"linecache\" module) to obtain the source for these functions.\n # For space efficiency, this submodule should internally store\n # code in a compressed format -- which probably means \"gzip\" for\n # maximal portability. This submodule should at least define these\n # attributes:\n # * \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\", a dictionary mapping from\n # the unique fake module names assigned to @beartype-generated\n # wrapper functions by the @beartype decorator to the compressed\n # source strings for those fake modules.\n # * get_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator and returning the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally access the\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has *NOT* already been registered\n # to that dictionary, raise an exception.\n # * Else, uncompress the compressed source string previously\n # registered under that module name with that dictionary and\n # return that uncompressed string. Don't worry about caching\n # uncompressed strings here; that's exactly what the stdlib\n # \"linecache\" module already does on our behalf.\n # Ergo, this function should have signature resembling:\n # def get_source(func_wrapper_module_name: str) -> str:\n # * set_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator as well as as the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has already been registered to\n # that dictionary, raise an exception.\n # * Else, compress the passed uncompressed source string and\n # register that compressed string under that module name with\n # that dictionary.\n #* In the \"beartype._decor.decormain\" submodule:\n # * Do... something? Oh, boy. Why didn't we finish this comment?\n \n # If the expression yielding the current pith is neither...\n #\n # Note that we explicitly test against piths rather than\n # seemingly equivalent metadata to account for edge cases.\n # Notably, child hints of unions (and possibly other \"typing\"\n # objects) do *NOT* narrow the current pith and are *NOT* the\n # root hint. Ergo, a seemingly equivalent test like\n # \"hints_meta_index_curr != 0\" would generate false positives\n # and thus unnecessarily inefficient code.\n if not (\n # The root pith *NOR*...\n #\n # Note that this is merely a negligible optimization for the\n # common case in which the current pith is the root pith\n # (i.e., this is the first iteration of the outermost loop).\n # The subsequent call to the str.isidentifier() method is\n # *MUCH* more expensive than this object identity test.\n hints_meta.pith_curr_expr is VAR_NAME_PITH_ROOT or\n # A simple Python identifier *NOR*...\n hints_meta.pith_curr_expr.isidentifier() or\n # A complex Python expression already containing the\n # assignment expression-specific walrus operator \":=\". Since\n # this implies this expression to already be an assignment\n # expression, needlessly reassigning the local variable to\n # which this assignment expression was previously assigned\n # as yet another redundant local variable only harms\n # efficiency for *NO* tangible gain (e.g., expanding the\n # efficient assignment expression \"__beartype_pith_1 :=\n # next(iter(__beartype_pith_0))\" to the inefficient\n # assignment expression \"__beartype_pith_2 :=\n # __beartype_pith_1 := next(iter(__beartype_pith_0))\").\n #\n # Note that this edge case is induced by method calls\n # performed below of the form:\n # hints_meta.enqueue_hint_child(\n # ..., pith_expr=pith_curr_assign_expr, ...)\n #\n # As of this writing, the only such edge cases are:\n # * PEP 484- or 604-compliant unions containing *ONLY* two\n # or more PEP-compliant type hints (e.g., \"list[str] |\n # set[bytes]\").\n # * PEP 695-compliant subscripted type aliases.\n ':=' in hints_meta.pith_curr_expr\n ):\n # Then the current pith is ideally assigned to a unique\n # local variable via an assignment expression.\n # print(f'Incrementing hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index} by one.')\n \n # Increment the integer suffixing the name of this variable\n # *BEFORE* defining this variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n hints_meta.pith_curr_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Assignment expression assigning this full expression to\n # this local variable.\n hints_meta.pith_curr_assign_expr = (\n CODE_PEP572_PITH_ASSIGN_EXPR_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n pith_curr_expr=hints_meta.pith_curr_expr,\n ))\n # Else, the current pith is *NOT* safely assignable to a unique\n # local variable via an assignment expression. Since the\n # expression yielding the current pith is a simple Python\n # identifier, there is *NO* benefit to assigning that to another\n # local variable via another assignment expression, which would\n # just be an alias of the existing local variable assigned via\n # the existing assignment expression. Moreover, whereas chained\n # assignments are syntactically valid, chained assignment\n # expressions are syntactically invalid unless explicitly\n # protected by parens: e.g.,\n # >>> a = b = 'Mother*Teacher*Destroyer' # <-- fine\n # >>> (a := \"Mother's Abomination\") # <-- fine\n # >>> (a :=\n # ... (b := \"Mother's Illumination\")) # <-- fine\n # >>> (a := b := \"Mother's Illumination\") # <-- not fine\n # SyntaxError: invalid syntax\n #\n # In this case...\n else:\n # print(f'Preserving hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index}.')\n \n # Preserve the Python code snippet evaluating to the value\n # of the current pith as is.\n hints_meta.pith_curr_assign_expr = hints_meta.pith_curr_expr\n \n # ............{ UNION }............\n # If this hint is a union (e.g., \"typing.Union[bool, str]\",\n # typing.Optional[float]\")...\n if hint_curr_sign in HINT_SIGNS_UNION:\n # Python code snippet type-checking the current pith against\n # this union if this union is unignorable *OR* \"None\".\n make_hint_pep484604_check_expr(hints_meta)\n # Else, this hint is *NOT* a union.\n #\n # ..........{ CONTAINERS }............\n # If this hint is either:\n # * A single-argument container like list[int] or set[str].\n # * A similar hint semantically resembling a single-argument\n # container subscripted by one argument and one or more\n # ignorable arguments like tuple[str, ...].\n #\n # Then this hint is effectively (for all intents and purposes) a\n # standard single-argument container. In this case...\n elif hint_curr_sign in HINT_SIGNS_CONTAINER_ARGS_1:\n # Python code snippet type-checking the current pith against\n # this hint if the child hint subscripting this parent\n # container hint is unignorable *OR* \"None\" otherwise.\n make_hint_pep484585_container_check_expr(hints_meta)\n # Else, this hint is *NOT* a standard single-argument container.\n #\n # ............{ SEQUENCES ~ tuple : fixed }............\n # If this hint is a fixed-length tuple (e.g., \"tuple[int,\n # str]\")...\n #\n # Note that if this hint is a:\n # * PEP 484-compliant \"typing.Tuple\"-based hint, this hint is\n # guaranteed to contain one or more child hints. Moreover, if\n # this hint contains exactly one child hint that is the empty\n # tuple, this hint is the empty fixed-length form\n # \"typing.Tuple[()]\".\n # * PEP 585-compliant \"tuple\"-based hint, this hint is *NOT*\n # guaranteed to contain one or more child hints. If this hint\n # contains *NO* child hints, this hint is equivalent to the\n # empty fixed-length PEP 484-compliant form\n # \"typing.Tuple[()]\". Yes, PEP 585 even managed to violate\n # PEP 484-compliance. UUUURGH!\n #\n # While tuples are sequences, the \"typing.Tuple\" singleton that\n # types tuples violates the syntactic norms established for\n # other standard sequences by concurrently supporting two\n # different syntaxes with equally different semantics:\n # * \"typing.Tuple[{typename}, ...]\", typing a tuple whose items\n # all satisfy the \"{typename}\" child hint. Note that the\n # \"...\" substring here is a literal ellipses.\n # * \"typing.Tuple[{typename1}, {typename2}, ..., {typenameN}]\",\n # typing a tuple whose:\n # * First item satisfies the \"{typename1}\" child hint.\n # * Second item satisfies the \"{typename2}\" child hint.\n # * Last item satisfies the \"{typenameN}\" child hint.\n # Note that the \"...\" substring here is *NOT* a literal\n # ellipses.\n #\n # This is what happens when unreadable APIs are promoted.\n elif hint_curr_sign is HintSignTupleFixed:\n # Initialize the code type-checking this pith against this\n # tuple to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_TUPLE_FIXED_PREFIX\n \n # If this hint is the empty fixed-length tuple, generate\n # and append code type-checking the current pith to be the\n # empty tuple. This edge case constitutes a code smell.\n if is_hint_pep484585_tuple_empty(hint_curr):\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_EMPTY_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name))\n # Else, that ridiculous edge case does *NOT* apply. In this\n # case...\n else:\n # Append code type-checking the length of this pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_LEN_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_childs_len=hint_childs_len,\n ))\n \n #FIXME: Optimize by refactoring into a \"while\" loop.\n # For each possibly ignorable insane child hint of this\n # parent tuple...\n for hint_child_index, hint_child in enumerate(\n hint_childs):\n #FIXME: Refactor most (or even *ALL*) calls to\n #sanify_hint_child() to a new\n #hints_meta.sanify_hint() method. The repetition\n #here is becoming... unnerving.\n \n # Unignorable sane child hint sanified from this\n # possibly ignorable insane child hint *OR* \"None\"\n # otherwise (i.e., if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=hint_child,\n cls_stack=hints_meta.cls_stack,\n conf=hints_meta.conf,\n typevar_to_hint=(\n hints_meta.hint_curr_meta.typevar_to_hint),\n exception_prefix=hints_meta.exception_prefix,\n )\n # print(f'Sanified fixed tuple {hints_meta.hint_curr_meta}...')\n # print(f'...child hint {hint_child} -> {hint_or_sane_child}!')\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Python expression yielding the value of the\n # currently indexed item of this tuple to be\n # type-checked against this child hint.\n pith_child_expr = (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_child_index=hint_child_index,\n ))\n \n # Deeply type-check this child pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_child_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n ))\n # Else, this child hint is ignorable.\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_TUPLE_FIXED_SUFFIX}'\n # Format...\n ).format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n )\n # Else, this hint is *NOT* a fixed-length tuple.\n #\n # ..........{ MAPPINGS }............\n # If this hint is a standard mapping (e.g., \"dict[str, int]\")...\n elif hint_curr_sign in HINT_SIGNS_MAPPING:\n # Python expression evaluating to the origin type of this\n # mapping hint as a hidden beartype-specific parameter\n # injected into the signature of this wrapper function.\n hints_meta.hint_curr_expr = (\n hints_meta.add_func_scope_type_or_types(\n get_hint_pep_origin_type_isinstanceable(hint_curr)))\n \n # 2-tuple of the possibly ignorable insane child key and\n # value hints subscripting this mapping hint, defined as\n # either...\n hint_childs = (\n #FIXME: Note that a similar effect can also be achieved\n #through a reduction from type hints the form\n #\"{collections,typing}.Counter[{hint_child}]\" to:\n # typing.Annotated[\n # collections.abc.MutableMapping[{hint_child}, int],\n # beartype.vale.IsInstance[collections.Counter]\n # ]\n #However, the current approach is even *MORE* trivial\n #than that reduction. So, we currently prefer this.\n \n # If this hint describes a \"collections.Counter\"\n # dictionary subclass:\n # * The \"typing.Counter[...]\" type hint factory is\n # subscriptable by only a single key child type hint\n # and assumes the value child type hint typically\n # subscripting dictionary type hint factories to be\n # the standard \"int\" type (e.g., \"typing.Counter[str]\"\n # effectively expands to \"typing.Counter[str, int]\").\n # * The \"collections.Counter[...]\" type hint factory is\n # technically subscriptable by an arbitrary number of\n # child type hints but pragmatically subscriptable by\n # only a single key child type hint. Why? Static\n # type-checkers, which enforce that constraint.\n #\n # Despite these type-checking assumptions and\n # constraints, the \"collections.Counter\" type is itself\n # unconstrained. As of Python 3.13, the\n # collections.Counter.__init__() initializer accepts\n # arbitrary values that are *NOT* integers: e.g.,\n # >>> from collections import Counter\n # >>> c = Counter({'red': 'no, blue!', 'blue': 4.2})\n # >>> print(c)\n # Counter({'red': 'no, blue!', 'blue': 4.2}) # lol\n #\n # That permissiveness arguably constitutes a bug in both\n # CPython itself *AND* user code attempting such\n # shenanigans. Static type-checkers believe this to be\n # the case, anyway -- and that's good enough for us.\n # @beartype thus explicitly catches these bugs by\n # defaulting the undeclared value child type hint for\n # counter type hints to be the \"int\" type.\n (\n get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=EXCEPTION_PREFIX,\n ),\n int,\n )\n if hint_curr_sign is HintSignCounter else\n # Else, this hint does *NOT* describe a\n # \"collections.Counter\" dictionary subclass. In this\n # case, introspect the child key and value type hints\n # subscripting this parent hint in the standard way.\n get_hint_pep484585_args( # type: ignore[assignment]\n hint=hint_curr,\n args_len=2,\n exception_prefix=EXCEPTION_PREFIX,\n )\n )\n \n #FIXME: Consider also contextually considering child key\n #hints that reduce to \"Hashable\" to be ignorable. This\n #includes complex type hints like \"Union[Hashable, str]\",\n #which reduces to \"Hashable\". We can't particularly be\n #bothered at the moment. This is a microoptimization and\n #will probably require a non-trivial amount of work. *sigh*\n # Unignorable sane child key and value hints sanified from\n # these possibly ignorable insane child key and value hints\n # *OR* \"None\" otherwise (i.e., if ignorable).\n hint_or_sane_child_key = (\n sanify_hint_child(\n hint=hint_childs[0],\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n hint_or_sane_child_value = (\n sanify_hint_child(\n hint=hint_childs[1], # type: ignore[has-type]\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n \n # If at least one of these child hints are unignorable...\n if not (\n hint_or_sane_child_key is Any and\n hint_or_sane_child_value is Any\n ):\n # If this child key hint is unignorable...\n if hint_or_sane_child_key is not Any:\n # If this child value hint is also unignorable...\n if hint_or_sane_child_value is not Any:\n # Increase the indentation level of code\n # type-checking this child value pith.\n hints_meta.indent_level_child += 1\n \n # Increment the integer suffixing the name of a\n # unique local variable storing the value of\n # this child key pith *BEFORE* defining this\n # variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n pith_key_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child key pith\n # against this hint.\n hint_key_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_key,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_key_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child value pith\n # against this hint.\n hint_value_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_VALUE_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_key_var_name=pith_key_var_name,\n ),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Code deeply type-checking these child key and\n # value piths against these hints.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_VALUE_format(\n indent_curr=hints_meta.indent_curr,\n pith_key_var_name=pith_key_var_name, # pyright: ignore\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n hint_key_placeholder=(\n hint_key_placeholder),\n hint_value_placeholder=(\n hint_value_placeholder),\n ))\n # Else, this child value hint is ignorable. In this\n # case...\n else:\n # Code deeply type-checking only this child key\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child key pith against this hint.\n hint_key_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=(\n hint_or_sane_child_key),\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n # Else, this child key hint is ignorable. By process\n # of elimination, this child value hint *MUST* be\n # unignorable. In this case...\n else:\n # Code deeply type-checking only this child value\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_VALUE_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child value pith against this hint.\n hint_value_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_VALUE_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Code deeply type-checking this pith as well as at\n # least one of these child key and value piths.\n hints_meta.func_curr_code = CODE_PEP484585_MAPPING_format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hints_meta.hint_curr_expr,\n func_curr_code_key_value=func_curr_code_key_value,\n )\n # Else, these child key *AND* value hints are both\n # ignorable. In this case, fallback to trivial code\n # shallowly type-checking this pith as an instance of this\n # origin type.\n # Else, this hint is *NOT* a mapping.\n #\n # ............{ ANNOTATED }............\n # If this hint is a PEP 593-compliant type metahint, this\n # metahint is guaranteed by the reduction performed above to be\n # beartype-specific (i.e., metahint whose second argument is a\n # beartype validator produced by subscripting a beartype\n # validator factory). In this case...\n elif hint_curr_sign is HintSignAnnotated:\n # Defer heavyweight imports.\n from beartype.vale._core._valecore import BeartypeValidator\n \n # Initialize the code type-checking this pith against this\n # metahint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP593_VALIDATOR_PREFIX\n \n # Unignorable sane metahint annotating this parent hint\n # sanified from this possibly ignorable insane metahint *OR*\n # \"None\" otherwise (i.e., if this metahint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=get_hint_pep593_metahint(hint_curr),\n conf=conf,\n cls_stack=cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # print(f'[593] metahint: {repr(get_hint_pep593_metahint(hint_curr))}')\n # print(f'[593] hint_curr_meta: {repr(hints_meta.hint_curr_meta)}')\n # print(f'[593] hint_curr: {repr(hint_curr)}; hint_or_sane_child: {repr(hint_or_sane_child)}')\n \n # Tuple of the one or more beartype validators annotating\n # this metahint.\n hints_child = get_hint_pep593_metadata(hint_curr)\n # print(f'hints_child: {repr(hints_child)}')\n \n # If this metahint is ignorable...\n if hint_or_sane_child is Any:\n # Expression yielding the value of the current pith,\n # defined as either...\n hint_curr_expr = (\n hints_meta.pith_curr_expr\n # If this metahint is annotated by only one beartype\n # validator, the most efficient expression yielding\n # the value of the current pith is simply the full\n # Python expression *WITHOUT* assigning that value\n # to a reusable local variable in an assignment\n # expression. *NO* assignment expression is needed\n # in this case.\n #\n # Why? Because beartype validators are *NEVER*\n # recursed into. Each beartype validator is\n # guaranteed to be the leaf of a type-checking\n # subtree, guaranteeing this pith to be evaluated\n # only once.\n if len(hints_child) == 1 else\n # Else, this metahint is annotated by two or more\n # beartype validators. In this case, the most\n # efficient expression yielding the value of the\n # current pith is the assignment expression\n # assigning this value to a reusable local variable.\n hints_meta.pith_curr_assign_expr\n )\n # Else, this metahint is unignorable. In this case...\n else:\n # Python expression yielding the value of the current\n # pith, defaulting to the name of the local variable\n # assigned to by the assignment expression performed\n # below.\n hint_curr_expr = hints_meta.pith_curr_var_name\n \n # Code deeply type-checking this metahint.\n hints_meta.func_curr_code += (\n CODE_PEP593_VALIDATOR_METAHINT_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression yielding the value of the\n # current pith assigned to a local variable\n # efficiently reused by code generated by the\n # following iteration.\n #\n # Note this child hint is guaranteed to be followed\n # by at least one more test expression referencing\n # this local variable. Why? Because the \"typing\"\n # module forces metahints to be subscripted by one\n # child hint and one or more arbitrary objects.\n # Ergo, we need *NOT* explicitly validate that here.\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=hints_meta.pith_curr_assign_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n #FIXME: Optimize by refactoring into a \"while\" loop. *sigh*\n # For the 0-based index and each beartype validator\n # annotating this metahint...\n for hint_child_index, hint_child in enumerate(hints_child):\n # print(f'Type-checking PEP 593 type hint {repr(hint_curr)} argument {repr(hint_child)}...')\n # If this is *NOT* a beartype validator, raise an\n # exception.\n #\n # Note that the previously called sanify_hint_child()\n # function validated only the first such to be a\n # beartype validator. All remaining arguments have yet\n # to be validated, so we do so now for consistency and\n # safety.\n if not isinstance(hint_child, BeartypeValidator):\n raise BeartypeDecorHintPep593Exception(\n f'{EXCEPTION_PREFIX}PEP 593 type hint '\n f'{repr(hint_curr)} subscripted by both '\n f'@beartype-specific and -agnostic metadata '\n f'(i.e., {represent_object(hint_child)} not '\n f'beartype validator).'\n )\n # Else, this argument is beartype-specific.\n #\n # If this is any beartype validator *EXCEPT* the first,\n # set the Python expression yielding the value of the\n # current pith to the name of the local variable\n # assigned to by the prior assignment expression. By\n # deduction, it *MUST* be the case now that either:\n # * This metahint was unignorable, in which case this\n # assignment uselessly reduplicates the exact same\n # assignment performed above. While non-ideal, this\n # assignment is sufficiently efficient to make any\n # optimizations here effectively worthless.\n # * This metahint was ignorable, in which case this\n # expression was set above to the assignment\n # expression assigning this pith for the first\n # beartype validator. Since this iteration has already\n # processed the first beartype validator, this\n # assignment expression has already been performed.\n # Avoid inefficiently re-performing this assignment\n # expression for each additional beartype validator by\n # efficiently reusing the previously assigned local.\n elif hint_child_index:\n hint_curr_expr = hints_meta.pith_curr_var_name\n # Else, this is the first beartype validator. See above.\n \n # Code deeply type-checking this validator.\n hints_meta.func_curr_code += CODE_PEP593_VALIDATOR_IS_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression formatting the current pith into\n # the \"{obj}\" format substring previously embedded\n # by this validator into this code string.\n hint_child_expr=hint_child._is_valid_code.format(\n indent=hints_meta.indent_child,\n obj=hint_curr_expr,\n ),\n )\n \n # Generate locals safely merging the locals required by\n # both this validator code *AND* the current code\n # type-checking this entire root hint.\n update_mapping(\n mapping_trg=hints_meta.func_wrapper_scope,\n mapping_src=hint_child._is_valid_code_locals,\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP593_VALIDATOR_SUFFIX_format(indent_curr=hints_meta.indent_curr)}'\n )\n # Else, this hint is *NOT* a metahint.\n #\n # ............{ SUBCLASS }............\n # If this hint is either a PEP 484- or 585-compliant subclass\n # type hint...\n elif hint_curr_sign is HintSignType:\n # Unignorable sane child hint sanified from this possibly\n # ignorable insane child hint *OR* \"None\" otherwise (i.e.,\n # if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n # Possibly ignorable insane child hint subscripting\n # this parent hint, validated to be the *ONLY* child\n # hint subscripting this parent hint.\n hint=get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=hints_meta.exception_prefix,\n ),\n conf=conf,\n cls_stack=hints_meta.cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=hints_meta.exception_prefix,\n )\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Child hint encapsulated by this metadata.\n hint_child = get_hint_or_sane_hint(hint_or_sane_child)\n \n # Sign identifying this child hint.\n hint_child_sign = get_hint_pep_sign_or_none(hint_child)\n \n # If this child hint is a forward reference to a\n # superclass, expose this forward reference to the body\n # of this wrapper function. See above for commentary.\n if hint_child_sign is HintSignForwardRef:\n (\n hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_child, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # Else, this child hint is *NOT* a forward reference. In\n # this case...\n else:\n # If this child hint is a union of superclasses,\n # reduce this union to a tuple of superclasses. Only\n # the latter is safely passable as the second\n # parameter to the issubclass() builtin under all\n # supported Python versions.\n if hint_child_sign is HintSignUnion:\n hint_child = get_hint_pep_args(hint_child) # pyright: ignore\n # Else, this child hint is *NOT* a union.\n \n # If this child hint is *NOT* an issubclassable\n # object, raise an exception.\n #\n # Note that the is_object_issubclassable() tester is\n # considerably faster and thus called before the\n # considerably slower\n # die_unless_object_issubclassable() raiser.\n if not is_object_issubclassable(hint_child): # type: ignore[arg-type]\n die_unless_object_issubclassable(\n obj=hint_child, # type: ignore[arg-type]\n exception_prefix=(\n f'{EXCEPTION_PREFIX}PEP 484 or 585 '\n f'subclass type hint {repr(hint_curr)} '\n f'child type hint '\n ),\n )\n # Else, this child hint is an issubclassable object.\n \n # Python expression evaluating to this child hint.\n hint_curr_expr = hints_meta.add_func_scope_type_or_types(\n hint_child) # pyright: ignore\n \n # Code type-checking this pith against this superclass.\n hints_meta.func_curr_code = CODE_PEP484585_SUBCLASS_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hint_curr_expr,\n indent_curr=hints_meta.indent_curr,\n )\n # Else, this child hint is ignorable. In this case...\n else:\n # Python expression evaluating to the origin type of\n # this hint -- which, by definition, is the \"type\"\n # superclass. Since this superclass is a builtin (i.e.,\n # universally accessible object), we efficiently\n # hardcode the access of this superclass rather than\n # inject a hidden beartype-specific parameter into the\n # signature of this wrapper function as we usually do.\n hints_meta.hint_curr_expr = 'type'\n \n # Fallback to trivial code shallowly type-checking this\n # pith as an instance of this origin type.\n # Else, this hint is *NOT* a subclass type hint.\n #\n # ............{ GENERIC or PROTOCOL }............\n # If this hint is either a:\n # * PEP 484-compliant generic (i.e., user-defined class\n # subclassing a combination of one or more of the\n # \"typing.Generic\" superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 544-compliant protocol (i.e., class subclassing a\n # combination of one or more of the \"typing.Protocol\"\n # superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 585-compliant generic (i.e., user-defined class\n # subclassing at least one non-class PEP 585-compliant\n # pseudo-superclasses) *OR*...\n #\n # ...then this hint is a PEP-compliant generic. In this case...\n elif hint_curr_sign is HintSignPep484585GenericUnsubscripted:\n # print(f'Visiting generic type {repr(hint_curr)}...')\n \n # Initialize the code type-checking this pith against this\n # generic to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_GENERIC_PREFIX\n \n # For each unignorable unerased transitive pseudo-superclass\n # originally declared as a superclass of this generic...\n for hint_or_sane_child in (\n iter_hint_pep484585_generic_bases_unerased(\n hint=hint_curr, # pyright: ignore\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )):\n # print(f'Visiting generic type hint {repr(hint_curr)}...')\n # print(f'...unerased base {repr(hint_child)}...')\n \n # Generate and append code type-checking this pith\n # against this pseudo-superclass.\n hints_meta.func_curr_code += (\n CODE_PEP484585_GENERIC_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n # Python expression efficiently reusing\n # the value of this pith previously\n # assigned to a local variable by the\n # prior expression.\n pith_expr=hints_meta.pith_curr_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_GENERIC_SUFFIX}'\n # Format...\n ).format(\n # Indentation deferred above for efficiency.\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n # Python expression evaluating to this generic type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n hint_curr), # pyright: ignore\n )\n # print(f'{hint_curr_exception_prefix} PEP generic {repr(hint)} handled.')\n # Else, this hint is *NOT* a generic.\n #\n # ............{ PEP 484 ~ type variable }............\n # If this hint is a PEP 484-compliant type variable (i.e.,\n # \"typing.TypeVar\" object), this hint is both dependent on and\n # less common than .PEP 484- and 585-compliant generics and thus\n # intentionally detected immediately after generics. In this\n # case...\n \n #FIXME: Preserved for posterity, once we begin generating\n #call-time type variable type-checking.\n #FIXME: Unit test us up, please.\n #FIXME: Implement corresponding \"beartype._check.error\"\n #validation, please. *sigh*\n # elif hint_curr_sign is HintSignTypeVar:\n # # Either the unignorable hint this type variable reduces to\n # # if any *OR* \"None\" if this type variable is ignorable.\n # hint_child = make_hint_pep484_typevar_check_expr( # type: ignore[assignment]\n # hint_meta=hint_curr_meta,\n # conf=conf,\n # pith_curr_assign_expr=pith_curr_assign_expr,\n # pith_curr_var_name_index=pith_curr_var_name_index,\n # cls_stack=cls_stack,\n # exception_prefix=EXCEPTION_PREFIX,\n # )\n #\n # # If this type variable is reducible to an unignorable\n # # hint, revisit this hint metadata in the outermost \"while\"\n # # loop. Doing so avoids the \"CLEANUP\" logic below, which\n # # assumes this hint to be unignorable and thus\n # # type-checkable.\n # if hint_child is not None:\n # continue\n # # Else, this type variable is *NOT* reducible to an\n # # unignorable hint. Since @beartype currently fails to\n # # generate type-checking code for type variables in and of\n # # themselves, type variables have *NO* intrinsic semantic\n # # meaning and are thus ignorable. In this case, prepare this\n # # BFS to visit the next enqueued hint by incrementing the\n # # 0-based index of metadata describing the next visited hint\n # # in the \"hints_meta\" list *BEFORE* visiting that hint.\n # else:\n # #FIXME: Insufficient. The parent type hint thought this\n # #type variable was unignorable and thus... ugh.\n # hints_meta_index_curr += 1\n # ............{ PEP 586 ~ typing.Literal }............\n # If this hint is a PEP 586-compliant type hint (i.e., the\n # \"typing.Literal\" singleton subscripted by one or more literal\n # objects), this hint is largely useless and thus intentionally\n # detected late. Why? Because \"typing.Literal\" is subscriptable\n # by objects that are instances of only *SIX* possible types,\n # which is sufficiently limiting as to render this singleton\n # patently absurd and a farce that we weep to even implement.\n # In this case...\n elif hint_curr_sign is HintSignLiteral:\n # Tuple of zero or more literal objects subscripting this\n # hint, intentionally replacing the current such tuple due\n # to the non-standard implementation of the third-party\n # \"typing_extensions.Literal\" type hint factory.\n hint_childs = get_hint_pep586_literals(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n \n # Initialize the code type-checking this pith against this\n # hint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP586_PREFIX_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n \n #FIXME: If \"typing.Literal\" is ever extended to support\n #substantially more types (and thus actually becomes\n #useful), optimize the construction of the \"types\" set\n #below to instead leverage a similar\n #\"acquire_instance(set)\" caching solution as that\n #currently employed for unions. For now, we only shrug.\n \n # Python expression evaluating to a tuple of the unique\n # types of all literal objects subscripting this hint.\n> hint_child_types_expr=hints_meta.add_func_scope_type_or_types({\n #FIXME: Optimize by refactoring into a \"while\"\n #loop. Also, this should probably be a \"frozenset\"\n #rather than \"set\". *sigh*\n # Set comprehension of all unique literal objects\n # subscripting this hint, implicitly discarding all\n # duplicate such objects.\n type(hint_child) for hint_child in hint_childs}),\n )\nE TypeError: 'NoneType' object is not iterable\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_ahu17qdp/beartype/_check/code/codemake.py:1572\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n\n> return func(*args)\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> return func(*args)\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> return func(*args)\n\n> @callable_cached\n def make_check_expr(\n # ..................{ ARGS ~ mandatory }..................\n hint_or_sane: HintOrHintSanifiedData,\n conf: BeartypeConf,\n \n # ..................{ ARGS ~ optional }..................\n cls_stack: TypeStack = None,\n ) -> CodeGenerated:\n '''\n **Type-checking expression factory** (i.e., low-level callable dynamically\n generating a pure-Python boolean expression type-checking an arbitrary\n object against the passed PEP-compliant type hint).\n \n This code factory performs a breadth-first search (BFS) over the abstract\n graph of nested type hints reachable from the subscripted arguments of the\n passed root type hint. For each such (possibly nested) hint, this factory\n embeds one or more boolean subexpressions validating a (possibly nested\n sub)object of an arbitrary object against that hint into the full boolean\n expression created and returned by this factory. In short, this factory is\n the beating heart of :mod:`beartype`. We applaud you for your perseverance.\n You finally found the essence of the Great Bear. You did it!! Now, we clap.\n \n This code factory is memoized for efficiency.\n \n Caveats\n -------\n **This factory intentionally accepts no** ``exception_prefix``\n **parameter.** Why? Since that parameter is typically specific to the\n context-sensitive use case of the caller, accepting that parameter would\n prevent this factory from memoizing the passed hint with the returned code,\n which would rather defeat the point. Instead, this factory only:\n \n * Returns generic non-working code containing the placeholder\n :data:`VAR_NAME_PITH_ROOT` substring that the caller is required to\n globally replace by either the name of the current parameter *or*\n ``return`` for return values (e.g., by calling the builtin\n :meth:`str.replace` method) to generate the desired non-generic working\n code type-checking that parameter or return value.\n * Raises generic non-human-readable exceptions containing the placeholder\n :attr:`beartype._util.error.utilerrraise.EXCEPTION_PLACEHOLDER` substring\n that the caller is required to explicitly catch and raise non-generic\n human-readable exceptions from by calling the\n :func:`beartype._util.error.utilerrraise.reraise_exception_placeholder`\n function.\n \n Parameters\n ----------\n hint_or_sane : HintOrHintSanifiedData\n Either a type hint *or* **sanified type hint metadata** (i.e.,\n :data:`.HintSanifiedData` object) to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n \n Returns\n -------\n CodeGenerated\n Tuple containing the Python code snippet dynamically generated by this\n code generator and metadata describing that code. See also the\n :attr:`beartype._data.hint.datahinttyping.CodeGenerated` type hint.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If this object is *not* a PEP-compliant type hint.\n BeartypeDecorHintPepUnsupportedException\n If this object is a PEP-compliant type hint currently unsupported by\n the :func:`beartype.beartype` decorator.\n BeartypeDecorHintPep484Exception\n If one or more PEP-compliant type hints visitable from this object are\n nested :attr:`typing.NoReturn` child hints, since\n :attr:`typing.NoReturn` is valid *only* as a non-nested return hint.\n BeartypeDecorHintPep593Exception\n If one or more PEP-compliant type hints visitable from this object\n subscript the :pep:`593`-compliant :class:`typing.Annotated` class such\n that:\n \n * The second argument subscripting that class is an instance of the\n :class:`beartype.vale.Is` class.\n * One or more further arguments subscripting that class are *not*\n instances of the :class:`beartype.vale.Is` class.\n \n Warns\n -----\n BeartypeDecorHintPep585DeprecationWarning\n If one or more :pep:`484`-compliant type hints visitable from this\n object have been deprecated by :pep:`585`.\n '''\n \n # ..................{ LOCALS ~ hint : root }..................\n # Unpack the passed sanified hint metadata into:\n # * \"hint_root\", the top-level hint to be type-checked.\n # * \"typevar_to_hint_root\", the top-level type variable lookup table (i.e.,\n # dictionary mapping from each type variable parametrizing the origin of\n # this top-level hint to the child hint subscripting this top-level hint).\n hint_root, typevar_to_hint_root = unpack_hint_or_sane(hint_or_sane)\n # print(f'Received root hint {repr(hint_root)} and type variable lookup table {repr(typevar_to_hint_root)}.')\n \n # ..................{ LOCALS ~ hint : current }..................\n # Currently visited hint.\n hint_curr: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this hint (e.g.,\n # \"Union\" if \"hint_curr == Union[int, str]\").\n hint_curr_sign: HintSign = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : child }..................\n # Currently iterated child hint subscripting the currently visited hint.\n hint_child: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this child hint\n # (e.g., \"Union\" if \"hint_child == Union[int, str]\").\n hint_child_sign: Optional[HintSign] = None\n \n # Currently iterated child hint subscripting the currently visited hint *OR*\n # sanified child hint metadata** (i.e., \"HintSanifiedData\" object describing\n # that child hint).\n hint_or_sane_child: HintOrHintSanifiedData = None # pyright: ignore\n \n # ..................{ LOCALS ~ hint : childs }..................\n # Current tuple of all child hints subscripting the currently visited hint\n # (e.g., \"(int, str)\" if \"hint_curr == Union[int, str]\").\n hint_childs: tuple = None # type: ignore[assignment]\n \n # Number of child hints subscripting the currently visited hint.\n hint_childs_len: int = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : metadata }..................\n # Fixed list of all metadata describing all visitable hints currently\n # discovered by the breadth-first search (BFS) below. This list acts as a\n # standard First In First Out (FILO) queue, enabling this BFS to be\n # implemented as an efficient imperative algorithm rather than an\n # inefficient (and dangerous, due to both unavoidable stack exhaustion and\n # avoidable infinite recursion) recursive algorithm.\n #\n # Note that this list is guaranteed by the previously called\n # _die_if_hint_repr_exceeds_child_limit() function to be larger than the\n # number of hints transitively visitable from this root hint. Ergo, *ALL*\n # indexation into this list performed by this BFS is guaranteed to be safe.\n # Ergo, avoid explicitly testing below that the \"hints_meta.index_last\"\n # integer maintained by this BFS is strictly less than\n # \"FIXED_LIST_SIZE_MEDIUM\", as this constraint is already guaranteed to be\n # the case.\n hints_meta = acquire_instance(HintsMeta)\n \n # Initialize this fixed list.\n hints_meta.reinit(cls_stack=cls_stack, conf=conf)\n \n # 0-based index of metadata describing the currently visited hint in this\n # fixed list.\n hints_meta_index_curr = 0\n \n # ..................{ LOCALS ~ pep : 484 }..................\n # Set of the unqualified classnames referred to by all relative forward\n # references visitable from this root hint if any *OR* \"None\" otherwise\n # (i.e., if no such forward references are visitable).\n hint_refs_type_basename: Optional[set] = None\n \n # ..................{ LOCALS ~ func : code }..................\n # Python code snippet type-checking the root pith against the root hint:\n # * Localized separately from the \"func_wrapper_code\" snippet to enable this\n # function to validate this code to be valid *BEFORE* returning this code.\n # * Initialized to a placeholder string to be globally replaced in the\n # Python code snippet to be returned (i.e., \"func_wrapper_code\") by a\n # Python code snippet type-checking the root pith expression (i.e.,\n # \"VAR_NAME_PITH_ROOT\") against the root hint (i.e., \"hint_root\").\n func_root_code = hints_meta.enqueue_hint_child(\n hint=hint_root,\n # 1-based indentation level describing the initial level of indentation\n # appropriate for the root hint.\n indent_level=1,\n pith_expr=VAR_NAME_PITH_ROOT,\n pith_var_name_index=hints_meta.pith_curr_var_name_index,\n typevar_to_hint=typevar_to_hint_root,\n )\n \n # Python code snippet to be returned, seeded with a placeholder to be\n # replaced on the first iteration of the breadth-first search performed\n # below with a snippet type-checking the root pith against the root hint.\n #\n # Note that, shockingly, brute-force string concatenation has been\n # personally profiled by @leycec to be substantially faster than *ALL*\n # alternatives under CPython up to a large number of iterations (e.g.,\n # 100,000). This includes these popular alternatives, *ALL* of which are\n # orders of magnitude slower than brute-force string concatenation:\n # * deque.append().\n # * list.append().\n func_wrapper_code = func_root_code\n \n # ..................{ SEARCH }..................\n # While the 0-based index of metadata describing the next visited hint in\n # the \"hints_meta\" list does *NOT* exceed that describing the last\n # visitable hint in this list, there remains at least one hint to be\n # visited in the breadth-first search performed by this iteration.\n while hints_meta_index_curr <= hints_meta.index_last:\n # Update instance variables of this queue to reflect that this hint is\n # now the currently visited hint.\n hints_meta.set_hint_curr_meta(\n hint_curr_meta=hints_meta[hints_meta_index_curr])\n \n # Localize metadata for both efficiency and f-string purposes.\n hint_curr = hints_meta.hint_curr_meta.hint\n # print(f'Visiting type hint {repr(hint_curr)}...')\n \n # ................{ PEP }................\n # If this hint is PEP-compliant...\n if is_hint_pep(hint_curr):\n #FIXME: Refactor to call warn_if_hint_pep_unsupported() instead.\n #Actually...wait. This is probably still a valid test here. We'll\n #need to instead augment the is_hint_ignorable() function to\n #additionally test whether the passed hint is unsupported, in which\n #case that function should return false as well as emit a non-fatal\n #warning ala the new warn_if_hint_pep_unsupported() function --\n #which should probably simply be removed now. *sigh*\n #FIXME: Actually, in that case, we can simply reduce the following\n #two calls to simply:\n # die_if_hint_pep_ignorable(\n # hint=hint_curr, exception_prefix=hint_curr_exception_prefix)\n #\n #Of course, this implies we want to refactor the\n #die_if_hint_pep_unsupported() function into\n #die_if_hint_pep_ignorable()... probably.\n \n # If this hint is currently unsupported, raise an exception.\n #\n # Note the human-readable label prefixing the representations of\n # child PEP-compliant type hints is unconditionally passed. Since\n # the root hint has already been validated to be supported by\n # the above call to the same function, this call is guaranteed to\n # *NEVER* raise an exception for that hint.\n die_if_hint_pep_unsupported(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n # Else, this hint is supported.\n \n # Assert that this hint is unignorable. Iteration below generating\n # code for child hints of the current parent hint is *REQUIRED* to\n # explicitly ignore ignorable child hints. Since the caller has\n # explicitly ignored ignorable root hints, these two guarantees\n # together ensure that all hints visited by this breadth-first\n # search *SHOULD* be unignorable. Naturally, we validate that here.\n assert hint_curr is not Any, (\n f'{EXCEPTION_PREFIX}ignorable type hint '\n f'{repr(hint_curr)} not ignored.'\n )\n \n # Sign uniquely identifying this hint.\n hint_curr_sign = get_hint_pep_sign(hint_curr)\n # print(f'Visiting PEP type hint {repr(hint_curr)} sign {repr(hint_curr_sign)}...')\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # NOTE: Whenever adding support for (i.e., when generating code\n # type-checking) a new \"typing\" attribute below, similar support\n # for that attribute *MUST* also be added to the parallel:\n # * \"beartype._check.error\" subpackage, which raises exceptions on\n # the current pith failing this check.\n # * \"beartype._data.hint.pep.sign.datapepsignset.HINT_SIGNS_SUPPORTED_DEEP\"\n # frozen set of all signs for which this function generates deeply\n # type-checking code.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n #FIXME: Python 3.10 provides proper syntactic support for \"case\"\n #statements, which should allow us to dramatically optimize this\n #\"if\" logic into equivalent \"case\" logic *AFTER* we drop support\n #for Python 3.9. Of course, that will be basically never, so we'll\n #have to preserve this for basically forever. What you gonna do?\n #FIXME: Actually, we should probably just leverage a hypothetical\n #\"beartype.vale.IsInline[...]\" validator to coerce this slow O(n)\n #procedural logic into fast O(1) object-oriented logic. Of course,\n #object-oriented logic is itself slow -- so we only do this if we\n #can sufficiently memoize that logic. Consideration!\n \n # Switch on (as in, pretend Python provides a \"case\" statement)\n # the sign identifying this hint to decide which type of code to\n # generate to type-check the current pith against the current hint.\n #\n # This decision is intentionally implemented as a linear series of\n # tests ordered in descending likelihood for efficiency. While\n # alternative implementations (that are more readily readable and\n # maintainable) do exist, these alternatives all appear to be\n # substantially less efficient.\n #\n # Consider the standard alternative of sequestering the body of\n # each test implemented below into either:\n #\n # * A discrete private function called by this function. This\n # approach requires maintaining a global private dictionary\n # mapping from each support unsubscripted typing attribute to\n # the function generating code for that attribute: e.g.,\n # def pep_code_check_union(...): ...\n # _HINT_TYPING_ATTR_ARGLESS_TO_CODER = {\n # typing.Union: pep_code_check_union,\n # }\n # Each iteration of this loop then looks up the function\n # generating code for the current attribute from this dictionary\n # and calls that function to do so. Function calls come with\n # substantial overhead in Python, impacting performance more\n # than the comparable linear series of tests implemented below.\n # Additionally, these functions *MUST* mutate local variables of\n # this function by some arcane means -- either:\n # * Passing these locals to each such function, returning these\n # locals from each such function, and assigning these return\n # values to these locals in this function after each such call.\n # * Passing a single composite fixed list of these locals to each\n # such function, which then mutates these locals in-place,\n # which then necessitates this function permanently store these\n # locals in such a list rather than as local variables.\n # * A discrete closure of this function, which adequately resolves\n # the aforementioned locality issue via the \"nonlocal\" keyword at\n # a substantial up-front performance cost of redeclaring these\n # closures on each invocation of this function.\n #\n # ..............{ SHALLOW }..............\n # Perform shallow type-checking logic (i.e., logic that does *NOT*\n # recurse and thus \"bottoms out\" at this hint) *BEFORE* deep\n # type-checking logic. The latter needs additional setup (e.g.,\n # generation of assignment expressions) *NOT* needed by the former,\n # whose requirements are more understandably minimalist.\n #\n # Note that:\n # * Shallow type-checking code should access this pith via\n # \"pith_curr_expr\". Since this code does *NOT* recurse,\n # \"pith_curr_expr\" accesses this pith optimally efficiently.\n # * Deep type-checking code should access this pith via\n # \"pith_assign_expr\". Since that code *DOES* recurse, only\n # \"pith_assign_expr\" accesses this pith optimally efficiently;\n # \"pith_curr_expr\" accesses this pith extremely inefficiently.\n # * Ignorable type-checking code (i.e., code ignoring this hint but\n # otherwise unsuitable for implementation as a reducer called by\n # the \"beartype._check.convert._reduce.redhint\" submodule, typically\n # due to useful side effects intentionally interacting with this\n # BFS) should follow the design pattern established by the\n # \"HintSignPep695TypeAliasSubscripted\" branch below.\n #\n # ..............{ ORIGIN }..............\n # If this hint both...\n if (\n # Originates from an origin type and may thus be shallowly\n # type-checked against that type *AND is either...\n hint_curr_sign in HINT_SIGNS_ORIGIN_ISINSTANCEABLE and (\n # Unsubscripted *OR*...\n not get_hint_pep_args(hint_curr) or\n # Currently unsupported with deep type-checking...\n hint_curr_sign not in HINT_SIGNS_SUPPORTED_DEEP\n )\n ):\n # Then generate trivial code shallowly type-checking the current\n # pith as an instance of the origin type originating this sign\n # (e.g., \"list\" for the hint \"typing.List[int]\").\n # print(f'Shallow checking unsubscripted hint {repr(hint_curr)}...')\n \n # Code type-checking the current pith against this origin type.\n hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n pith_curr_expr=hints_meta.pith_curr_expr,\n # Python expression evaluating to this origin type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n # Origin type of this hint if any *OR* raise an\n # exception -- which should *NEVER* happen, as this hint\n # was validated above to be supported.\n get_hint_pep_origin_type_isinstanceable(hint_curr)),\n )\n # Else, this hint is either subscripted, not shallowly\n # type-checkable, *OR* deeply type-checkable.\n #\n # ..............{ FORWARDREF }..............\n # If this hint is a forward reference...\n elif hint_curr_sign is HintSignForwardRef:\n # Render this forward reference accessible to the body of this\n # wrapper function by populating:\n # * A Python expression evaluating to the class referred to by\n # this forward reference when accessed via the private\n # \"__beartypistry\" parameter.\n # * A set of the unqualified classnames referred to by all\n # relative forward references, including this reference if\n # relative. If this set was previously uninstantiated (i.e.,\n # \"None\"), this assignment initializes this local to the new\n # set instantiated by this call; else, this assignment\n # preserves this local set as is.\n (\n hints_meta.hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_curr, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n \n #FIXME: *REDUNDANT.* Shallow type-checking code defined below\n #already performs this exact same logic. Excise us up, please.\n # # Code type-checking the current pith against this class.\n # hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n # pith_curr_expr=hints_meta.pith_curr_expr,\n # hint_curr_expr=hints_meta.hint_curr_expr,\n # )\n # Else, this hint is *NOT* a forward reference.\n #\n # Since this hint is *NOT* shallowly type-checkable, this hint\n # *MUST* be deeply type-checkable. So, we do so now.\n #\n # ..............{ DEEP }..............\n # Perform deep type-checking logic (i.e., logic that is guaranteed\n # to recurse and thus *NOT* \"bottom out\" at this hint).\n else:\n # Tuple of all child hints subscripting this hint if any *OR*\n # the empty tuple otherwise (e.g., if this hint is its own\n # unsubscripted \"typing\" attribute).\n #\n # Note that the \"__args__\" dunder attribute is *NOT* guaranteed\n # to exist for arbitrary PEP-compliant type hints. Ergo, we\n # obtain this attribute via a higher-level utility getter.\n hint_childs = get_hint_pep_args(hint_curr)\n \n # Number of these child hints.\n hint_childs_len = len(hint_childs)\n \n # ............{ DEEP ~ expression }............\n #FIXME: Unit test that this is behaving as expected. Doing so\n #will require further generalizations, including:\n #* In the \"beartype._decor.decormain\" submodule:\n # * Detect when running under tests.\n # * When running under tests, define a new\n # \"func_wrapper.__beartype_wrapper_code\" attribute added to\n # decorated callables to be the \"func_wrapper_code\" string\n # rather than True. Note that this obviously isn't the right way\n # to do source code association. Ideally, we'd at least\n # interface with the stdlib \"linecache\" module (e.g., by calling\n # the linecache.lazycache() function intended to be used to\n # cache the source code for non-file-based modules) and possibly\n # even go so far as to define a PEP 302-compatible beartype\n # module loader. That's out of scope, so this suffices for now.\n #* In the \"beartype_test.a00_unit.data._data_hint_pep\" submodule:\n # * Add a new \"_PepHintMetadata.code_str_match_regexes\" field,\n # defined as an iterable of regular expressions matching\n # substrings of the \"func_wrapper.__beartype_wrapper_code\"\n # attribute that are expected to exist.\n # * For most \"HINTS_PEP_META\" entries, default this field to\n # merely the empty tuple.\n # * For deeply nested \"HINTS_PEP_META\" entries, define this\n # field as follows:\n # code_str_match_regexes=(r'\\s+:=\\s+',)\n #* In the \"beartype_test.a00_unit.pep.p484.test_p484\" submodule:\n # * Match the \"pep_hinted.__beartype_wrapper_code\" string against\n # all regular expressions in the \"code_str_match_regexes\"\n # iterable for the currently iterated \"pep_hint_meta\".\n #\n #This is fairly important, as we have no other reusable means of\n #ascertaining whether this is actually being applied in general.\n #FIXME: That's all great, except for the\n #\"func_wrapper.__beartype_wrapper_code\" part. Don't do that,\n #please. We really do just want to do this right the first time. As\n #expected, the key to doing so is the linecache.lazycache()\n #function, whose implementation under Python 3.7 reads:\n #\n # def lazycache(filename, module_globals):\n # \"\"\"Seed the cache for filename with module_globals.\n #\n # The module loader will be asked for the source only when getlines is\n # called, not immediately.\n #\n # If there is an entry in the cache already, it is not altered.\n #\n # :return: True if a lazy load is registered in the cache,\n # otherwise False. To register such a load a module loader with a\n # get_source method must be found, the filename must be a cachable\n # filename, and the filename must not be already cached.\n # \"\"\"\n # if filename in cache:\n # if len(cache[filename]) == 1:\n # return True\n # else:\n # return False\n # if not filename or (filename.startswith('<') and filename.endswith('>')):\n # return False\n # # Try for a __loader__, if available\n # if module_globals and '__loader__' in module_globals:\n # name = module_globals.get('__name__')\n # loader = module_globals['__loader__']\n # get_source = getattr(loader, 'get_source', None)\n #\n # if name and get_source:\n # get_lines = functools.partial(get_source, name)\n # cache[filename] = (get_lines,)\n # return True\n # return False\n #\n #Given that, what we need to do is:\n #* Define a new \"beartype._decor._pep302\" submodule implementing a\n # PEP 302-compatible loader for @beartype-generated wrapper\n # functions, enabling external callers (including the stdlib\n # \"linecache\" module) to obtain the source for these functions.\n # For space efficiency, this submodule should internally store\n # code in a compressed format -- which probably means \"gzip\" for\n # maximal portability. This submodule should at least define these\n # attributes:\n # * \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\", a dictionary mapping from\n # the unique fake module names assigned to @beartype-generated\n # wrapper functions by the @beartype decorator to the compressed\n # source strings for those fake modules.\n # * get_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator and returning the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally access the\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has *NOT* already been registered\n # to that dictionary, raise an exception.\n # * Else, uncompress the compressed source string previously\n # registered under that module name with that dictionary and\n # return that uncompressed string. Don't worry about caching\n # uncompressed strings here; that's exactly what the stdlib\n # \"linecache\" module already does on our behalf.\n # Ergo, this function should have signature resembling:\n # def get_source(func_wrapper_module_name: str) -> str:\n # * set_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator as well as as the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has already been registered to\n # that dictionary, raise an exception.\n # * Else, compress the passed uncompressed source string and\n # register that compressed string under that module name with\n # that dictionary.\n #* In the \"beartype._decor.decormain\" submodule:\n # * Do... something? Oh, boy. Why didn't we finish this comment?\n \n # If the expression yielding the current pith is neither...\n #\n # Note that we explicitly test against piths rather than\n # seemingly equivalent metadata to account for edge cases.\n # Notably, child hints of unions (and possibly other \"typing\"\n # objects) do *NOT* narrow the current pith and are *NOT* the\n # root hint. Ergo, a seemingly equivalent test like\n # \"hints_meta_index_curr != 0\" would generate false positives\n # and thus unnecessarily inefficient code.\n if not (\n # The root pith *NOR*...\n #\n # Note that this is merely a negligible optimization for the\n # common case in which the current pith is the root pith\n # (i.e., this is the first iteration of the outermost loop).\n # The subsequent call to the str.isidentifier() method is\n # *MUCH* more expensive than this object identity test.\n hints_meta.pith_curr_expr is VAR_NAME_PITH_ROOT or\n # A simple Python identifier *NOR*...\n hints_meta.pith_curr_expr.isidentifier() or\n # A complex Python expression already containing the\n # assignment expression-specific walrus operator \":=\". Since\n # this implies this expression to already be an assignment\n # expression, needlessly reassigning the local variable to\n # which this assignment expression was previously assigned\n # as yet another redundant local variable only harms\n # efficiency for *NO* tangible gain (e.g., expanding the\n # efficient assignment expression \"__beartype_pith_1 :=\n # next(iter(__beartype_pith_0))\" to the inefficient\n # assignment expression \"__beartype_pith_2 :=\n # __beartype_pith_1 := next(iter(__beartype_pith_0))\").\n #\n # Note that this edge case is induced by method calls\n # performed below of the form:\n # hints_meta.enqueue_hint_child(\n # ..., pith_expr=pith_curr_assign_expr, ...)\n #\n # As of this writing, the only such edge cases are:\n # * PEP 484- or 604-compliant unions containing *ONLY* two\n # or more PEP-compliant type hints (e.g., \"list[str] |\n # set[bytes]\").\n # * PEP 695-compliant subscripted type aliases.\n ':=' in hints_meta.pith_curr_expr\n ):\n # Then the current pith is ideally assigned to a unique\n # local variable via an assignment expression.\n # print(f'Incrementing hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index} by one.')\n \n # Increment the integer suffixing the name of this variable\n # *BEFORE* defining this variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n hints_meta.pith_curr_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Assignment expression assigning this full expression to\n # this local variable.\n hints_meta.pith_curr_assign_expr = (\n CODE_PEP572_PITH_ASSIGN_EXPR_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n pith_curr_expr=hints_meta.pith_curr_expr,\n ))\n # Else, the current pith is *NOT* safely assignable to a unique\n # local variable via an assignment expression. Since the\n # expression yielding the current pith is a simple Python\n # identifier, there is *NO* benefit to assigning that to another\n # local variable via another assignment expression, which would\n # just be an alias of the existing local variable assigned via\n # the existing assignment expression. Moreover, whereas chained\n # assignments are syntactically valid, chained assignment\n # expressions are syntactically invalid unless explicitly\n # protected by parens: e.g.,\n # >>> a = b = 'Mother*Teacher*Destroyer' # <-- fine\n # >>> (a := \"Mother's Abomination\") # <-- fine\n # >>> (a :=\n # ... (b := \"Mother's Illumination\")) # <-- fine\n # >>> (a := b := \"Mother's Illumination\") # <-- not fine\n # SyntaxError: invalid syntax\n #\n # In this case...\n else:\n # print(f'Preserving hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index}.')\n \n # Preserve the Python code snippet evaluating to the value\n # of the current pith as is.\n hints_meta.pith_curr_assign_expr = hints_meta.pith_curr_expr\n \n # ............{ UNION }............\n # If this hint is a union (e.g., \"typing.Union[bool, str]\",\n # typing.Optional[float]\")...\n if hint_curr_sign in HINT_SIGNS_UNION:\n # Python code snippet type-checking the current pith against\n # this union if this union is unignorable *OR* \"None\".\n make_hint_pep484604_check_expr(hints_meta)\n # Else, this hint is *NOT* a union.\n #\n # ..........{ CONTAINERS }............\n # If this hint is either:\n # * A single-argument container like list[int] or set[str].\n # * A similar hint semantically resembling a single-argument\n # container subscripted by one argument and one or more\n # ignorable arguments like tuple[str, ...].\n #\n # Then this hint is effectively (for all intents and purposes) a\n # standard single-argument container. In this case...\n elif hint_curr_sign in HINT_SIGNS_CONTAINER_ARGS_1:\n # Python code snippet type-checking the current pith against\n # this hint if the child hint subscripting this parent\n # container hint is unignorable *OR* \"None\" otherwise.\n make_hint_pep484585_container_check_expr(hints_meta)\n # Else, this hint is *NOT* a standard single-argument container.\n #\n # ............{ SEQUENCES ~ tuple : fixed }............\n # If this hint is a fixed-length tuple (e.g., \"tuple[int,\n # str]\")...\n #\n # Note that if this hint is a:\n # * PEP 484-compliant \"typing.Tuple\"-based hint, this hint is\n # guaranteed to contain one or more child hints. Moreover, if\n # this hint contains exactly one child hint that is the empty\n # tuple, this hint is the empty fixed-length form\n # \"typing.Tuple[()]\".\n # * PEP 585-compliant \"tuple\"-based hint, this hint is *NOT*\n # guaranteed to contain one or more child hints. If this hint\n # contains *NO* child hints, this hint is equivalent to the\n # empty fixed-length PEP 484-compliant form\n # \"typing.Tuple[()]\". Yes, PEP 585 even managed to violate\n # PEP 484-compliance. UUUURGH!\n #\n # While tuples are sequences, the \"typing.Tuple\" singleton that\n # types tuples violates the syntactic norms established for\n # other standard sequences by concurrently supporting two\n # different syntaxes with equally different semantics:\n # * \"typing.Tuple[{typename}, ...]\", typing a tuple whose items\n # all satisfy the \"{typename}\" child hint. Note that the\n # \"...\" substring here is a literal ellipses.\n # * \"typing.Tuple[{typename1}, {typename2}, ..., {typenameN}]\",\n # typing a tuple whose:\n # * First item satisfies the \"{typename1}\" child hint.\n # * Second item satisfies the \"{typename2}\" child hint.\n # * Last item satisfies the \"{typenameN}\" child hint.\n # Note that the \"...\" substring here is *NOT* a literal\n # ellipses.\n #\n # This is what happens when unreadable APIs are promoted.\n elif hint_curr_sign is HintSignTupleFixed:\n # Initialize the code type-checking this pith against this\n # tuple to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_TUPLE_FIXED_PREFIX\n \n # If this hint is the empty fixed-length tuple, generate\n # and append code type-checking the current pith to be the\n # empty tuple. This edge case constitutes a code smell.\n if is_hint_pep484585_tuple_empty(hint_curr):\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_EMPTY_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name))\n # Else, that ridiculous edge case does *NOT* apply. In this\n # case...\n else:\n # Append code type-checking the length of this pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_LEN_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_childs_len=hint_childs_len,\n ))\n \n #FIXME: Optimize by refactoring into a \"while\" loop.\n # For each possibly ignorable insane child hint of this\n # parent tuple...\n for hint_child_index, hint_child in enumerate(\n hint_childs):\n #FIXME: Refactor most (or even *ALL*) calls to\n #sanify_hint_child() to a new\n #hints_meta.sanify_hint() method. The repetition\n #here is becoming... unnerving.\n \n # Unignorable sane child hint sanified from this\n # possibly ignorable insane child hint *OR* \"None\"\n # otherwise (i.e., if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=hint_child,\n cls_stack=hints_meta.cls_stack,\n conf=hints_meta.conf,\n typevar_to_hint=(\n hints_meta.hint_curr_meta.typevar_to_hint),\n exception_prefix=hints_meta.exception_prefix,\n )\n # print(f'Sanified fixed tuple {hints_meta.hint_curr_meta}...')\n # print(f'...child hint {hint_child} -> {hint_or_sane_child}!')\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Python expression yielding the value of the\n # currently indexed item of this tuple to be\n # type-checked against this child hint.\n pith_child_expr = (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_child_index=hint_child_index,\n ))\n \n # Deeply type-check this child pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_child_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n ))\n # Else, this child hint is ignorable.\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_TUPLE_FIXED_SUFFIX}'\n # Format...\n ).format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n )\n # Else, this hint is *NOT* a fixed-length tuple.\n #\n # ..........{ MAPPINGS }............\n # If this hint is a standard mapping (e.g., \"dict[str, int]\")...\n elif hint_curr_sign in HINT_SIGNS_MAPPING:\n # Python expression evaluating to the origin type of this\n # mapping hint as a hidden beartype-specific parameter\n # injected into the signature of this wrapper function.\n hints_meta.hint_curr_expr = (\n hints_meta.add_func_scope_type_or_types(\n get_hint_pep_origin_type_isinstanceable(hint_curr)))\n \n # 2-tuple of the possibly ignorable insane child key and\n # value hints subscripting this mapping hint, defined as\n # either...\n hint_childs = (\n #FIXME: Note that a similar effect can also be achieved\n #through a reduction from type hints the form\n #\"{collections,typing}.Counter[{hint_child}]\" to:\n # typing.Annotated[\n # collections.abc.MutableMapping[{hint_child}, int],\n # beartype.vale.IsInstance[collections.Counter]\n # ]\n #However, the current approach is even *MORE* trivial\n #than that reduction. So, we currently prefer this.\n \n # If this hint describes a \"collections.Counter\"\n # dictionary subclass:\n # * The \"typing.Counter[...]\" type hint factory is\n # subscriptable by only a single key child type hint\n # and assumes the value child type hint typically\n # subscripting dictionary type hint factories to be\n # the standard \"int\" type (e.g., \"typing.Counter[str]\"\n # effectively expands to \"typing.Counter[str, int]\").\n # * The \"collections.Counter[...]\" type hint factory is\n # technically subscriptable by an arbitrary number of\n # child type hints but pragmatically subscriptable by\n # only a single key child type hint. Why? Static\n # type-checkers, which enforce that constraint.\n #\n # Despite these type-checking assumptions and\n # constraints, the \"collections.Counter\" type is itself\n # unconstrained. As of Python 3.13, the\n # collections.Counter.__init__() initializer accepts\n # arbitrary values that are *NOT* integers: e.g.,\n # >>> from collections import Counter\n # >>> c = Counter({'red': 'no, blue!', 'blue': 4.2})\n # >>> print(c)\n # Counter({'red': 'no, blue!', 'blue': 4.2}) # lol\n #\n # That permissiveness arguably constitutes a bug in both\n # CPython itself *AND* user code attempting such\n # shenanigans. Static type-checkers believe this to be\n # the case, anyway -- and that's good enough for us.\n # @beartype thus explicitly catches these bugs by\n # defaulting the undeclared value child type hint for\n # counter type hints to be the \"int\" type.\n (\n get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=EXCEPTION_PREFIX,\n ),\n int,\n )\n if hint_curr_sign is HintSignCounter else\n # Else, this hint does *NOT* describe a\n # \"collections.Counter\" dictionary subclass. In this\n # case, introspect the child key and value type hints\n # subscripting this parent hint in the standard way.\n get_hint_pep484585_args( # type: ignore[assignment]\n hint=hint_curr,\n args_len=2,\n exception_prefix=EXCEPTION_PREFIX,\n )\n )\n \n #FIXME: Consider also contextually considering child key\n #hints that reduce to \"Hashable\" to be ignorable. This\n #includes complex type hints like \"Union[Hashable, str]\",\n #which reduces to \"Hashable\". We can't particularly be\n #bothered at the moment. This is a microoptimization and\n #will probably require a non-trivial amount of work. *sigh*\n # Unignorable sane child key and value hints sanified from\n # these possibly ignorable insane child key and value hints\n # *OR* \"None\" otherwise (i.e., if ignorable).\n hint_or_sane_child_key = (\n sanify_hint_child(\n hint=hint_childs[0],\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n hint_or_sane_child_value = (\n sanify_hint_child(\n hint=hint_childs[1], # type: ignore[has-type]\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n \n # If at least one of these child hints are unignorable...\n if not (\n hint_or_sane_child_key is Any and\n hint_or_sane_child_value is Any\n ):\n # If this child key hint is unignorable...\n if hint_or_sane_child_key is not Any:\n # If this child value hint is also unignorable...\n if hint_or_sane_child_value is not Any:\n # Increase the indentation level of code\n # type-checking this child value pith.\n hints_meta.indent_level_child += 1\n \n # Increment the integer suffixing the name of a\n # unique local variable storing the value of\n # this child key pith *BEFORE* defining this\n # variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n pith_key_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child key pith\n # against this hint.\n hint_key_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_key,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_key_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child value pith\n # against this hint.\n hint_value_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_VALUE_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_key_var_name=pith_key_var_name,\n ),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Code deeply type-checking these child key and\n # value piths against these hints.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_VALUE_format(\n indent_curr=hints_meta.indent_curr,\n pith_key_var_name=pith_key_var_name, # pyright: ignore\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n hint_key_placeholder=(\n hint_key_placeholder),\n hint_value_placeholder=(\n hint_value_placeholder),\n ))\n # Else, this child value hint is ignorable. In this\n # case...\n else:\n # Code deeply type-checking only this child key\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child key pith against this hint.\n hint_key_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=(\n hint_or_sane_child_key),\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n # Else, this child key hint is ignorable. By process\n # of elimination, this child value hint *MUST* be\n # unignorable. In this case...\n else:\n # Code deeply type-checking only this child value\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_VALUE_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child value pith against this hint.\n hint_value_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_VALUE_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Code deeply type-checking this pith as well as at\n # least one of these child key and value piths.\n hints_meta.func_curr_code = CODE_PEP484585_MAPPING_format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hints_meta.hint_curr_expr,\n func_curr_code_key_value=func_curr_code_key_value,\n )\n # Else, these child key *AND* value hints are both\n # ignorable. In this case, fallback to trivial code\n # shallowly type-checking this pith as an instance of this\n # origin type.\n # Else, this hint is *NOT* a mapping.\n #\n # ............{ ANNOTATED }............\n # If this hint is a PEP 593-compliant type metahint, this\n # metahint is guaranteed by the reduction performed above to be\n # beartype-specific (i.e., metahint whose second argument is a\n # beartype validator produced by subscripting a beartype\n # validator factory). In this case...\n elif hint_curr_sign is HintSignAnnotated:\n # Defer heavyweight imports.\n from beartype.vale._core._valecore import BeartypeValidator\n \n # Initialize the code type-checking this pith against this\n # metahint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP593_VALIDATOR_PREFIX\n \n # Unignorable sane metahint annotating this parent hint\n # sanified from this possibly ignorable insane metahint *OR*\n # \"None\" otherwise (i.e., if this metahint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=get_hint_pep593_metahint(hint_curr),\n conf=conf,\n cls_stack=cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # print(f'[593] metahint: {repr(get_hint_pep593_metahint(hint_curr))}')\n # print(f'[593] hint_curr_meta: {repr(hints_meta.hint_curr_meta)}')\n # print(f'[593] hint_curr: {repr(hint_curr)}; hint_or_sane_child: {repr(hint_or_sane_child)}')\n \n # Tuple of the one or more beartype validators annotating\n # this metahint.\n hints_child = get_hint_pep593_metadata(hint_curr)\n # print(f'hints_child: {repr(hints_child)}')\n \n # If this metahint is ignorable...\n if hint_or_sane_child is Any:\n # Expression yielding the value of the current pith,\n # defined as either...\n hint_curr_expr = (\n hints_meta.pith_curr_expr\n # If this metahint is annotated by only one beartype\n # validator, the most efficient expression yielding\n # the value of the current pith is simply the full\n # Python expression *WITHOUT* assigning that value\n # to a reusable local variable in an assignment\n # expression. *NO* assignment expression is needed\n # in this case.\n #\n # Why? Because beartype validators are *NEVER*\n # recursed into. Each beartype validator is\n # guaranteed to be the leaf of a type-checking\n # subtree, guaranteeing this pith to be evaluated\n # only once.\n if len(hints_child) == 1 else\n # Else, this metahint is annotated by two or more\n # beartype validators. In this case, the most\n # efficient expression yielding the value of the\n # current pith is the assignment expression\n # assigning this value to a reusable local variable.\n hints_meta.pith_curr_assign_expr\n )\n # Else, this metahint is unignorable. In this case...\n else:\n # Python expression yielding the value of the current\n # pith, defaulting to the name of the local variable\n # assigned to by the assignment expression performed\n # below.\n hint_curr_expr = hints_meta.pith_curr_var_name\n \n # Code deeply type-checking this metahint.\n hints_meta.func_curr_code += (\n CODE_PEP593_VALIDATOR_METAHINT_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression yielding the value of the\n # current pith assigned to a local variable\n # efficiently reused by code generated by the\n # following iteration.\n #\n # Note this child hint is guaranteed to be followed\n # by at least one more test expression referencing\n # this local variable. Why? Because the \"typing\"\n # module forces metahints to be subscripted by one\n # child hint and one or more arbitrary objects.\n # Ergo, we need *NOT* explicitly validate that here.\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=hints_meta.pith_curr_assign_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n #FIXME: Optimize by refactoring into a \"while\" loop. *sigh*\n # For the 0-based index and each beartype validator\n # annotating this metahint...\n for hint_child_index, hint_child in enumerate(hints_child):\n # print(f'Type-checking PEP 593 type hint {repr(hint_curr)} argument {repr(hint_child)}...')\n # If this is *NOT* a beartype validator, raise an\n # exception.\n #\n # Note that the previously called sanify_hint_child()\n # function validated only the first such to be a\n # beartype validator. All remaining arguments have yet\n # to be validated, so we do so now for consistency and\n # safety.\n if not isinstance(hint_child, BeartypeValidator):\n raise BeartypeDecorHintPep593Exception(\n f'{EXCEPTION_PREFIX}PEP 593 type hint '\n f'{repr(hint_curr)} subscripted by both '\n f'@beartype-specific and -agnostic metadata '\n f'(i.e., {represent_object(hint_child)} not '\n f'beartype validator).'\n )\n # Else, this argument is beartype-specific.\n #\n # If this is any beartype validator *EXCEPT* the first,\n # set the Python expression yielding the value of the\n # current pith to the name of the local variable\n # assigned to by the prior assignment expression. By\n # deduction, it *MUST* be the case now that either:\n # * This metahint was unignorable, in which case this\n # assignment uselessly reduplicates the exact same\n # assignment performed above. While non-ideal, this\n # assignment is sufficiently efficient to make any\n # optimizations here effectively worthless.\n # * This metahint was ignorable, in which case this\n # expression was set above to the assignment\n # expression assigning this pith for the first\n # beartype validator. Since this iteration has already\n # processed the first beartype validator, this\n # assignment expression has already been performed.\n # Avoid inefficiently re-performing this assignment\n # expression for each additional beartype validator by\n # efficiently reusing the previously assigned local.\n elif hint_child_index:\n hint_curr_expr = hints_meta.pith_curr_var_name\n # Else, this is the first beartype validator. See above.\n \n # Code deeply type-checking this validator.\n hints_meta.func_curr_code += CODE_PEP593_VALIDATOR_IS_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression formatting the current pith into\n # the \"{obj}\" format substring previously embedded\n # by this validator into this code string.\n hint_child_expr=hint_child._is_valid_code.format(\n indent=hints_meta.indent_child,\n obj=hint_curr_expr,\n ),\n )\n \n # Generate locals safely merging the locals required by\n # both this validator code *AND* the current code\n # type-checking this entire root hint.\n update_mapping(\n mapping_trg=hints_meta.func_wrapper_scope,\n mapping_src=hint_child._is_valid_code_locals,\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP593_VALIDATOR_SUFFIX_format(indent_curr=hints_meta.indent_curr)}'\n )\n # Else, this hint is *NOT* a metahint.\n #\n # ............{ SUBCLASS }............\n # If this hint is either a PEP 484- or 585-compliant subclass\n # type hint...\n elif hint_curr_sign is HintSignType:\n # Unignorable sane child hint sanified from this possibly\n # ignorable insane child hint *OR* \"None\" otherwise (i.e.,\n # if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n # Possibly ignorable insane child hint subscripting\n # this parent hint, validated to be the *ONLY* child\n # hint subscripting this parent hint.\n hint=get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=hints_meta.exception_prefix,\n ),\n conf=conf,\n cls_stack=hints_meta.cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=hints_meta.exception_prefix,\n )\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Child hint encapsulated by this metadata.\n hint_child = get_hint_or_sane_hint(hint_or_sane_child)\n \n # Sign identifying this child hint.\n hint_child_sign = get_hint_pep_sign_or_none(hint_child)\n \n # If this child hint is a forward reference to a\n # superclass, expose this forward reference to the body\n # of this wrapper function. See above for commentary.\n if hint_child_sign is HintSignForwardRef:\n (\n hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_child, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # Else, this child hint is *NOT* a forward reference. In\n # this case...\n else:\n # If this child hint is a union of superclasses,\n # reduce this union to a tuple of superclasses. Only\n # the latter is safely passable as the second\n # parameter to the issubclass() builtin under all\n # supported Python versions.\n if hint_child_sign is HintSignUnion:\n hint_child = get_hint_pep_args(hint_child) # pyright: ignore\n # Else, this child hint is *NOT* a union.\n \n # If this child hint is *NOT* an issubclassable\n # object, raise an exception.\n #\n # Note that the is_object_issubclassable() tester is\n # considerably faster and thus called before the\n # considerably slower\n # die_unless_object_issubclassable() raiser.\n if not is_object_issubclassable(hint_child): # type: ignore[arg-type]\n die_unless_object_issubclassable(\n obj=hint_child, # type: ignore[arg-type]\n exception_prefix=(\n f'{EXCEPTION_PREFIX}PEP 484 or 585 '\n f'subclass type hint {repr(hint_curr)} '\n f'child type hint '\n ),\n )\n # Else, this child hint is an issubclassable object.\n \n # Python expression evaluating to this child hint.\n hint_curr_expr = hints_meta.add_func_scope_type_or_types(\n hint_child) # pyright: ignore\n \n # Code type-checking this pith against this superclass.\n hints_meta.func_curr_code = CODE_PEP484585_SUBCLASS_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hint_curr_expr,\n indent_curr=hints_meta.indent_curr,\n )\n # Else, this child hint is ignorable. In this case...\n else:\n # Python expression evaluating to the origin type of\n # this hint -- which, by definition, is the \"type\"\n # superclass. Since this superclass is a builtin (i.e.,\n # universally accessible object), we efficiently\n # hardcode the access of this superclass rather than\n # inject a hidden beartype-specific parameter into the\n # signature of this wrapper function as we usually do.\n hints_meta.hint_curr_expr = 'type'\n \n # Fallback to trivial code shallowly type-checking this\n # pith as an instance of this origin type.\n # Else, this hint is *NOT* a subclass type hint.\n #\n # ............{ GENERIC or PROTOCOL }............\n # If this hint is either a:\n # * PEP 484-compliant generic (i.e., user-defined class\n # subclassing a combination of one or more of the\n # \"typing.Generic\" superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 544-compliant protocol (i.e., class subclassing a\n # combination of one or more of the \"typing.Protocol\"\n # superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 585-compliant generic (i.e., user-defined class\n # subclassing at least one non-class PEP 585-compliant\n # pseudo-superclasses) *OR*...\n #\n # ...then this hint is a PEP-compliant generic. In this case...\n elif hint_curr_sign is HintSignPep484585GenericUnsubscripted:\n # print(f'Visiting generic type {repr(hint_curr)}...')\n \n # Initialize the code type-checking this pith against this\n # generic to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_GENERIC_PREFIX\n \n # For each unignorable unerased transitive pseudo-superclass\n # originally declared as a superclass of this generic...\n for hint_or_sane_child in (\n iter_hint_pep484585_generic_bases_unerased(\n hint=hint_curr, # pyright: ignore\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )):\n # print(f'Visiting generic type hint {repr(hint_curr)}...')\n # print(f'...unerased base {repr(hint_child)}...')\n \n # Generate and append code type-checking this pith\n # against this pseudo-superclass.\n hints_meta.func_curr_code += (\n CODE_PEP484585_GENERIC_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n # Python expression efficiently reusing\n # the value of this pith previously\n # assigned to a local variable by the\n # prior expression.\n pith_expr=hints_meta.pith_curr_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_GENERIC_SUFFIX}'\n # Format...\n ).format(\n # Indentation deferred above for efficiency.\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n # Python expression evaluating to this generic type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n hint_curr), # pyright: ignore\n )\n # print(f'{hint_curr_exception_prefix} PEP generic {repr(hint)} handled.')\n # Else, this hint is *NOT* a generic.\n #\n # ............{ PEP 484 ~ type variable }............\n # If this hint is a PEP 484-compliant type variable (i.e.,\n # \"typing.TypeVar\" object), this hint is both dependent on and\n # less common than .PEP 484- and 585-compliant generics and thus\n # intentionally detected immediately after generics. In this\n # case...\n \n #FIXME: Preserved for posterity, once we begin generating\n #call-time type variable type-checking.\n #FIXME: Unit test us up, please.\n #FIXME: Implement corresponding \"beartype._check.error\"\n #validation, please. *sigh*\n # elif hint_curr_sign is HintSignTypeVar:\n # # Either the unignorable hint this type variable reduces to\n # # if any *OR* \"None\" if this type variable is ignorable.\n # hint_child = make_hint_pep484_typevar_check_expr( # type: ignore[assignment]\n # hint_meta=hint_curr_meta,\n # conf=conf,\n # pith_curr_assign_expr=pith_curr_assign_expr,\n # pith_curr_var_name_index=pith_curr_var_name_index,\n # cls_stack=cls_stack,\n # exception_prefix=EXCEPTION_PREFIX,\n # )\n #\n # # If this type variable is reducible to an unignorable\n # # hint, revisit this hint metadata in the outermost \"while\"\n # # loop. Doing so avoids the \"CLEANUP\" logic below, which\n # # assumes this hint to be unignorable and thus\n # # type-checkable.\n # if hint_child is not None:\n # continue\n # # Else, this type variable is *NOT* reducible to an\n # # unignorable hint. Since @beartype currently fails to\n # # generate type-checking code for type variables in and of\n # # themselves, type variables have *NO* intrinsic semantic\n # # meaning and are thus ignorable. In this case, prepare this\n # # BFS to visit the next enqueued hint by incrementing the\n # # 0-based index of metadata describing the next visited hint\n # # in the \"hints_meta\" list *BEFORE* visiting that hint.\n # else:\n # #FIXME: Insufficient. The parent type hint thought this\n # #type variable was unignorable and thus... ugh.\n # hints_meta_index_curr += 1\n # ............{ PEP 586 ~ typing.Literal }............\n # If this hint is a PEP 586-compliant type hint (i.e., the\n # \"typing.Literal\" singleton subscripted by one or more literal\n # objects), this hint is largely useless and thus intentionally\n # detected late. Why? Because \"typing.Literal\" is subscriptable\n # by objects that are instances of only *SIX* possible types,\n # which is sufficiently limiting as to render this singleton\n # patently absurd and a farce that we weep to even implement.\n # In this case...\n elif hint_curr_sign is HintSignLiteral:\n # Tuple of zero or more literal objects subscripting this\n # hint, intentionally replacing the current such tuple due\n # to the non-standard implementation of the third-party\n # \"typing_extensions.Literal\" type hint factory.\n hint_childs = get_hint_pep586_literals(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n \n # Initialize the code type-checking this pith against this\n # hint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP586_PREFIX_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n \n #FIXME: If \"typing.Literal\" is ever extended to support\n #substantially more types (and thus actually becomes\n #useful), optimize the construction of the \"types\" set\n #below to instead leverage a similar\n #\"acquire_instance(set)\" caching solution as that\n #currently employed for unions. For now, we only shrug.\n \n # Python expression evaluating to a tuple of the unique\n # types of all literal objects subscripting this hint.\n> hint_child_types_expr=hints_meta.add_func_scope_type_or_types({\n #FIXME: Optimize by refactoring into a \"while\"\n #loop. Also, this should probably be a \"frozenset\"\n #rather than \"set\". *sigh*\n # Set comprehension of all unique literal objects\n # subscripting this hint, implicitly discarding all\n # duplicate such objects.\n type(hint_child) for hint_child in hint_childs}),\n )\nE TypeError: 'NoneType' object is not iterable\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 18.029209600000012, "in_degree": 2, "true_in_degree": 5.68, "out_degree": 1, "betweenness": 1.8967311193965145e-05, "pagerank": 0.0003075519236909324, "harmonic": 0.0197564223057644, "bidirectional_harmonic": 0.236846733310549, "degree": 3 }, "line_count": 9, "code_line_count": 9, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/forward/fwdscope.py", "function_name": "BeartypeForwardScope.__init__", "test_info": { "success": false, "failed": 19, "passed": 1111, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563\nLocation: /tmp/benchmark_pxr7vmea/beartype/_check/forward/fwdmain.py:855\nError: beartype.roar.BeartypePep563Exception: Stringified type hint 'OfPearl' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_pxr7vmea/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \n File \"/tmp/benchmark_pxr7vmea/beartype/_check/forward/fwdscope.py\", line 341, in __missing__\n self._scope_name, hint_name)\n ^^^^^^^^^^^^^^^^\nAttributeError: 'BeartypeForwardScope' object has no attribute '_scope_name'. Did you mean: '_scope_dict'?\n\nTraceback:\n\n> def test_resolve_pep563() -> None:\n '''\n Test the :func:`beartype.peps.resolve_pep563` resolver.\n '''\n \n # .....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.peps import resolve_pep563\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n BeartypePep563Exception,\n )\n from beartype_test.a00_unit.data.pep.pep563.data_pep563_resolve import (\n ToAvariceOrPride,\n FrequentWith,\n their_starry_domes,\n )\n from pytest import raises\n \n # .....................{ LOCALS }....................\n # Arbitrary instance of the generic accepted by the function called below.\n numberless_and_immeasurable_halls = ToAvariceOrPride()\n \n # Arbitrary instance of the class defining various problematic methods\n # called below.\n and_thrones_radiant_with_chrysolite = FrequentWith()\n \n # .....................{ PASS }....................\n # Assert that this function unsuccessfully raises the expected exception\n # *BEFORE* resolving all PEP 563-postponed type hints annotating these\n # callables.\n with raises(BeartypeDecorHintForwardRefException):\n their_starry_domes(numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.until_the_doves(\n numberless_and_immeasurable_halls)\n with raises(BeartypeDecorHintForwardRefException):\n and_thrones_radiant_with_chrysolite.crystal_column(\n 'Nor had that scene of ampler majesty')\n \n # Resolve all PEP 563-postponed type hints annotating these callables.\n resolve_pep563(their_starry_domes)\n resolve_pep563(FrequentWith.until_the_doves)\n> resolve_pep563(FrequentWith.crystal_column)\n\n> arg_name_to_hint[arg_name] = resolve_hint(\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypePep563Exception: Stringified type hint 'OfPearl' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_pxr7vmea/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE File \"/tmp/benchmark_pxr7vmea/beartype/_check/forward/fwdscope.py\", line 341, in __missing__\nE self._scope_name, hint_name)\nE ^^^^^^^^^^^^^^^^\nE AttributeError: 'BeartypeForwardScope' object has no attribute '_scope_name'. Did you mean: '_scope_dict'?\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487\nLocation: /tmp/benchmark_pxr7vmea/beartype/_check/forward/fwdmain.py:855\nError: beartype.roar.BeartypeDecorHintForwardRefException: Method a00_type.test_decortype_descriptor.test_decor_type_descriptor_custom_pep487.AndAllThoseActs.doth_ease_its() return stringified type hint 'Optional[HeartOfLove]' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_pxr7vmea/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \n File \"/tmp/benchmark_pxr7vmea/beartype/_check/forward/fwdscope.py\", line 341, in __missing__\n self._scope_name, hint_name)\n ^^^^^^^^^^^^^^^^\nAttributeError: 'BeartypeForwardScope' object has no attribute '_scope_name'. Did you mean: '_scope_dict'?\n\nTraceback:\n\n> def test_decor_type_descriptor_custom_pep487() -> None:\n '''\n Test the :func:`beartype.beartype` decorator on :pep:`487`-compliant\n **custom pure-Python method descriptors** (i.e., methods decorated by\n pure-Python types satisfying the :pep:`487`-compliant descriptor protocol by\n declaring at least the ``__set_name__()`` dunder method).\n \n This unit test exercises an inscrutable `edge case`_ induced by\n :func:`beartype.beartype`-decorated classes defining at least two kinds of\n seemingly unrelated methods that nonetheless *could* interact harmfully:\n \n * A method decorated by a :pep:`487`-compliant custom pure-Python method\n descriptor declaring at least the ``__set_name__()`` dunder method.\n * A method annotated by a stringified forward reference to a currently\n undefined type, which :func:`beartype.beartype` then internally coerces\n into a **forward reference proxy** (i.e.,\n :class:`beartype._check.forward.reference.fwdrefabc.BeartypeForwardRefABC`\n subclass) encapsulating that undefined type.\n \n For obscure reasons that are difficult to fully explain within the expected\n lifetime of the Universe, this interaction causes the ``__set_name__()``\n dunder method of the descriptor decorating the first method to be\n erroneously called multiple times with erroneous owners. Although seemingly\n innocuous, this issue is indicative of an explosive increase in the space\n and time complexity associated with forward reference proxies. Ergo, this\n issue is actually quite serious. It is imperative this *never* happen again.\n \n .. _edge case:\n https://github.com/beartype/beartype/issues/488#issuecomment-2650865299\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype.typing import Optional\n from collections.abc import Callable\n \n # ....................{ DESCRIPTORS }....................\n class setname_descriptor(object):\n '''\n **Setname method descriptor** (i.e., pure-Python object whose\n :pep:`487`-compliant :meth:`__set_name__` dunder method raises an\n exception when called more than once as a regression check against this\n issue silently reverting).\n \n Attributes\n ----------\n _is_set_name_called : bool\n :data:`True` only if Python has already called the\n :pep:`487`-compliant :meth:`__set_name__` dunder method.\n '''\n \n def __init__(self, func: Callable) -> None:\n '''\n Initialize this method descriptor by doing... absolutely nothing.\n '''\n \n # Record that Python has yet to call __set_name__().\n self._is_set_name_called = False\n \n \n def __call__(self) -> None:\n '''\n Call this method descriptor by doing... absolutely nothing.\n '''\n \n # Doing nothing never felt so good, so right, so... clean.\n pass\n \n \n def __set_name__(self, owner: type, name: str) -> None:\n '''\n :pep:`487`-compliant callback called by Python itself with metadata\n describing the current decoration of an external method by this\n descriptor.\n \n Parameters\n ----------\n owner : type\n Parent class declaring that external method.\n name : str\n Unqualified basename of that external method.\n '''\n \n # If Python has already called this dunder method, this issue has\n # reverted. In this case, raise an exception.\n if self._is_set_name_called:\n raise ValueError(\n 'PEP 487 setname_descriptor.__set_name__() dunder method '\n 'already called.'\n )\n # Else, this is Python's first call of this dunder method.\n \n # Record that Python has already called this dunder method.\n self._is_set_name_called = True\n \n # ....................{ CLASSES }....................\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_type(obj, **kwargs) # type: ignore[return-value]\n\n> attr_value_beartyped = beartype_object( # type: ignore[type-var]\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_return = _code_check_return(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> hint_or_sane = sanify_hint_root_func(\n\n> hint = decor_meta.func_arg_name_to_hint[pith_name] = coerce_func_hint_root(\n\n> hint = resolve_hint( # pyright: ignore\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypeDecorHintForwardRefException: Method a00_type.test_decortype_descriptor.test_decor_type_descriptor_custom_pep487.AndAllThoseActs.doth_ease_its() return stringified type hint 'Optional[HeartOfLove]' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_pxr7vmea/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE File \"/tmp/benchmark_pxr7vmea/beartype/_check/forward/fwdscope.py\", line 341, in __missing__\nE self._scope_name, hint_name)\nE ^^^^^^^^^^^^^^^^\nE AttributeError: 'BeartypeForwardScope' object has no attribute '_scope_name'. Did you mean: '_scope_dict'?\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #15: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #16: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #17: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #18: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #19: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py", "test_resolve_pep563" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py", "test_decor_type_descriptor_custom_pep487" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 1, "true_in_degree": 3.0800000000000005, "out_degree": 1, "betweenness": 2.7096158848521633e-05, "pagerank": 0.00028725369805818646, "harmonic": 0.0024671052631578946, "bidirectional_harmonic": 0.19801717836257388, "degree": 2 }, "line_count": 13, "code_line_count": 13, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/error/errcause.py", "function_name": "ViolationCause.find_cause", "test_info": { "success": false, "failed": 51, "passed": 1079, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_8llvbtj8/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable\nLocation: /tmp/benchmark_8llvbtj8/beartype/_check/error/errget.py:476\nError: AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_typehint_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :meth:`beartype.door.TypeHint.die_if_unbearable` raiser method.\n \n This test intentionally tests only the core functionality of this tester to\n avoid violating Don't Repeat Yourself (DRY). This tester internally defers\n to the procedural :class:`beartype.door.die_if_unbearable` tester, already\n exhaustively tested by preceding unit tests.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import TypeHint\n from beartype.roar import (\n BeartypeDoorHintViolation,\n BeartypeDoorNonpepException,\n )\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from contextlib import suppress\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined unignorable type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n #FIXME: Remove this suppression *AFTER* improving \"TypeHint\" to support\n #all currently unsupported type hints.\n with suppress(BeartypeDoorNonpepException):\n # Wrapper wrapping this type hint.\n typehint = TypeHint(hint)\n \n # If this pith violates this hint, assert this raiser raises the\n # expected exception when passed this pith and hint.\n if isinstance(\n hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n with raises(BeartypeDoorHintViolation):\n> typehint.die_if_unbearable(pith, conf=conf)\n\n> die_if_unbearable(\n\n> func_raiser(obj) # pyright: ignore\n\n> ???\n\n> def get_hint_object_violation(\n # Mandatory parameters.\n obj: object,\n hint: Hint,\n conf: BeartypeConf,\n \n # Optional parameters.\n func: Optional[CallableABC] = None,\n cls_stack: TypeStack = None,\n exception_prefix: Optional[str] = None,\n pith_name: Optional[str] = None,\n random_int: Optional[int] = None,\n ) -> Exception:\n '''\n Human-readable exception detailing the failure of the passed object to\n satisfy the passed type hint under the passed beartype configuration.\n \n This function intentionally returns rather than raises this exception. Why?\n Because the ignorable stack frame encapsulating the call of the parent\n type-checking wrapper function generated by the :mod:`beartype.beartype`\n decorator complicates inspection of type-checking violations in tracebacks\n (especially from :mod:`pytest`, which unhelpfully recapitulates the full\n definition of this function including this docstring in those tracebacks).\n Instead, that wrapper function raises this exception directly from itself.\n \n Design\n ------\n The :mod:`beartype` package actually implements two parallel PEP-compliant\n runtime type-checkers, each complementing the other by providing\n functionality unsuited for the other. These are:\n \n * The :mod:`beartype._check.code` submodule, dynamically generating\n optimized PEP-compliant runtime type-checking code embedded in the body\n of the wrapper function wrapping the decorated callable. For both\n efficiency and maintainability, that code only tests whether or not a\n parameter passed to that callable or value returned from that callable\n satisfies a PEP-compliant annotation on that callable; that code does\n *not* raise human-readable exceptions in the event that value fails to\n satisfy that annotation. Instead, that code defers to...\n * This function, performing unoptimized PEP-compliant runtime type-checking\n generically applicable to all wrapper functions. The aforementioned\n code calls this function only in the event that value fails to satisfy\n that annotation, in which case this function then returns a human-readable\n exception after discovering the underlying cause of this type failure by\n recursively traversing that value and annotation. While efficiency is the\n foremost focus of this package, efficiency is irrelevant during exception\n handling -- which typically only occurs under infrequent edge cases.\n Likewise, while raising this exception *would* technically be feasible\n from the aforementioned code, doing so proved sufficiently non-trivial,\n fragile, and ultimately unmaintainable to warrant offloading to this\n function universally callable from all wrapper functions.\n \n Parameters\n ----------\n obj : object\n Arbitrary object to be type-checked against this type hint.\n hint : Hint\n Type hint against which to type-check this object.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all flags, options, settings, and other metadata configuring the\n validation of this object against this type hint).\n func : Optional[CallableABC]\n Either:\n \n * If this violation originates from a decorated callable, that\n callable.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n exception_prefix : Optional[str]\n Either:\n \n * If the caller prefers specifying an explicit human-readable label\n prefixing the representation of this object in the exception message,\n that labal.\n * Else, :data:`None`. In this case, this getter automatically\n synthesizes this label from the other passed parameters that are\n required to be non-:data:`None`. If any such parameter is\n :data:`None`, an exception is raised. These parameters include:\n \n * The passed ``func`` parameter, required to be non-:data:`None`.\n * The passed ``pith_name`` parameter, required to be non-:data:`None`.\n pith_name : Optional[str]\n Either:\n \n * If this hint annotates a parameter of some callable, the name of that\n parameter.\n * If this hint annotates the return of some callable, ``\"return\"``.\n * Else, :data:`None`.\n \n Defaults to :data:`None`.\n random_int: Optional[int], optional\n **Pseudo-random integer** (i.e., unsigned 32-bit integer\n pseudo-randomly generated by the parent :func:`beartype.beartype`\n wrapper function in type-checking randomly indexed container items by\n the current call to that function) if that function generated such an\n integer *or* :data:`None` otherwise (i.e., if that function generated\n *no* such integer). Note that this parameter critically governs whether\n this exception handler runs in constant or linear time. Specifically, if\n this parameter is:\n \n * An integer, this handler runs in **constant time.** Since there exists\n a one-to-one relation between this integer and the random container\n item(s) type-checked by the parent :func:`beartype.beartype` wrapper\n function, receiving this integer enables this handler to efficiently\n re-type-check the same random container item(s) type-checked by the\n parent in constant time rather type-checking all container items in\n linear time.\n * :data:`None`, this handler runs in **linear time.**\n \n Defaults to :data:`None`, implying this exception handler runs in linear\n time by default.\n \n Returns\n -------\n Exception\n Human-readable exception detailing the failure of this object to satisfy\n the type hint. This is guaranteed to be an instance of either:\n \n * If this is a parameter, :attr:`.BeartypeConf.violation_param_type`.\n * If this is a return, :attr:`.BeartypeConf.violation_return_type`.\n * Else, :attr:`.BeartypeConf.violation_door_type`.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If the type hint annotating this object is *not* PEP-compliant.\n _BeartypeCallHintPepRaiseException\n If all three of the ``exception_prefix``,``func``, and ``pith_name``\n parameters are :data:`None`.\n _BeartypeCallHintPepRaiseDesynchronizationException\n If this pith actually satisfies this hint, implying either:\n \n * The parent wrapper function generated by the :mod:`beartype.beartype`\n decorator type-checking this pith triggered a false negative by\n erroneously misdetecting this pith as failing this type check.\n * This child helper function re-type-checking this pith triggered a\n false positive by erroneously misdetecting this pith as satisfying\n this type check when in fact this pith fails to do so.\n '''\n # print('''get_hint_object_violation(\n # func={!r},\n # hint={!r},\n # conf={!r},\n # pith_name={!r},\n # obj={!r},\n # )'''.format(func, hint, conf, pith_name, obj))\n \n # ....................{ LOCALS }....................\n # Type of violation to be raised.\n exception_cls: TypeException = None # type: ignore[assignment]\n \n # If the caller passed *NO* parameter name, the passed object is neither a\n # parameter nor return of a decorated callable. By elimination, this object\n # *MUST* have been directly passed to the beartype.door.die_if_unbearable()\n # type-checker. In this case...\n if pith_name is None:\n # If the caller also passed *NO* exception prefix, raise an exception.\n if exception_prefix is None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed neither '\n '\"exception_prefix\" nor \"pith_name\" parameters.'\n )\n # Else, the caller passed an exception prefix.\n \n # Default the exception class appropriately.\n exception_cls = conf.violation_door_type\n \n # Suffix this exception prefix with an additional noun for disambiguity.\n exception_prefix = (\n f'{exception_prefix}value '\n f'{prefix_pith_value(pith=obj, is_color=conf.is_color)}'\n )\n # Else, the caller passed a parameter name. In this case...\n else:\n # If the caller also passed an exception prefix, raise an exception.\n if exception_prefix is not None:\n raise _BeartypeCallHintPepRaiseException(\n 'get_hint_object_violation() passed both '\n '\"exception_prefix\" and \"pith_name\" parameters.'\n )\n # Else, the caller passed *NO* exception prefix.\n \n # If the name of this parameter is the magic string implying the passed\n # object to be a return value...\n if pith_name == ARG_NAME_RETURN:\n # Default these exception locals appropriately\n exception_cls = conf.violation_return_type\n exception_prefix = prefix_callable_return_value(\n func=func, # type: ignore[arg-type]\n return_value=obj,\n is_color=conf.is_color,\n )\n # Else, the passed object is a parameter. In this case...\n else:\n # Default these exception locals appropriately\n exception_cls = conf.violation_param_type\n exception_prefix = prefix_callable_arg_value(\n func=func, # type: ignore[arg-type]\n arg_name=pith_name,\n arg_value=obj,\n is_color=conf.is_color,\n )\n \n # Uppercase the first character of this violation prefix for readability.\n exception_prefix = uppercase_str_char_first(exception_prefix)\n \n # ....................{ CAUSE }....................\n # Cause describing the failure of this pith to satisfy this hint.\n violation_cause = ViolationCause(\n cause_indent='',\n cls_stack=cls_stack,\n conf=conf,\n exception_prefix=exception_prefix,\n func=func,\n hint=hint,\n # is_hint_root=True,\n pith=obj,\n pith_name=pith_name,\n random_int=random_int,\n ).find_cause()\n \n # If this pith satisfies this hint, *SOMETHING HAS GONE TERRIBLY AWRY.*\n #\n # In theory, this should never happen, as the parent wrapper function\n # performing type checking should *ONLY* call this child helper function\n # when this pith does *NOT* satisfy this hint. In this case, raise an\n # exception encouraging the end user to submit an upstream issue with us.\n> if not violation_cause.cause_str_or_none:\nE AttributeError: 'NoneType' object has no attribute 'cause_str_or_none'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation", "Failure #4: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_is_color", "Failure #5: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_types", "Failure #6: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorget.py::test_get_func_pith_violation_conf_violation_verbosity", "Failure #7: beartype_test/a00_unit/a70_decor/a00_error/a90_main/test_errorplug.py::test_get_func_pith_violation_instancecheck_str", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #42: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #43: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #44: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #45: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #46: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #47: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #48: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #49: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #50: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #51: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_typehint_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 8, "true_in_degree": 8.8, "out_degree": 1, "betweenness": 2.1676927078817306e-05, "pagerank": 0.0005594989301885853, "harmonic": 0.001644736842105263, "bidirectional_harmonic": 0.25313621411483256, "degree": 9 }, "line_count": 37, "code_line_count": 37, "cyclomatic": 8, "halstead_volume": 95.90827503317318, "halstead_difficulty": 3.75 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/forward/reference/fwdrefmeta.py", "function_name": "BeartypeForwardRefMeta.__getattr__", "test_info": { "success": false, "failed": 6, "passed": 1124, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py::test_make_forwardref_indexable_subtype\nLocation: /tmp/benchmark_1tgb9lgs/beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py:61\nError: AttributeError: 'NoneType' object has no attribute '__name__'. Did you mean: '__ne__'?\n\nTraceback:\n\n> def test_make_forwardref_indexable_subtype() -> None:\n '''\n Test the\n :func:`beartype._check.forward.reference.fwdrefmake.make_forwardref_indexable_subtype`\n factory.\n '''\n \n # ....................{ LOCALS }....................\n # Defer test-specific imports.\n from beartype.roar import (\n BeartypeCallHintForwardRefException,\n BeartypeDecorHintForwardRefException,\n )\n from beartype_test.a00_unit.data.check.forward.data_fwdref import (\n CLASS_BASENAME,\n CLASS_NAME,\n FORWARDREF_ABSOLUTE,\n FORWARDREF_MODULE_ABSOLUTE,\n FORWARDREF_MODULE_CLASS,\n FORWARDREF_RELATIVE,\n FORWARDREF_RELATIVE_CIRCULAR,\n MODULE_BASENAME,\n MODULE_NAME,\n PACKAGE_NAME,\n SCOPE_NAME,\n )\n from beartype_test.a00_unit.data.data_type import (\n Class,\n Subclass,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Arbitrary instance of a subclass of that class.\n obj_subclass = Subclass()\n \n # ....................{ PASS ~ attr }....................\n # Assert that these proxies have the expected class names.\n assert FORWARDREF_ABSOLUTE.__name__ == CLASS_BASENAME\n assert FORWARDREF_RELATIVE.__name__ == CLASS_BASENAME\n assert FORWARDREF_MODULE_ABSOLUTE.__name__ == MODULE_BASENAME\n> assert FORWARDREF_MODULE_CLASS.__name__ == CLASS_BASENAME\nE AttributeError: 'NoneType' object has no attribute '__name__'. Did you mean: '__ne__'?\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data\nLocation: /tmp/benchmark_1tgb9lgs/beartype/_check/forward/fwdmain.py:855\nError: beartype.roar.BeartypeDecorHintForwardRefException: Function beartype_test.a00_unit.data.hint.data_hintref.the_woods_are_lovely() parameter \"dark_and_deep\" stringified type hint 'beartype_test.a00_unit.data.hint.data_hintref.TheDarkestEveningOfTheYear' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nTraceback (most recent call last):\n File \"/tmp/benchmark_1tgb9lgs/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1, in \nAttributeError: 'NoneType' object has no attribute 'data'\n\nTraceback:\n\n> def test_pep484_ref_data() -> None:\n '''\n Test successful usage of the :func:`beartype.beartype` decorator with\n respect to both PEP-compliant and -noncompliant forward references by\n importing an external data module declaring these references *before* the\n user-defined classes referred to by these references.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar import BeartypeCallHintReturnViolation\n> from beartype_test.a00_unit.data.hint.data_hintref import (\n BeforeTheHurricane,\n TheDarkestEveningOfTheYear,\n WithSluggishSurge,\n a_little_shallop,\n but_i_have_promises,\n its_fields_of_snow,\n of_easy_wind,\n stopping_by_woods_on,\n the_dry_leaf,\n the_woods_are_lovely,\n winding_among_the_springs,\n # between_the_woods_and_frozen_lake,\n )\n\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper_code = generate_code(decor_meta)\n\n> code_check_params = _code_check_args(decor_meta)\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> hint_or_sane = sanify_hint_root_func(\n\n> hint = decor_meta.func_arg_name_to_hint[pith_name] = coerce_func_hint_root(\n\n> hint = resolve_hint( # pyright: ignore\n\n> return _resolve_func_scope_forward_hint(\n\n> def _resolve_func_scope_forward_hint(\n hint: str,\n decor_meta: BeartypeDecorMeta,\n exception_cls: TypeException,\n exception_prefix: str,\n ) -> Hint:\n '''\n Resolve the passed stringified type hint into a non-string type hint\n against the **forward scope** (i.e., dictionary mapping from the names to\n values of all attributes accessible to the lexical scope of the passed\n decorated callable where this scope comprises both the global scope and all\n local lexical scopes enclosing that callable) of that callable.\n \n This resolver is intentionally *not* memoized (e.g., by the\n :func:`callable_cached` decorator). Resolving both absolute *and* relative\n forward references assumes contextual context (e.g., the fully-qualified\n name of the object to which relative forward references are relative to)\n that *cannot* be safely and context-freely memoized away.\n \n Parameters\n ----------\n hint : str\n Stringified type hint to be resolved.\n decor_meta : BeartypeDecorMeta\n Decorated callable to resolve the forward scope of\n exception_cls : Type[Exception]\n Type of exception to be raised in the event of a fatal error.\n exception_prefix : str\n Human-readable substring prefixing raised exception messages.\n \n Returns\n -------\n Hint\n Non-string type hint resolved from this stringified type hint.\n \n Raises\n ------\n exception_cls\n If attempting to dynamically evaluate this stringified type hint into a\n non-string type hint against both the global and local scopes of the\n decorated callable raises an exception, typically due to this\n stringified type hint being syntactically invalid.\n BeartypeDecorHintPep604Exception\n If the active Python interpreter is Python <= 3.9 and this stringified\n type hint is a :pep:`604`-compliant new-style union, which requires\n Python >= 3.10.\n '''\n \n # Attempt to resolve this stringified type hint into a non-string type hint\n # against both the global and local scopes of the decorated callable.\n try:\n hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\n # print(f'Resolved stringified type hint {repr(hint)} to {repr(hint_resolved)}...')\n # If doing so failed for *ANY* reason whatsoever...\n except Exception as exception:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # Human-readable message to be raised if this message has been defined\n # *OR* \"None\" otherwise (i.e., if this message has yet to be defined).\n exception_message: Optional[str] = None\n \n # If the following conditions all hold:\n # * The active Python interpreter targets Python < 3.10 *AND*...\n # * The external module defining this stringified type hint was prefixed\n # by the \"from __future__ import annotations\" pragma enabling PEP 563\n # *AND*...\n # * This hint contains one or more PEP 604-compliant new unions (e.g.,\n # \"int | str\")...\n #\n # ...then this interpreter fails to syntactically support this hint at\n # runtime (because only Python >= 3.10 supports PEP 604) but nonetheless\n # superficially appears to do so under PEP 563 by simply stringifying\n # this otherwise unsupported hint into a string. Indeed, PEP 563\n # superficially appears to support a countably infinite set of\n # syntactically and semantically invalid type hints -- including but\n # certainly not limited to PEP 604 under Python < 3.10: e.g.,\n # from __future__ import annotations # <-- enable PEP 563\n # def bad() -> int | str: # <-- invalid under Python < 3.10, but\n # pass # silently ignored by PEP 563\n # def BAD() -> int ** str: # <-- invalid under all Python versions,\n # pass # but silently ignored by PEP 563\n #\n # Clearly, exponentiating one type by another is both syntactically and\n # semantically invalid -- but PEP 563 blindly accepts and stringifies\n # that invalid type hint into the string \"int ** str\". This is nonsense.\n #\n # This branch detects this discrepancy between PEP 563 and 604 and, when\n # detected, raises a human-readable exception advising the caller with\n # recommendations of how to resolve this. Although we could also simply\n # do nothing, doing nothing results in non-human-readable exceptions\n # resembling the following, which only generates confusion: e.g.,\n # $ python3.9\n # >>> int | str\n # Traceback (most recent call last):\n # File \"\", line 1, in \n # TypeError: unsupported operand type(s) for |: 'type' and 'type'\n #\n # Specifically, if...\n if (\n # The active Python interpreter targets Python <= 3.9 *AND*...\n IS_PYTHON_AT_MOST_3_9 and\n # Evaluating this stringified type hint raised a \"TypeError\"...\n isinstance(exception, TypeError)\n ):\n # If the exception message raised by this \"TypeError\" is prefixed by\n # a well-known substring implying this exception to have been\n # produced by a discrepancy between PEP 563 and 604...\n if str(exception).startswith(\n 'unsupported operand type(s) for |: '):\n # PEP 604-specific exception type, forcefully overriding the\n # passed exception type (for disambiguity).\n exception_cls = BeartypeDecorHintPep604Exception\n \n # Human-readable message providing various recommendations.\n exception_message = (\n f'{exception_prefix}stringified PEP 604 type hint '\n f'{repr(hint)} syntactically invalid under Python < 3.10 '\n f'(i.e., {repr(exception)}). Consider either:\\n'\n f'* Requiring Python >= 3.10. Abandon Python < 3.10 all '\n f'ye who code here.\\n'\n f'* Refactoring PEP 604 type hints into '\n f'equivalent PEP 484 type hints: e.g.,\\n'\n f' # Instead of this...\\n'\n f' from __future__ import annotations\\n'\n f' def bad_func() -> int | str: ...\\n'\n f'\\n'\n f' # Do this. Ugly, yet it works. Worky >>>> pretty.\\n'\n f' from typing import Union\\n'\n f' def bad_func() -> Union[int, str]: ...'\n )\n # Else, this another kind of \"TypeError\" entirely. In this case,\n # defer to the default message defined below.\n # Else, either the active Python interpreter targets Python >= 3.10 *OR*\n # another type of exception was raised. In either case, defer to the\n # default message defined below.\n \n # If a human-readable message has yet to be defined, fallback to a\n # default message generically applicable to *ALL* stringified hints.\n if exception_message is None:\n # Human-readable message to be raised.\n exception_message = (\n f'{exception_prefix}stringified type hint '\n f'{color_hint(text=repr(hint), is_color=decor_meta.conf.is_color)} '\n f'invalid, as attempting to dynamically import '\n f'the attribute referred to by this hint raises:\\n'\n f'{format_exc()}'\n )\n \n # If the beartype configuration associated with the decorated\n # callable enabled debugging, append debug-specific metadata to this\n # message.\n # if True:\n if decor_meta.conf.is_debug:\n exception_message += (\n f'\\nComposite global and local scope enclosing this hint:\\n\\n'\n f'{repr(decor_meta.func_wrappee_scope_forward)}'\n )\n # Else, the beartype configuration associated with the decorated\n # callable disabled debugging. In this case, avoid appending\n # debug-specific metadata to this message.\n # Else, a human-readable message has already been defined.\n \n # Raise a human-readable exception wrapping the typically\n # non-human-readable exception raised above.\n> raise exception_cls(exception_message) from exception\nE beartype.roar.BeartypeDecorHintForwardRefException: Function beartype_test.a00_unit.data.hint.data_hintref.the_woods_are_lovely() parameter \"dark_and_deep\" stringified type hint 'beartype_test.a00_unit.data.hint.data_hintref.TheDarkestEveningOfTheYear' invalid, as attempting to dynamically import the attribute referred to by this hint raises:\nE Traceback (most recent call last):\nE File \"/tmp/benchmark_1tgb9lgs/beartype/_check/forward/fwdmain.py\", line 739, in _resolve_func_scope_forward_hint\nE hint_resolved = eval(hint, decor_meta.func_wrappee_scope_forward)\nE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nE File \"\", line 1, in \nE AttributeError: 'NoneType' object has no attribute 'data'\n", "Failure #3: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #4: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #5: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #6: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py", "test_make_forwardref_indexable_subtype" ], [ "beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py", "test_pep484_ref_data" ] ] }, "complexity_info": { "centrality": { "distance_discount": 4.473600000000001, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 3, "betweenness": 0.0, "pagerank": 0.00024630541871921186, "harmonic": 0.0072642543859649114, "bidirectional_harmonic": 0.1711936866130952, "degree": 3 }, "line_count": 17, "code_line_count": 17, "cyclomatic": 3, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/code/codescope.py", "function_name": "express_func_scope_type_ref", "test_info": { "success": false, "failed": 16, "passed": 1114, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a20_code/test_codescope.py::test_express_func_scope_type_ref\nLocation: /tmp/benchmark_8t6uppn6/beartype_test/a00_unit/a60_check/a20_code/test_codescope.py:312\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_express_func_scope_type_ref() -> None:\n '''\n Test the\n :func:`beartype._check.code.codescope.express_func_scope_type_ref`\n function.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintForwardRefException\n from beartype.typing import ForwardRef\n from beartype._check.code.codescope import express_func_scope_type_ref\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # Arbitrary scope to be added to below.\n func_scope = {}\n \n # Set of the unqualified classnames referred to by all relative forward\n # references relative to this scope if any *OR* \"None\" otherwise (i.e., if\n # no such references have been expressed relative to this scope yet).\n refs_type_basename = None\n \n # Fully-qualified classname of a non-existing class.\n CLASSNAME_QUALIFIED = 'Thy.giant.brood.of.pines.around.thee.clinging'\n \n # Unqualified classname of a non-existing class.\n CLASSNAME_UNQUALIFIED = 'Children_of_elder_time_in_whose_devotion'\n \n # Tuple of all PEP-compliant forward references to this fully-qualified\n # class, including...\n FORWARDREFS_QUALIFIED = (\n # PEP 484-compliant forward reference to this class.\n ForwardRef(CLASSNAME_QUALIFIED),\n # PEP 585-compliant forward reference to this class.\n CLASSNAME_QUALIFIED,\n )\n \n # Tuple of all PEP-compliant forward references to this unqualified class,\n # including...\n FORWARDREFS_UNQUALIFIED = (\n # PEP 484-compliant forward reference to this class.\n ForwardRef(CLASSNAME_UNQUALIFIED),\n # PEP 585-compliant forward reference to this class.\n CLASSNAME_UNQUALIFIED,\n )\n \n # ....................{ PASS }....................\n # For each absolute forward reference...\n for forwardref_qualified in FORWARDREFS_QUALIFIED:\n # Express a fully-qualified forward reference to a non-existing class.\n> forwardref_expr, refs_type_basename = (\n express_func_scope_type_ref(\n forwardref=forwardref_qualified,\n refs_type_basename=refs_type_basename,\n func_scope=func_scope,\n ))\nE TypeError: cannot unpack non-iterable NoneType object\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_8t6uppn6/beartype/_check/code/codemake.py:538\nError: TypeError: cannot unpack non-iterable NoneType object\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n with warns(hint_meta.warning_type):\n is_bearable(pith, hint, conf=conf)\n # print(f'Deprecated type hint {repr(hint)} warned!')\n # Else, this tester is expected to emit *NO* warning for this hint. In\n # this case, call this tester outside of such a context manager.\n else:\n> is_bearable(pith, hint, conf=conf)\n\n> func_tester = make_func_tester(hint, conf)\n\n> return func(*args)\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> return func(*args)\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> return func(*args)\n\n> @callable_cached\n def make_check_expr(\n # ..................{ ARGS ~ mandatory }..................\n hint_or_sane: HintOrHintSanifiedData,\n conf: BeartypeConf,\n \n # ..................{ ARGS ~ optional }..................\n cls_stack: TypeStack = None,\n ) -> CodeGenerated:\n '''\n **Type-checking expression factory** (i.e., low-level callable dynamically\n generating a pure-Python boolean expression type-checking an arbitrary\n object against the passed PEP-compliant type hint).\n \n This code factory performs a breadth-first search (BFS) over the abstract\n graph of nested type hints reachable from the subscripted arguments of the\n passed root type hint. For each such (possibly nested) hint, this factory\n embeds one or more boolean subexpressions validating a (possibly nested\n sub)object of an arbitrary object against that hint into the full boolean\n expression created and returned by this factory. In short, this factory is\n the beating heart of :mod:`beartype`. We applaud you for your perseverance.\n You finally found the essence of the Great Bear. You did it!! Now, we clap.\n \n This code factory is memoized for efficiency.\n \n Caveats\n -------\n **This factory intentionally accepts no** ``exception_prefix``\n **parameter.** Why? Since that parameter is typically specific to the\n context-sensitive use case of the caller, accepting that parameter would\n prevent this factory from memoizing the passed hint with the returned code,\n which would rather defeat the point. Instead, this factory only:\n \n * Returns generic non-working code containing the placeholder\n :data:`VAR_NAME_PITH_ROOT` substring that the caller is required to\n globally replace by either the name of the current parameter *or*\n ``return`` for return values (e.g., by calling the builtin\n :meth:`str.replace` method) to generate the desired non-generic working\n code type-checking that parameter or return value.\n * Raises generic non-human-readable exceptions containing the placeholder\n :attr:`beartype._util.error.utilerrraise.EXCEPTION_PLACEHOLDER` substring\n that the caller is required to explicitly catch and raise non-generic\n human-readable exceptions from by calling the\n :func:`beartype._util.error.utilerrraise.reraise_exception_placeholder`\n function.\n \n Parameters\n ----------\n hint_or_sane : HintOrHintSanifiedData\n Either a type hint *or* **sanified type hint metadata** (i.e.,\n :data:`.HintSanifiedData` object) to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n \n Returns\n -------\n CodeGenerated\n Tuple containing the Python code snippet dynamically generated by this\n code generator and metadata describing that code. See also the\n :attr:`beartype._data.hint.datahinttyping.CodeGenerated` type hint.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If this object is *not* a PEP-compliant type hint.\n BeartypeDecorHintPepUnsupportedException\n If this object is a PEP-compliant type hint currently unsupported by\n the :func:`beartype.beartype` decorator.\n BeartypeDecorHintPep484Exception\n If one or more PEP-compliant type hints visitable from this object are\n nested :attr:`typing.NoReturn` child hints, since\n :attr:`typing.NoReturn` is valid *only* as a non-nested return hint.\n BeartypeDecorHintPep593Exception\n If one or more PEP-compliant type hints visitable from this object\n subscript the :pep:`593`-compliant :class:`typing.Annotated` class such\n that:\n \n * The second argument subscripting that class is an instance of the\n :class:`beartype.vale.Is` class.\n * One or more further arguments subscripting that class are *not*\n instances of the :class:`beartype.vale.Is` class.\n \n Warns\n -----\n BeartypeDecorHintPep585DeprecationWarning\n If one or more :pep:`484`-compliant type hints visitable from this\n object have been deprecated by :pep:`585`.\n '''\n \n # ..................{ LOCALS ~ hint : root }..................\n # Unpack the passed sanified hint metadata into:\n # * \"hint_root\", the top-level hint to be type-checked.\n # * \"typevar_to_hint_root\", the top-level type variable lookup table (i.e.,\n # dictionary mapping from each type variable parametrizing the origin of\n # this top-level hint to the child hint subscripting this top-level hint).\n hint_root, typevar_to_hint_root = unpack_hint_or_sane(hint_or_sane)\n # print(f'Received root hint {repr(hint_root)} and type variable lookup table {repr(typevar_to_hint_root)}.')\n \n # ..................{ LOCALS ~ hint : current }..................\n # Currently visited hint.\n hint_curr: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this hint (e.g.,\n # \"Union\" if \"hint_curr == Union[int, str]\").\n hint_curr_sign: HintSign = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : child }..................\n # Currently iterated child hint subscripting the currently visited hint.\n hint_child: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this child hint\n # (e.g., \"Union\" if \"hint_child == Union[int, str]\").\n hint_child_sign: Optional[HintSign] = None\n \n # Currently iterated child hint subscripting the currently visited hint *OR*\n # sanified child hint metadata** (i.e., \"HintSanifiedData\" object describing\n # that child hint).\n hint_or_sane_child: HintOrHintSanifiedData = None # pyright: ignore\n \n # ..................{ LOCALS ~ hint : childs }..................\n # Current tuple of all child hints subscripting the currently visited hint\n # (e.g., \"(int, str)\" if \"hint_curr == Union[int, str]\").\n hint_childs: tuple = None # type: ignore[assignment]\n \n # Number of child hints subscripting the currently visited hint.\n hint_childs_len: int = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : metadata }..................\n # Fixed list of all metadata describing all visitable hints currently\n # discovered by the breadth-first search (BFS) below. This list acts as a\n # standard First In First Out (FILO) queue, enabling this BFS to be\n # implemented as an efficient imperative algorithm rather than an\n # inefficient (and dangerous, due to both unavoidable stack exhaustion and\n # avoidable infinite recursion) recursive algorithm.\n #\n # Note that this list is guaranteed by the previously called\n # _die_if_hint_repr_exceeds_child_limit() function to be larger than the\n # number of hints transitively visitable from this root hint. Ergo, *ALL*\n # indexation into this list performed by this BFS is guaranteed to be safe.\n # Ergo, avoid explicitly testing below that the \"hints_meta.index_last\"\n # integer maintained by this BFS is strictly less than\n # \"FIXED_LIST_SIZE_MEDIUM\", as this constraint is already guaranteed to be\n # the case.\n hints_meta = acquire_instance(HintsMeta)\n \n # Initialize this fixed list.\n hints_meta.reinit(cls_stack=cls_stack, conf=conf)\n \n # 0-based index of metadata describing the currently visited hint in this\n # fixed list.\n hints_meta_index_curr = 0\n \n # ..................{ LOCALS ~ pep : 484 }..................\n # Set of the unqualified classnames referred to by all relative forward\n # references visitable from this root hint if any *OR* \"None\" otherwise\n # (i.e., if no such forward references are visitable).\n hint_refs_type_basename: Optional[set] = None\n \n # ..................{ LOCALS ~ func : code }..................\n # Python code snippet type-checking the root pith against the root hint:\n # * Localized separately from the \"func_wrapper_code\" snippet to enable this\n # function to validate this code to be valid *BEFORE* returning this code.\n # * Initialized to a placeholder string to be globally replaced in the\n # Python code snippet to be returned (i.e., \"func_wrapper_code\") by a\n # Python code snippet type-checking the root pith expression (i.e.,\n # \"VAR_NAME_PITH_ROOT\") against the root hint (i.e., \"hint_root\").\n func_root_code = hints_meta.enqueue_hint_child(\n hint=hint_root,\n # 1-based indentation level describing the initial level of indentation\n # appropriate for the root hint.\n indent_level=1,\n pith_expr=VAR_NAME_PITH_ROOT,\n pith_var_name_index=hints_meta.pith_curr_var_name_index,\n typevar_to_hint=typevar_to_hint_root,\n )\n \n # Python code snippet to be returned, seeded with a placeholder to be\n # replaced on the first iteration of the breadth-first search performed\n # below with a snippet type-checking the root pith against the root hint.\n #\n # Note that, shockingly, brute-force string concatenation has been\n # personally profiled by @leycec to be substantially faster than *ALL*\n # alternatives under CPython up to a large number of iterations (e.g.,\n # 100,000). This includes these popular alternatives, *ALL* of which are\n # orders of magnitude slower than brute-force string concatenation:\n # * deque.append().\n # * list.append().\n func_wrapper_code = func_root_code\n \n # ..................{ SEARCH }..................\n # While the 0-based index of metadata describing the next visited hint in\n # the \"hints_meta\" list does *NOT* exceed that describing the last\n # visitable hint in this list, there remains at least one hint to be\n # visited in the breadth-first search performed by this iteration.\n while hints_meta_index_curr <= hints_meta.index_last:\n # Update instance variables of this queue to reflect that this hint is\n # now the currently visited hint.\n hints_meta.set_hint_curr_meta(\n hint_curr_meta=hints_meta[hints_meta_index_curr])\n \n # Localize metadata for both efficiency and f-string purposes.\n hint_curr = hints_meta.hint_curr_meta.hint\n # print(f'Visiting type hint {repr(hint_curr)}...')\n \n # ................{ PEP }................\n # If this hint is PEP-compliant...\n if is_hint_pep(hint_curr):\n #FIXME: Refactor to call warn_if_hint_pep_unsupported() instead.\n #Actually...wait. This is probably still a valid test here. We'll\n #need to instead augment the is_hint_ignorable() function to\n #additionally test whether the passed hint is unsupported, in which\n #case that function should return false as well as emit a non-fatal\n #warning ala the new warn_if_hint_pep_unsupported() function --\n #which should probably simply be removed now. *sigh*\n #FIXME: Actually, in that case, we can simply reduce the following\n #two calls to simply:\n # die_if_hint_pep_ignorable(\n # hint=hint_curr, exception_prefix=hint_curr_exception_prefix)\n #\n #Of course, this implies we want to refactor the\n #die_if_hint_pep_unsupported() function into\n #die_if_hint_pep_ignorable()... probably.\n \n # If this hint is currently unsupported, raise an exception.\n #\n # Note the human-readable label prefixing the representations of\n # child PEP-compliant type hints is unconditionally passed. Since\n # the root hint has already been validated to be supported by\n # the above call to the same function, this call is guaranteed to\n # *NEVER* raise an exception for that hint.\n die_if_hint_pep_unsupported(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n # Else, this hint is supported.\n \n # Assert that this hint is unignorable. Iteration below generating\n # code for child hints of the current parent hint is *REQUIRED* to\n # explicitly ignore ignorable child hints. Since the caller has\n # explicitly ignored ignorable root hints, these two guarantees\n # together ensure that all hints visited by this breadth-first\n # search *SHOULD* be unignorable. Naturally, we validate that here.\n assert hint_curr is not Any, (\n f'{EXCEPTION_PREFIX}ignorable type hint '\n f'{repr(hint_curr)} not ignored.'\n )\n \n # Sign uniquely identifying this hint.\n hint_curr_sign = get_hint_pep_sign(hint_curr)\n # print(f'Visiting PEP type hint {repr(hint_curr)} sign {repr(hint_curr_sign)}...')\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # NOTE: Whenever adding support for (i.e., when generating code\n # type-checking) a new \"typing\" attribute below, similar support\n # for that attribute *MUST* also be added to the parallel:\n # * \"beartype._check.error\" subpackage, which raises exceptions on\n # the current pith failing this check.\n # * \"beartype._data.hint.pep.sign.datapepsignset.HINT_SIGNS_SUPPORTED_DEEP\"\n # frozen set of all signs for which this function generates deeply\n # type-checking code.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n #FIXME: Python 3.10 provides proper syntactic support for \"case\"\n #statements, which should allow us to dramatically optimize this\n #\"if\" logic into equivalent \"case\" logic *AFTER* we drop support\n #for Python 3.9. Of course, that will be basically never, so we'll\n #have to preserve this for basically forever. What you gonna do?\n #FIXME: Actually, we should probably just leverage a hypothetical\n #\"beartype.vale.IsInline[...]\" validator to coerce this slow O(n)\n #procedural logic into fast O(1) object-oriented logic. Of course,\n #object-oriented logic is itself slow -- so we only do this if we\n #can sufficiently memoize that logic. Consideration!\n \n # Switch on (as in, pretend Python provides a \"case\" statement)\n # the sign identifying this hint to decide which type of code to\n # generate to type-check the current pith against the current hint.\n #\n # This decision is intentionally implemented as a linear series of\n # tests ordered in descending likelihood for efficiency. While\n # alternative implementations (that are more readily readable and\n # maintainable) do exist, these alternatives all appear to be\n # substantially less efficient.\n #\n # Consider the standard alternative of sequestering the body of\n # each test implemented below into either:\n #\n # * A discrete private function called by this function. This\n # approach requires maintaining a global private dictionary\n # mapping from each support unsubscripted typing attribute to\n # the function generating code for that attribute: e.g.,\n # def pep_code_check_union(...): ...\n # _HINT_TYPING_ATTR_ARGLESS_TO_CODER = {\n # typing.Union: pep_code_check_union,\n # }\n # Each iteration of this loop then looks up the function\n # generating code for the current attribute from this dictionary\n # and calls that function to do so. Function calls come with\n # substantial overhead in Python, impacting performance more\n # than the comparable linear series of tests implemented below.\n # Additionally, these functions *MUST* mutate local variables of\n # this function by some arcane means -- either:\n # * Passing these locals to each such function, returning these\n # locals from each such function, and assigning these return\n # values to these locals in this function after each such call.\n # * Passing a single composite fixed list of these locals to each\n # such function, which then mutates these locals in-place,\n # which then necessitates this function permanently store these\n # locals in such a list rather than as local variables.\n # * A discrete closure of this function, which adequately resolves\n # the aforementioned locality issue via the \"nonlocal\" keyword at\n # a substantial up-front performance cost of redeclaring these\n # closures on each invocation of this function.\n #\n # ..............{ SHALLOW }..............\n # Perform shallow type-checking logic (i.e., logic that does *NOT*\n # recurse and thus \"bottoms out\" at this hint) *BEFORE* deep\n # type-checking logic. The latter needs additional setup (e.g.,\n # generation of assignment expressions) *NOT* needed by the former,\n # whose requirements are more understandably minimalist.\n #\n # Note that:\n # * Shallow type-checking code should access this pith via\n # \"pith_curr_expr\". Since this code does *NOT* recurse,\n # \"pith_curr_expr\" accesses this pith optimally efficiently.\n # * Deep type-checking code should access this pith via\n # \"pith_assign_expr\". Since that code *DOES* recurse, only\n # \"pith_assign_expr\" accesses this pith optimally efficiently;\n # \"pith_curr_expr\" accesses this pith extremely inefficiently.\n # * Ignorable type-checking code (i.e., code ignoring this hint but\n # otherwise unsuitable for implementation as a reducer called by\n # the \"beartype._check.convert._reduce.redhint\" submodule, typically\n # due to useful side effects intentionally interacting with this\n # BFS) should follow the design pattern established by the\n # \"HintSignPep695TypeAliasSubscripted\" branch below.\n #\n # ..............{ ORIGIN }..............\n # If this hint both...\n if (\n # Originates from an origin type and may thus be shallowly\n # type-checked against that type *AND is either...\n hint_curr_sign in HINT_SIGNS_ORIGIN_ISINSTANCEABLE and (\n # Unsubscripted *OR*...\n not get_hint_pep_args(hint_curr) or\n # Currently unsupported with deep type-checking...\n hint_curr_sign not in HINT_SIGNS_SUPPORTED_DEEP\n )\n ):\n # Then generate trivial code shallowly type-checking the current\n # pith as an instance of the origin type originating this sign\n # (e.g., \"list\" for the hint \"typing.List[int]\").\n # print(f'Shallow checking unsubscripted hint {repr(hint_curr)}...')\n \n # Code type-checking the current pith against this origin type.\n hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n pith_curr_expr=hints_meta.pith_curr_expr,\n # Python expression evaluating to this origin type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n # Origin type of this hint if any *OR* raise an\n # exception -- which should *NEVER* happen, as this hint\n # was validated above to be supported.\n get_hint_pep_origin_type_isinstanceable(hint_curr)),\n )\n # Else, this hint is either subscripted, not shallowly\n # type-checkable, *OR* deeply type-checkable.\n #\n # ..............{ FORWARDREF }..............\n # If this hint is a forward reference...\n elif hint_curr_sign is HintSignForwardRef:\n # Render this forward reference accessible to the body of this\n # wrapper function by populating:\n # * A Python expression evaluating to the class referred to by\n # this forward reference when accessed via the private\n # \"__beartypistry\" parameter.\n # * A set of the unqualified classnames referred to by all\n # relative forward references, including this reference if\n # relative. If this set was previously uninstantiated (i.e.,\n # \"None\"), this assignment initializes this local to the new\n # set instantiated by this call; else, this assignment\n # preserves this local set as is.\n> (\n hints_meta.hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_curr, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\nE TypeError: cannot unpack non-iterable NoneType object\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #16: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a20_code/test_codescope.py", "test_express_func_scope_type_ref" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ] ] }, "complexity_info": { "centrality": { "distance_discount": 5.178880000000001, "in_degree": 1, "true_in_degree": 4.6800000000000015, "out_degree": 2, "betweenness": 2.1676927078817306e-05, "pagerank": 0.00026568000250866636, "harmonic": 0.007456140350877193, "bidirectional_harmonic": 0.2413619275461381, "degree": 3 }, "line_count": 32, "code_line_count": 32, "cyclomatic": 5, "halstead_volume": 28.529325012980813, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/utilpepget.py", "function_name": "get_hint_pep_sign", "test_info": { "success": false, "failed": 74, "passed": 1056, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return\nLocation: /tmp/benchmark_cxwzk4ve/beartype/_util/hint/pep/proposal/pep484585/pep484585callable.py:122\nError: beartype.roar.BeartypeDecorHintPep484585Exception: Type hint typing.Callable[[], str] not PEP 484 or 585 callable type hint (i.e., \"typing.Callable[...]\" or \"collections.abc.Callable[...]\").\n\nTraceback:\n\n> def test_get_hint_pep484585_callable_params_and_return(hints_pep_meta) -> None:\n '''\n Test both the ``get_hint_pep484585_callable_params`` and\n ``get_hint_pep484585_callable_return`` getters declared by the\n :mod:`beartype._util.hint.pep.proposal.pep484585.pep484585callable`\n submodule.\n \n Since these getters are inextricably interrelated, this unit test exercises\n both within the same test to satisfy Don't Repeat Yourself (DRY).\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import Any\n from beartype._data.hint.pep.sign.datapepsigns import HintSignCallable\n from beartype._util.hint.pep.proposal.pep484585.pep484585callable import (\n get_hint_pep484585_callable_params,\n get_hint_pep484585_callable_return,\n )\n from beartype._util.py.utilpyversion import (\n IS_PYTHON_AT_LEAST_3_10,\n )\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # Intentionally import the callable type hint factory from \"typing\" rather\n # than \"beartype.typing\" to guarantee PEP 484-compliance.\n from typing import Callable as Pep484Callable\n \n # Intentionally import the callable type hint factory from\n # \"collections.abc\" rather than \"beartype.typing\" to guarantee PEP\n # 585-compliance.\n from collections.abc import Callable as Pep585Callable\n \n # ..................{ GENERIC }..................\n # General-purpose logic generically exercising these getters against all\n # globally defined type hints.\n \n # Assert these getters...\n for hint_pep_meta in hints_pep_meta:\n # Return zero or more arguments for PEP-compliant callable type hints.\n if hint_pep_meta.pep_sign is HintSignCallable:\n> hint_callable_params = get_hint_pep484585_callable_params(\n hint_pep_meta.hint)\n\n> _die_unless_hint_pep484585_callable(hint)\n\n> def _die_unless_hint_pep484585_callable(\n # Mandatory parameters.\n hint: object,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> None:\n '''\n Raise an exception unless the passed object is either a :pep:`484`- or\n :pep:`585`-compliant **callable type hint** (i.e., ``typing.Callable[...]``\n or ``collections.abc.Callable[...]`` type hint).\n \n Parameters\n ----------\n hint : object\n Object to be validated.\n exception_cls : TypeException, optional\n Type of exception to be raised in the event of fatal error. Defaults to\n :exc:`.BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable label prefixing the representation of this object in the\n exception message. Defaults to the empty string.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * PEP-compliant but *not* uniquely identifiable by a sign.\n * PEP-noncompliant.\n * *Not* a hint (i.e., neither PEP-compliant nor -noncompliant).\n * *Not* a callable type hint (i.e., ``typing.Callable[...]`` or\n ``collections.abc.Callable[...]``).\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.utilpepget import get_hint_pep_sign\n \n # Sign uniquely identifying this hint if any *OR* raise an exception.\n hint_sign = get_hint_pep_sign(\n hint=hint,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n \n # If this object is *NOT* a callable type hint, raise an exception.\n if hint_sign is not HintSignCallable:\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception class.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} not '\n f'PEP 484 or 585 callable type hint '\n f'(i.e., \"typing.Callable[...]\" or '\n f'\"collections.abc.Callable[...]\").'\n )\nE beartype.roar.BeartypeDecorHintPep484585Exception: Type hint typing.Callable[[], str] not PEP 484 or 585 callable type hint (i.e., \"typing.Callable[...]\" or \"collections.abc.Callable[...]\").\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep586.py::test_is_hint_pep586\nLocation: /tmp/benchmark_cxwzk4ve/beartype/_util/hint/pep/proposal/pep586.py:89\nError: beartype.roar.BeartypeDecorHintPep586Exception: Type hint typing.Literal[26] not PEP 586-compliant (e.g., \"typing.Literal[...]\", \"typing_extensions.Literal[...]\").\n\nTraceback:\n\n> def test_is_hint_pep586() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep586.die_unless_hint_pep586`\n raiser.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep586Exception\n from beartype.typing import Optional\n from beartype._util.hint.pep.proposal.pep586 import (\n die_unless_hint_pep586)\n from beartype._util.api.standard.utiltyping import get_typing_attrs\n from enum import Enum\n \n # ....................{ LOCALS }....................\n class _Color(Enum):\n '''\n Arbitrary enumeration to be tested below.\n '''\n \n RED = 0\n \n \n # Tuple of arbitrary objects permissible for use as arguments subscripting\n # PEP 586-compliant \"Literal\" type hints.\n #\n # For conformance, the items of this tuple are copied verbatim from a\n # prominent PEP 586 example under the \"Legal parameters for Literal at type\n # check time\" subsection.\n _LITERAL_ARGS = (\n 26,\n 0x1A,\n -4,\n \"hello world\",\n b\"hello world\",\n u\"hello world\",\n True,\n _Color.RED,\n None,\n )\n \n # ..................{ FACTORIES }..................\n # For each PEP 586-compliant \"Literal\" factory importable from each\n # currently importable \"typing\" module...\n for Literal in get_typing_attrs('Literal'):\n # ....................{ PASS }....................\n # For each object that is a valid literal argument, assert this raiser\n # raises no exception when passed that factory subscripted by that\n # argument.\n for literal_arg in _LITERAL_ARGS:\n> die_unless_hint_pep586(Literal[literal_arg])\n\n> def die_unless_hint_pep586(\n # Mandatory parameters.\n hint: Any,\n \n # Optional parameters.\n exception_cls: TypeException = BeartypeDecorHintPep586Exception,\n exception_prefix: str = '',\n ) -> None:\n '''\n Raise an exception of the passed type unless the passed object is a\n :pep:`586`-compliant type hint (i.e., subscription of either the\n :attr:`typing.Literal` or :attr:`typing_extensions.Literal` type hint\n factories).\n \n Ideally, the :attr:`typing.Literal` singleton would internally validate the\n literal objects subscripting that singleton at subscription time (i.e., in\n the body of the ``__class_getitem__()`` dunder method). Whereas *all* other\n :mod:`typing` attributes do just that, :attr:`typing.Literal` permissively\n accepts all possible arguments like a post-modern philosopher hopped up on\n too much tenure. For inexplicable reasons, :pep:`586` explicitly requires\n third-party type checkers (that's us) to validate these hints rather than\n standardizing that validation in the :mod:`typing` module. Weep, Guido!\n \n Caveats\n -------\n **This function is slow** and should thus be called only once per\n visitation of a :pep:`586`-compliant type hint. Specifically, this function\n is O(n) for n the number of arguments subscripting this hint.\n \n Parameters\n ----------\n hint : object\n Object to be inspected.\n exception_cls : TypeException, optional\n Type of exception to be raised in the event of fatal error. Defaults to\n :exc:`.BeartypeDecorHintPep586Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Raises\n ------\n exception_cls\n If this object either:\n \n * Is *not* a subscription of either the :attr:`typing.Literal` or\n :attr:`typing_extensions.Literal` type hint factories.\n * Subscripts either factory with zero arguments via the empty tuple,\n which these factories sadly fails to guard against.\n * Subscripts either factory with one or more arguments that are *not*\n **valid literals**, defined as the set of all:\n \n * Booleans.\n * Byte strings.\n * Integers.\n * Unicode strings.\n * :class:`enum.Enum` members.\n * The :data:`None` singleton.\n '''\n \n # Avoid circular import dependencies.\n from beartype._util.hint.pep.utilpepget import (\n get_hint_pep_args,\n get_hint_pep_sign,\n )\n \n # If this hint is *NOT* PEP 586-compliant, raise an exception.\n if get_hint_pep_sign(hint) is not HintSignLiteral:\n> raise exception_cls(\n f'{exception_prefix}type hint {repr(hint)} not PEP 586-compliant '\n f'(e.g., \"typing.Literal[...]\", \"typing_extensions.Literal[...]\").'\n )\nE beartype.roar.BeartypeDecorHintPep586Exception: Type hint typing.Literal[26] not PEP 586-compliant (e.g., \"typing.Literal[...]\", \"typing_extensions.Literal[...]\").\n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign", "Failure #4: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported", "Failure #5: beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported", "Failure #6: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint", "Failure #7: beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint", "Failure #8: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping", "Failure #9: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_repr", "Failure #10: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_compare_fail", "Failure #11: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable", "Failure #12: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_subhint_fail", "Failure #13: beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_args_ignorable", "Failure #14: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #15: beartype_test/a00_unit/a60_check/a40_convert/a00_reduce/test_redhint.py::test_reduce_hint_ignorable", "Failure #16: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #17: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #18: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #19: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #20: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #21: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep593.py::test_decor_pep593", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_hint_ignorable_iter", "Failure #67: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #68: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #69: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #70: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #71: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #72: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #73: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #74: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py", "test_get_hint_pep484585_callable_params_and_return" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep586.py", "test_is_hint_pep586" ] ] }, "complexity_info": { "centrality": { "distance_discount": 16.58112000000001, "in_degree": 7, "true_in_degree": 18.200000000000006, "out_degree": 2, "betweenness": 0.00010567501950923438, "pagerank": 0.0015133573936441894, "harmonic": 0.020504385964912282, "bidirectional_harmonic": 0.26223572662717387, "degree": 9 }, "line_count": 27, "code_line_count": 27, "cyclomatic": 4, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/proposal/checkpep484585generic.py", "function_name": "iter_hint_pep484585_generic_bases_unerased", "test_info": { "success": false, "failed": 15, "passed": 1115, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings\nLocation: /tmp/benchmark_8yni94pi/beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py:119\nError: Failed: DID NOT WARN. No warnings of type (,) were emitted.\n Emitted warnings: [].\n\nTraceback:\n\n> def test_door_is_bearable_warnings(hints_meta) -> None:\n '''\n Test the :class:`beartype.door.is_bearable` tester function with respect\n to non-fatal warnings emitted by that tester when passed various problematic\n (e.g., deprecated) type hints.\n \n Note that this test *cannot* be folded into the comparable\n :func:`.test_door_is_bearable` test. Why? Because that test (and almost all\n other tests testing type hints) iterates over type hints by calling the\n session-scoped ``iter_hints_piths_meta()`` closure iterator. For unknown\n reasons, :mod:`pytest` fails to capture deprecation warnings emitted from\n that iterator. This is almost certainly a :mod:`pytest` issue. However,\n reporting this issue would require reducing this issue to a minimal\n reproducible working example -- which appears to be infeasible. In short,\n this test manually iterates over type hints as an acceptable (albeit\n annoying) alternative that allows deprecation warnings to be captured.\n \n Parameters\n ----------\n hints_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintNonpepMetadata]\n List of PEP-agnostic type hint metadata describing sample PEP-agnostic\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # ..................{ IMPORTS }..................\n # Defer test-specific imports.\n from beartype.door import is_bearable\n from pytest import warns\n from warnings import simplefilter\n \n # ....................{ SETUP }....................\n # Force pytest to temporarily allow deprecation warnings to be caught by the\n # warns() context manager for the duration of this test. By default, pytest\n # simply \"passes through\" all deprecation warnings for subsequent reporting\n # if tests otherwise successfully pass. Deprecation warnings include:\n # * \"DeprecationWarning\".\n # * \"FutureWarning\".\n # * \"PendingDeprecationWarning\".\n simplefilter('always')\n \n # ..................{ PASS }..................\n # For each predefined type hint and associated metadata...\n for hint_meta in hints_meta:\n # If it is *NOT* the case that...\n if not (\n # This hint is currently supported *AND*...\n hint_meta.is_supported and\n # This is type-checkable against at least one object.\n hint_meta.piths_meta\n # Then this hint is ignorable. Silently continue to the next.\n ):\n continue\n # Else, this hint is currently supported.\n \n # Type hint to be type-checked.\n hint = hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_meta.conf\n \n # Object to be type-checked against this hint, arbitrarily selected from\n # the iterable of all such objects supplied with this hint. By the above\n # validation, this is guaranteed to be non-empty.\n pith = hint_meta.piths_meta[0]\n \n # If this tester is expected to emit a warning for this hint...\n if hint_meta.warning_type is not None:\n # print(f'hint_meta: {hint_meta}\\n')\n \n # Call this tester under a context manager asserting this tester to\n # emit the expected warning.\n> with warns(hint_meta.warning_type):\nE Failed: DID NOT WARN. No warnings of type (,) were emitted.\nE Emitted warnings: [].\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable\nLocation: /tmp/benchmark_8yni94pi/beartype/_check/code/codemake.py:1448\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> @ignore_warnings(DeprecationWarning)\n def test_door_die_if_unbearable(iter_hints_piths_meta) -> None:\n '''\n Test the :class:`beartype.door.die_if_unbearable` raiser function.\n \n Parameters\n ----------\n iter_hints_piths_meta : Callable[[], Iterable[beartype_test.a00_unit.data.hint.util.data_hintmetautil.HintPithMetadata]]\n Factory function creating and returning a generator iteratively yielding\n ``HintPithMetadata`` instances, each describing a sample type hint\n exercising an edge case in the :mod:`beartype` codebase paired with a\n related object either satisfying or violating that hint.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.door import die_if_unbearable\n from beartype.roar import (\n BeartypeConfException,\n BeartypeDecorHintNonpepException,\n BeartypeDoorHintViolation,\n )\n from beartype._util.text.utiltextrepr import represent_object\n from beartype_test.a00_unit.data.hint.util.data_hintmetacls import (\n HintPithUnsatisfiedMetadata)\n from pytest import raises\n \n # ....................{ PASS }....................\n # For each predefined type hint and associated metadata...\n for hint_pith_meta in iter_hints_piths_meta():\n # Type hint to be type-checked.\n hint = hint_pith_meta.hint_meta.hint\n \n # Beartype dataclass configuring this type-check.\n conf = hint_pith_meta.hint_meta.conf\n \n # Object to type-check against this type hint.\n pith = hint_pith_meta.pith\n \n # If this pith violates this hint...\n if isinstance(hint_pith_meta.pith_meta, HintPithUnsatisfiedMetadata):\n # print(f'hint_pith_meta: {hint_pith_meta}\\n')\n \n # Assert this raiser raises the expected exception when passed this\n # pith and hint.\n with raises(BeartypeDoorHintViolation) as exception_info:\n die_if_unbearable(pith, hint, conf=conf)\n \n # Exception message raised by this wrapper function.\n exception_message = str(exception_info.value)\n \n # Truncated representation of this pith.\n pith_repr = represent_object(pith)\n \n # Assert that this message contains a truncated representation of\n # this pith.\n assert pith_repr in exception_message\n \n # Assert that this raiser successfully replaced the temporary\n # placeholder previously prefixing this message.\n assert 'die_if_unbearable() value ' in exception_message.lower()\n assert ' violates type hint ' in exception_message\n # Else, this raiser satisfies this hint. In this case...\n else:\n # Assert this validator raises *NO* exception when passed this pith\n # and hint.\n> die_if_unbearable(pith, hint, conf=conf)\n\n> func_raiser = make_func_raiser(hint, conf, exception_prefix) # pyright: ignore\n\n> return func(*args)\n\n> return _make_func_checker( # type: ignore[return-value]\n\n> reraise_exception_placeholder(\n\n> raise exception.with_traceback(exception.__traceback__)\n\n> ) = make_code_check(hint_or_sane, hint, conf, exception_prefix)\n\n> return func(*args)\n\n> ) = make_check_expr(hint_or_sane, conf)\n\n> return func(*args)\n\n> @callable_cached\n def make_check_expr(\n # ..................{ ARGS ~ mandatory }..................\n hint_or_sane: HintOrHintSanifiedData,\n conf: BeartypeConf,\n \n # ..................{ ARGS ~ optional }..................\n cls_stack: TypeStack = None,\n ) -> CodeGenerated:\n '''\n **Type-checking expression factory** (i.e., low-level callable dynamically\n generating a pure-Python boolean expression type-checking an arbitrary\n object against the passed PEP-compliant type hint).\n \n This code factory performs a breadth-first search (BFS) over the abstract\n graph of nested type hints reachable from the subscripted arguments of the\n passed root type hint. For each such (possibly nested) hint, this factory\n embeds one or more boolean subexpressions validating a (possibly nested\n sub)object of an arbitrary object against that hint into the full boolean\n expression created and returned by this factory. In short, this factory is\n the beating heart of :mod:`beartype`. We applaud you for your perseverance.\n You finally found the essence of the Great Bear. You did it!! Now, we clap.\n \n This code factory is memoized for efficiency.\n \n Caveats\n -------\n **This factory intentionally accepts no** ``exception_prefix``\n **parameter.** Why? Since that parameter is typically specific to the\n context-sensitive use case of the caller, accepting that parameter would\n prevent this factory from memoizing the passed hint with the returned code,\n which would rather defeat the point. Instead, this factory only:\n \n * Returns generic non-working code containing the placeholder\n :data:`VAR_NAME_PITH_ROOT` substring that the caller is required to\n globally replace by either the name of the current parameter *or*\n ``return`` for return values (e.g., by calling the builtin\n :meth:`str.replace` method) to generate the desired non-generic working\n code type-checking that parameter or return value.\n * Raises generic non-human-readable exceptions containing the placeholder\n :attr:`beartype._util.error.utilerrraise.EXCEPTION_PLACEHOLDER` substring\n that the caller is required to explicitly catch and raise non-generic\n human-readable exceptions from by calling the\n :func:`beartype._util.error.utilerrraise.reraise_exception_placeholder`\n function.\n \n Parameters\n ----------\n hint_or_sane : HintOrHintSanifiedData\n Either a type hint *or* **sanified type hint metadata** (i.e.,\n :data:`.HintSanifiedData` object) to be type-checked.\n conf : BeartypeConf\n **Beartype configuration** (i.e., self-caching dataclass encapsulating\n all settings configuring type-checking for the passed object).\n cls_stack : TypeStack, optional\n **Type stack** (i.e., either a tuple of the one or more\n :func:`beartype.beartype`-decorated classes lexically containing the\n class variable or method annotated by this hint *or* :data:`None`).\n Defaults to :data:`None`.\n \n Returns\n -------\n CodeGenerated\n Tuple containing the Python code snippet dynamically generated by this\n code generator and metadata describing that code. See also the\n :attr:`beartype._data.hint.datahinttyping.CodeGenerated` type hint.\n \n Raises\n ------\n BeartypeDecorHintPepException\n If this object is *not* a PEP-compliant type hint.\n BeartypeDecorHintPepUnsupportedException\n If this object is a PEP-compliant type hint currently unsupported by\n the :func:`beartype.beartype` decorator.\n BeartypeDecorHintPep484Exception\n If one or more PEP-compliant type hints visitable from this object are\n nested :attr:`typing.NoReturn` child hints, since\n :attr:`typing.NoReturn` is valid *only* as a non-nested return hint.\n BeartypeDecorHintPep593Exception\n If one or more PEP-compliant type hints visitable from this object\n subscript the :pep:`593`-compliant :class:`typing.Annotated` class such\n that:\n \n * The second argument subscripting that class is an instance of the\n :class:`beartype.vale.Is` class.\n * One or more further arguments subscripting that class are *not*\n instances of the :class:`beartype.vale.Is` class.\n \n Warns\n -----\n BeartypeDecorHintPep585DeprecationWarning\n If one or more :pep:`484`-compliant type hints visitable from this\n object have been deprecated by :pep:`585`.\n '''\n \n # ..................{ LOCALS ~ hint : root }..................\n # Unpack the passed sanified hint metadata into:\n # * \"hint_root\", the top-level hint to be type-checked.\n # * \"typevar_to_hint_root\", the top-level type variable lookup table (i.e.,\n # dictionary mapping from each type variable parametrizing the origin of\n # this top-level hint to the child hint subscripting this top-level hint).\n hint_root, typevar_to_hint_root = unpack_hint_or_sane(hint_or_sane)\n # print(f'Received root hint {repr(hint_root)} and type variable lookup table {repr(typevar_to_hint_root)}.')\n \n # ..................{ LOCALS ~ hint : current }..................\n # Currently visited hint.\n hint_curr: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this hint (e.g.,\n # \"Union\" if \"hint_curr == Union[int, str]\").\n hint_curr_sign: HintSign = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : child }..................\n # Currently iterated child hint subscripting the currently visited hint.\n hint_child: Hint = None # pyright: ignore\n \n # Current unsubscripted typing attribute associated with this child hint\n # (e.g., \"Union\" if \"hint_child == Union[int, str]\").\n hint_child_sign: Optional[HintSign] = None\n \n # Currently iterated child hint subscripting the currently visited hint *OR*\n # sanified child hint metadata** (i.e., \"HintSanifiedData\" object describing\n # that child hint).\n hint_or_sane_child: HintOrHintSanifiedData = None # pyright: ignore\n \n # ..................{ LOCALS ~ hint : childs }..................\n # Current tuple of all child hints subscripting the currently visited hint\n # (e.g., \"(int, str)\" if \"hint_curr == Union[int, str]\").\n hint_childs: tuple = None # type: ignore[assignment]\n \n # Number of child hints subscripting the currently visited hint.\n hint_childs_len: int = None # type: ignore[assignment]\n \n # ..................{ LOCALS ~ hint : metadata }..................\n # Fixed list of all metadata describing all visitable hints currently\n # discovered by the breadth-first search (BFS) below. This list acts as a\n # standard First In First Out (FILO) queue, enabling this BFS to be\n # implemented as an efficient imperative algorithm rather than an\n # inefficient (and dangerous, due to both unavoidable stack exhaustion and\n # avoidable infinite recursion) recursive algorithm.\n #\n # Note that this list is guaranteed by the previously called\n # _die_if_hint_repr_exceeds_child_limit() function to be larger than the\n # number of hints transitively visitable from this root hint. Ergo, *ALL*\n # indexation into this list performed by this BFS is guaranteed to be safe.\n # Ergo, avoid explicitly testing below that the \"hints_meta.index_last\"\n # integer maintained by this BFS is strictly less than\n # \"FIXED_LIST_SIZE_MEDIUM\", as this constraint is already guaranteed to be\n # the case.\n hints_meta = acquire_instance(HintsMeta)\n \n # Initialize this fixed list.\n hints_meta.reinit(cls_stack=cls_stack, conf=conf)\n \n # 0-based index of metadata describing the currently visited hint in this\n # fixed list.\n hints_meta_index_curr = 0\n \n # ..................{ LOCALS ~ pep : 484 }..................\n # Set of the unqualified classnames referred to by all relative forward\n # references visitable from this root hint if any *OR* \"None\" otherwise\n # (i.e., if no such forward references are visitable).\n hint_refs_type_basename: Optional[set] = None\n \n # ..................{ LOCALS ~ func : code }..................\n # Python code snippet type-checking the root pith against the root hint:\n # * Localized separately from the \"func_wrapper_code\" snippet to enable this\n # function to validate this code to be valid *BEFORE* returning this code.\n # * Initialized to a placeholder string to be globally replaced in the\n # Python code snippet to be returned (i.e., \"func_wrapper_code\") by a\n # Python code snippet type-checking the root pith expression (i.e.,\n # \"VAR_NAME_PITH_ROOT\") against the root hint (i.e., \"hint_root\").\n func_root_code = hints_meta.enqueue_hint_child(\n hint=hint_root,\n # 1-based indentation level describing the initial level of indentation\n # appropriate for the root hint.\n indent_level=1,\n pith_expr=VAR_NAME_PITH_ROOT,\n pith_var_name_index=hints_meta.pith_curr_var_name_index,\n typevar_to_hint=typevar_to_hint_root,\n )\n \n # Python code snippet to be returned, seeded with a placeholder to be\n # replaced on the first iteration of the breadth-first search performed\n # below with a snippet type-checking the root pith against the root hint.\n #\n # Note that, shockingly, brute-force string concatenation has been\n # personally profiled by @leycec to be substantially faster than *ALL*\n # alternatives under CPython up to a large number of iterations (e.g.,\n # 100,000). This includes these popular alternatives, *ALL* of which are\n # orders of magnitude slower than brute-force string concatenation:\n # * deque.append().\n # * list.append().\n func_wrapper_code = func_root_code\n \n # ..................{ SEARCH }..................\n # While the 0-based index of metadata describing the next visited hint in\n # the \"hints_meta\" list does *NOT* exceed that describing the last\n # visitable hint in this list, there remains at least one hint to be\n # visited in the breadth-first search performed by this iteration.\n while hints_meta_index_curr <= hints_meta.index_last:\n # Update instance variables of this queue to reflect that this hint is\n # now the currently visited hint.\n hints_meta.set_hint_curr_meta(\n hint_curr_meta=hints_meta[hints_meta_index_curr])\n \n # Localize metadata for both efficiency and f-string purposes.\n hint_curr = hints_meta.hint_curr_meta.hint\n # print(f'Visiting type hint {repr(hint_curr)}...')\n \n # ................{ PEP }................\n # If this hint is PEP-compliant...\n if is_hint_pep(hint_curr):\n #FIXME: Refactor to call warn_if_hint_pep_unsupported() instead.\n #Actually...wait. This is probably still a valid test here. We'll\n #need to instead augment the is_hint_ignorable() function to\n #additionally test whether the passed hint is unsupported, in which\n #case that function should return false as well as emit a non-fatal\n #warning ala the new warn_if_hint_pep_unsupported() function --\n #which should probably simply be removed now. *sigh*\n #FIXME: Actually, in that case, we can simply reduce the following\n #two calls to simply:\n # die_if_hint_pep_ignorable(\n # hint=hint_curr, exception_prefix=hint_curr_exception_prefix)\n #\n #Of course, this implies we want to refactor the\n #die_if_hint_pep_unsupported() function into\n #die_if_hint_pep_ignorable()... probably.\n \n # If this hint is currently unsupported, raise an exception.\n #\n # Note the human-readable label prefixing the representations of\n # child PEP-compliant type hints is unconditionally passed. Since\n # the root hint has already been validated to be supported by\n # the above call to the same function, this call is guaranteed to\n # *NEVER* raise an exception for that hint.\n die_if_hint_pep_unsupported(\n hint=hint_curr, exception_prefix=EXCEPTION_PREFIX)\n # Else, this hint is supported.\n \n # Assert that this hint is unignorable. Iteration below generating\n # code for child hints of the current parent hint is *REQUIRED* to\n # explicitly ignore ignorable child hints. Since the caller has\n # explicitly ignored ignorable root hints, these two guarantees\n # together ensure that all hints visited by this breadth-first\n # search *SHOULD* be unignorable. Naturally, we validate that here.\n assert hint_curr is not Any, (\n f'{EXCEPTION_PREFIX}ignorable type hint '\n f'{repr(hint_curr)} not ignored.'\n )\n \n # Sign uniquely identifying this hint.\n hint_curr_sign = get_hint_pep_sign(hint_curr)\n # print(f'Visiting PEP type hint {repr(hint_curr)} sign {repr(hint_curr_sign)}...')\n \n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n # NOTE: Whenever adding support for (i.e., when generating code\n # type-checking) a new \"typing\" attribute below, similar support\n # for that attribute *MUST* also be added to the parallel:\n # * \"beartype._check.error\" subpackage, which raises exceptions on\n # the current pith failing this check.\n # * \"beartype._data.hint.pep.sign.datapepsignset.HINT_SIGNS_SUPPORTED_DEEP\"\n # frozen set of all signs for which this function generates deeply\n # type-checking code.\n #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n \n #FIXME: Python 3.10 provides proper syntactic support for \"case\"\n #statements, which should allow us to dramatically optimize this\n #\"if\" logic into equivalent \"case\" logic *AFTER* we drop support\n #for Python 3.9. Of course, that will be basically never, so we'll\n #have to preserve this for basically forever. What you gonna do?\n #FIXME: Actually, we should probably just leverage a hypothetical\n #\"beartype.vale.IsInline[...]\" validator to coerce this slow O(n)\n #procedural logic into fast O(1) object-oriented logic. Of course,\n #object-oriented logic is itself slow -- so we only do this if we\n #can sufficiently memoize that logic. Consideration!\n \n # Switch on (as in, pretend Python provides a \"case\" statement)\n # the sign identifying this hint to decide which type of code to\n # generate to type-check the current pith against the current hint.\n #\n # This decision is intentionally implemented as a linear series of\n # tests ordered in descending likelihood for efficiency. While\n # alternative implementations (that are more readily readable and\n # maintainable) do exist, these alternatives all appear to be\n # substantially less efficient.\n #\n # Consider the standard alternative of sequestering the body of\n # each test implemented below into either:\n #\n # * A discrete private function called by this function. This\n # approach requires maintaining a global private dictionary\n # mapping from each support unsubscripted typing attribute to\n # the function generating code for that attribute: e.g.,\n # def pep_code_check_union(...): ...\n # _HINT_TYPING_ATTR_ARGLESS_TO_CODER = {\n # typing.Union: pep_code_check_union,\n # }\n # Each iteration of this loop then looks up the function\n # generating code for the current attribute from this dictionary\n # and calls that function to do so. Function calls come with\n # substantial overhead in Python, impacting performance more\n # than the comparable linear series of tests implemented below.\n # Additionally, these functions *MUST* mutate local variables of\n # this function by some arcane means -- either:\n # * Passing these locals to each such function, returning these\n # locals from each such function, and assigning these return\n # values to these locals in this function after each such call.\n # * Passing a single composite fixed list of these locals to each\n # such function, which then mutates these locals in-place,\n # which then necessitates this function permanently store these\n # locals in such a list rather than as local variables.\n # * A discrete closure of this function, which adequately resolves\n # the aforementioned locality issue via the \"nonlocal\" keyword at\n # a substantial up-front performance cost of redeclaring these\n # closures on each invocation of this function.\n #\n # ..............{ SHALLOW }..............\n # Perform shallow type-checking logic (i.e., logic that does *NOT*\n # recurse and thus \"bottoms out\" at this hint) *BEFORE* deep\n # type-checking logic. The latter needs additional setup (e.g.,\n # generation of assignment expressions) *NOT* needed by the former,\n # whose requirements are more understandably minimalist.\n #\n # Note that:\n # * Shallow type-checking code should access this pith via\n # \"pith_curr_expr\". Since this code does *NOT* recurse,\n # \"pith_curr_expr\" accesses this pith optimally efficiently.\n # * Deep type-checking code should access this pith via\n # \"pith_assign_expr\". Since that code *DOES* recurse, only\n # \"pith_assign_expr\" accesses this pith optimally efficiently;\n # \"pith_curr_expr\" accesses this pith extremely inefficiently.\n # * Ignorable type-checking code (i.e., code ignoring this hint but\n # otherwise unsuitable for implementation as a reducer called by\n # the \"beartype._check.convert._reduce.redhint\" submodule, typically\n # due to useful side effects intentionally interacting with this\n # BFS) should follow the design pattern established by the\n # \"HintSignPep695TypeAliasSubscripted\" branch below.\n #\n # ..............{ ORIGIN }..............\n # If this hint both...\n if (\n # Originates from an origin type and may thus be shallowly\n # type-checked against that type *AND is either...\n hint_curr_sign in HINT_SIGNS_ORIGIN_ISINSTANCEABLE and (\n # Unsubscripted *OR*...\n not get_hint_pep_args(hint_curr) or\n # Currently unsupported with deep type-checking...\n hint_curr_sign not in HINT_SIGNS_SUPPORTED_DEEP\n )\n ):\n # Then generate trivial code shallowly type-checking the current\n # pith as an instance of the origin type originating this sign\n # (e.g., \"list\" for the hint \"typing.List[int]\").\n # print(f'Shallow checking unsubscripted hint {repr(hint_curr)}...')\n \n # Code type-checking the current pith against this origin type.\n hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n pith_curr_expr=hints_meta.pith_curr_expr,\n # Python expression evaluating to this origin type.\n hint_curr_expr=hints_meta.add_func_scope_type_or_types(\n # Origin type of this hint if any *OR* raise an\n # exception -- which should *NEVER* happen, as this hint\n # was validated above to be supported.\n get_hint_pep_origin_type_isinstanceable(hint_curr)),\n )\n # Else, this hint is either subscripted, not shallowly\n # type-checkable, *OR* deeply type-checkable.\n #\n # ..............{ FORWARDREF }..............\n # If this hint is a forward reference...\n elif hint_curr_sign is HintSignForwardRef:\n # Render this forward reference accessible to the body of this\n # wrapper function by populating:\n # * A Python expression evaluating to the class referred to by\n # this forward reference when accessed via the private\n # \"__beartypistry\" parameter.\n # * A set of the unqualified classnames referred to by all\n # relative forward references, including this reference if\n # relative. If this set was previously uninstantiated (i.e.,\n # \"None\"), this assignment initializes this local to the new\n # set instantiated by this call; else, this assignment\n # preserves this local set as is.\n (\n hints_meta.hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_curr, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n \n #FIXME: *REDUNDANT.* Shallow type-checking code defined below\n #already performs this exact same logic. Excise us up, please.\n # # Code type-checking the current pith against this class.\n # hints_meta.func_curr_code = CODE_PEP484_INSTANCE_format(\n # pith_curr_expr=hints_meta.pith_curr_expr,\n # hint_curr_expr=hints_meta.hint_curr_expr,\n # )\n # Else, this hint is *NOT* a forward reference.\n #\n # Since this hint is *NOT* shallowly type-checkable, this hint\n # *MUST* be deeply type-checkable. So, we do so now.\n #\n # ..............{ DEEP }..............\n # Perform deep type-checking logic (i.e., logic that is guaranteed\n # to recurse and thus *NOT* \"bottom out\" at this hint).\n else:\n # Tuple of all child hints subscripting this hint if any *OR*\n # the empty tuple otherwise (e.g., if this hint is its own\n # unsubscripted \"typing\" attribute).\n #\n # Note that the \"__args__\" dunder attribute is *NOT* guaranteed\n # to exist for arbitrary PEP-compliant type hints. Ergo, we\n # obtain this attribute via a higher-level utility getter.\n hint_childs = get_hint_pep_args(hint_curr)\n \n # Number of these child hints.\n hint_childs_len = len(hint_childs)\n \n # ............{ DEEP ~ expression }............\n #FIXME: Unit test that this is behaving as expected. Doing so\n #will require further generalizations, including:\n #* In the \"beartype._decor.decormain\" submodule:\n # * Detect when running under tests.\n # * When running under tests, define a new\n # \"func_wrapper.__beartype_wrapper_code\" attribute added to\n # decorated callables to be the \"func_wrapper_code\" string\n # rather than True. Note that this obviously isn't the right way\n # to do source code association. Ideally, we'd at least\n # interface with the stdlib \"linecache\" module (e.g., by calling\n # the linecache.lazycache() function intended to be used to\n # cache the source code for non-file-based modules) and possibly\n # even go so far as to define a PEP 302-compatible beartype\n # module loader. That's out of scope, so this suffices for now.\n #* In the \"beartype_test.a00_unit.data._data_hint_pep\" submodule:\n # * Add a new \"_PepHintMetadata.code_str_match_regexes\" field,\n # defined as an iterable of regular expressions matching\n # substrings of the \"func_wrapper.__beartype_wrapper_code\"\n # attribute that are expected to exist.\n # * For most \"HINTS_PEP_META\" entries, default this field to\n # merely the empty tuple.\n # * For deeply nested \"HINTS_PEP_META\" entries, define this\n # field as follows:\n # code_str_match_regexes=(r'\\s+:=\\s+',)\n #* In the \"beartype_test.a00_unit.pep.p484.test_p484\" submodule:\n # * Match the \"pep_hinted.__beartype_wrapper_code\" string against\n # all regular expressions in the \"code_str_match_regexes\"\n # iterable for the currently iterated \"pep_hint_meta\".\n #\n #This is fairly important, as we have no other reusable means of\n #ascertaining whether this is actually being applied in general.\n #FIXME: That's all great, except for the\n #\"func_wrapper.__beartype_wrapper_code\" part. Don't do that,\n #please. We really do just want to do this right the first time. As\n #expected, the key to doing so is the linecache.lazycache()\n #function, whose implementation under Python 3.7 reads:\n #\n # def lazycache(filename, module_globals):\n # \"\"\"Seed the cache for filename with module_globals.\n #\n # The module loader will be asked for the source only when getlines is\n # called, not immediately.\n #\n # If there is an entry in the cache already, it is not altered.\n #\n # :return: True if a lazy load is registered in the cache,\n # otherwise False. To register such a load a module loader with a\n # get_source method must be found, the filename must be a cachable\n # filename, and the filename must not be already cached.\n # \"\"\"\n # if filename in cache:\n # if len(cache[filename]) == 1:\n # return True\n # else:\n # return False\n # if not filename or (filename.startswith('<') and filename.endswith('>')):\n # return False\n # # Try for a __loader__, if available\n # if module_globals and '__loader__' in module_globals:\n # name = module_globals.get('__name__')\n # loader = module_globals['__loader__']\n # get_source = getattr(loader, 'get_source', None)\n #\n # if name and get_source:\n # get_lines = functools.partial(get_source, name)\n # cache[filename] = (get_lines,)\n # return True\n # return False\n #\n #Given that, what we need to do is:\n #* Define a new \"beartype._decor._pep302\" submodule implementing a\n # PEP 302-compatible loader for @beartype-generated wrapper\n # functions, enabling external callers (including the stdlib\n # \"linecache\" module) to obtain the source for these functions.\n # For space efficiency, this submodule should internally store\n # code in a compressed format -- which probably means \"gzip\" for\n # maximal portability. This submodule should at least define these\n # attributes:\n # * \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\", a dictionary mapping from\n # the unique fake module names assigned to @beartype-generated\n # wrapper functions by the @beartype decorator to the compressed\n # source strings for those fake modules.\n # * get_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator and returning the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally access the\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has *NOT* already been registered\n # to that dictionary, raise an exception.\n # * Else, uncompress the compressed source string previously\n # registered under that module name with that dictionary and\n # return that uncompressed string. Don't worry about caching\n # uncompressed strings here; that's exactly what the stdlib\n # \"linecache\" module already does on our behalf.\n # Ergo, this function should have signature resembling:\n # def get_source(func_wrapper_module_name: str) -> str:\n # * set_source(), a function accepting one unique fake module name\n # assigned to an arbitrary @beartype-generated wrapper function\n # by the @beartype decorator as well as as the uncompressed\n # source string for that fake module. Clearly, this function\n # should internally\n # \"_FUNC_WRAPPER_MODULE_NAME_TO_CODE\" dictionary and either:\n # * If the passed module name has already been registered to\n # that dictionary, raise an exception.\n # * Else, compress the passed uncompressed source string and\n # register that compressed string under that module name with\n # that dictionary.\n #* In the \"beartype._decor.decormain\" submodule:\n # * Do... something? Oh, boy. Why didn't we finish this comment?\n \n # If the expression yielding the current pith is neither...\n #\n # Note that we explicitly test against piths rather than\n # seemingly equivalent metadata to account for edge cases.\n # Notably, child hints of unions (and possibly other \"typing\"\n # objects) do *NOT* narrow the current pith and are *NOT* the\n # root hint. Ergo, a seemingly equivalent test like\n # \"hints_meta_index_curr != 0\" would generate false positives\n # and thus unnecessarily inefficient code.\n if not (\n # The root pith *NOR*...\n #\n # Note that this is merely a negligible optimization for the\n # common case in which the current pith is the root pith\n # (i.e., this is the first iteration of the outermost loop).\n # The subsequent call to the str.isidentifier() method is\n # *MUCH* more expensive than this object identity test.\n hints_meta.pith_curr_expr is VAR_NAME_PITH_ROOT or\n # A simple Python identifier *NOR*...\n hints_meta.pith_curr_expr.isidentifier() or\n # A complex Python expression already containing the\n # assignment expression-specific walrus operator \":=\". Since\n # this implies this expression to already be an assignment\n # expression, needlessly reassigning the local variable to\n # which this assignment expression was previously assigned\n # as yet another redundant local variable only harms\n # efficiency for *NO* tangible gain (e.g., expanding the\n # efficient assignment expression \"__beartype_pith_1 :=\n # next(iter(__beartype_pith_0))\" to the inefficient\n # assignment expression \"__beartype_pith_2 :=\n # __beartype_pith_1 := next(iter(__beartype_pith_0))\").\n #\n # Note that this edge case is induced by method calls\n # performed below of the form:\n # hints_meta.enqueue_hint_child(\n # ..., pith_expr=pith_curr_assign_expr, ...)\n #\n # As of this writing, the only such edge cases are:\n # * PEP 484- or 604-compliant unions containing *ONLY* two\n # or more PEP-compliant type hints (e.g., \"list[str] |\n # set[bytes]\").\n # * PEP 695-compliant subscripted type aliases.\n ':=' in hints_meta.pith_curr_expr\n ):\n # Then the current pith is ideally assigned to a unique\n # local variable via an assignment expression.\n # print(f'Incrementing hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index} by one.')\n \n # Increment the integer suffixing the name of this variable\n # *BEFORE* defining this variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n hints_meta.pith_curr_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Assignment expression assigning this full expression to\n # this local variable.\n hints_meta.pith_curr_assign_expr = (\n CODE_PEP572_PITH_ASSIGN_EXPR_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n pith_curr_expr=hints_meta.pith_curr_expr,\n ))\n # Else, the current pith is *NOT* safely assignable to a unique\n # local variable via an assignment expression. Since the\n # expression yielding the current pith is a simple Python\n # identifier, there is *NO* benefit to assigning that to another\n # local variable via another assignment expression, which would\n # just be an alias of the existing local variable assigned via\n # the existing assignment expression. Moreover, whereas chained\n # assignments are syntactically valid, chained assignment\n # expressions are syntactically invalid unless explicitly\n # protected by parens: e.g.,\n # >>> a = b = 'Mother*Teacher*Destroyer' # <-- fine\n # >>> (a := \"Mother's Abomination\") # <-- fine\n # >>> (a :=\n # ... (b := \"Mother's Illumination\")) # <-- fine\n # >>> (a := b := \"Mother's Illumination\") # <-- not fine\n # SyntaxError: invalid syntax\n #\n # In this case...\n else:\n # print(f'Preserving hint {hint_curr} pith expression {pith_curr_expr}...')\n # print(f'...index {pith_curr_var_name_index}.')\n \n # Preserve the Python code snippet evaluating to the value\n # of the current pith as is.\n hints_meta.pith_curr_assign_expr = hints_meta.pith_curr_expr\n \n # ............{ UNION }............\n # If this hint is a union (e.g., \"typing.Union[bool, str]\",\n # typing.Optional[float]\")...\n if hint_curr_sign in HINT_SIGNS_UNION:\n # Python code snippet type-checking the current pith against\n # this union if this union is unignorable *OR* \"None\".\n make_hint_pep484604_check_expr(hints_meta)\n # Else, this hint is *NOT* a union.\n #\n # ..........{ CONTAINERS }............\n # If this hint is either:\n # * A single-argument container like list[int] or set[str].\n # * A similar hint semantically resembling a single-argument\n # container subscripted by one argument and one or more\n # ignorable arguments like tuple[str, ...].\n #\n # Then this hint is effectively (for all intents and purposes) a\n # standard single-argument container. In this case...\n elif hint_curr_sign in HINT_SIGNS_CONTAINER_ARGS_1:\n # Python code snippet type-checking the current pith against\n # this hint if the child hint subscripting this parent\n # container hint is unignorable *OR* \"None\" otherwise.\n make_hint_pep484585_container_check_expr(hints_meta)\n # Else, this hint is *NOT* a standard single-argument container.\n #\n # ............{ SEQUENCES ~ tuple : fixed }............\n # If this hint is a fixed-length tuple (e.g., \"tuple[int,\n # str]\")...\n #\n # Note that if this hint is a:\n # * PEP 484-compliant \"typing.Tuple\"-based hint, this hint is\n # guaranteed to contain one or more child hints. Moreover, if\n # this hint contains exactly one child hint that is the empty\n # tuple, this hint is the empty fixed-length form\n # \"typing.Tuple[()]\".\n # * PEP 585-compliant \"tuple\"-based hint, this hint is *NOT*\n # guaranteed to contain one or more child hints. If this hint\n # contains *NO* child hints, this hint is equivalent to the\n # empty fixed-length PEP 484-compliant form\n # \"typing.Tuple[()]\". Yes, PEP 585 even managed to violate\n # PEP 484-compliance. UUUURGH!\n #\n # While tuples are sequences, the \"typing.Tuple\" singleton that\n # types tuples violates the syntactic norms established for\n # other standard sequences by concurrently supporting two\n # different syntaxes with equally different semantics:\n # * \"typing.Tuple[{typename}, ...]\", typing a tuple whose items\n # all satisfy the \"{typename}\" child hint. Note that the\n # \"...\" substring here is a literal ellipses.\n # * \"typing.Tuple[{typename1}, {typename2}, ..., {typenameN}]\",\n # typing a tuple whose:\n # * First item satisfies the \"{typename1}\" child hint.\n # * Second item satisfies the \"{typename2}\" child hint.\n # * Last item satisfies the \"{typenameN}\" child hint.\n # Note that the \"...\" substring here is *NOT* a literal\n # ellipses.\n #\n # This is what happens when unreadable APIs are promoted.\n elif hint_curr_sign is HintSignTupleFixed:\n # Initialize the code type-checking this pith against this\n # tuple to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_TUPLE_FIXED_PREFIX\n \n # If this hint is the empty fixed-length tuple, generate\n # and append code type-checking the current pith to be the\n # empty tuple. This edge case constitutes a code smell.\n if is_hint_pep484585_tuple_empty(hint_curr):\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_EMPTY_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name))\n # Else, that ridiculous edge case does *NOT* apply. In this\n # case...\n else:\n # Append code type-checking the length of this pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_LEN_format(\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_childs_len=hint_childs_len,\n ))\n \n #FIXME: Optimize by refactoring into a \"while\" loop.\n # For each possibly ignorable insane child hint of this\n # parent tuple...\n for hint_child_index, hint_child in enumerate(\n hint_childs):\n #FIXME: Refactor most (or even *ALL*) calls to\n #sanify_hint_child() to a new\n #hints_meta.sanify_hint() method. The repetition\n #here is becoming... unnerving.\n \n # Unignorable sane child hint sanified from this\n # possibly ignorable insane child hint *OR* \"None\"\n # otherwise (i.e., if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=hint_child,\n cls_stack=hints_meta.cls_stack,\n conf=hints_meta.conf,\n typevar_to_hint=(\n hints_meta.hint_curr_meta.typevar_to_hint),\n exception_prefix=hints_meta.exception_prefix,\n )\n # print(f'Sanified fixed tuple {hints_meta.hint_curr_meta}...')\n # print(f'...child hint {hint_child} -> {hint_or_sane_child}!')\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Python expression yielding the value of the\n # currently indexed item of this tuple to be\n # type-checked against this child hint.\n pith_child_expr = (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_child_index=hint_child_index,\n ))\n \n # Deeply type-check this child pith.\n hints_meta.func_curr_code += (\n CODE_PEP484585_TUPLE_FIXED_NONEMPTY_CHILD_format(\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_child_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n ))\n # Else, this child hint is ignorable.\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP484585_TUPLE_FIXED_SUFFIX}'\n # Format...\n ).format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n )\n # Else, this hint is *NOT* a fixed-length tuple.\n #\n # ..........{ MAPPINGS }............\n # If this hint is a standard mapping (e.g., \"dict[str, int]\")...\n elif hint_curr_sign in HINT_SIGNS_MAPPING:\n # Python expression evaluating to the origin type of this\n # mapping hint as a hidden beartype-specific parameter\n # injected into the signature of this wrapper function.\n hints_meta.hint_curr_expr = (\n hints_meta.add_func_scope_type_or_types(\n get_hint_pep_origin_type_isinstanceable(hint_curr)))\n \n # 2-tuple of the possibly ignorable insane child key and\n # value hints subscripting this mapping hint, defined as\n # either...\n hint_childs = (\n #FIXME: Note that a similar effect can also be achieved\n #through a reduction from type hints the form\n #\"{collections,typing}.Counter[{hint_child}]\" to:\n # typing.Annotated[\n # collections.abc.MutableMapping[{hint_child}, int],\n # beartype.vale.IsInstance[collections.Counter]\n # ]\n #However, the current approach is even *MORE* trivial\n #than that reduction. So, we currently prefer this.\n \n # If this hint describes a \"collections.Counter\"\n # dictionary subclass:\n # * The \"typing.Counter[...]\" type hint factory is\n # subscriptable by only a single key child type hint\n # and assumes the value child type hint typically\n # subscripting dictionary type hint factories to be\n # the standard \"int\" type (e.g., \"typing.Counter[str]\"\n # effectively expands to \"typing.Counter[str, int]\").\n # * The \"collections.Counter[...]\" type hint factory is\n # technically subscriptable by an arbitrary number of\n # child type hints but pragmatically subscriptable by\n # only a single key child type hint. Why? Static\n # type-checkers, which enforce that constraint.\n #\n # Despite these type-checking assumptions and\n # constraints, the \"collections.Counter\" type is itself\n # unconstrained. As of Python 3.13, the\n # collections.Counter.__init__() initializer accepts\n # arbitrary values that are *NOT* integers: e.g.,\n # >>> from collections import Counter\n # >>> c = Counter({'red': 'no, blue!', 'blue': 4.2})\n # >>> print(c)\n # Counter({'red': 'no, blue!', 'blue': 4.2}) # lol\n #\n # That permissiveness arguably constitutes a bug in both\n # CPython itself *AND* user code attempting such\n # shenanigans. Static type-checkers believe this to be\n # the case, anyway -- and that's good enough for us.\n # @beartype thus explicitly catches these bugs by\n # defaulting the undeclared value child type hint for\n # counter type hints to be the \"int\" type.\n (\n get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=EXCEPTION_PREFIX,\n ),\n int,\n )\n if hint_curr_sign is HintSignCounter else\n # Else, this hint does *NOT* describe a\n # \"collections.Counter\" dictionary subclass. In this\n # case, introspect the child key and value type hints\n # subscripting this parent hint in the standard way.\n get_hint_pep484585_args( # type: ignore[assignment]\n hint=hint_curr,\n args_len=2,\n exception_prefix=EXCEPTION_PREFIX,\n )\n )\n \n #FIXME: Consider also contextually considering child key\n #hints that reduce to \"Hashable\" to be ignorable. This\n #includes complex type hints like \"Union[Hashable, str]\",\n #which reduces to \"Hashable\". We can't particularly be\n #bothered at the moment. This is a microoptimization and\n #will probably require a non-trivial amount of work. *sigh*\n # Unignorable sane child key and value hints sanified from\n # these possibly ignorable insane child key and value hints\n # *OR* \"None\" otherwise (i.e., if ignorable).\n hint_or_sane_child_key = (\n sanify_hint_child(\n hint=hint_childs[0],\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n hint_or_sane_child_value = (\n sanify_hint_child(\n hint=hint_childs[1], # type: ignore[has-type]\n cls_stack=cls_stack,\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n ))\n \n # If at least one of these child hints are unignorable...\n if not (\n hint_or_sane_child_key is Any and\n hint_or_sane_child_value is Any\n ):\n # If this child key hint is unignorable...\n if hint_or_sane_child_key is not Any:\n # If this child value hint is also unignorable...\n if hint_or_sane_child_value is not Any:\n # Increase the indentation level of code\n # type-checking this child value pith.\n hints_meta.indent_level_child += 1\n \n # Increment the integer suffixing the name of a\n # unique local variable storing the value of\n # this child key pith *BEFORE* defining this\n # variable.\n hints_meta.pith_curr_var_name_index += 1\n \n # Name of this local variable.\n pith_key_var_name = PITH_INDEX_TO_VAR_NAME[\n hints_meta.pith_curr_var_name_index]\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child key pith\n # against this hint.\n hint_key_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_key,\n indent_level=hints_meta.indent_level_child,\n pith_expr=pith_key_var_name,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Placeholder string to be subsequently replaced\n # by code type-checking this child value pith\n # against this hint.\n hint_value_placeholder = (\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_VALUE_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n pith_key_var_name=pith_key_var_name,\n ),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n ))\n \n # Code deeply type-checking these child key and\n # value piths against these hints.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_VALUE_format(\n indent_curr=hints_meta.indent_curr,\n pith_key_var_name=pith_key_var_name, # pyright: ignore\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name),\n hint_key_placeholder=(\n hint_key_placeholder),\n hint_value_placeholder=(\n hint_value_placeholder),\n ))\n # Else, this child value hint is ignorable. In this\n # case...\n else:\n # Code deeply type-checking only this child key\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_KEY_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child key pith against this hint.\n hint_key_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=(\n hint_or_sane_child_key),\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_KEY_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n # Else, this child key hint is ignorable. By process\n # of elimination, this child value hint *MUST* be\n # unignorable. In this case...\n else:\n # Code deeply type-checking only this child value\n # pith against this hint.\n func_curr_code_key_value = (\n CODE_PEP484585_MAPPING_VALUE_ONLY_format(\n indent_curr=hints_meta.indent_curr,\n # Placeholder string to be subsequently\n # replaced by code type-checking this\n # child value pith against this hint.\n hint_value_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child_value,\n indent_level=hints_meta.indent_level_child,\n pith_expr=CODE_PEP484585_MAPPING_VALUE_ONLY_PITH_CHILD_EXPR_format(\n pith_curr_var_name=(\n hints_meta.pith_curr_var_name)),\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n # Code deeply type-checking this pith as well as at\n # least one of these child key and value piths.\n hints_meta.func_curr_code = CODE_PEP484585_MAPPING_format(\n indent_curr=hints_meta.indent_curr,\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hints_meta.hint_curr_expr,\n func_curr_code_key_value=func_curr_code_key_value,\n )\n # Else, these child key *AND* value hints are both\n # ignorable. In this case, fallback to trivial code\n # shallowly type-checking this pith as an instance of this\n # origin type.\n # Else, this hint is *NOT* a mapping.\n #\n # ............{ ANNOTATED }............\n # If this hint is a PEP 593-compliant type metahint, this\n # metahint is guaranteed by the reduction performed above to be\n # beartype-specific (i.e., metahint whose second argument is a\n # beartype validator produced by subscripting a beartype\n # validator factory). In this case...\n elif hint_curr_sign is HintSignAnnotated:\n # Defer heavyweight imports.\n from beartype.vale._core._valecore import BeartypeValidator\n \n # Initialize the code type-checking this pith against this\n # metahint to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP593_VALIDATOR_PREFIX\n \n # Unignorable sane metahint annotating this parent hint\n # sanified from this possibly ignorable insane metahint *OR*\n # \"None\" otherwise (i.e., if this metahint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n hint=get_hint_pep593_metahint(hint_curr),\n conf=conf,\n cls_stack=cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # print(f'[593] metahint: {repr(get_hint_pep593_metahint(hint_curr))}')\n # print(f'[593] hint_curr_meta: {repr(hints_meta.hint_curr_meta)}')\n # print(f'[593] hint_curr: {repr(hint_curr)}; hint_or_sane_child: {repr(hint_or_sane_child)}')\n \n # Tuple of the one or more beartype validators annotating\n # this metahint.\n hints_child = get_hint_pep593_metadata(hint_curr)\n # print(f'hints_child: {repr(hints_child)}')\n \n # If this metahint is ignorable...\n if hint_or_sane_child is Any:\n # Expression yielding the value of the current pith,\n # defined as either...\n hint_curr_expr = (\n hints_meta.pith_curr_expr\n # If this metahint is annotated by only one beartype\n # validator, the most efficient expression yielding\n # the value of the current pith is simply the full\n # Python expression *WITHOUT* assigning that value\n # to a reusable local variable in an assignment\n # expression. *NO* assignment expression is needed\n # in this case.\n #\n # Why? Because beartype validators are *NEVER*\n # recursed into. Each beartype validator is\n # guaranteed to be the leaf of a type-checking\n # subtree, guaranteeing this pith to be evaluated\n # only once.\n if len(hints_child) == 1 else\n # Else, this metahint is annotated by two or more\n # beartype validators. In this case, the most\n # efficient expression yielding the value of the\n # current pith is the assignment expression\n # assigning this value to a reusable local variable.\n hints_meta.pith_curr_assign_expr\n )\n # Else, this metahint is unignorable. In this case...\n else:\n # Python expression yielding the value of the current\n # pith, defaulting to the name of the local variable\n # assigned to by the assignment expression performed\n # below.\n hint_curr_expr = hints_meta.pith_curr_var_name\n \n # Code deeply type-checking this metahint.\n hints_meta.func_curr_code += (\n CODE_PEP593_VALIDATOR_METAHINT_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression yielding the value of the\n # current pith assigned to a local variable\n # efficiently reused by code generated by the\n # following iteration.\n #\n # Note this child hint is guaranteed to be followed\n # by at least one more test expression referencing\n # this local variable. Why? Because the \"typing\"\n # module forces metahints to be subscripted by one\n # child hint and one or more arbitrary objects.\n # Ergo, we need *NOT* explicitly validate that here.\n hint_child_placeholder=(\n hints_meta.enqueue_hint_or_sane_child(\n hint_or_sane=hint_or_sane_child,\n indent_level=hints_meta.indent_level_child,\n pith_expr=hints_meta.pith_curr_assign_expr,\n pith_var_name_index=(\n hints_meta.pith_curr_var_name_index),\n )\n ),\n )\n )\n \n #FIXME: Optimize by refactoring into a \"while\" loop. *sigh*\n # For the 0-based index and each beartype validator\n # annotating this metahint...\n for hint_child_index, hint_child in enumerate(hints_child):\n # print(f'Type-checking PEP 593 type hint {repr(hint_curr)} argument {repr(hint_child)}...')\n # If this is *NOT* a beartype validator, raise an\n # exception.\n #\n # Note that the previously called sanify_hint_child()\n # function validated only the first such to be a\n # beartype validator. All remaining arguments have yet\n # to be validated, so we do so now for consistency and\n # safety.\n if not isinstance(hint_child, BeartypeValidator):\n raise BeartypeDecorHintPep593Exception(\n f'{EXCEPTION_PREFIX}PEP 593 type hint '\n f'{repr(hint_curr)} subscripted by both '\n f'@beartype-specific and -agnostic metadata '\n f'(i.e., {represent_object(hint_child)} not '\n f'beartype validator).'\n )\n # Else, this argument is beartype-specific.\n #\n # If this is any beartype validator *EXCEPT* the first,\n # set the Python expression yielding the value of the\n # current pith to the name of the local variable\n # assigned to by the prior assignment expression. By\n # deduction, it *MUST* be the case now that either:\n # * This metahint was unignorable, in which case this\n # assignment uselessly reduplicates the exact same\n # assignment performed above. While non-ideal, this\n # assignment is sufficiently efficient to make any\n # optimizations here effectively worthless.\n # * This metahint was ignorable, in which case this\n # expression was set above to the assignment\n # expression assigning this pith for the first\n # beartype validator. Since this iteration has already\n # processed the first beartype validator, this\n # assignment expression has already been performed.\n # Avoid inefficiently re-performing this assignment\n # expression for each additional beartype validator by\n # efficiently reusing the previously assigned local.\n elif hint_child_index:\n hint_curr_expr = hints_meta.pith_curr_var_name\n # Else, this is the first beartype validator. See above.\n \n # Code deeply type-checking this validator.\n hints_meta.func_curr_code += CODE_PEP593_VALIDATOR_IS_format(\n indent_curr=hints_meta.indent_curr,\n # Python expression formatting the current pith into\n # the \"{obj}\" format substring previously embedded\n # by this validator into this code string.\n hint_child_expr=hint_child._is_valid_code.format(\n indent=hints_meta.indent_child,\n obj=hint_curr_expr,\n ),\n )\n \n # Generate locals safely merging the locals required by\n # both this validator code *AND* the current code\n # type-checking this entire root hint.\n update_mapping(\n mapping_trg=hints_meta.func_wrapper_scope,\n mapping_src=hint_child._is_valid_code_locals,\n )\n \n # Munge this code to...\n hints_meta.func_curr_code = (\n # Strip the erroneous \" and\" suffix appended by the\n # last child hint from this code.\n f'{hints_meta.func_curr_code[:LINE_RSTRIP_INDEX_AND]}'\n # Suffix this code by the substring suffixing all such\n # code.\n f'{CODE_PEP593_VALIDATOR_SUFFIX_format(indent_curr=hints_meta.indent_curr)}'\n )\n # Else, this hint is *NOT* a metahint.\n #\n # ............{ SUBCLASS }............\n # If this hint is either a PEP 484- or 585-compliant subclass\n # type hint...\n elif hint_curr_sign is HintSignType:\n # Unignorable sane child hint sanified from this possibly\n # ignorable insane child hint *OR* \"None\" otherwise (i.e.,\n # if this child hint is ignorable).\n hint_or_sane_child = sanify_hint_child(\n # Possibly ignorable insane child hint subscripting\n # this parent hint, validated to be the *ONLY* child\n # hint subscripting this parent hint.\n hint=get_hint_pep484585_arg(\n hint=hint_curr,\n exception_prefix=hints_meta.exception_prefix,\n ),\n conf=conf,\n cls_stack=hints_meta.cls_stack,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=hints_meta.exception_prefix,\n )\n \n # If this child hint is unignorable...\n if hint_or_sane_child is not Any:\n # Child hint encapsulated by this metadata.\n hint_child = get_hint_or_sane_hint(hint_or_sane_child)\n \n # Sign identifying this child hint.\n hint_child_sign = get_hint_pep_sign_or_none(hint_child)\n \n # If this child hint is a forward reference to a\n # superclass, expose this forward reference to the body\n # of this wrapper function. See above for commentary.\n if hint_child_sign is HintSignForwardRef:\n (\n hint_curr_expr,\n hint_refs_type_basename,\n ) = express_func_scope_type_ref(\n forwardref=hint_child, # type: ignore[arg-type]\n refs_type_basename=hint_refs_type_basename,\n func_scope=hints_meta.func_wrapper_scope,\n exception_prefix=EXCEPTION_PREFIX,\n )\n # Else, this child hint is *NOT* a forward reference. In\n # this case...\n else:\n # If this child hint is a union of superclasses,\n # reduce this union to a tuple of superclasses. Only\n # the latter is safely passable as the second\n # parameter to the issubclass() builtin under all\n # supported Python versions.\n if hint_child_sign is HintSignUnion:\n hint_child = get_hint_pep_args(hint_child) # pyright: ignore\n # Else, this child hint is *NOT* a union.\n \n # If this child hint is *NOT* an issubclassable\n # object, raise an exception.\n #\n # Note that the is_object_issubclassable() tester is\n # considerably faster and thus called before the\n # considerably slower\n # die_unless_object_issubclassable() raiser.\n if not is_object_issubclassable(hint_child): # type: ignore[arg-type]\n die_unless_object_issubclassable(\n obj=hint_child, # type: ignore[arg-type]\n exception_prefix=(\n f'{EXCEPTION_PREFIX}PEP 484 or 585 '\n f'subclass type hint {repr(hint_curr)} '\n f'child type hint '\n ),\n )\n # Else, this child hint is an issubclassable object.\n \n # Python expression evaluating to this child hint.\n hint_curr_expr = hints_meta.add_func_scope_type_or_types(\n hint_child) # pyright: ignore\n \n # Code type-checking this pith against this superclass.\n hints_meta.func_curr_code = CODE_PEP484585_SUBCLASS_format(\n pith_curr_assign_expr=hints_meta.pith_curr_assign_expr,\n pith_curr_var_name=hints_meta.pith_curr_var_name,\n hint_curr_expr=hint_curr_expr,\n indent_curr=hints_meta.indent_curr,\n )\n # Else, this child hint is ignorable. In this case...\n else:\n # Python expression evaluating to the origin type of\n # this hint -- which, by definition, is the \"type\"\n # superclass. Since this superclass is a builtin (i.e.,\n # universally accessible object), we efficiently\n # hardcode the access of this superclass rather than\n # inject a hidden beartype-specific parameter into the\n # signature of this wrapper function as we usually do.\n hints_meta.hint_curr_expr = 'type'\n \n # Fallback to trivial code shallowly type-checking this\n # pith as an instance of this origin type.\n # Else, this hint is *NOT* a subclass type hint.\n #\n # ............{ GENERIC or PROTOCOL }............\n # If this hint is either a:\n # * PEP 484-compliant generic (i.e., user-defined class\n # subclassing a combination of one or more of the\n # \"typing.Generic\" superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 544-compliant protocol (i.e., class subclassing a\n # combination of one or more of the \"typing.Protocol\"\n # superclass and other \"typing\" non-class\n # pseudo-superclasses) *OR*...\n # * PEP 585-compliant generic (i.e., user-defined class\n # subclassing at least one non-class PEP 585-compliant\n # pseudo-superclasses) *OR*...\n #\n # ...then this hint is a PEP-compliant generic. In this case...\n elif hint_curr_sign is HintSignPep484585GenericUnsubscripted:\n # print(f'Visiting generic type {repr(hint_curr)}...')\n \n # Initialize the code type-checking this pith against this\n # generic to the substring prefixing all such code.\n hints_meta.func_curr_code = CODE_PEP484585_GENERIC_PREFIX\n \n # For each unignorable unerased transitive pseudo-superclass\n # originally declared as a superclass of this generic...\n> for hint_or_sane_child in (\n iter_hint_pep484585_generic_bases_unerased(\n hint=hint_curr, # pyright: ignore\n conf=conf,\n typevar_to_hint=hints_meta.hint_curr_meta.typevar_to_hint,\n exception_prefix=EXCEPTION_PREFIX,\n )):\nE TypeError: 'NoneType' object is not iterable\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #7: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #8: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #15: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_is_bearable_warnings" ], [ "beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py", "test_door_die_if_unbearable" ] ] }, "complexity_info": { "centrality": { "distance_discount": 29.326899200000025, "in_degree": 2, "true_in_degree": 5.68, "out_degree": 7, "betweenness": 0.00014360964189716465, "pagerank": 0.0003075519236909324, "harmonic": 0.03918781328320802, "bidirectional_harmonic": 0.2702401125920861, "degree": 9 }, "line_count": 53, "code_line_count": 53, "cyclomatic": 6, "halstead_volume": 51.89147427955947, "halstead_difficulty": 1.875 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py", "function_name": "get_hint_pep484585_generic_bases_unerased", "test_info": { "success": false, "failed": 19, "passed": 1111, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_args_full\nLocation: /tmp/benchmark_gwv7qu39/beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:391\nError: TypeError: 'NoneType' object is not reversible\n\nTraceback:\n\n> def test_get_hint_pep484585_generic_args_full() -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.pep484585generic.get_hint_pep484585_generic_args_full`\n getter.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPep484585Exception\n from beartype.typing import (\n Generic,\n List,\n Sequence,\n )\n from beartype._data.hint.datahinttyping import (\n S,\n T,\n U,\n )\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_args_full)\n from beartype_test.a00_unit.data.hint.pep.proposal.pep484585.data_pep484585generic import (\n Nongeneric,\n Pep484GenericST,\n Pep585SequenceU,\n Pep484585GenericSTSequenceU,\n Pep484585GenericIntTSequenceU,\n Pep484585GenericUUST,\n Pep585GenericUIntT,\n )\n from pytest import raises\n \n # ....................{ LOCALS }....................\n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic.\n PEP484585_GENERIC_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, (S, T,)),\n (Pep484GenericST[int, float], (int, float,)),\n (Pep585SequenceU, (U,)),\n (Pep585SequenceU[complex], (complex,)),\n (Pep484585GenericSTSequenceU, (bool, int, T, U,)),\n (Pep484585GenericIntTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, (U, S, T, U,)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], (bool, int, float, complex,)),\n (Pep484585GenericIntTSequenceU[complex], (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], (bool, int, float, bool,)),\n (Pep585GenericUIntT, (U, int, T, U,)),\n (Pep585GenericUIntT[bool, float], (bool, int, float, bool,)),\n ]\n \n # List of all generic argument cases, each of which is a 2-tuple of the\n # form \"(src_generic, src_base_target, trg_args)\" such that:\n # * \"src_generic\" is a PEP 484- or 585-compliant generic to be passed as the\n # input \"hint\" parameter to this getter.\n # * \"src_base_target\" is a target pseudo-superclass to be passed as the\n # input \"hint_base_target\" parameter to this getter.\n # * \"trg_args\" is the output tuple returned by this getter when passed that\n # input generic and target pseudo-superclass.\n PEP484585_GENERIC_BASE_TARGET_ARGS_FULL = [\n # ....................{ PEP ~ 484 }....................\n (Pep484GenericST, Generic, (S, T,)),\n (Pep484GenericST, Generic[S, T], (S, T,)),\n (Pep484GenericST[int, float], Generic, (int, float,)),\n (Pep585SequenceU, Sequence, (U,)),\n (Pep585SequenceU[complex], Sequence, (complex,)),\n (Pep484585GenericSTSequenceU, List, (bool,)),\n (Pep484585GenericSTSequenceU, Pep484GenericST, (int, T,)),\n (Pep484585GenericSTSequenceU, Nongeneric, ()),\n (Pep484585GenericSTSequenceU, Pep585SequenceU, (U,)),\n (Pep484585GenericIntTSequenceU, Pep484585GenericSTSequenceU, (bool, int, float, U,)),\n (Pep484585GenericUUST, Pep585SequenceU, (U,)),\n (Pep484585GenericUUST, Pep484GenericST, (S, T)),\n \n # ....................{ PEP ~ 585 }....................\n (Pep484585GenericSTSequenceU[float, complex], Pep484GenericST, (int, float,)),\n (Pep484585GenericSTSequenceU[float, complex], Pep585SequenceU, (complex,)),\n (Pep484585GenericIntTSequenceU[complex], Pep484585GenericSTSequenceU, (bool, int, float, complex,)),\n (Pep484585GenericUUST[bool, int, float], List[U], (bool,)),\n (Pep484585GenericUUST[bool, int, float], Pep484GenericST, (int, float)),\n (Pep585GenericUIntT, Pep585SequenceU, (U,)),\n (Pep585GenericUIntT, Pep484GenericST, (int, T)),\n (Pep585GenericUIntT[bool, float], List[U], (bool,)),\n (Pep585GenericUIntT[bool, float], Pep484GenericST, (int, float)),\n ]\n \n # ....................{ PASS }....................\n # Assert that this getter returns the expected tuples for the passed\n # generics, including subscripted and unsubscripted forms of these generics.\n for src_generic, trg_args in PEP484585_GENERIC_ARGS_FULL:\n> assert get_hint_pep484585_generic_args_full(src_generic) == trg_args\n\n> return func(*args)\n\n> @callable_cached\n def get_hint_pep484585_generic_args_full(\n # Mandatory parameters.\n hint: Hint,\n \n # Optional parameters.\n hint_base_target: Optional[Hint] = None,\n exception_cls: TypeException = BeartypeDecorHintPep484585Exception,\n exception_prefix: str = '',\n ) -> TupleHints:\n '''\n Tuple of the one or more **full child type hints** (i.e., complete tuple of\n *all* type hints directly subscripting both the passed generic *and*\n one or more pseudo-superclasses of this generic) transitively subscripting\n the passed :pep:`484`- or :pep:`585`-compliant **generic** (i.e., class\n superficially subclassing at least one PEP-compliant type hint that is\n possibly *not* an actual class) if this object is a generic *or* raise an\n exception otherwise (i.e., if this object is not a generic).\n \n This getter greedily replaces in the passed tuple as many abstract\n :pep:`484`-compliant **type variables** (i.e., :class:`typing.TypeVar`\n objects) as there are concrete child type hints directly subscripting the\n passed generic. Doing so effectively \"bubbles up\" these concrete children up\n the class hierarchy into the \"empty placeholders\" established by the type\n variables transitively subscripting all pseudo-superclasses of this generic.\n \n This getter is guaranteed to return a non-empty tuple. By definition, a\n generic subclasses one or more generic superclasses necessarily subscripted\n by one or more child type hints.\n \n This getter is memoized for efficiency.\n \n Caveats\n -------\n **This getter is computationally complex in both space and time.** This\n getter exhibits:\n \n * Amortized :math:`O(1)` constant time complexity, thanks to memoization.\n * Non-amortized worst-case :math:`O(jk)` quadratic time complexity for:\n \n * :math:`j` the largest number of child type hints transitively\n subscripting a pseudo-superclass of this generic.\n * :math:`k` the total number of transitive pseudo-superclasses of this\n generic.\n \n **This getter is currently implemented with recursion.** Doing so yields a\n relatively trivial algorithm at a relatively non-trivial increase in runtime\n overhead, due to overhead associated with function calls in Python.\n \n Parameters\n ----------\n hint : object\n Generic type hint to be inspected.\n hint_base_target : Optional[Hint] = None\n **Target pseudo-superclass** (i.e., erased transitive pseudo-superclass\n of the passed generic to specifically search, filter, and return the\n child type hints of). Defaults to :data:`None`. Specifically:\n \n * If this parameter is :data:`None`, this getter returns the complete\n tuple of *all* type hints directly subscripting both the passed\n generic *and* one or more pseudo-superclasses of this generic.\n * If this parameter is *not* :data:`None`, this getter returns the\n partial tuple of *only* type hints directly subscripting both the\n passed generic *and* this passed pseudo-superclass of this generic.\n \n A target pseudo-superclass is passed to deduce whether two generics are\n related according to the :func:`beartype.door.is_subhint` relation. If\n all child type hints in the tuple returned by this getter (when passed\n some generic and its pseudo-superclass) are subhints of all child type\n hints in the tuple returned by this getter passed *only* that\n pseudo-superclass, then that generic is necessarily a subhint of that\n pseudo-superclass. Look. Just go with it, people.\n \n Lastly, note that this getter intentionally ignores *all* child hints\n subscripting this target pseudo-superclass. For search purposes, *any*\n child hints subscripting this target pseudo-superclass are not only\n irrelevant but harmful -- promoting false negatives in higher-level\n functions (e.g., :func:`beartype.door.is_subhint`) internally leveraging\n this lower-level getter. Ignoring these child hints is thus imperative.\n Since deciding child hint compatibility between the passed generic and\n this target pseudo-superclass is a non-trivial decision problem, this\n lower-level getter defers that problem to the caller by unconditionally\n returning the same result regardless of child hints subscripting this\n target pseudo-superclass.\n \n For example, consider the :pep:`484`-compliant :obj:`typing.Any`.\n Clearly, this getter should return the same tuple when passed an\n unsubscripted target pseudo-superclass as when passed a target\n pseudo-superclass subscripted by :obj:`typing.Any`: e.g.,\n \n .. code-block:: pycon\n \n >>> from typing import Any, Generic\n >>> class MuhGeneric[S, T](Generic[S, T]): pass\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[Any])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[S, T])\n (S, T)\n >>> get_hint_pep484585_generic_args_full(\n ... MuhGeneric, hint_base_target=Generic[int, float])\n (S, T)\n \n exception_cls : TypeException\n Type of exception to be raised. Defaults to\n :exc:`.BeartypeDecorHintPep484585Exception`.\n exception_prefix : str, optional\n Human-readable substring prefixing the representation of this object in\n the exception message. Defaults to the empty string.\n \n Returns\n -------\n Tuple[Hint, ...]\n Tuple of the one or more full child type hints transitively subscripting\n this generic.\n \n Raises\n ------\n exception_cls\n If this hint is either:\n \n * Neither a :pep:`484`- nor :pep:`585`-compliant generic.\n * A :pep:`484`- or :pep:`585`-compliant generic subclassing *no*\n pseudo-superclasses.\n \n Examples\n --------\n .. code-block:: pycon\n \n >>> from beartype.typing import Generic, TypeVar\n >>> from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n ... get_hint_pep484585_generic_args_full)\n \n >>> S = TypeVar('S')\n >>> T = TypeVar('T')\n \n >>> class GenericSuperclass(Generic[S], list[T]): pass\n >>> class GenericList(list[complex]): pass\n >>> class GenericSubclass(GenericSuperclass[int, T], GenericList): pass\n \n >>> get_hint_pep484585_generic_args_full(GenericSuperclass)\n (S, T)\n >>> get_hint_pep484585_generic_args_full(GenericSuperclass[int, float])\n (int, float)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass)\n (int, T, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n >>> get_hint_pep484585_generic_args_full(GenericSubclass[float])\n (int, float, complex)\n '''\n assert isinstance(exception_cls, type), (\n f'{repr(exception_cls)} not exception type.')\n assert isinstance(exception_prefix, str), (\n f'{repr(exception_prefix)} not string.')\n \n # ....................{ IMPORTS }....................\n # Avoid circular import dependencies.\n from beartype._util.hint.pep.utilpepget import get_hint_pep_args\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585gentest import (\n is_hint_pep484585_generic_user)\n \n # ....................{ PREAMBLE }....................\n # If the caller explicitly passed a pseudo-superclass target...\n #\n # Note that this is the common case for this getter and thus tested first.\n if hint_base_target:\n hint_base_target = (\n # If this pseudo-superclass target is this generic, this\n # pseudo-superclass target is effectively meaningless (albeit\n # technically valid). In this case, silently ignore this\n # pseudo-superclass target.\n None\n if hint is hint_base_target else\n # Else, this pseudo-superclass target is *NOT* this generic. In this\n # case, the unsubscripted generic underlying this possibly\n # subscripted target pseudo-superclass generic. See the docstring.\n get_hint_pep484585_generic_type( # pyright: ignore\n hint=hint_base_target,\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n )\n # Else, the caller passed *NO* pseudosuperclass target. In this case...\n \n # ....................{ LOCALS }....................\n # Metadata describing the passed generic, used to seed the depth-first\n # search (DFS) below with the first pseudo-superclass to be visited.\n hint_root_data = [\n # This generic.\n hint,\n \n # Metadata describing the direct parent pseudo-superclass of this\n # generic. By definition, this generic is the root of this n-ary tree\n # and thus has *NO* parent (either direct or indirect).\n None,\n ]\n \n # Unvisited pseudo-superclass stack (i.e., efficiently poppable list of\n # metadata describing *ALL* unvisited transitive pseudo-superclasses of this\n # generic, intentionally reordered in reverse order to enable the\n # non-recursive depth-first search (DFS) performed below to both visit and\n # pop these pseudo-superclasses in the expected order), seeded with metadata\n # describing the passed generic.\n #\n # Each item of this stack is a list of metadata describing an unvisited\n # transitive pseudo-superclass of this generic such that this list is\n # either:\n # * If this pseudo-superclass has yet to be visited by this DFS, a 2-list\n # \"(hint, hint_super_data)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is either:\n # * If this pseudo-superclass has a parent pseudo-superclass, the item\n # of this stack describing that parent pseudo-superclass.\n # * Else, this pseudo-superclass is the passed generic. Since this\n # generic has *NO* parent pseudo-superclass, \"None\".\n # * If this pseudo-superclass is itself a user-defined generic (i.e.,\n # defined by a third-party downstream package) that has already been\n # visited by this DFS, a 4-list \"(hint, hint_super_data, hint_args_stack,\n # hint_args_full)\" where:\n # * \"hint\" is this pseudo-superclass.\n # * \"hint_super_data\" is as defined above.\n # * \"hint_args_stack\" is this pseudo-superclass' direct child hint stack\n # (i.e., list of the zero or more child hints directly subscripting this\n # pseudo-superclass in reverse order, embodying an efficiently poppable\n # stack of these hints), popped off while recursing up from the child\n # pseudo-superclasses of this pseudo-superclass.\n # * \"hint_args_full\" is the list of zero or more child hints transitively\n # subscripting this pseudo-superclass, defined while recursing up from\n # the child pseudo-superclasses of this pseudo-superclass.\n #\n # In short, there be dragons here -- albeit extremely efficient dragons.\n hint_bases_data: _HintBasesData = [hint_root_data]\n \n # Dictionary mapping from each previously observed PEP 484-compliant type\n # variable (i.e., \"typing.TypeVar\" object) subscripting a transitive\n # pseudo-superclass of this generic to the corresponding child hint \"bubbled\n # up\" from a subclass of that pseudo-superclass into that type variable.\n #\n # This dictionary enables the DFS below to reliably \"bubble up\" a single\n # child hint to the same type variable appearing multiple times throughout a\n # generics hierarchy. For example, this dictionary enables the \"int\" child\n # hint subscripting the \"GenericList\" generic to be \"bubbled up\" into the\n # type variable \"T\" subscripting the pseudo-superclasses \"List\" and\n # \"Generic\" of this generic: e.g.,\n # >>> class GenericList[T](List[T], Generic[T]): pass\n # >>> get_hint_pep484585_generic_args_full(GenericList[int])\n # (int, int)\n #\n # For the above call, this contents of this dictionary resemble:\n # typevar_to_hint = {T: int}\n typevar_to_hint: TypeVarToHint = {}\n \n # ....................{ LOCALS ~ target }....................\n # List of zero or more child hints transitively subscripting the passed\n # target pseudo-superclass of this generic if this pseudo-superclass has\n # already been visited by the DFS below *OR* \"None\" otherwise (i.e., if this\n # pseudo-superclass has yet to be visited by this DFS).\n hint_base_target_args_full: Optional[ListHints] = None\n \n # True only if the pseudo-superclass currently visited by the DFS below is\n # still transitively subscripted by one or more PEP 484-compliant type\n # variables (i.e., \"TypeVar\" objects) that have yet to be replaced by\n # concrete hints of a parent pseudo-superclass of that pseudo-superclass.\n is_hint_base_arg_typevar = False\n \n # ....................{ SEARCH }....................\n # Iteration simulating a recursive depth-first search (DFS), efficiently\n # deciding the tuple of all child hints transitively subscripting the\n # desired pseudo-superclass of this generic.\n \n # With at least one transitive pseudo-superclass of this generic remains\n # unvisited...\n while hint_bases_data:\n # Metadata describing the currently visited transitive pseudo-superclass\n # of this generic defined as the top-most item of this stack.\n #\n # Note that we intentionally avoid popping this pseudo-superclass off\n # this stack yet. We only pop a pseudo-superclass off this stack *AFTER*\n # resolving all child pseudo-superclasses of that pseudo-superclass,\n # which simulates the \"backing out\" performed by genuine recursion.\n hint_base_data = hint_bases_data[-1]\n \n # Currently visited transitive pseudo-superclass of this generic.\n hint_base = hint_base_data[_HINT_BASES_INDEX_HINT]\n \n # True only if the metadata describing this pseudo-superclass is still\n # its initial size, implying that this DFS has yet to visit this\n # pseudo-superclass by recursing down into the child pseudo-superclasses\n # of this pseudo-superclass.\n is_hint_base_leaf = len(hint_base_data) == _HINT_BASE_DATA_LEN_LEAF\n \n # If...\n if (\n # This DFS has yet to visit this pseudo-superclass *AND*...\n is_hint_base_leaf and\n # This pseudo-superclass is itself a PEP 484- or 585-compliant\n # user-defined generic. Standard generics (i.e., that are *NOT*\n # user-defined) have *NO* pseudo-superclasses and are thus omitted.\n # Examples of omittable standard generics include:\n # * \"dict[str, U]\".\n # * \"typing.Generic[S, int]\").\n # * \"typing.Protocol[float, T]\").\n #\n # Note that this tester is mildly slower than the prior test and\n # thus intentionally tested later.\n is_hint_pep484585_generic_user(hint_base) # pyright: ignore\n # Then this DFS is currently recursing down into the child\n # pseudo-superclasses of this pseudo-superclass. In this case...\n ):\n # Expand the metadata describing this pseudo-superclass from its\n # current 2-list \"(hint, hint_super_data)\" into the expanded 4-list\n # \"(hint, hint_super_data, hint_args_stack, hint_args_full)\".\n # Specifically, append (in order):\n hint_base_data.extend((\n # Poppable stack of the zero or more child hints directly\n # subscripting this child pseudo-superclass.\n make_stack(get_hint_pep_args(hint_base)),\n # List of the zero or more child hints transitively subscripting\n # this child pseudo-superclass.\n [],\n ))\n \n # Tuple of the one or more child pseudo-superclasses of this\n # pseudo-superclass.\n # print(f'Introspecting generic {hint} unerased bases...')\n hint_child_bases = get_hint_pep484585_generic_bases_unerased(\n hint=hint_base, # pyright: ignore\n exception_cls=exception_cls,\n exception_prefix=exception_prefix,\n )\n # print(f'Generic {hint} unerased bases: {hint_child_bases}')\n \n # For each child pseudo-superclass of this pseudo-superclass,\n # intentionally iterated in reverse order so as to ensure that the\n # *FIRST* child pseudo-superclass is the *LAST* item of this stack\n # (and thus the *FIRST* unvisited pseudo-superclass to be visited by\n # this depth-first search (DFS) next).\n #\n # Note that the reversed() builtin is well-known to be the most\n # efficient means of producing a reversed iterable for iteration\n # purposes. See also:\n # https://stackoverflow.com/a/16514411/2809027\n> for hint_child_base in reversed(hint_child_bases):\nE TypeError: 'NoneType' object is not reversible\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_bases_unerased\nLocation: /tmp/benchmark_gwv7qu39/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py:178\nError: Failed: DID NOT RAISE \n\nTraceback:\n\n> def test_get_hint_pep484585_generic_bases_unerased(hints_pep_meta) -> None:\n '''\n Test the\n :func:`beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget.get_hint_pep484585_generic_bases_unerased`\n getter.\n \n Parameters\n ----------\n hints_pep_meta : List[beartype_test.a00_unit.data.hint.util.data_hintmetacls.HintPepMetadata]\n List of PEP-compliant type hint metadata describing sample PEP-compliant\n type hints exercising edge cases in the :mod:`beartype` codebase.\n '''\n \n # Defer test-specific imports.\n from beartype.roar import BeartypeDecorHintPepException\n from beartype._data.hint.pep.sign.datapepsignset import HINT_SIGNS_GENERIC\n from beartype._util.hint.pep.proposal.pep484585.generic.pep484585genget import (\n get_hint_pep484585_generic_bases_unerased)\n from beartype._util.hint.pep.utilpeptest import is_hint_pep_type_typing\n from beartype_test.a00_unit.data.hint.data_hint import NOT_HINTS_PEP\n from pytest import raises\n \n # For each PEP-compliant hint to be tested...\n for hint_pep_meta in hints_pep_meta:\n # If this is a generic hint, assert that this getter returns the\n # expected unerased pseudo-superclasses of this generic.\n if hint_pep_meta.pep_sign in HINT_SIGNS_GENERIC:\n hint_pep_bases = get_hint_pep484585_generic_bases_unerased(\n hint_pep_meta.hint)\n assert isinstance(hint_pep_bases, tuple)\n assert hint_pep_bases\n # Else, this is *NOT* a generic hint.\n #\n # If this hint is *NOT* defined by the \"typing\" module, assert that this\n # getter raises the expected exception.\n elif not is_hint_pep_type_typing(hint_pep_meta.hint):\n # print(f'hint_pep_meta: {repr(hint_pep_meta)}')\n> with raises(BeartypeDecorHintPepException):\nE Failed: DID NOT RAISE \n", "Failure #3: beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py::test_get_hint_pep484585_generic_base_in_module_first", "Failure #4: beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #9: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #10: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #19: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_args_full" ], [ "beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/generic/test_pep484585genget.py", "test_get_hint_pep484585_generic_bases_unerased" ] ] }, "complexity_info": { "centrality": { "distance_discount": 12.026880000000006, "in_degree": 3, "true_in_degree": 8.120000000000001, "out_degree": 4, "betweenness": 0.0001639317610335559, "pagerank": 0.0004463408698800402, "harmonic": 0.017050438596491226, "bidirectional_harmonic": 0.2377357337472471, "degree": 7 }, "line_count": 33, "code_line_count": 33, "cyclomatic": 5, "halstead_volume": 11.60964047443681, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/beartype/", "code_path": "beartype/", "name": "beartype", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/beartype/beartype.git", "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939, "stats": { "exists": true, "files_count": 374, "functions_count": 980, "total_lines": 86788, "avg_lines_per_file": 232.05347593582889, "avg_lines_per_func": 88.55918367346939 }, "commit": "8b34f7aee0125fb00cfa63fb1e992bc877ed4b71", "repos_final_path": "/home/ubuntu/repos-final/beartype/" }, "fpath": "beartype/_check/signature/sigmake.py", "function_name": "make_func_signature", "test_info": { "success": false, "failed": 85, "passed": 1045, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py::test_is_func_beartyped\nLocation: /tmp/benchmark__gbet2nz/beartype/_util/func/utilfuncmake.py:286\nError: beartype.roar.BeartypeDecorWrapperException: @beartyped where_that_or() wrapper unparseable, as @beartype generated invalid code raising:\n\tbuiltins.IndentationError: unexpected indent (<@beartype(beartype_test.a00_unit.a20_util.api.test_utilapibeartype.test_is_func_beartyped.where_that_or) at 0x747e0d7acae0>, line 4)\n\n(line 0001) None\n(line 0002) # Call this function with all passed parameters and localize the value\n(line 0003) # returned from this call.\n(line 0004) __beartype_pith_0 = __beartype_func(*args, **kwargs)\n(line 0005) \n(line 0006) # Noop required to artificially increase indentation level. Note that\n(line 0007) # CPython implicitly optimizes this conditional away. Isn't that nice?\n(line 0008) if True:\n(line 0009) # Type-check this parameter or return against this type hint.\n(line 0010) if not isinstance(__beartype_pith_0, str):\n(line 0011) __beartype_violation = __beartype_get_violation(\n(line 0012) check_meta=__beartype_check_meta,\n(line 0013) pith_name='return',\n(line 0014) pith_value=__beartype_pith_0,\n(line 0015) )\n(line 0016) \n(line 0017) raise __beartype_violation\n(line 0018) return __beartype_pith_0\n\nTraceback:\n\n> def test_is_func_beartyped() -> None:\n '''\n Test the\n :func:`beartype._util.api.utilbeartype.is_func_beartyped` tester.\n '''\n \n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.api.utilbeartype import is_func_beartyped\n \n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper = make_func(\n\n> def make_func(\n # Mandatory arguments.\n func_name: str,\n func_code: str,\n \n # Optional arguments.\n func_globals: Optional[LexicalScope] = None,\n func_locals: Optional[LexicalScope] = None,\n func_doc: Optional[str] = None,\n func_label: Optional[str] = None,\n func_labeller: Optional[Callable[[], str]] = None,\n func_wrapped: Optional[Callable] = None,\n is_debug: bool = False,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n ) -> Callable:\n '''\n Dynamically create and return a new function with the passed name declared\n by the passed code snippet and internally accessing the passed dictionaries\n of globally and locally scoped variables.\n \n Parameters\n ----------\n func_name : str\n Name of the function to be created.\n func_code : str\n Code snippet defining this function, including both this function's\n signature prefixed by zero or more decorations *and* body. **This\n snippet must be unindented.** If this snippet is indented, this factory\n raises a syntax error.\n func_globals : dict[str, Any] | None\n Dictionary mapping from the name to value of each **globally scoped\n attribute** (i.e., internally referenced in the body of the function\n declared by this code snippet). Defaults to the empty dictionary.\n func_locals : dict[str, Any] | None\n Dictionary mapping from the name to value of each **locally scoped\n attribute** (i.e., internally referenced either in the signature of\n the function declared by this code snippet *or* as decorators\n decorating that function). **Note that this factory necessarily\n modifies the contents of this dictionary.** Defaults to the empty\n dictionary.\n func_doc : str | None\n Human-readable docstring documenting this function. Defaults to\n :data:`None`, in which case this function remains undocumented.\n func_label : str | None\n Human-readable label describing this function for error-handling\n purposes. Note that this parameter is mutually exclusive with the\n competing ``func_labeller`` parameter; if both are non-:data:`None`, an\n exception is raised. Defaults to :data:`None`, in which case this label\n effectively defaults to ``\"{func_name}()\"``.\n func_labeller : Callable[[], str] | None\n Callback accepting *no* parameters and returning a human-readable label\n describing this function for error-handling purposes, intended for use\n cases in which simply passing this label as the ``func_label`` parameter\n is prohibitively expensive (e.g., due to the cost of string munging).\n Note that this parameter is mutually exclusive with the competing\n ``func_label`` parameter; if both are non-:data:`None`, an exception is\n raised. Defaults to :data:`None`, in which case this label effectively\n defaults to ``\"{func_name}()\"``.\n func_wrapped : Callable | None\n Callable wrapped by the function to be created. If non-:data:`None`,\n special dunder attributes will be propagated (i.e., copied) from this\n wrapped callable into this created function; these include:\n \n * ``__name__``, this function's unqualified name.\n * ``__doc__``, this function's docstring.\n * ``__module__``, the fully-qualified name of this function's module.\n \n Defaults to :data:`None`.\n is_debug : bool, optional\n :data:`True` only if this function is being debugged. If :data:`True`,\n then the definition (including signature and body) of this function is:\n \n * Printed to standard output.\n * Cached with the standard :mod:`linecache` module under a fake\n filename uniquely synthesized by this factory for this function.\n External callers may then subsequently access the definition of this\n function from that module as:\n \n .. code-block:: python\n \n from linecache import cache as linecache_cache\n func_source = linecache_cache[func.__code__.co_filename]\n \n Defaults to :data:`False`.\n exception_cls : Type[Exception], optional\n Type of exception to raise in the event of a fatal error. Defaults to\n :exc:`._BeartypeUtilCallableException`.\n \n Returns\n -------\n Callable\n Function with this name declared by this snippet.\n \n Raises\n ------\n exception_cls\n If either:\n \n * ``func_locals`` contains a key whose value is that of ``func_name``,\n implying the caller already declared a local attribute whose name\n collides with that of this function.\n * ``func_label`` and ``func_labeller`` are both non-:data:`None`.\n * This code snippet is syntactically invalid.\n * This code snippet is syntactically valid but fails to declare a\n function with this name.\n '''\n \n # ..................{ VALIDATION ~ pre }..................\n assert isinstance(func_name, str), f'{repr(func_name)} not string.'\n assert isinstance(func_code, str), f'{repr(func_code)} not string.'\n assert isinstance(is_debug, bool), f'{repr(is_debug)} not bool.'\n assert func_name, 'Parameter \"func_name\" empty.'\n assert func_code, 'Parameter \"func_code\" empty.'\n assert func_label is None or func_labeller is None, (\n f'Parameters \"func_label\" and \"func_labeller\" both non-\"None\".')\n \n # Default all unpassed parameters.\n if func_globals is None:\n func_globals = {}\n if func_locals is None:\n func_locals = {}\n assert isinstance(func_globals, dict), (\n f'{repr(func_globals)} not dictionary.')\n assert isinstance(func_locals, dict), (\n f'{repr(func_locals)} not dictionary.')\n \n # If \"func_labeller\" is unpassed...\n if func_labeller is None:\n # If both \"func_label\" *AND* \"func_labeller\" are unpassed, default\n # \"func_label\" to a sensible label.\n if func_label is None:\n func_label = f'{func_name}()'\n # Else, only \"func_labeller\" is unpassed.\n #\n # In either case, \"func_label\" should now be a valid label.\n \n assert isinstance(func_label, str), f'{repr(func_label)} not string.'\n # Else, \"func_labeller\" is passed. In this case...\n else:\n assert callable(func_labeller), f'{repr(func_labeller)} uncallable.'\n \n # If that function's name is already in this local scope, the caller\n # already declared a local attribute whose name collides with that\n # function's. In this case, raise an exception for safety.\n if func_name in func_locals:\n raise exception_cls(\n f'{func_label or func_labeller()} ' # type: ignore[misc]\n f'already defined by caller locals:\\n'\n f'{repr(func_locals)}'\n )\n # Else, that function's name is *NOT* already in this local scope.\n \n # ..................{ STARTUP ~ filename }..................\n # Note that this logic is intentionally performed *BEFORE* munging the\n # \"func_code\" string in-place below, as this logic depends upon the unique\n # ID of that string. Reassignment obliterates that uniqueness.\n \n # Arbitrary object uniquely associated with this function.\n func_filename_object: object = None\n \n # Possibly fully-qualified name of an arbitrary object uniquely associated\n # with this function.\n func_filename_name: str = None # type: ignore[assignment]\n \n # If this function is a high-level wrapper wrapping a lower-level\n # wrappee, uniquify the subsequent filename against this wrappee. This\n # wrappee's fully-qualified name guarantees the uniqueness of this\n # filename. Ergo, this is the ideal case.\n if func_wrapped:\n func_filename_name = get_object_name(func_wrapped)\n func_filename_object = func_wrapped\n # Else, this function is *NOT* such a wrapper. In this less ideal case,\n # fallback to a poor man's uniquification against the unqualified name and\n # code string underlying this function.\n else:\n func_filename_name = func_name\n func_filename_object = func_code\n \n # Fake in-memory filename hopefully unique to this function.\n # Optimistically, a fully-qualified object name and ID *SHOULD* be unique\n # for the lifetime of the active Python process.\n #\n # Specifically, this filename guarantees the uniqueness of the 3-tuple\n # ``({func_filename}, {func_file_line_number}, {func_name})`` commonly\n # leveraged by profilers (e.g., \"cProfile\") to identify arbitrary callables,\n # where:\n # * `{func_filename}` is this filename (e.g.,\n # `\"\"`).\n # * `{func_file_line_number}`, is *ALWAYS* 0 and thus *NEVER* unique.\n # * `{func_name}`, is identical to that of the decorated callable and also\n # thus *NEVER* unique.\n #\n # Ergo, uniquifying this filename is the *ONLY* means of uniquifying\n # metadata identifying this wrapper function via runtime inspection. Failure\n # to do so reduces tracebacks induced by exceptions raised by this wrapper\n # to non-human-readability, which is less than ideal: e.g.,\n #\n # Traceback (most recent call last):\n # File \"/home/leycec/py/betsee/betsee/gui/simconf/stack/widget/mixin/guisimconfwdgeditscalar.py\", line 313, in _set_alias_to_widget_value_if_sim_conf_open\n # widget=self, value_old=self._widget_value_last)\n # File \"\", line 25, in func_beartyped\n # File \"/home/leycec/py/betsee/betsee/gui/simconf/stack/widget/mixin/guisimconfwdgeditscalar.py\", line 409, in __init__\n # *args, widget=widget, synopsis=widget.undo_synopsis, **kwargs)\n # File \"\", line 13, in func_beartyped\n #\n # See the final traceback line, which is effectively useless.\n func_filename = (\n f'<@beartype({func_filename_name}) at {id(func_filename_object):#x}>')\n \n # ..................{ STARTUP ~ code }..................\n # Code snippet defining this function, stripped of all leading and trailing\n # whitespace to improve both readability and disambiguity. Since this\n # whitespace is safely ignorable, the original snippet is safely\n # replaceable by this stripped snippet.\n func_code = func_code.strip()\n \n # If debugging this function, print the definition of this function.\n if is_debug:\n print(f'{number_str_lines(func_code)}')\n # else:\n # print('!!!!!!!!!PRINTING NOTHING!!!!!!!!!!!')\n # Else, leave that definition obscured by the voracious bitbuckets of time.\n \n # ..................{ CREATION }..................\n # Attempt to...\n try:\n # Call the more verbose and obfuscatory compile() builtin instead of\n # simply calling \"exec(func_code, func_globals, func_locals)\". Why?\n # Because the exec() builtin does *NOT* provide a means to set this\n # function's \"__code__.co_filename\" read-only attribute.\n #\n # Note that we could pass \"single\" instead of \"exec\" here if we were\n # willing to constrain the passed \"func_code\" to a single statement. In\n # casual testing, there is very little performance difference between\n # the two (with an imperceptibly slight edge going to \"single\").\n func_code_compiled = compile(func_code, func_filename, 'exec')\n assert func_name not in func_locals\n \n # Define that function. For obscure and likely uninteresting reasons,\n # Python fails to capture that function (i.e., expose that function to\n # this factory) when the locals() dictionary is passed; instead, a\n # unique local dictionary *MUST* be passed.\n exec(func_code_compiled, func_globals, func_locals)\n # If doing so fails for *ANY* reason whatsoever, wrap that low-level\n # exception with a higher-level exception exhibiting the exact issue. Doing\n # so enables users to submit meaningful issues to our tracker.\n except Exception as exception:\n # Raise an exception suffixed by that function's declaration such that\n # each line of that declaration is prefixed by that line's number. This\n # renders \"SyntaxError\" exceptions referencing arbitrary line numbers\n # human-readable: e.g.,\n # File \"\", line 56\n # if not (\n # ^\n # SyntaxError: invalid syntax\n> raise exception_cls(\n f'{func_label or func_labeller()} ' # type: ignore[misc]\n f'unparseable, as @beartype generated invalid code raising:\\n'\n f'\\t{label_exception(exception)}\\n\\n'\n f'{number_str_lines(func_code)}'\n ) from exception\nE beartype.roar.BeartypeDecorWrapperException: @beartyped where_that_or() wrapper unparseable, as @beartype generated invalid code raising:\nE \tbuiltins.IndentationError: unexpected indent (<@beartype(beartype_test.a00_unit.a20_util.api.test_utilapibeartype.test_is_func_beartyped.where_that_or) at 0x747e0d7acae0>, line 4)\nE \nE (line 0001) None\nE (line 0002) # Call this function with all passed parameters and localize the value\nE (line 0003) # returned from this call.\nE (line 0004) __beartype_pith_0 = __beartype_func(*args, **kwargs)\nE (line 0005) \nE (line 0006) # Noop required to artificially increase indentation level. Note that\nE (line 0007) # CPython implicitly optimizes this conditional away. Isn't that nice?\nE (line 0008) if True:\nE (line 0009) # Type-check this parameter or return against this type hint.\nE (line 0010) if not isinstance(__beartype_pith_0, str):\nE (line 0011) __beartype_violation = __beartype_get_violation(\nE (line 0012) check_meta=__beartype_check_meta,\nE (line 0013) pith_name='return',\nE (line 0014) pith_value=__beartype_pith_0,\nE (line 0015) )\nE (line 0016) \nE (line 0017) raise __beartype_violation\nE (line 0018) return __beartype_pith_0\n", "\n============================================================\nFailure #2: beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py::test_api_vale_is_pass\nLocation: /tmp/benchmark__gbet2nz/beartype/_util/func/utilfuncmake.py:286\nError: beartype.roar.BeartypeDecorWrapperException: @beartyped _is_exclamatory() wrapper unparseable, as @beartype generated invalid code raising:\n\tbuiltins.IndentationError: unexpected indent (<@beartype(beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory) at 0x747e0d50ade0>, line 3)\n\n(line 0001) None\n(line 0002) # Localize the number of passed positional arguments for efficiency.\n(line 0003) __beartype_args_len = len(args)\n(line 0004) # Localize this positional or keyword parameter if passed *OR* to the\n(line 0005) # sentinel \"__beartype_raise_exception\" guaranteed to never be passed.\n(line 0006) __beartype_pith_0 = (\n(line 0007) args[0] if __beartype_args_len > 0 else\n(line 0008) kwargs.get('text', __beartype_get_violation)\n(line 0009) )\n(line 0010) \n(line 0011) # If this parameter was passed...\n(line 0012) if __beartype_pith_0 is not __beartype_get_violation:\n(line 0013) # Type-check this parameter or return against this type hint.\n(line 0014) if not isinstance(__beartype_pith_0, str):\n(line 0015) __beartype_violation = __beartype_get_violation(\n(line 0016) check_meta=__beartype_check_meta,\n(line 0017) pith_name='text',\n(line 0018) pith_value=__beartype_pith_0,\n(line 0019) )\n(line 0020) \n(line 0021) raise __beartype_violation\n(line 0022) # Call this function with all passed parameters and return the value\n(line 0023) # returned from this call as is (without being type-checked).\n(line 0024) return __beartype_func(*args, **kwargs)\n\nTraceback:\n\n> def test_api_vale_is_pass() -> None:\n '''\n Test successful usage of the :mod:`beartype.vale.Is` factory.\n '''\n \n # ....................{ IMPORTS }....................\n # Defer test-specific imports.\n from beartype import beartype\n from beartype._util.func.utilfuncmake import make_func\n from beartype.vale import Is\n from beartype.vale._core._valecore import BeartypeValidator\n from collections.abc import Mapping\n \n # ....................{ CLASSES }....................\n class FalseFake(object):\n '''\n Arbitrary class whose instances are implicitly convertible into\n **booleans** (i.e., :class:`bool` objects) via the :meth:`__bool__`\n dunder method despite *not* subclassing the builtin :class:`bool` type.\n '''\n \n def __bool__(self) -> bool:\n '''\n Dunder method coercing this non-boolean into a boolean.\n '''\n \n # Return false rather than true to exercise a non-trivial edge case\n # in which the callable subscripting an \"Is[...]\" validator returns\n # a non-boolean object, which then induces a validation failure,\n # which then displays a validator diagnosis embedding that object.\n return False\n \n # ....................{ FUNCS }....................\n # Undecorated non-lambda function with which to subscript the \"Is\" factory.\n def _is_quoted(text):\n return '\"' in text or \"'\" in text\n \n # Undecorated non-lambda function returning a non-boolean object implicitly\n # convertible into a boolean with which to subscript the \"Is\" factory,\n # exercising an edge case coercing the former to the latter in that factory.\n def _is_false_fake(obj):\n return FalseFake()\n \n # Decorated non-lambda function with which to subscript the \"Is\" factory,\n # exercising an edge case validating callable parameters in that factory.\n> @beartype\n\n> return beartype_object(obj, conf)\n\n> _beartype_object_fatal(obj, conf=conf, **kwargs)\n\n> beartype_nontype(obj, **kwargs) # type: ignore[return-value]\n\n> return beartype_func(obj, **kwargs) # type: ignore[return-value]\n\n> func_wrapper = make_func(\n\n> def make_func(\n # Mandatory arguments.\n func_name: str,\n func_code: str,\n \n # Optional arguments.\n func_globals: Optional[LexicalScope] = None,\n func_locals: Optional[LexicalScope] = None,\n func_doc: Optional[str] = None,\n func_label: Optional[str] = None,\n func_labeller: Optional[Callable[[], str]] = None,\n func_wrapped: Optional[Callable] = None,\n is_debug: bool = False,\n exception_cls: TypeException = _BeartypeUtilCallableException,\n ) -> Callable:\n '''\n Dynamically create and return a new function with the passed name declared\n by the passed code snippet and internally accessing the passed dictionaries\n of globally and locally scoped variables.\n \n Parameters\n ----------\n func_name : str\n Name of the function to be created.\n func_code : str\n Code snippet defining this function, including both this function's\n signature prefixed by zero or more decorations *and* body. **This\n snippet must be unindented.** If this snippet is indented, this factory\n raises a syntax error.\n func_globals : dict[str, Any] | None\n Dictionary mapping from the name to value of each **globally scoped\n attribute** (i.e., internally referenced in the body of the function\n declared by this code snippet). Defaults to the empty dictionary.\n func_locals : dict[str, Any] | None\n Dictionary mapping from the name to value of each **locally scoped\n attribute** (i.e., internally referenced either in the signature of\n the function declared by this code snippet *or* as decorators\n decorating that function). **Note that this factory necessarily\n modifies the contents of this dictionary.** Defaults to the empty\n dictionary.\n func_doc : str | None\n Human-readable docstring documenting this function. Defaults to\n :data:`None`, in which case this function remains undocumented.\n func_label : str | None\n Human-readable label describing this function for error-handling\n purposes. Note that this parameter is mutually exclusive with the\n competing ``func_labeller`` parameter; if both are non-:data:`None`, an\n exception is raised. Defaults to :data:`None`, in which case this label\n effectively defaults to ``\"{func_name}()\"``.\n func_labeller : Callable[[], str] | None\n Callback accepting *no* parameters and returning a human-readable label\n describing this function for error-handling purposes, intended for use\n cases in which simply passing this label as the ``func_label`` parameter\n is prohibitively expensive (e.g., due to the cost of string munging).\n Note that this parameter is mutually exclusive with the competing\n ``func_label`` parameter; if both are non-:data:`None`, an exception is\n raised. Defaults to :data:`None`, in which case this label effectively\n defaults to ``\"{func_name}()\"``.\n func_wrapped : Callable | None\n Callable wrapped by the function to be created. If non-:data:`None`,\n special dunder attributes will be propagated (i.e., copied) from this\n wrapped callable into this created function; these include:\n \n * ``__name__``, this function's unqualified name.\n * ``__doc__``, this function's docstring.\n * ``__module__``, the fully-qualified name of this function's module.\n \n Defaults to :data:`None`.\n is_debug : bool, optional\n :data:`True` only if this function is being debugged. If :data:`True`,\n then the definition (including signature and body) of this function is:\n \n * Printed to standard output.\n * Cached with the standard :mod:`linecache` module under a fake\n filename uniquely synthesized by this factory for this function.\n External callers may then subsequently access the definition of this\n function from that module as:\n \n .. code-block:: python\n \n from linecache import cache as linecache_cache\n func_source = linecache_cache[func.__code__.co_filename]\n \n Defaults to :data:`False`.\n exception_cls : Type[Exception], optional\n Type of exception to raise in the event of a fatal error. Defaults to\n :exc:`._BeartypeUtilCallableException`.\n \n Returns\n -------\n Callable\n Function with this name declared by this snippet.\n \n Raises\n ------\n exception_cls\n If either:\n \n * ``func_locals`` contains a key whose value is that of ``func_name``,\n implying the caller already declared a local attribute whose name\n collides with that of this function.\n * ``func_label`` and ``func_labeller`` are both non-:data:`None`.\n * This code snippet is syntactically invalid.\n * This code snippet is syntactically valid but fails to declare a\n function with this name.\n '''\n \n # ..................{ VALIDATION ~ pre }..................\n assert isinstance(func_name, str), f'{repr(func_name)} not string.'\n assert isinstance(func_code, str), f'{repr(func_code)} not string.'\n assert isinstance(is_debug, bool), f'{repr(is_debug)} not bool.'\n assert func_name, 'Parameter \"func_name\" empty.'\n assert func_code, 'Parameter \"func_code\" empty.'\n assert func_label is None or func_labeller is None, (\n f'Parameters \"func_label\" and \"func_labeller\" both non-\"None\".')\n \n # Default all unpassed parameters.\n if func_globals is None:\n func_globals = {}\n if func_locals is None:\n func_locals = {}\n assert isinstance(func_globals, dict), (\n f'{repr(func_globals)} not dictionary.')\n assert isinstance(func_locals, dict), (\n f'{repr(func_locals)} not dictionary.')\n \n # If \"func_labeller\" is unpassed...\n if func_labeller is None:\n # If both \"func_label\" *AND* \"func_labeller\" are unpassed, default\n # \"func_label\" to a sensible label.\n if func_label is None:\n func_label = f'{func_name}()'\n # Else, only \"func_labeller\" is unpassed.\n #\n # In either case, \"func_label\" should now be a valid label.\n \n assert isinstance(func_label, str), f'{repr(func_label)} not string.'\n # Else, \"func_labeller\" is passed. In this case...\n else:\n assert callable(func_labeller), f'{repr(func_labeller)} uncallable.'\n \n # If that function's name is already in this local scope, the caller\n # already declared a local attribute whose name collides with that\n # function's. In this case, raise an exception for safety.\n if func_name in func_locals:\n raise exception_cls(\n f'{func_label or func_labeller()} ' # type: ignore[misc]\n f'already defined by caller locals:\\n'\n f'{repr(func_locals)}'\n )\n # Else, that function's name is *NOT* already in this local scope.\n \n # ..................{ STARTUP ~ filename }..................\n # Note that this logic is intentionally performed *BEFORE* munging the\n # \"func_code\" string in-place below, as this logic depends upon the unique\n # ID of that string. Reassignment obliterates that uniqueness.\n \n # Arbitrary object uniquely associated with this function.\n func_filename_object: object = None\n \n # Possibly fully-qualified name of an arbitrary object uniquely associated\n # with this function.\n func_filename_name: str = None # type: ignore[assignment]\n \n # If this function is a high-level wrapper wrapping a lower-level\n # wrappee, uniquify the subsequent filename against this wrappee. This\n # wrappee's fully-qualified name guarantees the uniqueness of this\n # filename. Ergo, this is the ideal case.\n if func_wrapped:\n func_filename_name = get_object_name(func_wrapped)\n func_filename_object = func_wrapped\n # Else, this function is *NOT* such a wrapper. In this less ideal case,\n # fallback to a poor man's uniquification against the unqualified name and\n # code string underlying this function.\n else:\n func_filename_name = func_name\n func_filename_object = func_code\n \n # Fake in-memory filename hopefully unique to this function.\n # Optimistically, a fully-qualified object name and ID *SHOULD* be unique\n # for the lifetime of the active Python process.\n #\n # Specifically, this filename guarantees the uniqueness of the 3-tuple\n # ``({func_filename}, {func_file_line_number}, {func_name})`` commonly\n # leveraged by profilers (e.g., \"cProfile\") to identify arbitrary callables,\n # where:\n # * `{func_filename}` is this filename (e.g.,\n # `\"\"`).\n # * `{func_file_line_number}`, is *ALWAYS* 0 and thus *NEVER* unique.\n # * `{func_name}`, is identical to that of the decorated callable and also\n # thus *NEVER* unique.\n #\n # Ergo, uniquifying this filename is the *ONLY* means of uniquifying\n # metadata identifying this wrapper function via runtime inspection. Failure\n # to do so reduces tracebacks induced by exceptions raised by this wrapper\n # to non-human-readability, which is less than ideal: e.g.,\n #\n # Traceback (most recent call last):\n # File \"/home/leycec/py/betsee/betsee/gui/simconf/stack/widget/mixin/guisimconfwdgeditscalar.py\", line 313, in _set_alias_to_widget_value_if_sim_conf_open\n # widget=self, value_old=self._widget_value_last)\n # File \"\", line 25, in func_beartyped\n # File \"/home/leycec/py/betsee/betsee/gui/simconf/stack/widget/mixin/guisimconfwdgeditscalar.py\", line 409, in __init__\n # *args, widget=widget, synopsis=widget.undo_synopsis, **kwargs)\n # File \"\", line 13, in func_beartyped\n #\n # See the final traceback line, which is effectively useless.\n func_filename = (\n f'<@beartype({func_filename_name}) at {id(func_filename_object):#x}>')\n \n # ..................{ STARTUP ~ code }..................\n # Code snippet defining this function, stripped of all leading and trailing\n # whitespace to improve both readability and disambiguity. Since this\n # whitespace is safely ignorable, the original snippet is safely\n # replaceable by this stripped snippet.\n func_code = func_code.strip()\n \n # If debugging this function, print the definition of this function.\n if is_debug:\n print(f'{number_str_lines(func_code)}')\n # else:\n # print('!!!!!!!!!PRINTING NOTHING!!!!!!!!!!!')\n # Else, leave that definition obscured by the voracious bitbuckets of time.\n \n # ..................{ CREATION }..................\n # Attempt to...\n try:\n # Call the more verbose and obfuscatory compile() builtin instead of\n # simply calling \"exec(func_code, func_globals, func_locals)\". Why?\n # Because the exec() builtin does *NOT* provide a means to set this\n # function's \"__code__.co_filename\" read-only attribute.\n #\n # Note that we could pass \"single\" instead of \"exec\" here if we were\n # willing to constrain the passed \"func_code\" to a single statement. In\n # casual testing, there is very little performance difference between\n # the two (with an imperceptibly slight edge going to \"single\").\n func_code_compiled = compile(func_code, func_filename, 'exec')\n assert func_name not in func_locals\n \n # Define that function. For obscure and likely uninteresting reasons,\n # Python fails to capture that function (i.e., expose that function to\n # this factory) when the locals() dictionary is passed; instead, a\n # unique local dictionary *MUST* be passed.\n exec(func_code_compiled, func_globals, func_locals)\n # If doing so fails for *ANY* reason whatsoever, wrap that low-level\n # exception with a higher-level exception exhibiting the exact issue. Doing\n # so enables users to submit meaningful issues to our tracker.\n except Exception as exception:\n # Raise an exception suffixed by that function's declaration such that\n # each line of that declaration is prefixed by that line's number. This\n # renders \"SyntaxError\" exceptions referencing arbitrary line numbers\n # human-readable: e.g.,\n # File \"\", line 56\n # if not (\n # ^\n # SyntaxError: invalid syntax\n> raise exception_cls(\n f'{func_label or func_labeller()} ' # type: ignore[misc]\n f'unparseable, as @beartype generated invalid code raising:\\n'\n f'\\t{label_exception(exception)}\\n\\n'\n f'{number_str_lines(func_code)}'\n ) from exception\nE beartype.roar.BeartypeDecorWrapperException: @beartyped _is_exclamatory() wrapper unparseable, as @beartype generated invalid code raising:\nE \tbuiltins.IndentationError: unexpected indent (<@beartype(beartype_test.a00_unit.a40_api.vale._is.test_valeis.test_api_vale_is_pass._is_exclamatory) at 0x747e0d50ade0>, line 3)\nE \nE (line 0001) None\nE (line 0002) # Localize the number of passed positional arguments for efficiency.\nE (line 0003) __beartype_args_len = len(args)\nE (line 0004) # Localize this positional or keyword parameter if passed *OR* to the\nE (line 0005) # sentinel \"__beartype_raise_exception\" guaranteed to never be passed.\nE (line 0006) __beartype_pith_0 = (\nE (line 0007) args[0] if __beartype_args_len > 0 else\nE (line 0008) kwargs.get('text', __beartype_get_violation)\nE (line 0009) )\nE (line 0010) \nE (line 0011) # If this parameter was passed...\nE (line 0012) if __beartype_pith_0 is not __beartype_get_violation:\nE (line 0013) # Type-check this parameter or return against this type hint.\nE (line 0014) if not isinstance(__beartype_pith_0, str):\nE (line 0015) __beartype_violation = __beartype_get_violation(\nE (line 0016) check_meta=__beartype_check_meta,\nE (line 0017) pith_name='text',\nE (line 0018) pith_value=__beartype_pith_0,\nE (line 0019) )\nE (line 0020) \nE (line 0021) raise __beartype_violation\nE (line 0022) # Call this function with all passed parameters and return the value\nE (line 0023) # returned from this call as is (without being type-checked).\nE (line 0024) return __beartype_func(*args, **kwargs)\n", "Failure #3: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings", "Failure #4: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable", "Failure #5: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable", "Failure #6: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable", "Failure #7: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable", "Failure #8: beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py::test_resolve_pep563", "Failure #9: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_basic", "Failure #10: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_nested", "Failure #11: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_subtype", "Failure #12: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_core.py::test_decor_type_pseudocallable", "Failure #13: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_builtin", "Failure #14: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom", "Failure #15: beartype_test/a00_unit/a70_decor/a20_code/a00_type/test_decortype_descriptor.py::test_decor_type_descriptor_custom_pep487", "Failure #16: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_positional_or_keyword_pass", "Failure #17: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_and_keyword_only_pass", "Failure #18: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_param_kind_variadic_fail", "Failure #19: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_tuple", "Failure #20: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_pass_param_custom", "Failure #21: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_param_call_tuple", "Failure #22: beartype_test/a00_unit/a70_decor/a20_code/a40_nonpep/test_codenonpep.py::test_nonpep_fail_return_call", "Failure #23: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn", "Failure #24: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_noreturn_async", "Failure #25: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_namedtuple", "Failure #26: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484.py::test_decor_pep484_hint_sequence_args_1_cached", "Failure #27: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_data", "Failure #28: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_arg_pass", "Failure #29: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_fail", "Failure #30: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484ref.py::test_pep484_ref_call_arg_fail", "Failure #31: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/pep484/test_pep484typevar.py::test_decor_pep484_hint_typevar_cacheunworthy", "Failure #32: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep3119.py::test_decor_pep3119", "Failure #33: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_coroutine", "Failure #34: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_async_generator", "Failure #35: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep484585.py::test_decor_sync_generator", "Failure #36: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544", "Failure #37: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_decor_pep544_hint_subprotocol_elision", "Failure #38: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct", "Failure #39: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_direct_typevar", "Failure #40: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_protocol_custom_indirect", "Failure #41: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep544.py::test_typingpep544_pep593_integration", "Failure #42: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep557.py::test_decor_pep577", "Failure #43: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_reloaded", "Failure #44: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class_self_reference_override", "Failure #45: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_module", "Failure #46: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_class", "Failure #47: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_closure_nonnested", "Failure #48: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_namedtuple", "Failure #49: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep484_noreturn", "Failure #50: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep604", "Failure #51: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep563.py::test_pep563_hint_pep695", "Failure #52: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep585.py::test_decor_pep585_hint_nested_type_redefine", "Failure #53: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep591.py::test_decor_pep591", "Failure #54: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep612.py::test_decor_pep612", "Failure #55: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep646.py::test_decor_pep646", "Failure #56: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep647742.py::test_decor_pep647", "Failure #57: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep673.py::test_decor_pep673", "Failure #58: beartype_test/a00_unit/a70_decor/a20_code/a60_pep/test_decorpep692.py::test_decor_pep692", "Failure #59: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_asynccontextmanager", "Failure #60: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_contextlib.py::test_decor_contextlib_contextmanager", "Failure #61: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_functools.py::test_decor_functools_lru_cache", "Failure #62: beartype_test/a00_unit/a70_decor/a20_code/a90_api/test_decor_mypy.py::test_decor_mypy_notimplemented", "Failure #63: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex", "Failure #64: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varkw", "Failure #65: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kw_unknown_fail", "Failure #66: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_variadic", "Failure #67: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_kwonly_mixed", "Failure #68: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_flex_varpos_kwonly", "Failure #69: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly", "Failure #70: beartype_test/a00_unit/a70_decor/a20_code/test_decorarg.py::test_decor_arg_kind_posonly_flex_varpos_kwonly", "Failure #71: beartype_test/a00_unit/a70_decor/a20_code/test_decornontype.py::test_decor_nontype_wrapper_isomorphic", "Failure #72: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_python_optimized", "Failure #73: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_sync", "Failure #74: beartype_test/a00_unit/a70_decor/a20_code/test_decornoop.py::test_decor_noop_redecorated_async", "Failure #75: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_is_debug", "Failure #76: beartype_test/a00_unit/a70_decor/a40_conf/test_decorconf.py::test_decor_conf_strategy_O0", "Failure #77: beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype", "Failure #78: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_culprits", "Failure #79: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_pickle", "Failure #80: beartype_test/a00_unit/a70_decor/a90_roar/test_roarviolation.py::test_decor_violation_types", "Failure #81: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_this_package", "Failure #82: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_package", "Failure #83: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages", "Failure #84: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all", "Failure #85: beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py", "test_is_func_beartyped" ], [ "beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py", "test_api_vale_is_pass" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 2, "true_in_degree": 10.160000000000004, "out_degree": 1, "betweenness": 5.690193358189543e-05, "pagerank": 0.0007306864242630929, "harmonic": 0.0024671052631578946, "bidirectional_harmonic": 0.23530185549100024, "degree": 3 }, "line_count": 36, "code_line_count": 36, "cyclomatic": 9, "halstead_volume": 15.509775004326936, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/api.py", "function_name": "checkPath", "test_info": { "success": false, "failed": 23, "passed": 2200, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_CRLFLineEndings\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Tuples differ: (None, '') != (0, '')\n\nFirst differing element 0:\nNone\n0\n\n- (None, '')\n+ (0, '')\n\nTraceback:\n\n> def test_CRLFLineEndings(self):\n \"\"\"\n Source files with Windows CR LF line endings are parsed successfully.\n \"\"\"\n with self.makeTempFile(\"x = 42\\r\\n\") as sourcePath:\n> self.assertHasErrors(sourcePath, [])\n\n> self.assertEqual(\nE AssertionError: Tuples differ: (None, '') != (0, '')\nE \nE First differing element 0:\nE None\nE 0\nE \nE - (None, '')\nE + (0, '')\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::CheckTests::test_checkPathNonExisting\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: None != 1\n\nTraceback:\n\n> def test_checkPathNonExisting(self):\n \"\"\"\n L{checkPath} handles non-existing files.\n \"\"\"\n count, errors = self.getErrors('extremo')\n> self.assertEqual(count, 1)\nE AssertionError: None != 1\n", "Failure #3: pyflakes/test/test_api.py::CheckTests::test_checkRecursive", "Failure #4: pyflakes/test/test_api.py::CheckTests::test_encodedFileUTF8", "Failure #5: pyflakes/test/test_api.py::CheckTests::test_eofSyntaxError", "Failure #6: pyflakes/test/test_api.py::CheckTests::test_eofSyntaxErrorWithTab", "Failure #7: pyflakes/test/test_api.py::CheckTests::test_invalidEscape", "Failure #8: pyflakes/test/test_api.py::CheckTests::test_misencodedFileUTF16", "Failure #9: pyflakes/test/test_api.py::CheckTests::test_misencodedFileUTF8", "Failure #10: pyflakes/test/test_api.py::CheckTests::test_missingTrailingNewline", "Failure #11: pyflakes/test/test_api.py::CheckTests::test_multilineSyntaxError", "Failure #12: pyflakes/test/test_api.py::CheckTests::test_nonDefaultFollowsDefaultSyntaxError", "Failure #13: pyflakes/test/test_api.py::CheckTests::test_nonKeywordAfterKeywordSyntaxError", "Failure #14: pyflakes/test/test_api.py::CheckTests::test_permissionDenied", "Failure #15: pyflakes/test/test_api.py::CheckTests::test_pyflakesWarning", "Failure #16: pyflakes/test/test_api.py::IntegrationTests::test_errors_io", "Failure #17: pyflakes/test/test_api.py::IntegrationTests::test_errors_syntax", "Failure #18: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #19: pyflakes/test/test_api.py::IntegrationTests::test_goodFile", "Failure #20: pyflakes/test/test_api.py::TestMain::test_errors_io", "Failure #21: pyflakes/test/test_api.py::TestMain::test_errors_syntax", "Failure #22: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #23: pyflakes/test/test_api.py::TestMain::test_goodFile" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_CRLFLineEndings" ], [ "pyflakes/test/test_api.py", "test_checkPathNonExisting" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 2, "true_in_degree": 7.279999999999999, "out_degree": 1, "betweenness": 1.3466320731849644e-05, "pagerank": 0.000622861196748879, "harmonic": 0.0014970059880239522, "bidirectional_harmonic": 0.03594596521243226, "degree": 3 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 3, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.TUPLE", "test_info": { "success": false, "failed": 27, "passed": 2196, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentErrors\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n >>> a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46, a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61, a62, a63, a64, a65, a66, a67, a68, a69, a70, a71, a72, a73, a74, a75, a76, a77, a78, a79, a80, a81, a82, a83, a84, a85, a86, a87, a88, a89, a90, a91, a92, a93, a94, a95, a96, a97, a98, a99, a100, a101, a102, a103, a104, a105, a106, a107, a108, a109, a110, a111, a112, a113, a114, a115, a116, a117, a118, a119, a120, a121, a122, a123, a124, a125, a126, a127, a128, a129, a130, a131, a132, a133, a134, a135, a136, a137, a138, a139, a140, a141, a142, a143, a144, a145, a146, a147, a148, a149, a150, a151, a152, a153, a154, a155, a156, a157, a158, a159, a160, a161, a162, a163, a164, a165, a166, a167, a168, a169, a170, a171, a172, a173, a174, a175, a176, a177, a178, a179, a180, a181, a182, a183, a184, a185, a186, a187, a188, a189, a190, a191, a192, a193, a194, a195, a196, a197, a198, a199, a200, a201, a202, a203, a204, a205, a206, a207, a208, a209, a210, a211, a212, a213, a214, a215, a216, a217, a218, a219, a220, a221, a222, a223, a224, a225, a226, a227, a228, a229, a230, a231, a232, a233, a234, a235, a236, a237, a238, a239, a240, a241, a242, a243, a244, a245, a246, a247, a248, a249, a250, a251, a252, a253, a254, a255, *rest = range(1<<8 + 1)\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_starredAssignmentErrors(self):\n \"\"\"\n SyntaxErrors (not encoded in the ast) surrounding Python 3 extended\n iterable unpacking\n \"\"\"\n # Taken from test_unpack_ex.py in the cPython source\n s = \", \".join(\"a%d\" % i for i in range(1 << 8)) + \\\n \", *rest = range(1<<8 + 1)\"\n> self.flakes(s, m.TooManyExpressionsInStarredAssignment)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE >>> a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46, a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61, a62, a63, a64, a65, a66, a67, a68, a69, a70, a71, a72, a73, a74, a75, a76, a77, a78, a79, a80, a81, a82, a83, a84, a85, a86, a87, a88, a89, a90, a91, a92, a93, a94, a95, a96, a97, a98, a99, a100, a101, a102, a103, a104, a105, a106, a107, a108, a109, a110, a111, a112, a113, a114, a115, a116, a117, a118, a119, a120, a121, a122, a123, a124, a125, a126, a127, a128, a129, a130, a131, a132, a133, a134, a135, a136, a137, a138, a139, a140, a141, a142, a143, a144, a145, a146, a147, a148, a149, a150, a151, a152, a153, a154, a155, a156, a157, a158, a159, a160, a161, a162, a163, a164, a165, a166, a167, a168, a169, a170, a171, a172, a173, a174, a175, a176, a177, a178, a179, a180, a181, a182, a183, a184, a185, a186, a187, a188, a189, a190, a191, a192, a193, a194, a195, a196, a197, a198, a199, a200, a201, a202, a203, a204, a205, a206, a207, a208, a209, a210, a211, a212, a213, a214, a215, a216, a217, a218, a219, a220, a221, a222, a223, a224, a225, a226, a227, a228, a229, a230, a231, a232, a233, a234, a235, a236, a237, a238, a239, a240, a241, a242, a243, a244, a245, a246, a247, a248, a249, a250, a251, a252, a253, a254, a255, *rest = range(1<<8 + 1)\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> import fu.bar, fu.baz\n >>> fu.bar, fu.baz\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):4:12: 'fu.baz' imported but unused\n\nTraceback:\n\n> def test_differentSubmoduleImport(self):\n \"\"\"\n If two different submodules of a package are imported, no duplicate\n import warning is reported for the package.\n \"\"\"\n> self.flakes('''\n import fu.bar, fu.baz\n fu.bar, fu.baz\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> import fu.bar, fu.baz\nE >>> fu.bar, fu.baz\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):4:12: 'fu.baz' imported but unused\n", "Failure #3: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #4: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #5: pyflakes/test/test_doctests.py::TestImports::test_usedInList", "Failure #6: pyflakes/test/test_doctests.py::TestImports::test_usedInTuple", "Failure #7: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarUnpack", "Failure #8: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #9: pyflakes/test/test_imports.py::Test::test_differentSubmoduleImport", "Failure #10: pyflakes/test/test_imports.py::Test::test_redefinedWhileUnused", "Failure #11: pyflakes/test/test_imports.py::Test::test_shadowedByForDeep", "Failure #12: pyflakes/test/test_imports.py::Test::test_usedInList", "Failure #13: pyflakes/test/test_imports.py::Test::test_usedInTuple", "Failure #14: pyflakes/test/test_imports.py::TestSpecialAll::test_all_mixed_attributes_and_strings", "Failure #15: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes", "Failure #16: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes_added", "Failure #17: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_names", "Failure #18: pyflakes/test/test_other.py::Test::test_starredAssignmentErrors", "Failure #19: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #20: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #21: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #22: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined", "Failure #23: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future", "Failure #24: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #25: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #26: pyflakes/test/test_undefined_names.py::Test::test_definedAsStarUnpack", "Failure #27: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_starredAssignmentErrors" ], [ "pyflakes/test/test_doctests.py", "test_differentSubmoduleImport" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.9040000000000004, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.0054890219560878245, "bidirectional_harmonic": 0.0597305389221557, "degree": 2 }, "line_count": 15, "code_line_count": 15, "cyclomatic": 7, "halstead_volume": 92.0, "halstead_difficulty": 3.409090909090909 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.COMPARE", "test_info": { "success": false, "failed": 26, "passed": 2197, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestImports::test_usedInOperators\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n >>> import fu; 1 == fu.bar\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):3:12: 'fu' imported but unused\n\nTraceback:\n\n> def test_usedInOperators(self):\n self.flakes('import fu; 3 + fu.bar')\n self.flakes('import fu; 3 % fu.bar')\n self.flakes('import fu; 3 - fu.bar')\n self.flakes('import fu; 3 * fu.bar')\n self.flakes('import fu; 3 ** fu.bar')\n self.flakes('import fu; 3 / fu.bar')\n self.flakes('import fu; 3 // fu.bar')\n self.flakes('import fu; -fu.bar')\n self.flakes('import fu; ~fu.bar')\n> self.flakes('import fu; 1 == fu.bar')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE >>> import fu; 1 == fu.bar\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:12: 'fu' imported but unused\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileNested\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> context = None\n >>> def _worker():\n ... o = True\n ... while o is not True:\n ... while True:\n ... with context():\n ... del o\n ... o = False\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):11:20: local variable 'o' is assigned to but never used\n\nTraceback:\n\n> def test_delWhileNested(self):\n \"\"\"\n Ignore bindings deletions if node is part of while's test, even when\n del is in a nested block.\n \"\"\"\n> self.flakes('''\n context = None\n def _worker():\n o = True\n while o is not True:\n while True:\n with context():\n del o\n o = False\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> context = None\nE >>> def _worker():\nE ... o = True\nE ... while o is not True:\nE ... while True:\nE ... with context():\nE ... del o\nE ... o = False\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):11:20: local variable 'o' is assigned to but never used\n", "Failure #3: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileTestUsage", "Failure #4: pyflakes/test/test_imports.py::Test::test_usedInOperators", "Failure #5: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str", "Failure #6: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str_end", "Failure #7: pyflakes/test/test_is_literal.py::Test::test_is_bytes", "Failure #8: pyflakes/test/test_is_literal.py::Test::test_is_int", "Failure #9: pyflakes/test/test_is_literal.py::Test::test_is_not_bytes", "Failure #10: pyflakes/test/test_is_literal.py::Test::test_is_not_int", "Failure #11: pyflakes/test/test_is_literal.py::Test::test_is_not_str", "Failure #12: pyflakes/test/test_is_literal.py::Test::test_is_not_unicode", "Failure #13: pyflakes/test/test_is_literal.py::Test::test_is_str", "Failure #14: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant", "Failure #15: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant_containing_constants", "Failure #16: pyflakes/test/test_is_literal.py::Test::test_is_unicode", "Failure #17: pyflakes/test/test_is_literal.py::Test::test_left_is_bytes", "Failure #18: pyflakes/test/test_is_literal.py::Test::test_left_is_int", "Failure #19: pyflakes/test/test_is_literal.py::Test::test_left_is_not_bytes", "Failure #20: pyflakes/test/test_is_literal.py::Test::test_left_is_not_int", "Failure #21: pyflakes/test/test_is_literal.py::Test::test_left_is_not_str", "Failure #22: pyflakes/test/test_is_literal.py::Test::test_left_is_not_unicode", "Failure #23: pyflakes/test/test_is_literal.py::Test::test_left_is_str", "Failure #24: pyflakes/test/test_is_literal.py::Test::test_left_is_unicode", "Failure #25: pyflakes/test/test_undefined_names.py::Test::test_delWhileNested", "Failure #26: pyflakes/test/test_undefined_names.py::Test::test_delWhileTestUsage" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_usedInOperators" ], [ "pyflakes/test/test_doctests.py", "test_delWhileNested" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.496000000000002, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 3, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.008982035928143712, "bidirectional_harmonic": 0.06167664670658683, "degree": 3 }, "line_count": 13, "code_line_count": 13, "cyclomatic": 5, "halstead_volume": 15.509775004326936, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/api.py", "function_name": "main", "test_info": { "success": false, "failed": 9, "passed": 2214, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::IntegrationTests::test_errors_io\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Tuples differ: ('', '', 0) != ('', '/tmp/tmpf8z3sozx/temp: No such file or directory\\n', 1)\n\nFirst differing element 1:\n''\n'/tmp/tmpf8z3sozx/temp: No such file or directory\\n'\n\n- ('', '', 0)\n+ ('', '/tmp/tmpf8z3sozx/temp: No such file or directory\\n', 1)\n\nTraceback:\n\n> def test_errors_io(self):\n \"\"\"\n When pyflakes finds errors with the files it's given, (if they don't\n exist, say), then the return code is non-zero and the errors are\n printed to stderr.\n \"\"\"\n d = self.runPyflakes([self.tempfilepath])\n error_msg = '{}: No such file or directory{}'.format(self.tempfilepath,\n os.linesep)\n> self.assertEqual(d, ('', error_msg, 1))\nE AssertionError: Tuples differ: ('', '', 0) != ('', '/tmp/tmpf8z3sozx/temp: No such file or directory\\n', 1)\nE \nE First differing element 1:\nE ''\nE '/tmp/tmpf8z3sozx/temp: No such file or directory\\n'\nE \nE - ('', '', 0)\nE + ('', '/tmp/tmpf8z3sozx/temp: No such file or directory\\n', 1)\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::IntegrationTests::test_errors_syntax\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Tuples differ: ('', '', 0) != ('', '/tmp/tmpr1bc85pg/temp:1:7: invalid syntax\\nimport\\n ^\\n', 1)\n\nFirst differing element 1:\n''\n'/tmp/tmpr1bc85pg/temp:1:7: invalid syntax\\nimport\\n ^\\n'\n\n- ('', '', 0)\n+ ('', '/tmp/tmpr1bc85pg/temp:1:7: invalid syntax\\nimport\\n ^\\n', 1)\n\nTraceback:\n\n> def test_errors_syntax(self):\n \"\"\"\n When pyflakes finds errors with the files it's given, (if they don't\n exist, say), then the return code is non-zero and the errors are\n printed to stderr.\n \"\"\"\n with open(self.tempfilepath, 'wb') as fd:\n fd.write(b\"import\")\n d = self.runPyflakes([self.tempfilepath])\n \n if sys.version_info >= (3, 13):\n message = \"Expected one or more names after 'import'\"\n else:\n message = 'invalid syntax'\n \n error_msg = '{0}:1:7: {1}{2}import{2} ^{2}'.format(\n self.tempfilepath, message, os.linesep)\n> self.assertEqual(d, ('', error_msg, 1))\nE AssertionError: Tuples differ: ('', '', 0) != ('', '/tmp/tmpr1bc85pg/temp:1:7: invalid syntax\\nimport\\n ^\\n', 1)\nE \nE First differing element 1:\nE ''\nE '/tmp/tmpr1bc85pg/temp:1:7: invalid syntax\\nimport\\n ^\\n'\nE \nE - ('', '', 0)\nE + ('', '/tmp/tmpr1bc85pg/temp:1:7: invalid syntax\\nimport\\n ^\\n', 1)\n", "Failure #3: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #4: pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin", "Failure #5: pyflakes/test/test_api.py::TestMain::test_errors_io", "Failure #6: pyflakes/test/test_api.py::TestMain::test_errors_syntax", "Failure #7: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #8: pyflakes/test/test_api.py::TestMain::test_goodFile", "Failure #9: pyflakes/test/test_api.py::TestMain::test_readFromStdin" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_errors_io" ], [ "pyflakes/test/test_api.py", "test_errors_syntax" ] ] }, "complexity_info": { "centrality": { "distance_discount": 4.992000000000001, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 4, "betweenness": 3.14214150409825e-05, "pagerank": 0.0005100896860986547, "harmonic": 0.007984031936127744, "bidirectional_harmonic": 0.036174674460602595, "degree": 6 }, "line_count": 18, "code_line_count": 18, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.RETURN", "test_info": { "success": false, "failed": 30, "passed": 2193, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [, ] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 1:\n\n\n- [,\n? ^\n\n+ []\n? ^\n\n- ] : for input:\n\n def foo():\n a = range(1, 10)\n range = a\n return range\n\n foo()\n\n print(range)\n \nexpected outputs:\n[]\nbut got:\n(none):3:9: local variable 'range' defined as a builtin referenced before assignment\n(none):4:5: local variable 'range' is assigned to but never used\n\nTraceback:\n\n> def test_builtin_unbound_local(self):\n> self.flakes('''\n def foo():\n a = range(1, 10)\n range = a\n return range\n \n foo()\n \n print(range)\n ''', m.UndefinedLocal)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [, ] != []\nE \nE First list contains 1 additional elements.\nE First extra element 1:\nE \nE \nE - [,\nE ? ^\nE \nE + []\nE ? ^\nE \nE - ] : for input:\nE \nE def foo():\nE a = range(1, 10)\nE range = a\nE return range\nE \nE foo()\nE \nE print(range)\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:9: local variable 'range' defined as a builtin referenced before assignment\nE (none):4:5: local variable 'range' is assigned to but never used\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestOther::test_classWithReturn\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> class Foo(object):\n ... return\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_classWithReturn(self):\n \"\"\"\n If a return is used inside a class, a warning is emitted.\n \"\"\"\n> self.flakes('''\n class Foo(object):\n return\n ''', m.ReturnOutsideFunction)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> class Foo(object):\nE ... return\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "Failure #3: pyflakes/test/test_doctests.py::TestOther::test_moduleWithReturn", "Failure #4: pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine", "Failure #5: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #6: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #7: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #8: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #9: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #10: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #11: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #12: pyflakes/test/test_doctests.py::Test::test_ignore_nested_function", "Failure #13: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #14: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #15: pyflakes/test/test_imports.py::Test::test_nonGlobalDoesNotRedefine", "Failure #16: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #17: pyflakes/test/test_other.py::Test::test_classWithReturn", "Failure #18: pyflakes/test/test_other.py::Test::test_moduleWithReturn", "Failure #19: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope_reassigns_parameter", "Failure #20: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignmentInsideLoop", "Failure #21: pyflakes/test/test_other.py::TestUnusedAssignment::test_closedOver", "Failure #22: pyflakes/test/test_other.py::TestUnusedAssignment::test_doubleClosedOver", "Failure #23: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableAsLocals", "Failure #24: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #25: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #26: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #27: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #28: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #29: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #30: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_builtin.py", "test_builtin_unbound_local" ], [ "pyflakes/test/test_doctests.py", "test_classWithReturn" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.8800000000000003, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.004491017964071856, "bidirectional_harmonic": 0.06042914171656688, "degree": 2 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.YIELD", "test_info": { "success": false, "failed": 12, "passed": 2211, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestOther::test_classWithYield\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> class Foo(object):\n ... yield\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_classWithYield(self):\n \"\"\"\n If a yield is used inside a class, a warning is emitted.\n \"\"\"\n> self.flakes('''\n class Foo(object):\n yield\n ''', m.YieldOutsideFunction)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> class Foo(object):\nE ... yield\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> class Foo(object):\n ... yield from range(10)\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_classWithYieldFrom(self):\n \"\"\"\n If a yield from is used inside a class, a warning is emitted.\n \"\"\"\n> self.flakes('''\n class Foo(object):\n yield from range(10)\n ''', m.YieldOutsideFunction)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> class Foo(object):\nE ... yield from range(10)\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "Failure #3: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYield", "Failure #4: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYieldFrom", "Failure #5: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #6: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #7: pyflakes/test/test_other.py::Test::test_classWithYield", "Failure #8: pyflakes/test/test_other.py::Test::test_classWithYieldFrom", "Failure #9: pyflakes/test/test_other.py::Test::test_moduleWithYield", "Failure #10: pyflakes/test/test_other.py::Test::test_moduleWithYieldFrom", "Failure #11: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #12: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_classWithYield" ], [ "pyflakes/test/test_doctests.py", "test_classWithYieldFrom" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.8800000000000003, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.004491017964071856, "bidirectional_harmonic": 0.06042914171656688, "degree": 2 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "is_typing_overload", "test_info": { "success": false, "failed": 6, "passed": 2217, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 2 additional elements.\nFirst extra element 0:\n\n\n+ []\n- [,\n- ] : for input:\n\n import typing as t\n\n @t.overload\n def f(s: None) -> None:\n pass\n\n @t.overload\n def f(s: int) -> int:\n pass\n\n def f(s):\n return s\n \nexpected outputs:\n[]\nbut got:\n(none):9:1: redefinition of unused 'f' from line 5\n(none):12:1: redefinition of unused 'f' from line 9\n\nTraceback:\n\n> def test_aliased_import(self):\n \"\"\"Detect when typing is imported as another name\"\"\"\n> self.flakes(\"\"\"\n import typing as t\n \n @t.overload\n def f(s: None) -> None:\n pass\n \n @t.overload\n def f(s: int) -> int:\n pass\n \n def f(s):\n return s\n \"\"\")\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 2 additional elements.\nE First extra element 0:\nE \nE \nE + []\nE - [,\nE - ] : for input:\nE \nE import typing as t\nE \nE @t.overload\nE def f(s: None) -> None:\nE pass\nE \nE @t.overload\nE def f(s: int) -> int:\nE pass\nE \nE def f(s):\nE return s\nE \nE expected outputs:\nE []\nE but got:\nE (none):9:1: redefinition of unused 'f' from line 5\nE (none):12:1: redefinition of unused 'f' from line 9\n", "\n============================================================\nFailure #2: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 2 additional elements.\nFirst extra element 0:\n\n\n+ []\n- [,\n- ] : for input:\n\n from typing import overload\n\n class C:\n @overload\n def f(self, x: int) -> int:\n pass\n\n @overload\n def f(self, x: str) -> str:\n pass\n\n def f(self, x): return x\n \nexpected outputs:\n[]\nbut got:\n(none):10:5: redefinition of unused 'f' from line 6\n(none):13:5: redefinition of unused 'f' from line 10\n\nTraceback:\n\n> def test_overload_in_class(self):\n> self.flakes(\"\"\"\n from typing import overload\n \n class C:\n @overload\n def f(self, x: int) -> int:\n pass\n \n @overload\n def f(self, x: str) -> str:\n pass\n \n def f(self, x): return x\n \"\"\")\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 2 additional elements.\nE First extra element 0:\nE \nE \nE + []\nE - [,\nE - ] : for input:\nE \nE from typing import overload\nE \nE class C:\nE @overload\nE def f(self, x: int) -> int:\nE pass\nE \nE @overload\nE def f(self, x: str) -> str:\nE pass\nE \nE def f(self, x): return x\nE \nE expected outputs:\nE []\nE but got:\nE (none):10:5: redefinition of unused 'f' from line 6\nE (none):13:5: redefinition of unused 'f' from line 10\n", "Failure #3: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #4: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #5: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #6: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_type_annotations.py", "test_aliased_import" ], [ "pyflakes/test/test_type_annotations.py", "test_overload_in_class" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.4400000000000002, "in_degree": 1, "true_in_degree": 9.96, "out_degree": 1, "betweenness": 5.835405650468179e-05, "pagerank": 0.00035399174874546234, "harmonic": 0.002245508982035928, "bidirectional_harmonic": 0.05399201596806387, "degree": 2 }, "line_count": 9, "code_line_count": 9, "cyclomatic": 3, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.EXCEPTHANDLER", "test_info": { "success": false, "failed": 21, "passed": 2202, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != [, ]\n\nFirst differing element 0:\n\n\n\nSecond list contains 1 additional elements.\nFirst extra element 1:\n\n\n+ [,\n- []\n? ^ ^^^^ ^\n\n+ ]\n? ^ ^^ ^^^^^\n : for input:\ndef doctest_something():\n \"\"\"\n \n >>> import fu\n >>> try: pass\n ... except Exception as fu: pass\n \"\"\"\n\nexpected outputs:\n[, ]\nbut got:\n(none):4:12: 'fu' imported but unused\n\nTraceback:\n\n> def test_redefinedByExcept(self):\n expected = [m.RedefinedWhileUnused]\n # The exc variable is unused inside the exception handler.\n expected.append(m.UnusedVariable)\n> self.flakes('''\n import fu\n try: pass\n except Exception as fu: pass\n ''', *expected)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != [, ]\nE \nE First differing element 0:\nE \nE \nE \nE Second list contains 1 additional elements.\nE First extra element 1:\nE \nE \nE + [,\nE - []\nE ? ^ ^^^^ ^\nE \nE + ]\nE ? ^ ^^ ^^^^^\nE : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> import fu\nE >>> try: pass\nE ... except Exception as fu: pass\nE \"\"\"\nE \nE expected outputs:\nE [, ]\nE but got:\nE (none):4:12: 'fu' imported but unused\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> try:\n ... raise ValueError('ve')\n ... except ValueError as exc:\n ... e = exc\n >>> e\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):8:12: undefined name 'e'\n\nTraceback:\n\n> def test_namesDeclaredInExceptBlocks(self):\n \"\"\"Locals declared in except: blocks can be used after the block.\n \n This shows the example in test_undefinedExceptionName is\n different.\"\"\"\n> self.flakes('''\n try:\n raise ValueError('ve')\n except ValueError as exc:\n e = exc\n e\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> try:\nE ... raise ValueError('ve')\nE ... except ValueError as exc:\nE ... e = exc\nE >>> e\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):8:12: undefined name 'e'\n", "Failure #3: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #4: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #5: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #6: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #7: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #8: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #9: pyflakes/test/test_imports.py::Test::test_redefinedByExcept", "Failure #10: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #11: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #12: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExcept", "Failure #13: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #14: pyflakes/test/test_other.py::TestUnusedAssignment::test_exception_unused_in_except_star", "Failure #15: pyflakes/test/test_undefined_names.py::Test::test_namesDeclaredInExceptBlocks", "Failure #16: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionName", "Failure #17: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #18: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #19: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #20: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #21: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_redefinedByExcept" ], [ "pyflakes/test/test_doctests.py", "test_namesDeclaredInExceptBlocks" ] ] }, "complexity_info": { "centrality": { "distance_discount": 11.534080000000003, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 3, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.01427145708582834, "bidirectional_harmonic": 0.062475049900199614, "degree": 3 }, "line_count": 22, "code_line_count": 22, "cyclomatic": 8, "halstead_volume": 22.458839376460833, "halstead_difficulty": 1.875 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/reporter.py", "function_name": "Reporter.syntaxError", "test_info": { "success": false, "failed": 15, "passed": 2208, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::TestReporter::test_multiLineSyntaxError\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: 'foo.py:3:25: a problem\\nmore bad lines of source\\n ^\\n' != ''\n- foo.py:3:25: a problem\n- more bad lines of source\n- ^\n\nTraceback:\n\n> def test_multiLineSyntaxError(self):\n \"\"\"\n If there's a multi-line syntax error, then we only report the last\n line. The offset is adjusted so that it is relative to the start of\n the last line.\n \"\"\"\n err = io.StringIO()\n lines = [\n 'bad line of source',\n 'more bad lines of source',\n ]\n reporter = Reporter(None, err)\n reporter.syntaxError('foo.py', 'a problem', 3, len(lines[0]) + 7,\n '\\n'.join(lines))\n> self.assertEqual(\n (\"foo.py:3:25: a problem\\n\" +\n lines[-1] + \"\\n\" +\n \" \" * 24 + \"^\\n\"),\n err.getvalue())\nE AssertionError: 'foo.py:3:25: a problem\\nmore bad lines of source\\n ^\\n' != ''\nE - foo.py:3:25: a problem\nE - more bad lines of source\nE - ^\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::TestReporter::test_syntaxError\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: 'foo.py:3:8: a problem\\nbad line of source\\n ^\\n' != ''\n- foo.py:3:8: a problem\n- bad line of source\n- ^\n\nTraceback:\n\n> def test_syntaxError(self):\n \"\"\"\n C{syntaxError} reports that there was a syntax error in the source\n file. It reports to the error stream and includes the filename, line\n number, error message, actual line of source and a caret pointing to\n where the error is.\n \"\"\"\n err = io.StringIO()\n reporter = Reporter(None, err)\n reporter.syntaxError('foo.py', 'a problem', 3, 8, 'bad line of source')\n> self.assertEqual(\n (\"foo.py:3:8: a problem\\n\"\n \"bad line of source\\n\"\n \" ^\\n\"),\n err.getvalue())\nE AssertionError: 'foo.py:3:8: a problem\\nbad line of source\\n ^\\n' != ''\nE - foo.py:3:8: a problem\nE - bad line of source\nE - ^\n", "Failure #3: pyflakes/test/test_api.py::TestReporter::test_syntaxErrorNoOffset", "Failure #4: pyflakes/test/test_api.py::TestReporter::test_syntaxErrorNoText", "Failure #5: pyflakes/test/test_api.py::CheckTests::test_eofSyntaxError", "Failure #6: pyflakes/test/test_api.py::CheckTests::test_eofSyntaxErrorWithTab", "Failure #7: pyflakes/test/test_api.py::CheckTests::test_invalidEscape", "Failure #8: pyflakes/test/test_api.py::CheckTests::test_misencodedFileUTF16", "Failure #9: pyflakes/test/test_api.py::CheckTests::test_misencodedFileUTF8", "Failure #10: pyflakes/test/test_api.py::CheckTests::test_multilineSyntaxError", "Failure #11: pyflakes/test/test_api.py::CheckTests::test_nonDefaultFollowsDefaultSyntaxError", "Failure #12: pyflakes/test/test_api.py::CheckTests::test_nonKeywordAfterKeywordSyntaxError", "Failure #13: pyflakes/test/test_api.py::CheckTests::test_stdinReportsErrors", "Failure #14: pyflakes/test/test_api.py::IntegrationTests::test_errors_syntax", "Failure #15: pyflakes/test/test_api.py::TestMain::test_errors_syntax" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_multiLineSyntaxError" ], [ "pyflakes/test/test_api.py", "test_syntaxError" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 4, "true_in_degree": 4.0, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0006053811659192826, "harmonic": 0.0, "bidirectional_harmonic": 0.026507698887938396, "degree": 4 }, "line_count": 20, "code_line_count": 20, "cyclomatic": 6, "halstead_volume": 125.33591475173351, "halstead_difficulty": 5.115384615384615 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/api.py", "function_name": "checkRecursive", "test_info": { "success": false, "failed": 9, "passed": 2214, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_checkRecursive\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: None != 2\n\nTraceback:\n\n> def test_checkRecursive(self):\n \"\"\"\n L{checkRecursive} descends into each directory, finding Python files\n and reporting problems.\n \"\"\"\n tempdir = tempfile.mkdtemp()\n try:\n os.mkdir(os.path.join(tempdir, 'foo'))\n file1 = os.path.join(tempdir, 'foo', 'bar.py')\n with open(file1, 'wb') as fd:\n fd.write(b\"import baz\\n\")\n file2 = os.path.join(tempdir, 'baz.py')\n with open(file2, 'wb') as fd:\n fd.write(b\"import contraband\")\n log = []\n reporter = LoggingReporter(log)\n warnings = checkRecursive([tempdir], reporter)\n> self.assertEqual(warnings, 2)\nE AssertionError: None != 2\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::IntegrationTests::test_errors_io\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Tuples differ: ('', 'Traceback (most recent call last):\\n Fil[305 chars]', 1) != ('', '/tmp/tmp3adhg9l2/temp: No such file or directory\\n', 1)\n\nFirst differing element 1:\n'Traceback (most recent call last):\\n Fil[301 chars]\\'\\n'\n'/tmp/tmp3adhg9l2/temp: No such file or directory\\n'\n\n+ ('', '/tmp/tmp3adhg9l2/temp: No such file or directory\\n', 1)\n- ('',\n- 'Traceback (most recent call last):\\n'\n- ' File \"/tmp/benchmark_12xw7twy/pyflakes/../bin/pyflakes\", line 3, in '\n- '\\n'\n- ' main()\\n'\n- ' File \"/tmp/benchmark_12xw7twy/pyflakes/api.py\", line 182, in main\\n'\n- ' raise SystemExit(warnings > 0)\\n'\n- ' ^^^^^^^^^^^^\\n'\n- \"TypeError: '>' not supported between instances of 'NoneType' and 'int'\\n\",\n- 1)\n\nTraceback:\n\n> def test_errors_io(self):\n \"\"\"\n When pyflakes finds errors with the files it's given, (if they don't\n exist, say), then the return code is non-zero and the errors are\n printed to stderr.\n \"\"\"\n d = self.runPyflakes([self.tempfilepath])\n error_msg = '{}: No such file or directory{}'.format(self.tempfilepath,\n os.linesep)\n> self.assertEqual(d, ('', error_msg, 1))\nE AssertionError: Tuples differ: ('', 'Traceback (most recent call last):\\n Fil[305 chars]', 1) != ('', '/tmp/tmp3adhg9l2/temp: No such file or directory\\n', 1)\nE \nE First differing element 1:\nE 'Traceback (most recent call last):\\n Fil[301 chars]\\'\\n'\nE '/tmp/tmp3adhg9l2/temp: No such file or directory\\n'\nE \nE + ('', '/tmp/tmp3adhg9l2/temp: No such file or directory\\n', 1)\nE - ('',\nE - 'Traceback (most recent call last):\\n'\nE - ' File \"/tmp/benchmark_12xw7twy/pyflakes/../bin/pyflakes\", line 3, in '\nE - '\\n'\nE - ' main()\\n'\nE - ' File \"/tmp/benchmark_12xw7twy/pyflakes/api.py\", line 182, in main\\n'\nE - ' raise SystemExit(warnings > 0)\\n'\nE - ' ^^^^^^^^^^^^\\n'\nE - \"TypeError: '>' not supported between instances of 'NoneType' and 'int'\\n\",\nE - 1)\n", "Failure #3: pyflakes/test/test_api.py::IntegrationTests::test_errors_syntax", "Failure #4: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #5: pyflakes/test/test_api.py::IntegrationTests::test_goodFile", "Failure #6: pyflakes/test/test_api.py::TestMain::test_errors_io", "Failure #7: pyflakes/test/test_api.py::TestMain::test_errors_syntax", "Failure #8: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #9: pyflakes/test/test_api.py::TestMain::test_goodFile" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_checkRecursive" ], [ "pyflakes/test/test_api.py", "test_errors_io" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.8800000000000003, "in_degree": 2, "true_in_degree": 3.5999999999999996, "out_degree": 2, "betweenness": 2.693264146369929e-05, "pagerank": 0.0003802550448430494, "harmonic": 0.004491017964071856, "bidirectional_harmonic": 0.04186804961505559, "degree": 4 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 2, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "convert_to_value", "test_info": { "success": false, "failed": 15, "passed": 2208, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_dict.py::Test::test_duplicate_key_float_and_int\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 2 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [,\n+ ] : for input:\n\n {1: 1, 1.0: 2}\n \nexpected outputs:\n[, ]\nbut got:\n\nTraceback:\n\n> def test_duplicate_key_float_and_int(self):\n \"\"\"\n These do look like different values, but when it comes to their use as\n keys, they compare as equal and so are actually duplicates.\n The literal dict {1: 1, 1.0: 1} actually becomes {1.0: 1}.\n \"\"\"\n> self.flakes(\n '''\n {1: 1, 1.0: 2}\n ''',\n m.MultiValueRepeatedKeyLiteral,\n m.MultiValueRepeatedKeyLiteral,\n )\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 2 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [,\nE + ] : for input:\nE \nE {1: 1, 1.0: 2}\nE \nE expected outputs:\nE [, ]\nE but got:\n", "\n============================================================\nFailure #2: pyflakes/test/test_dict.py::Test::test_duplicate_keys\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 2 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [,\n+ ] : for input:\n{'yes': 1, 'yes': 2}\nexpected outputs:\n[, ]\nbut got:\n\nTraceback:\n\n> def test_duplicate_keys(self):\n> self.flakes(\n \"{'yes': 1, 'yes': 2}\",\n m.MultiValueRepeatedKeyLiteral,\n m.MultiValueRepeatedKeyLiteral,\n )\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 2 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [,\nE + ] : for input:\nE {'yes': 1, 'yes': 2}\nE expected outputs:\nE [, ]\nE but got:\n", "Failure #3: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bools", "Failure #4: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bools_false", "Failure #5: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_function", "Failure #6: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_lambda", "Failure #7: pyflakes/test/test_dict.py::Test::test_duplicate_keys_ints", "Failure #8: pyflakes/test/test_dict.py::Test::test_duplicate_keys_none", "Failure #9: pyflakes/test/test_dict.py::Test::test_duplicate_keys_tuples", "Failure #10: pyflakes/test/test_dict.py::Test::test_duplicate_keys_tuples_int_and_float", "Failure #11: pyflakes/test/test_dict.py::Test::test_duplicate_values_bytes_vs_unicode_py3", "Failure #12: pyflakes/test/test_dict.py::Test::test_duplicate_variable_keys", "Failure #13: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values", "Failure #14: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values_same_value", "Failure #15: pyflakes/test/test_dict.py::Test::test_multiple_duplicate_keys" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_dict.py", "test_duplicate_key_float_and_int" ], [ "pyflakes/test/test_dict.py", "test_duplicate_keys" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 1, "betweenness": 2.2443867886416075e-06, "pagerank": 0.0002877428998505232, "harmonic": 0.0014970059880239522, "bidirectional_harmonic": 0.04510978043912172, "degree": 2 }, "line_count": 10, "code_line_count": 10, "cyclomatic": 5, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.differentForks", "test_info": { "success": false, "failed": 22, "passed": 2201, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseFunction\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> if True:\n ... def a(): pass\n ... else:\n ... def a(): pass\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):7:16: redefinition of unused 'a' from line 5\n\nTraceback:\n\n> def test_redefinedIfElseFunction(self):\n \"\"\"\n Test that shadowing a function definition twice in an if\n and else block does not raise a warning.\n \"\"\"\n> self.flakes('''\n if True:\n def a(): pass\n else:\n def a(): pass\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> if True:\nE ... def a(): pass\nE ... else:\nE ... def a(): pass\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):7:16: redefinition of unused 'a' from line 5\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryExceptFunction\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> try:\n ... def a(): pass\n ... except:\n ... def a(): pass\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):7:16: redefinition of unused 'a' from line 5\n\nTraceback:\n\n> def test_redefinedTryExceptFunction(self):\n \"\"\"\n Test that shadowing a function definition twice in try\n and except block does not raise a warning.\n \"\"\"\n> self.flakes('''\n try:\n def a(): pass\n except:\n def a(): pass\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> try:\nE ... def a(): pass\nE ... except:\nE ... def a(): pass\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):7:16: redefinition of unused 'a' from line 5\n", "Failure #3: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #4: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #5: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #6: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #7: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #8: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #9: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #10: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #11: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #12: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #13: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #14: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElseFinally", "Failure #15: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptFinally", "Failure #16: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #17: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #18: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #19: pyflakes/test/test_match.py::TestMatch::test_defined_in_different_branches", "Failure #20: pyflakes/test/test_other.py::Test::test_redefinedIfElseFunction", "Failure #21: pyflakes/test/test_other.py::Test::test_redefinedTryExceptFunction", "Failure #22: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_redefinedIfElseFunction" ], [ "pyflakes/test/test_doctests.py", "test_redefinedTryExceptFunction" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.4000000000000004, "in_degree": 1, "true_in_degree": 9.96, "out_degree": 3, "betweenness": 8.753108475702269e-05, "pagerank": 0.00035399174874546234, "harmonic": 0.004491017964071856, "bidirectional_harmonic": 0.05414171656686626, "degree": 4 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 4, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/api.py", "function_name": "iterSourceCode", "test_info": { "success": false, "failed": 16, "passed": 2207, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::TestIterSourceCode::test_emptyDirectory\nLocation: /home/ubuntu/repos/pyflakes/pyflakes/test/test_api.py:119\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_emptyDirectory(self):\n \"\"\"\n There are no Python files in an empty directory.\n \"\"\"\n> self.assertEqual(list(iterSourceCode([self.tempdir])), [])\nE TypeError: 'NoneType' object is not iterable\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::TestIterSourceCode::test_explicitFiles\nLocation: /home/ubuntu/repos/pyflakes/pyflakes/test/test_api.py:218\nError: TypeError: 'NoneType' object is not iterable\n\nTraceback:\n\n> def test_explicitFiles(self):\n \"\"\"\n If one of the paths given to L{iterSourceCode} is not a directory but\n a file, it will include that in its output.\n \"\"\"\n epath = self.makeEmptyFile('e.py')\n> self.assertEqual(list(iterSourceCode([epath])),\n [epath])\nE TypeError: 'NoneType' object is not iterable\n", "Failure #3: pyflakes/test/test_api.py::TestIterSourceCode::test_multipleDirectories", "Failure #4: pyflakes/test/test_api.py::TestIterSourceCode::test_onlyPythonSource", "Failure #5: pyflakes/test/test_api.py::TestIterSourceCode::test_recurses", "Failure #6: pyflakes/test/test_api.py::TestIterSourceCode::test_shebang", "Failure #7: pyflakes/test/test_api.py::TestIterSourceCode::test_singleFile", "Failure #8: pyflakes/test/test_api.py::CheckTests::test_checkRecursive", "Failure #9: pyflakes/test/test_api.py::IntegrationTests::test_errors_io", "Failure #10: pyflakes/test/test_api.py::IntegrationTests::test_errors_syntax", "Failure #11: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #12: pyflakes/test/test_api.py::IntegrationTests::test_goodFile", "Failure #13: pyflakes/test/test_api.py::TestMain::test_errors_io", "Failure #14: pyflakes/test/test_api.py::TestMain::test_errors_syntax", "Failure #15: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #16: pyflakes/test/test_api.py::TestMain::test_goodFile" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_emptyDirectory" ], [ "pyflakes/test/test_api.py", "test_explicitFiles" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 8, "true_in_degree": 10.880000000000003, "out_degree": 1, "betweenness": 2.693264146369929e-05, "pagerank": 0.00114815547926009, "harmonic": 0.0014970059880239522, "bidirectional_harmonic": 0.0391686864366505, "degree": 9 }, "line_count": 12, "code_line_count": 12, "cyclomatic": 6, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.DICT", "test_info": { "success": false, "failed": 17, "passed": 2206, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_dict.py::Test::test_duplicate_key_float_and_int\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 2 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [,\n+ ] : for input:\n\n {1: 1, 1.0: 2}\n \nexpected outputs:\n[, ]\nbut got:\n\nTraceback:\n\n> def test_duplicate_key_float_and_int(self):\n \"\"\"\n These do look like different values, but when it comes to their use as\n keys, they compare as equal and so are actually duplicates.\n The literal dict {1: 1, 1.0: 1} actually becomes {1.0: 1}.\n \"\"\"\n> self.flakes(\n '''\n {1: 1, 1.0: 2}\n ''',\n m.MultiValueRepeatedKeyLiteral,\n m.MultiValueRepeatedKeyLiteral,\n )\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 2 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [,\nE + ] : for input:\nE \nE {1: 1, 1.0: 2}\nE \nE expected outputs:\nE [, ]\nE but got:\n", "\n============================================================\nFailure #2: pyflakes/test/test_dict.py::Test::test_duplicate_keys\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 2 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [,\n+ ] : for input:\n{'yes': 1, 'yes': 2}\nexpected outputs:\n[, ]\nbut got:\n\nTraceback:\n\n> def test_duplicate_keys(self):\n> self.flakes(\n \"{'yes': 1, 'yes': 2}\",\n m.MultiValueRepeatedKeyLiteral,\n m.MultiValueRepeatedKeyLiteral,\n )\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 2 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [,\nE + ] : for input:\nE {'yes': 1, 'yes': 2}\nE expected outputs:\nE [, ]\nE but got:\n", "Failure #3: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bools", "Failure #4: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bools_false", "Failure #5: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_function", "Failure #6: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_lambda", "Failure #7: pyflakes/test/test_dict.py::Test::test_duplicate_keys_ints", "Failure #8: pyflakes/test/test_dict.py::Test::test_duplicate_keys_none", "Failure #9: pyflakes/test/test_dict.py::Test::test_duplicate_keys_tuples", "Failure #10: pyflakes/test/test_dict.py::Test::test_duplicate_keys_tuples_int_and_float", "Failure #11: pyflakes/test/test_dict.py::Test::test_duplicate_values_bytes_vs_unicode_py3", "Failure #12: pyflakes/test/test_dict.py::Test::test_duplicate_variable_keys", "Failure #13: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values", "Failure #14: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values_same_value", "Failure #15: pyflakes/test/test_dict.py::Test::test_multiple_duplicate_keys", "Failure #16: pyflakes/test/test_doctests.py::TestImports::test_usedInDict", "Failure #17: pyflakes/test/test_imports.py::Test::test_usedInDict" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_dict.py", "test_duplicate_key_float_and_int" ], [ "pyflakes/test/test_dict.py", "test_duplicate_keys" ] ] }, "complexity_info": { "centrality": { "distance_discount": 5.344000000000001, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 3, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.007734530938123751, "bidirectional_harmonic": 0.06110279441117765, "degree": 3 }, "line_count": 30, "code_line_count": 30, "cyclomatic": 12, "halstead_volume": 23.264662506490403, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/api.py", "function_name": "check", "test_info": { "success": false, "failed": 22, "passed": 2201, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_CRLFLineEndings\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Tuples differ: (None, '') != (0, '')\n\nFirst differing element 0:\nNone\n0\n\n- (None, '')\n+ (0, '')\n\nTraceback:\n\n> def test_CRLFLineEndings(self):\n \"\"\"\n Source files with Windows CR LF line endings are parsed successfully.\n \"\"\"\n with self.makeTempFile(\"x = 42\\r\\n\") as sourcePath:\n> self.assertHasErrors(sourcePath, [])\n\n> self.assertEqual(\nE AssertionError: Tuples differ: (None, '') != (0, '')\nE \nE First differing element 0:\nE None\nE 0\nE \nE - (None, '')\nE + (0, '')\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::CheckTests::test_checkRecursive\nLocation: /tmp/benchmark_d_5ycoqi/pyflakes/api.py:111\nError: TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'\n\nTraceback:\n\n> def test_checkRecursive(self):\n \"\"\"\n L{checkRecursive} descends into each directory, finding Python files\n and reporting problems.\n \"\"\"\n tempdir = tempfile.mkdtemp()\n try:\n os.mkdir(os.path.join(tempdir, 'foo'))\n file1 = os.path.join(tempdir, 'foo', 'bar.py')\n with open(file1, 'wb') as fd:\n fd.write(b\"import baz\\n\")\n file2 = os.path.join(tempdir, 'baz.py')\n with open(file2, 'wb') as fd:\n fd.write(b\"import contraband\")\n log = []\n reporter = LoggingReporter(log)\n> warnings = checkRecursive([tempdir], reporter)\n\n> def checkRecursive(paths, reporter):\n \"\"\"\n Recursively check all source files in C{paths}.\n \n @param paths: A list of paths to Python source files and directories\n containing Python source files.\n @param reporter: A L{Reporter} where all of the warnings and errors\n will be reported to.\n @return: The number of warnings found.\n \"\"\"\n warnings = 0\n for sourcePath in iterSourceCode(paths):\n> warnings += checkPath(sourcePath, reporter)\nE TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'\n", "Failure #3: pyflakes/test/test_api.py::CheckTests::test_encodedFileUTF8", "Failure #4: pyflakes/test/test_api.py::CheckTests::test_eofSyntaxError", "Failure #5: pyflakes/test/test_api.py::CheckTests::test_eofSyntaxErrorWithTab", "Failure #6: pyflakes/test/test_api.py::CheckTests::test_invalidEscape", "Failure #7: pyflakes/test/test_api.py::CheckTests::test_misencodedFileUTF16", "Failure #8: pyflakes/test/test_api.py::CheckTests::test_misencodedFileUTF8", "Failure #9: pyflakes/test/test_api.py::CheckTests::test_missingTrailingNewline", "Failure #10: pyflakes/test/test_api.py::CheckTests::test_multilineSyntaxError", "Failure #11: pyflakes/test/test_api.py::CheckTests::test_nonDefaultFollowsDefaultSyntaxError", "Failure #12: pyflakes/test/test_api.py::CheckTests::test_nonKeywordAfterKeywordSyntaxError", "Failure #13: pyflakes/test/test_api.py::CheckTests::test_pyflakesWarning", "Failure #14: pyflakes/test/test_api.py::CheckTests::test_stdinReportsErrors", "Failure #15: pyflakes/test/test_api.py::IntegrationTests::test_errors_syntax", "Failure #16: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #17: pyflakes/test/test_api.py::IntegrationTests::test_goodFile", "Failure #18: pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin", "Failure #19: pyflakes/test/test_api.py::TestMain::test_errors_syntax", "Failure #20: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #21: pyflakes/test/test_api.py::TestMain::test_goodFile", "Failure #22: pyflakes/test/test_api.py::TestMain::test_readFromStdin" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_CRLFLineEndings" ], [ "pyflakes/test/test_api.py", "test_checkRecursive" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 7.760000000000002, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0008620413221692826, "harmonic": 0.0, "bidirectional_harmonic": 0.030284074707727402, "degree": 2 }, "line_count": 18, "code_line_count": 18, "cyclomatic": 5, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.handleStringAnnotation", "test_info": { "success": false, "failed": 15, "passed": 2208, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n from typing_extensions import TypeAlias\n from foo import Bar\n\n bar: TypeAlias = 'Bar'\n \nexpected outputs:\n[]\nbut got:\n(none):3:1: 'foo.Bar' imported but unused\n\nTraceback:\n\n> def test_TypeAlias_annotations(self):\n self.flakes(\"\"\"\n from typing_extensions import TypeAlias\n from foo import Bar\n \n bar: TypeAlias = Bar\n \"\"\")\n> self.flakes(\"\"\"\n from typing_extensions import TypeAlias\n from foo import Bar\n \n bar: TypeAlias = 'Bar'\n \"\"\")\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE from typing_extensions import TypeAlias\nE from foo import Bar\nE \nE bar: TypeAlias = 'Bar'\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:1: 'foo.Bar' imported but unused\n", "\n============================================================\nFailure #2: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n from typing import Annotated\n\n def f(x: Annotated['integer']) -> None:\n return None\n \nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_annotated_type_typing_missing_forward_type(self):\n> self.flakes(\"\"\"\n from typing import Annotated\n \n def f(x: Annotated['integer']) -> None:\n return None\n \"\"\", m.UndefinedName)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE from typing import Annotated\nE \nE def f(x: Annotated['integer']) -> None:\nE return None\nE \nE expected outputs:\nE []\nE but got:\n", "Failure #3: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #4: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #5: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #6: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #7: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #8: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #9: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #10: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #11: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #12: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #13: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #14: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #15: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_type_annotations.py", "test_TypeAlias_annotations" ], [ "pyflakes/test/test_type_annotations.py", "test_annotated_type_typing_missing_forward_type" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.8800000000000003, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 2, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.004491017964071856, "bidirectional_harmonic": 0.06042914171656689, "degree": 2 }, "line_count": 20, "code_line_count": 20, "cyclomatic": 7, "halstead_volume": 66.41714012534482, "halstead_difficulty": 2.75 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.IMPORTFROM", "test_info": { "success": false, "failed": 95, "passed": 2128, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestOther::test_functionDecorator\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> from somewhere import somedecorator\n \n >>> def a(): pass\n >>> a = somedecorator(a)\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):7:16: undefined name 'somedecorator'\n\nTraceback:\n\n> def test_functionDecorator(self):\n \"\"\"\n Test that shadowing a function definition with a decorated version of\n that function does not raise a warning.\n \"\"\"\n> self.flakes('''\n from somewhere import somedecorator\n \n def a(): pass\n a = somedecorator(a)\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> from somewhere import somedecorator\nE \nE >>> def a(): pass\nE >>> a = somedecorator(a)\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):7:16: undefined name 'somedecorator'\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreImportation\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> from .i18n import _\n >>> def _(): pass\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_redefinedUnderscoreImportation(self):\n \"\"\"\n Test that shadowing an underscore importation raises a warning.\n \"\"\"\n> self.flakes('''\n from .i18n import _\n def _(): pass\n ''', m.RedefinedWhileUnused)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> from .i18n import _\nE >>> def _(): pass\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "Failure #3: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #4: pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule", "Failure #5: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #6: pyflakes/test/test_doctests.py::TestImports::test_futureImportStar", "Failure #7: pyflakes/test/test_doctests.py::TestImports::test_futureImportUndefined", "Failure #8: pyflakes/test/test_doctests.py::TestImports::test_futureImportUsed", "Failure #9: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #10: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #11: pyflakes/test/test_doctests.py::TestImports::test_localImportStar", "Failure #12: pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass", "Failure #13: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #14: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #15: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #16: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #17: pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative", "Failure #18: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #19: pyflakes/test/test_doctests.py::TestImports::test_usedImport_relative", "Failure #20: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #21: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #22: pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined", "Failure #23: pyflakes/test/test_doctests.py::Test::test_globalUnderscoreInDoctest", "Failure #24: pyflakes/test/test_imports.py::Test::test_aliasedImport", "Failure #25: pyflakes/test/test_imports.py::Test::test_aliasedImportShadowModule", "Failure #26: pyflakes/test/test_imports.py::Test::test_futureImportFirst", "Failure #27: pyflakes/test/test_imports.py::Test::test_futureImportStar", "Failure #28: pyflakes/test/test_imports.py::Test::test_futureImportUndefined", "Failure #29: pyflakes/test/test_imports.py::Test::test_futureImportUsed", "Failure #30: pyflakes/test/test_imports.py::Test::test_importStar", "Failure #31: pyflakes/test/test_imports.py::Test::test_importStar_relative", "Failure #32: pyflakes/test/test_imports.py::Test::test_localImportStar", "Failure #33: pyflakes/test/test_imports.py::Test::test_redefinedBySubclass", "Failure #34: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #35: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #36: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #37: pyflakes/test/test_imports.py::Test::test_unusedImport", "Failure #38: pyflakes/test/test_imports.py::Test::test_unusedImport_relative", "Failure #39: pyflakes/test/test_imports.py::Test::test_usedImport", "Failure #40: pyflakes/test/test_imports.py::Test::test_usedImport_relative", "Failure #41: pyflakes/test/test_imports.py::TestSpecialAll::test_all_mixed_attributes_and_strings", "Failure #42: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes", "Failure #43: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes_added", "Failure #44: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_names", "Failure #45: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #46: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarNotExported", "Failure #47: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #48: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #49: pyflakes/test/test_match.py::TestMatch::test_match_pattern_matched_class", "Failure #50: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #51: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreImportation", "Failure #52: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr", "Failure #53: pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall", "Failure #54: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #55: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #56: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #57: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #58: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #59: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import", "Failure #60: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #61: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #62: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #63: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #64: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #65: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #66: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #67: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #68: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #69: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #70: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #71: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #72: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #73: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #74: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #75: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #76: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #77: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #78: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #79: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #80: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #81: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #82: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_cast_literal_str_to_str", "Failure #83: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #84: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #85: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #86: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #87: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #88: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #89: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync", "Failure #90: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol", "Failure #91: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #92: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #93: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #94: pyflakes/test/test_undefined_names.py::Test::test_globalImportStar", "Failure #95: pyflakes/test/test_undefined_names.py::Test::test_metaClassUndefined" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_functionDecorator" ], [ "pyflakes/test/test_doctests.py", "test_redefinedUnderscoreImportation" ] ] }, "complexity_info": { "centrality": { "distance_discount": 8.377600000000003, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 5, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.012100798403193612, "bidirectional_harmonic": 0.06574351297405193, "degree": 5 }, "line_count": 29, "code_line_count": 29, "cyclomatic": 11, "halstead_volume": 133.97977094150824, "halstead_difficulty": 4.285714285714286 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.getCommonAncestor", "test_info": { "success": false, "failed": 22, "passed": 2201, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseFunction\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> if True:\n ... def a(): pass\n ... else:\n ... def a(): pass\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):7:16: redefinition of unused 'a' from line 5\n\nTraceback:\n\n> def test_redefinedIfElseFunction(self):\n \"\"\"\n Test that shadowing a function definition twice in an if\n and else block does not raise a warning.\n \"\"\"\n> self.flakes('''\n if True:\n def a(): pass\n else:\n def a(): pass\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> if True:\nE ... def a(): pass\nE ... else:\nE ... def a(): pass\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):7:16: redefinition of unused 'a' from line 5\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryExceptFunction\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> try:\n ... def a(): pass\n ... except:\n ... def a(): pass\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):7:16: redefinition of unused 'a' from line 5\n\nTraceback:\n\n> def test_redefinedTryExceptFunction(self):\n \"\"\"\n Test that shadowing a function definition twice in try\n and except block does not raise a warning.\n \"\"\"\n> self.flakes('''\n try:\n def a(): pass\n except:\n def a(): pass\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> try:\nE ... def a(): pass\nE ... except:\nE ... def a(): pass\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):7:16: redefinition of unused 'a' from line 5\n", "Failure #3: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #4: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #5: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #6: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #7: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #8: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #9: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #10: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #11: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #12: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #13: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #14: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElseFinally", "Failure #15: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptFinally", "Failure #16: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #17: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #18: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #19: pyflakes/test/test_match.py::TestMatch::test_defined_in_different_branches", "Failure #20: pyflakes/test/test_other.py::Test::test_redefinedIfElseFunction", "Failure #21: pyflakes/test/test_other.py::Test::test_redefinedTryExceptFunction", "Failure #22: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_redefinedIfElseFunction" ], [ "pyflakes/test/test_doctests.py", "test_redefinedTryExceptFunction" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 7.9200000000000035, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.00060034888124544, "harmonic": 0.0, "bidirectional_harmonic": 0.04097162817222694, "degree": 2 }, "line_count": 21, "code_line_count": 21, "cyclomatic": 7, "halstead_volume": 81.7492568250068, "halstead_difficulty": 4.55 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.SUBSCRIPT", "test_info": { "success": false, "failed": 32, "passed": 2191, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n >>> import fu; print(fu.bar[1:])\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):3:12: 'fu' imported but unused\n\nTraceback:\n\n> def test_usedInSlice(self):\n> self.flakes('import fu; print(fu.bar[1:])')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE >>> import fu; print(fu.bar[1:])\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:12: 'fu' imported but unused\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n >>> import fu; \"meow\"[::fu]\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):3:12: 'fu' imported but unused\n\nTraceback:\n\n> def test_usedInSliceObj(self):\n> self.flakes('import fu; \"meow\"[::fu]')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE >>> import fu; \"meow\"[::fu]\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:12: 'fu' imported but unused\n", "Failure #3: pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript", "Failure #4: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #5: pyflakes/test/test_imports.py::Test::test_usedInSlice", "Failure #6: pyflakes/test/test_imports.py::Test::test_usedInSliceObj", "Failure #7: pyflakes/test/test_imports.py::Test::test_usedInSubscript", "Failure #8: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscript", "Failure #9: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined", "Failure #10: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #11: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #12: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #13: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #14: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #15: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #16: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #17: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #18: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #19: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #20: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #21: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #22: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #23: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #24: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #25: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #26: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #27: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #28: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #29: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #30: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #31: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #32: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_usedInSlice" ], [ "pyflakes/test/test_doctests.py", "test_usedInSliceObj" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.560000000000002, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 5, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.010479041916167664, "bidirectional_harmonic": 0.058832335329341304, "degree": 5 }, "line_count": 30, "code_line_count": 30, "cyclomatic": 10, "halstead_volume": 43.01955000865388, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.CALL", "test_info": { "success": false, "failed": 89, "passed": 2134, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n def foo():\n a = range(1, 10)\n range = a\n return range\n\n foo()\n\n print(range)\n \nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_builtin_unbound_local(self):\n> self.flakes('''\n def foo():\n a = range(1, 10)\n range = a\n return range\n \n foo()\n \n print(range)\n ''', m.UndefinedLocal)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE def foo():\nE a = range(1, 10)\nE range = a\nE return range\nE \nE foo()\nE \nE print(range)\nE \nE expected outputs:\nE []\nE but got:\n", "\n============================================================\nFailure #2: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_function\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 2 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [,\n+ ] : for input:\n\n def f(thing):\n pass\n f({'yes': 1, 'yes': 2})\n \nexpected outputs:\n[, ]\nbut got:\n\nTraceback:\n\n> def test_duplicate_keys_in_function(self):\n> self.flakes(\n '''\n def f(thing):\n pass\n f({'yes': 1, 'yes': 2})\n ''',\n m.MultiValueRepeatedKeyLiteral,\n m.MultiValueRepeatedKeyLiteral,\n )\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 2 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [,\nE + ] : for input:\nE \nE def f(thing):\nE pass\nE f({'yes': 1, 'yes': 2})\nE \nE expected outputs:\nE [, ]\nE but got:\n", "Failure #3: pyflakes/test/test_doctests.py::TestOther::test_classFunctionDecorator", "Failure #4: pyflakes/test/test_doctests.py::TestOther::test_functionDecorator", "Failure #5: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #6: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #7: pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope", "Failure #8: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #9: pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass", "Failure #10: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #11: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #12: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #13: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #14: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #15: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #16: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #17: pyflakes/test/test_doctests.py::TestImports::test_usedInCall", "Failure #18: pyflakes/test/test_doctests.py::TestImports::test_usedInElse", "Failure #19: pyflakes/test/test_doctests.py::TestImports::test_usedInExec", "Failure #20: pyflakes/test/test_doctests.py::TestImports::test_usedInFor", "Failure #21: pyflakes/test/test_doctests.py::TestImports::test_usedInForElse", "Failure #22: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #23: pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody", "Failure #24: pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg", "Failure #25: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice", "Failure #26: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import_of_alias", "Failure #27: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #28: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #29: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #30: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #31: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #32: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #33: pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter", "Failure #34: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #35: pyflakes/test/test_imports.py::Test::test_notUsedInNestedScope", "Failure #36: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #37: pyflakes/test/test_imports.py::Test::test_redefinedInClass", "Failure #38: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #39: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #40: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #41: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #42: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #43: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #44: pyflakes/test/test_imports.py::Test::test_usedImport", "Failure #45: pyflakes/test/test_imports.py::Test::test_usedInCall", "Failure #46: pyflakes/test/test_imports.py::Test::test_usedInElse", "Failure #47: pyflakes/test/test_imports.py::Test::test_usedInExec", "Failure #48: pyflakes/test/test_imports.py::Test::test_usedInFor", "Failure #49: pyflakes/test/test_imports.py::Test::test_usedInForElse", "Failure #50: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #51: pyflakes/test/test_imports.py::Test::test_usedInIfBody", "Failure #52: pyflakes/test/test_imports.py::Test::test_usedInKeywordArg", "Failure #53: pyflakes/test/test_imports.py::Test::test_usedInSlice", "Failure #54: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import_of_alias", "Failure #55: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #56: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #57: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #58: pyflakes/test/test_match.py::TestMatch::test_match_bindings", "Failure #59: pyflakes/test/test_other.py::Test::test_classFunctionDecorator", "Failure #60: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #61: pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope", "Failure #62: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr", "Failure #63: pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall", "Failure #64: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #65: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableAsLocals", "Failure #66: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #67: pyflakes/test/test_other.py::TestStringFormatting::test_f_string_without_placeholders", "Failure #68: pyflakes/test/test_other.py::TestStringFormatting::test_invalid_dot_format_calls", "Failure #69: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #70: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem", "Failure #71: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import", "Failure #72: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #73: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #74: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #75: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #76: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #77: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_cast_literal_str_to_str", "Failure #78: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #79: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #80: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #81: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unassigned_annotation_is_undefined", "Failure #82: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #83: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #84: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #85: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #86: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #87: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInComprehension", "Failure #88: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInDictionaryComprehension", "Failure #89: pyflakes/test/test_undefined_names.py::Test::test_undefinedInLoop" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_builtin.py", "test_builtin_unbound_local" ], [ "pyflakes/test/test_dict.py", "test_duplicate_keys_in_function" ] ] }, "complexity_info": { "centrality": { "distance_discount": 7.200000000000003, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 5, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.01122754491017964, "bidirectional_harmonic": 0.06060379241516966, "degree": 5 }, "line_count": 66, "code_line_count": 66, "cyclomatic": 36, "halstead_volume": 578.5873848810926, "halstead_difficulty": 3.75 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.handleNodeDelete", "test_info": { "success": false, "failed": 10, "passed": 2213, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestImports::test_usedImport\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n >>> import fu; del fu\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):3:12: 'fu' imported but unused\n\nTraceback:\n\n> def test_usedImport(self):\n self.flakes('import fu; print(fu)')\n self.flakes('from baz import fu; print(fu)')\n> self.flakes('import fu; del fu')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE >>> import fu; del fu\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:12: 'fu' imported but unused\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n >>> a = 1; del a; a\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_del(self):\n \"\"\"Del deletes bindings.\"\"\"\n> self.flakes('a = 1; del a; a', m.UndefinedName)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE >>> a = 1; del a; a\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "Failure #3: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delExceptionInExcept", "Failure #4: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delGlobal", "Failure #5: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined", "Failure #6: pyflakes/test/test_imports.py::Test::test_usedImport", "Failure #7: pyflakes/test/test_undefined_names.py::Test::test_del", "Failure #8: pyflakes/test/test_undefined_names.py::Test::test_delExceptionInExcept", "Failure #9: pyflakes/test/test_undefined_names.py::Test::test_delGlobal", "Failure #10: pyflakes/test/test_undefined_names.py::Test::test_delUndefined" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_usedImport" ], [ "pyflakes/test/test_doctests.py", "test_del" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.6, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 2, "betweenness": 1.4962578590944049e-06, "pagerank": 0.00027186098654708525, "harmonic": 0.0029940119760479044, "bidirectional_harmonic": 0.05661177644710579, "degree": 3 }, "line_count": 24, "code_line_count": 24, "cyclomatic": 7, "halstead_volume": 22.458839376460833, "halstead_difficulty": 1.875 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.CLASSDEF", "test_info": { "success": false, "failed": 78, "passed": 2145, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_instance_attributes\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n class Test():\n pass\n f = Test()\n f.a = 1\n {f.a: 1, f.a: 1}\n \nexpected outputs:\n[]\nbut got:\n(none):4:5: undefined name 'Test'\n\nTraceback:\n\n> def test_no_duplicate_key_errors_instance_attributes(self):\n> self.flakes('''\n class Test():\n pass\n f = Test()\n f.a = 1\n {f.a: 1, f.a: 1}\n ''')\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE class Test():\nE pass\nE f = Test()\nE f.a = 1\nE {f.a: 1, f.a: 1}\nE \nE expected outputs:\nE []\nE but got:\nE (none):4:5: undefined name 'Test'\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> while True:\n ... class A:\n ... break\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_breakOutsideLoop(self):\n self.flakes('''\n break\n ''', m.BreakOutsideLoop)\n \n self.flakes('''\n def f():\n break\n ''', m.BreakOutsideLoop)\n \n self.flakes('''\n while True:\n pass\n else:\n break\n ''', m.BreakOutsideLoop)\n \n self.flakes('''\n while True:\n pass\n else:\n if 1:\n if 2:\n break\n ''', m.BreakOutsideLoop)\n \n self.flakes('''\n while True:\n def f():\n break\n ''', m.BreakOutsideLoop)\n \n> self.flakes('''\n while True:\n class A:\n break\n ''', m.BreakOutsideLoop)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> while True:\nE ... class A:\nE ... break\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "Failure #3: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody", "Failure #4: pyflakes/test/test_doctests.py::TestOther::test_classRedefinedAsFunction", "Failure #5: pyflakes/test/test_doctests.py::TestOther::test_classRedefinition", "Failure #6: pyflakes/test/test_doctests.py::TestOther::test_classWithReturn", "Failure #7: pyflakes/test/test_doctests.py::TestOther::test_classWithYield", "Failure #8: pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom", "Failure #9: pyflakes/test/test_doctests.py::TestOther::test_continueOutsideLoop", "Failure #10: pyflakes/test/test_doctests.py::TestOther::test_functionRedefinedAsClass", "Failure #11: pyflakes/test/test_doctests.py::TestOther::test_global_nonlocal_in_class_bodies", "Failure #12: pyflakes/test/test_doctests.py::TestOther::test_redefinedClassFunction", "Failure #13: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #14: pyflakes/test/test_doctests.py::TestOther::test_unused_global_in_class", "Failure #15: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_in_clas", "Failure #16: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #17: pyflakes/test/test_doctests.py::TestImports::test_localImportStar", "Failure #18: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #19: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #20: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #21: pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass", "Failure #22: pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass", "Failure #23: pyflakes/test/test_doctests.py::TestImports::test_usedInClass", "Failure #24: pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase", "Failure #25: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #26: pyflakes/test/test_doctests.py::TestUndefinedNames::test_dunderClass", "Failure #27: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #28: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #29: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #30: pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined", "Failure #31: pyflakes/test/test_doctests.py::TestUndefinedNames::test_nestedClass", "Failure #32: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #33: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #34: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #35: pyflakes/test/test_imports.py::Test::test_localImportStar", "Failure #36: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #37: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #38: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #39: pyflakes/test/test_imports.py::Test::test_redefinedByClass", "Failure #40: pyflakes/test/test_imports.py::Test::test_redefinedBySubclass", "Failure #41: pyflakes/test/test_imports.py::Test::test_usedInClass", "Failure #42: pyflakes/test/test_imports.py::Test::test_usedInClassBase", "Failure #43: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #44: pyflakes/test/test_other.py::Test::test_breakOutsideLoop", "Failure #45: pyflakes/test/test_other.py::Test::test_classNameUndefinedInClassBody", "Failure #46: pyflakes/test/test_other.py::Test::test_classRedefinedAsFunction", "Failure #47: pyflakes/test/test_other.py::Test::test_classRedefinition", "Failure #48: pyflakes/test/test_other.py::Test::test_classWithReturn", "Failure #49: pyflakes/test/test_other.py::Test::test_classWithYield", "Failure #50: pyflakes/test/test_other.py::Test::test_classWithYieldFrom", "Failure #51: pyflakes/test/test_other.py::Test::test_continueOutsideLoop", "Failure #52: pyflakes/test/test_other.py::Test::test_functionRedefinedAsClass", "Failure #53: pyflakes/test/test_other.py::Test::test_global_nonlocal_in_class_bodies", "Failure #54: pyflakes/test/test_other.py::Test::test_redefinedClassFunction", "Failure #55: pyflakes/test/test_other.py::Test::test_undefinedBaseClass", "Failure #56: pyflakes/test/test_other.py::Test::test_unused_global_in_class", "Failure #57: pyflakes/test/test_other.py::Test::test_unused_nonlocal_in_clas", "Failure #58: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToMember", "Failure #59: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #60: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_async_def", "Failure #61: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #62: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #63: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #64: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #65: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #66: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #67: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #68: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_functions", "Failure #69: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_statements", "Failure #70: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #71: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #72: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #73: pyflakes/test/test_undefined_names.py::Test::test_dunderClass", "Failure #74: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #75: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #76: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #77: pyflakes/test/test_undefined_names.py::Test::test_metaClassUndefined", "Failure #78: pyflakes/test/test_undefined_names.py::Test::test_nestedClass" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_dict.py", "test_no_duplicate_key_errors_instance_attributes" ], [ "pyflakes/test/test_doctests.py", "test_breakOutsideLoop" ] ] }, "complexity_info": { "centrality": { "distance_discount": 14.329600000000006, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 7, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.02008483033932136, "bidirectional_harmonic": 0.06479540918163675, "degree": 7 }, "line_count": 18, "code_line_count": 18, "cyclomatic": 8, "halstead_volume": 22.458839376460833, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.TRY", "test_info": { "success": false, "failed": 57, "passed": 2166, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> try:\n ... pass\n ... finally:\n ... break\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_breakOutsideLoop(self):\n self.flakes('''\n break\n ''', m.BreakOutsideLoop)\n \n self.flakes('''\n def f():\n break\n ''', m.BreakOutsideLoop)\n \n self.flakes('''\n while True:\n pass\n else:\n break\n ''', m.BreakOutsideLoop)\n \n self.flakes('''\n while True:\n pass\n else:\n if 1:\n if 2:\n break\n ''', m.BreakOutsideLoop)\n \n self.flakes('''\n while True:\n def f():\n break\n ''', m.BreakOutsideLoop)\n \n self.flakes('''\n while True:\n class A:\n break\n ''', m.BreakOutsideLoop)\n \n> self.flakes('''\n try:\n pass\n finally:\n break\n ''', m.BreakOutsideLoop)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> try:\nE ... pass\nE ... finally:\nE ... break\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptNotLast\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> try:\n ... pass\n ... except:\n ... pass\n ... except ValueError:\n ... pass\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_defaultExceptNotLast(self):\n> self.flakes('''\n try:\n pass\n except:\n pass\n except ValueError:\n pass\n ''', m.DefaultExceptNotLast)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> try:\nE ... pass\nE ... except:\nE ... pass\nE ... except ValueError:\nE ... pass\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "Failure #3: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction", "Failure #4: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #5: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #6: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #7: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #8: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #9: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #10: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #11: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #12: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #13: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #14: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #15: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #16: pyflakes/test/test_doctests.py::TestImports::test_usedInExcept", "Failure #17: pyflakes/test/test_doctests.py::TestImports::test_usedInTry", "Failure #18: pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally", "Failure #19: pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks", "Failure #20: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #21: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #22: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #23: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #24: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #25: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #26: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #27: pyflakes/test/test_imports.py::Test::test_importStar", "Failure #28: pyflakes/test/test_imports.py::Test::test_importStar_relative", "Failure #29: pyflakes/test/test_imports.py::Test::test_redefinedByExcept", "Failure #30: pyflakes/test/test_imports.py::Test::test_redefinedTry", "Failure #31: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #32: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #33: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #34: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElseFinally", "Failure #35: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptFinally", "Failure #36: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #37: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #38: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #39: pyflakes/test/test_imports.py::Test::test_usedInExcept", "Failure #40: pyflakes/test/test_imports.py::Test::test_usedInTry", "Failure #41: pyflakes/test/test_imports.py::Test::test_usedInTryFinally", "Failure #42: pyflakes/test/test_other.py::Test::test_breakOutsideLoop", "Failure #43: pyflakes/test/test_other.py::Test::test_defaultExceptNotLast", "Failure #44: pyflakes/test/test_other.py::Test::test_redefinedTryFunction", "Failure #45: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #46: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #47: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExcept", "Failure #48: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #49: pyflakes/test/test_other.py::TestUnusedAssignment::test_exception_unused_in_except_star", "Failure #50: pyflakes/test/test_undefined_names.py::Test::test_namesDeclaredInExceptBlocks", "Failure #51: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionName", "Failure #52: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #53: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #54: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #55: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #56: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #57: pyflakes/test/test_undefined_names.py::Test::test_undefinedWithErrorHandler" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_breakOutsideLoop" ], [ "pyflakes/test/test_doctests.py", "test_defaultExceptNotLast" ] ] }, "complexity_info": { "centrality": { "distance_discount": 5.120000000000001, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 4, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.008233532934131737, "bidirectional_harmonic": 0.06429640718562876, "degree": 4 }, "line_count": 16, "code_line_count": 16, "cyclomatic": 8, "halstead_volume": 43.01955000865388, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.handleAnnotation", "test_info": { "success": false, "failed": 23, "passed": 2200, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [,[163 chars]rt'>] != []\n\nFirst list contains 5 additional elements.\nFirst extra element 0:\n\n\n+ []\n- [,\n- ,\n- ,\n- ,\n- ] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> from abc import note1, note2, note3, note4, note5\n >>> def func(a: note1, *args: note2,\n ... b: note3=12, **kw: note4) -> note5: pass\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):4:12: 'abc.note1' imported but unused\n(none):4:12: 'abc.note2' imported but unused\n(none):4:12: 'abc.note3' imported but unused\n(none):4:12: 'abc.note4' imported but unused\n(none):4:12: 'abc.note5' imported but unused\n\nTraceback:\n\n> def test_annotationUndefined(self):\n \"\"\"Undefined annotations.\"\"\"\n> self.flakes('''\n from abc import note1, note2, note3, note4, note5\n def func(a: note1, *args: note2,\n b: note3=12, **kw: note4) -> note5: pass\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [,[163 chars]rt'>] != []\nE \nE First list contains 5 additional elements.\nE First extra element 0:\nE \nE \nE + []\nE - [,\nE - ,\nE - ,\nE - ,\nE - ] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> from abc import note1, note2, note3, note4, note5\nE >>> def func(a: note1, *args: note2,\nE ... b: note3=12, **kw: note4) -> note5: pass\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):4:12: 'abc.note1' imported but unused\nE (none):4:12: 'abc.note2' imported but unused\nE (none):4:12: 'abc.note3' imported but unused\nE (none):4:12: 'abc.note4' imported but unused\nE (none):4:12: 'abc.note5' imported but unused\n", "\n============================================================\nFailure #2: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [,[37 chars]rt'>] != []\n\nFirst list contains 2 additional elements.\nFirst extra element 0:\n\n\n+ []\n- [,\n- ] : for input:\n\n from typing_extensions import TypeAlias\n from foo import Bar\n\n bar: TypeAlias = Bar\n \nexpected outputs:\n[]\nbut got:\n(none):2:1: 'typing_extensions.TypeAlias' imported but unused\n(none):3:1: 'foo.Bar' imported but unused\n\nTraceback:\n\n> def test_TypeAlias_annotations(self):\n> self.flakes(\"\"\"\n from typing_extensions import TypeAlias\n from foo import Bar\n \n bar: TypeAlias = Bar\n \"\"\")\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [,[37 chars]rt'>] != []\nE \nE First list contains 2 additional elements.\nE First extra element 0:\nE \nE \nE + []\nE - [,\nE - ] : for input:\nE \nE from typing_extensions import TypeAlias\nE from foo import Bar\nE \nE bar: TypeAlias = Bar\nE \nE expected outputs:\nE []\nE but got:\nE (none):2:1: 'typing_extensions.TypeAlias' imported but unused\nE (none):3:1: 'foo.Bar' imported but unused\n", "Failure #3: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #4: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #5: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #6: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #7: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import", "Failure #8: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #9: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #10: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #11: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #12: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #13: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #14: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #15: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #16: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #17: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #18: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #19: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #20: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #21: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #22: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #23: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_annotationUndefined" ], [ "pyflakes/test/test_type_annotations.py", "test_TypeAlias_annotations" ] ] }, "complexity_info": { "centrality": { "distance_discount": 4.832000000000001, "in_degree": 2, "true_in_degree": 2.8, "out_degree": 3, "betweenness": 8.97754715456643e-06, "pagerank": 0.00032336376254537695, "harmonic": 0.007235528942115768, "bidirectional_harmonic": 0.05571357285429141, "degree": 5 }, "line_count": 18, "code_line_count": 18, "cyclomatic": 4, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.ANNASSIGN", "test_info": { "success": false, "failed": 8, "passed": 2215, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [,[37 chars]rt'>] != []\n\nFirst list contains 2 additional elements.\nFirst extra element 0:\n\n\n+ []\n- [,\n- ] : for input:\n\n from typing_extensions import TypeAlias\n from foo import Bar\n\n bar: TypeAlias = Bar\n \nexpected outputs:\n[]\nbut got:\n(none):2:1: 'typing_extensions.TypeAlias' imported but unused\n(none):3:1: 'foo.Bar' imported but unused\n\nTraceback:\n\n> def test_TypeAlias_annotations(self):\n> self.flakes(\"\"\"\n from typing_extensions import TypeAlias\n from foo import Bar\n \n bar: TypeAlias = Bar\n \"\"\")\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [,[37 chars]rt'>] != []\nE \nE First list contains 2 additional elements.\nE First extra element 0:\nE \nE \nE + []\nE - [,\nE - ] : for input:\nE \nE from typing_extensions import TypeAlias\nE from foo import Bar\nE \nE bar: TypeAlias = Bar\nE \nE expected outputs:\nE []\nE but got:\nE (none):2:1: 'typing_extensions.TypeAlias' imported but unused\nE (none):3:1: 'foo.Bar' imported but unused\n", "\n============================================================\nFailure #2: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n from a import b, c\n b: c\n print(b)\n \nexpected outputs:\n[]\nbut got:\n(none):2:1: 'a.c' imported but unused\n\nTraceback:\n\n> def test_annotating_an_import(self):\n> self.flakes('''\n from a import b, c\n b: c\n print(b)\n ''')\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE from a import b, c\nE b: c\nE print(b)\nE \nE expected outputs:\nE []\nE but got:\nE (none):2:1: 'a.c' imported but unused\n", "Failure #3: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #4: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #5: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #6: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #7: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotation_references_self_name_undefined", "Failure #8: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_type_annotations.py", "test_TypeAlias_annotations" ], [ "pyflakes/test/test_type_annotations.py", "test_annotating_an_import" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.521600000000002, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 3, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.00910678642714571, "bidirectional_harmonic": 0.05144710578842311, "degree": 3 }, "line_count": 9, "code_line_count": 9, "cyclomatic": 3, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "_is_typing_helper", "test_info": { "success": false, "failed": 15, "passed": 2208, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n from typing_extensions import TypeAlias\n from foo import Bar\n\n bar: TypeAlias = 'Bar'\n \nexpected outputs:\n[]\nbut got:\n(none):3:1: 'foo.Bar' imported but unused\n\nTraceback:\n\n> def test_TypeAlias_annotations(self):\n self.flakes(\"\"\"\n from typing_extensions import TypeAlias\n from foo import Bar\n \n bar: TypeAlias = Bar\n \"\"\")\n> self.flakes(\"\"\"\n from typing_extensions import TypeAlias\n from foo import Bar\n \n bar: TypeAlias = 'Bar'\n \"\"\")\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE from typing_extensions import TypeAlias\nE from foo import Bar\nE \nE bar: TypeAlias = 'Bar'\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:1: 'foo.Bar' imported but unused\n", "\n============================================================\nFailure #2: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 2 additional elements.\nFirst extra element 0:\n\n\n+ []\n- [,\n- ] : for input:\n\n import typing as t\n\n @t.overload\n def f(s: None) -> None:\n pass\n\n @t.overload\n def f(s: int) -> int:\n pass\n\n def f(s):\n return s\n \nexpected outputs:\n[]\nbut got:\n(none):9:1: redefinition of unused 'f' from line 5\n(none):12:1: redefinition of unused 'f' from line 9\n\nTraceback:\n\n> def test_aliased_import(self):\n \"\"\"Detect when typing is imported as another name\"\"\"\n> self.flakes(\"\"\"\n import typing as t\n \n @t.overload\n def f(s: None) -> None:\n pass\n \n @t.overload\n def f(s: int) -> int:\n pass\n \n def f(s):\n return s\n \"\"\")\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 2 additional elements.\nE First extra element 0:\nE \nE \nE + []\nE - [,\nE - ] : for input:\nE \nE import typing as t\nE \nE @t.overload\nE def f(s: None) -> None:\nE pass\nE \nE @t.overload\nE def f(s: int) -> int:\nE pass\nE \nE def f(s):\nE return s\nE \nE expected outputs:\nE []\nE but got:\nE (none):9:1: redefinition of unused 'f' from line 5\nE (none):12:1: redefinition of unused 'f' from line 9\n", "Failure #3: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #4: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #5: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #6: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #7: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #8: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #9: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #10: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #11: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #12: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #13: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #14: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #15: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_type_annotations.py", "test_TypeAlias_annotations" ], [ "pyflakes/test/test_type_annotations.py", "test_aliased_import" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 2, "true_in_degree": 5.84, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0009799369158975952, "harmonic": 0.0, "bidirectional_harmonic": 0.03990233818078128, "degree": 2 }, "line_count": 31, "code_line_count": 31, "cyclomatic": 6, "halstead_volume": 137.5488750216347, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.handleDoctests", "test_info": { "success": false, "failed": 108, "passed": 2115, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> break\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_breakOutsideLoop(self):\n> self.flakes('''\n break\n ''', m.BreakOutsideLoop)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> break\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> class foo:\n ... foo\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_classNameUndefinedInClassBody(self):\n \"\"\"\n If a class name is used in the body of that class's definition and\n the name is not already defined, a warning is emitted.\n \"\"\"\n> self.flakes('''\n class foo:\n foo\n ''', m.UndefinedName)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> class foo:\nE ... foo\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\n", "Failure #3: pyflakes/test/test_doctests.py::TestOther::test_classRedefinedAsFunction", "Failure #4: pyflakes/test/test_doctests.py::TestOther::test_classRedefinition", "Failure #5: pyflakes/test/test_doctests.py::TestOther::test_classWithReturn", "Failure #6: pyflakes/test/test_doctests.py::TestOther::test_classWithYield", "Failure #7: pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom", "Failure #8: pyflakes/test/test_doctests.py::TestOther::test_continueOutsideLoop", "Failure #9: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptNotLast", "Failure #10: pyflakes/test/test_doctests.py::TestOther::test_duplicateArgs", "Failure #11: pyflakes/test/test_doctests.py::TestOther::test_functionRedefinedAsClass", "Failure #12: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #13: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #14: pyflakes/test/test_doctests.py::TestOther::test_moduleWithReturn", "Failure #15: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYield", "Failure #16: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYieldFrom", "Failure #17: pyflakes/test/test_doctests.py::TestOther::test_redefinedClassFunction", "Failure #18: pyflakes/test/test_doctests.py::TestOther::test_redefinedFunction", "Failure #19: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfFunction", "Failure #20: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #21: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #22: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #23: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction", "Failure #24: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreImportation", "Failure #25: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #26: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentErrors", "Failure #27: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #28: pyflakes/test/test_doctests.py::TestOther::test_unused_global_in_class", "Failure #29: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #30: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #31: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_in_clas", "Failure #32: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #33: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #34: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #35: pyflakes/test/test_doctests.py::TestImports::test_functionNamesAreBoundNow", "Failure #36: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #37: pyflakes/test/test_doctests.py::TestImports::test_futureImportStar", "Failure #38: pyflakes/test/test_doctests.py::TestImports::test_futureImportUndefined", "Failure #39: pyflakes/test/test_doctests.py::TestImports::test_importInClass", "Failure #40: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #41: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #42: pyflakes/test/test_doctests.py::TestImports::test_localImportStar", "Failure #43: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #44: pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass", "Failure #45: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #46: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #47: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFunction", "Failure #48: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #49: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #50: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #51: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #52: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #53: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #54: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #55: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #56: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #57: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #58: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #59: pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative", "Failure #60: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #61: pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport", "Failure #62: pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import", "Failure #63: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #64: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #65: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #66: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #67: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #68: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined", "Failure #69: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #70: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #71: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #72: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #73: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #74: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #75: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #76: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #77: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #78: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath", "Failure #79: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #80: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #81: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined", "Failure #82: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #83: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #84: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #85: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #86: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #87: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #88: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #89: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #90: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #91: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #92: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #93: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #94: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #95: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #96: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #97: pyflakes/test/test_doctests.py::Test::test_global_undefined", "Failure #98: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #99: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #100: pyflakes/test/test_doctests.py::Test::test_indentationErrorInDoctest", "Failure #101: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #102: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #103: pyflakes/test/test_doctests.py::Test::test_noOffsetSyntaxErrorInDoctest", "Failure #104: pyflakes/test/test_doctests.py::Test::test_offsetInDoctests", "Failure #105: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #106: pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs", "Failure #107: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #108: pyflakes/test/test_doctests.py::Test::test_syntaxErrorInDoctest" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_breakOutsideLoop" ], [ "pyflakes/test/test_doctests.py", "test_classNameUndefinedInClassBody" ] ] }, "complexity_info": { "centrality": { "distance_discount": 11.481600000000004, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 6, "betweenness": 1.8329158773906457e-05, "pagerank": 0.00027866752081998726, "harmonic": 0.016092814371257484, "bidirectional_harmonic": 0.0692864271457086, "degree": 8 }, "line_count": 28, "code_line_count": 28, "cyclomatic": 10, "halstead_volume": 174.22857502740396, "halstead_difficulty": 3.289473684210526 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.checkDeadScopes", "test_info": { "success": false, "failed": 86, "passed": 2137, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_checkRecursive\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: 0 != 2\n\nTraceback:\n\n> def test_checkRecursive(self):\n \"\"\"\n L{checkRecursive} descends into each directory, finding Python files\n and reporting problems.\n \"\"\"\n tempdir = tempfile.mkdtemp()\n try:\n os.mkdir(os.path.join(tempdir, 'foo'))\n file1 = os.path.join(tempdir, 'foo', 'bar.py')\n with open(file1, 'wb') as fd:\n fd.write(b\"import baz\\n\")\n file2 = os.path.join(tempdir, 'baz.py')\n with open(file2, 'wb') as fd:\n fd.write(b\"import contraband\")\n log = []\n reporter = LoggingReporter(log)\n warnings = checkRecursive([tempdir], reporter)\n> self.assertEqual(warnings, 2)\nE AssertionError: 0 != 2\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::CheckTests::test_pyflakesWarning\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: 0 != 1\n\nTraceback:\n\n> def test_pyflakesWarning(self):\n \"\"\"\n If the source file has a pyflakes warning, this is reported as a\n 'flake'.\n \"\"\"\n with self.makeTempFile(\"import foo\") as sourcePath:\n count, errors = self.getErrors(sourcePath)\n> self.assertEqual(count, 1)\nE AssertionError: 0 != 1\n", "Failure #3: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #4: pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin", "Failure #5: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #6: pyflakes/test/test_api.py::TestMain::test_readFromStdin", "Failure #7: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #8: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #9: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #10: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #11: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #12: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #13: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #14: pyflakes/test/test_doctests.py::TestOther::test_unused_global_in_class", "Failure #15: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #16: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #17: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_in_clas", "Failure #18: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #19: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #20: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #21: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #22: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #23: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #24: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #25: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #26: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #27: pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative", "Failure #28: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #29: pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport", "Failure #30: pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import", "Failure #31: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #32: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #33: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #34: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #35: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #36: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #37: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #38: pyflakes/test/test_doctests.py::Test::test_globalUnderscoreInDoctest", "Failure #39: pyflakes/test/test_imports.py::TestImportationObject::test_unusedImport_underscore", "Failure #40: pyflakes/test/test_imports.py::Test::test_aliasedImport", "Failure #41: pyflakes/test/test_imports.py::Test::test_importStar", "Failure #42: pyflakes/test/test_imports.py::Test::test_importStar_relative", "Failure #43: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunction", "Failure #44: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunctionTwice", "Failure #45: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #46: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #47: pyflakes/test/test_imports.py::Test::test_unusedImport", "Failure #48: pyflakes/test/test_imports.py::Test::test_unusedImport_relative", "Failure #49: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #50: pyflakes/test/test_imports.py::Test::test_unusedPackageImport", "Failure #51: pyflakes/test/test_imports.py::Test::test_unused_package_with_submodule_import", "Failure #52: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #53: pyflakes/test/test_imports.py::Test::test_usedInGetattr", "Failure #54: pyflakes/test/test_imports.py::Test::test_usedInGlobal", "Failure #55: pyflakes/test/test_imports.py::TestSpecialAll::test_augmentedAssignment", "Failure #56: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInClass", "Failure #57: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #58: pyflakes/test/test_imports.py::TestSpecialAll::test_ignored_when_not_directly_assigned", "Failure #59: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #60: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarNotExported", "Failure #61: pyflakes/test/test_imports.py::TestSpecialAll::test_list_concatenation_assignment", "Failure #62: pyflakes/test/test_imports.py::TestSpecialAll::test_redefinedByGenExp", "Failure #63: pyflakes/test/test_imports.py::TestSpecialAll::test_tuple_concatenation_assignment", "Failure #64: pyflakes/test/test_imports.py::TestSpecialAll::test_unboundExported", "Failure #65: pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope", "Failure #66: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #67: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #68: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #69: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #70: pyflakes/test/test_other.py::Test::test_unused_global_in_class", "Failure #71: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #72: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #73: pyflakes/test/test_other.py::Test::test_unused_nonlocal_in_clas", "Failure #74: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #75: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #76: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #77: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #78: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #79: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #80: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #81: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #82: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #83: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #84: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #85: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #86: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_checkRecursive" ], [ "pyflakes/test/test_api.py", "test_pyflakesWarning" ] ] }, "complexity_info": { "centrality": { "distance_discount": 3.2, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 4, "betweenness": 6.733160365924822e-06, "pagerank": 0.0002559790732436473, "harmonic": 0.005988023952095809, "bidirectional_harmonic": 0.06075349301397207, "degree": 5 }, "line_count": 55, "code_line_count": 55, "cyclomatic": 28, "halstead_volume": 101.95026032264605, "halstead_difficulty": 3.4615384615384617 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.IMPORT", "test_info": { "success": false, "failed": 182, "passed": 2041, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_checkRecursive\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: 0 != 2\n\nTraceback:\n\n> def test_checkRecursive(self):\n \"\"\"\n L{checkRecursive} descends into each directory, finding Python files\n and reporting problems.\n \"\"\"\n tempdir = tempfile.mkdtemp()\n try:\n os.mkdir(os.path.join(tempdir, 'foo'))\n file1 = os.path.join(tempdir, 'foo', 'bar.py')\n with open(file1, 'wb') as fd:\n fd.write(b\"import baz\\n\")\n file2 = os.path.join(tempdir, 'baz.py')\n with open(file2, 'wb') as fd:\n fd.write(b\"import contraband\")\n log = []\n reporter = LoggingReporter(log)\n warnings = checkRecursive([tempdir], reporter)\n> self.assertEqual(warnings, 2)\nE AssertionError: 0 != 2\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::CheckTests::test_pyflakesWarning\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: 0 != 1\n\nTraceback:\n\n> def test_pyflakesWarning(self):\n \"\"\"\n If the source file has a pyflakes warning, this is reported as a\n 'flake'.\n \"\"\"\n with self.makeTempFile(\"import foo\") as sourcePath:\n count, errors = self.getErrors(sourcePath)\n> self.assertEqual(count, 1)\nE AssertionError: 0 != 1\n", "Failure #3: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #4: pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin", "Failure #5: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #6: pyflakes/test/test_api.py::TestMain::test_readFromStdin", "Failure #7: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #8: pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule", "Failure #9: pyflakes/test/test_doctests.py::TestImports::test_assignRHSFirst", "Failure #10: pyflakes/test/test_doctests.py::TestImports::test_assignedToGlobal", "Failure #11: pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport", "Failure #12: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #13: pyflakes/test/test_doctests.py::TestImports::test_functionNamesAreBoundNow", "Failure #14: pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater", "Failure #15: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #16: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #17: pyflakes/test/test_doctests.py::TestImports::test_nestedFunctionsNestScope", "Failure #18: pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine", "Failure #19: pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope", "Failure #20: pyflakes/test/test_doctests.py::TestImports::test_packageImport", "Failure #21: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #22: pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass", "Failure #23: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #24: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #25: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFunction", "Failure #26: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #27: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #28: pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass", "Failure #29: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #30: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #31: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #32: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #33: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #34: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #35: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #36: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #37: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #38: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #39: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #40: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #41: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #42: pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport", "Failure #43: pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import", "Failure #44: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #45: pyflakes/test/test_doctests.py::TestImports::test_usedInAssert", "Failure #46: pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment", "Failure #47: pyflakes/test/test_doctests.py::TestImports::test_usedInAttributeAssign", "Failure #48: pyflakes/test/test_doctests.py::TestImports::test_usedInCall", "Failure #49: pyflakes/test/test_doctests.py::TestImports::test_usedInClass", "Failure #50: pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase", "Failure #51: pyflakes/test/test_doctests.py::TestImports::test_usedInDict", "Failure #52: pyflakes/test/test_doctests.py::TestImports::test_usedInElifConditional", "Failure #53: pyflakes/test/test_doctests.py::TestImports::test_usedInElse", "Failure #54: pyflakes/test/test_doctests.py::TestImports::test_usedInExcept", "Failure #55: pyflakes/test/test_doctests.py::TestImports::test_usedInExec", "Failure #56: pyflakes/test/test_doctests.py::TestImports::test_usedInFor", "Failure #57: pyflakes/test/test_doctests.py::TestImports::test_usedInForElse", "Failure #58: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #59: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #60: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #61: pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody", "Failure #62: pyflakes/test/test_doctests.py::TestImports::test_usedInIfConditional", "Failure #63: pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg", "Failure #64: pyflakes/test/test_doctests.py::TestImports::test_usedInLambda", "Failure #65: pyflakes/test/test_doctests.py::TestImports::test_usedInList", "Failure #66: pyflakes/test/test_doctests.py::TestImports::test_usedInListComp", "Failure #67: pyflakes/test/test_doctests.py::TestImports::test_usedInLogic", "Failure #68: pyflakes/test/test_doctests.py::TestImports::test_usedInOperators", "Failure #69: pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault", "Failure #70: pyflakes/test/test_doctests.py::TestImports::test_usedInRaise", "Failure #71: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #72: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice", "Failure #73: pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj", "Failure #74: pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript", "Failure #75: pyflakes/test/test_doctests.py::TestImports::test_usedInTry", "Failure #76: pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally", "Failure #77: pyflakes/test/test_doctests.py::TestImports::test_usedInTuple", "Failure #78: pyflakes/test/test_doctests.py::TestImports::test_usedInWhile", "Failure #79: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #80: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import", "Failure #81: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import_of_alias", "Failure #82: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs", "Failure #83: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #84: pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter", "Failure #85: pyflakes/test/test_imports.py::TestImportationObject::test_unusedImport_underscore", "Failure #86: pyflakes/test/test_imports.py::Test::test_aliasedImport", "Failure #87: pyflakes/test/test_imports.py::Test::test_aliasedImportShadowModule", "Failure #88: pyflakes/test/test_imports.py::Test::test_assignRHSFirst", "Failure #89: pyflakes/test/test_imports.py::Test::test_assignedToGlobal", "Failure #90: pyflakes/test/test_imports.py::Test::test_differentSubmoduleImport", "Failure #91: pyflakes/test/test_imports.py::Test::test_duplicateSubmoduleImport", "Failure #92: pyflakes/test/test_imports.py::Test::test_functionNamesAreBoundNow", "Failure #93: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #94: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #95: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #96: pyflakes/test/test_imports.py::Test::test_nestedFunctionsNestScope", "Failure #97: pyflakes/test/test_imports.py::Test::test_nonGlobalDoesNotRedefine", "Failure #98: pyflakes/test/test_imports.py::Test::test_notUsedInNestedScope", "Failure #99: pyflakes/test/test_imports.py::Test::test_packageImport", "Failure #100: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #101: pyflakes/test/test_imports.py::Test::test_redefinedByClass", "Failure #102: pyflakes/test/test_imports.py::Test::test_redefinedByExcept", "Failure #103: pyflakes/test/test_imports.py::Test::test_redefinedByFor", "Failure #104: pyflakes/test/test_imports.py::Test::test_redefinedByFunction", "Failure #105: pyflakes/test/test_imports.py::Test::test_redefinedIf", "Failure #106: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #107: pyflakes/test/test_imports.py::Test::test_redefinedInClass", "Failure #108: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunction", "Failure #109: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunctionTwice", "Failure #110: pyflakes/test/test_imports.py::Test::test_redefinedTry", "Failure #111: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #112: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #113: pyflakes/test/test_imports.py::Test::test_redefinedWhileUnused", "Failure #114: pyflakes/test/test_imports.py::Test::test_shadowedByFor", "Failure #115: pyflakes/test/test_imports.py::Test::test_shadowedByForDeep", "Failure #116: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #117: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #118: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #119: pyflakes/test/test_imports.py::Test::test_unusedImport", "Failure #120: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #121: pyflakes/test/test_imports.py::Test::test_unusedPackageImport", "Failure #122: pyflakes/test/test_imports.py::Test::test_unused_package_with_submodule_import", "Failure #123: pyflakes/test/test_imports.py::Test::test_usedImport", "Failure #124: pyflakes/test/test_imports.py::Test::test_usedInAssert", "Failure #125: pyflakes/test/test_imports.py::Test::test_usedInAssignment", "Failure #126: pyflakes/test/test_imports.py::Test::test_usedInAttributeAssign", "Failure #127: pyflakes/test/test_imports.py::Test::test_usedInCall", "Failure #128: pyflakes/test/test_imports.py::Test::test_usedInClass", "Failure #129: pyflakes/test/test_imports.py::Test::test_usedInClassBase", "Failure #130: pyflakes/test/test_imports.py::Test::test_usedInDict", "Failure #131: pyflakes/test/test_imports.py::Test::test_usedInElifConditional", "Failure #132: pyflakes/test/test_imports.py::Test::test_usedInElse", "Failure #133: pyflakes/test/test_imports.py::Test::test_usedInExcept", "Failure #134: pyflakes/test/test_imports.py::Test::test_usedInExec", "Failure #135: pyflakes/test/test_imports.py::Test::test_usedInFor", "Failure #136: pyflakes/test/test_imports.py::Test::test_usedInForElse", "Failure #137: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #138: pyflakes/test/test_imports.py::Test::test_usedInGetattr", "Failure #139: pyflakes/test/test_imports.py::Test::test_usedInGlobal", "Failure #140: pyflakes/test/test_imports.py::Test::test_usedInIfBody", "Failure #141: pyflakes/test/test_imports.py::Test::test_usedInIfConditional", "Failure #142: pyflakes/test/test_imports.py::Test::test_usedInKeywordArg", "Failure #143: pyflakes/test/test_imports.py::Test::test_usedInLambda", "Failure #144: pyflakes/test/test_imports.py::Test::test_usedInList", "Failure #145: pyflakes/test/test_imports.py::Test::test_usedInListComp", "Failure #146: pyflakes/test/test_imports.py::Test::test_usedInLogic", "Failure #147: pyflakes/test/test_imports.py::Test::test_usedInOperators", "Failure #148: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #149: pyflakes/test/test_imports.py::Test::test_usedInRaise", "Failure #150: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #151: pyflakes/test/test_imports.py::Test::test_usedInSlice", "Failure #152: pyflakes/test/test_imports.py::Test::test_usedInSliceObj", "Failure #153: pyflakes/test/test_imports.py::Test::test_usedInSubscript", "Failure #154: pyflakes/test/test_imports.py::Test::test_usedInTry", "Failure #155: pyflakes/test/test_imports.py::Test::test_usedInTryFinally", "Failure #156: pyflakes/test/test_imports.py::Test::test_usedInTuple", "Failure #157: pyflakes/test/test_imports.py::Test::test_usedInWhile", "Failure #158: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #159: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import", "Failure #160: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import_of_alias", "Failure #161: pyflakes/test/test_imports.py::TestSpecialAll::test_augmentedAssignment", "Failure #162: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInClass", "Failure #163: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #164: pyflakes/test/test_imports.py::TestSpecialAll::test_ignored_when_not_directly_assigned", "Failure #165: pyflakes/test/test_imports.py::TestSpecialAll::test_list_concatenation_assignment", "Failure #166: pyflakes/test/test_imports.py::TestSpecialAll::test_redefinedByGenExp", "Failure #167: pyflakes/test/test_imports.py::TestSpecialAll::test_tuple_concatenation_assignment", "Failure #168: pyflakes/test/test_imports.py::TestSpecialAll::test_usedInGenExp", "Failure #169: pyflakes/test/test_imports.py::TestSpecialAll::test_warningSuppressed", "Failure #170: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #171: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #172: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementAttributeName", "Failure #173: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameRedefined", "Failure #174: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscript", "Failure #175: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined", "Failure #176: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined", "Failure #177: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future", "Failure #178: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import", "Failure #179: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #180: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #181: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #182: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_checkRecursive" ], [ "pyflakes/test/test_api.py", "test_pyflakesWarning" ] ] }, "complexity_info": { "centrality": { "distance_discount": 7.417600000000003, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 3, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.009855289421157683, "bidirectional_harmonic": 0.05501497005988024, "degree": 3 }, "line_count": 9, "code_line_count": 9, "cyclomatic": 5, "halstead_volume": 34.86917501586544, "halstead_difficulty": 2.8 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.LAMBDA", "test_info": { "success": false, "failed": 136, "passed": 2087, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n def foo():\n a = range(1, 10)\n range = a\n return range\n\n foo()\n\n print(range)\n \nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_builtin_unbound_local(self):\n> self.flakes('''\n def foo():\n a = range(1, 10)\n range = a\n return range\n \n foo()\n \n print(range)\n ''', m.UndefinedLocal)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE def foo():\nE a = range(1, 10)\nE range = a\nE return range\nE \nE foo()\nE \nE print(range)\nE \nE expected outputs:\nE []\nE but got:\n", "\n============================================================\nFailure #2: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n class Foo:\n def bar():\n x = 0\n \nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_class_segment(self):\n self.flakes('''\n class Foo:\n class Bar:\n pass\n ''', is_segment=True)\n \n> self.flakes('''\n class Foo:\n def bar():\n x = 0\n ''', m.UnusedVariable, is_segment=True)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE class Foo:\nE def bar():\nE x = 0\nE \nE expected outputs:\nE []\nE but got:\n", "Failure #3: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #4: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #5: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_function", "Failure #6: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_lambda", "Failure #7: pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop", "Failure #8: pyflakes/test/test_doctests.py::TestOther::test_continueOutsideLoop", "Failure #9: pyflakes/test/test_doctests.py::TestOther::test_duplicateArgs", "Failure #10: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #11: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #12: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #13: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #14: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #15: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #16: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #17: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_in_clas", "Failure #18: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #19: pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater", "Failure #20: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #21: pyflakes/test/test_doctests.py::TestImports::test_localImportStar", "Failure #22: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #23: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #24: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #25: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #26: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #27: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #28: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #29: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #30: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #31: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #32: pyflakes/test/test_doctests.py::TestImports::test_usedInLambda", "Failure #33: pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault", "Failure #34: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #35: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #36: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #37: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #38: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #39: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #40: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #41: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #42: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs", "Failure #43: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #44: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #45: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #46: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #47: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #48: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #49: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #50: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #51: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #52: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #53: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #54: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #55: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #56: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #57: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #58: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #59: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #60: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #61: pyflakes/test/test_imports.py::Test::test_localImportStar", "Failure #62: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #63: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #64: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunction", "Failure #65: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunctionTwice", "Failure #66: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #67: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #68: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #69: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #70: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #71: pyflakes/test/test_imports.py::Test::test_usedInGlobal", "Failure #72: pyflakes/test/test_imports.py::Test::test_usedInLambda", "Failure #73: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #74: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #75: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #76: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #77: pyflakes/test/test_other.py::Test::test_breakOutsideLoop", "Failure #78: pyflakes/test/test_other.py::Test::test_continueOutsideLoop", "Failure #79: pyflakes/test/test_other.py::Test::test_duplicateArgs", "Failure #80: pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope", "Failure #81: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #82: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #83: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #84: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #85: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #86: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #87: pyflakes/test/test_other.py::Test::test_unused_nonlocal_in_clas", "Failure #88: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #89: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #90: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #91: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #92: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #93: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #94: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #95: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #96: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #97: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #98: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse", "Failure #99: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #100: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #101: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #102: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #103: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #104: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #105: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #106: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #107: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #108: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #109: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #110: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #111: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #112: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #113: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #114: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #115: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #116: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #117: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #118: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #119: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #120: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #121: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #122: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #123: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #124: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs", "Failure #125: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #126: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #127: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #128: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #129: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #130: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #131: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #132: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #133: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #134: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInComprehension", "Failure #135: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInDictionaryComprehension", "Failure #136: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_builtin.py", "test_builtin_unbound_local" ], [ "pyflakes/test/test_code_segment.py", "test_class_segment" ] ] }, "complexity_info": { "centrality": { "distance_discount": 8.281600000000001, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 6, "betweenness": 5.9850314363776195e-06, "pagerank": 0.0002514413837283793, "harmonic": 0.012849301397205587, "bidirectional_harmonic": 0.06766467065868265, "degree": 7 }, "line_count": 36, "code_line_count": 36, "cyclomatic": 12, "halstead_volume": 60.91767875292166, "halstead_difficulty": 2.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.FUNCTIONDEF", "test_info": { "success": false, "failed": 211, "passed": 2012, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst differing element 0:\n\n\n\n- []\n? ^ ^^\n\n+ []\n? ^^^ ^\n : for input:\n\n def foo():\n a = range(1, 10)\n range = a\n return range\n\n foo()\n\n print(range)\n \nexpected outputs:\n[]\nbut got:\n(none):7:1: undefined name 'foo'\n\nTraceback:\n\n> def test_builtin_unbound_local(self):\n> self.flakes('''\n def foo():\n a = range(1, 10)\n range = a\n return range\n \n foo()\n \n print(range)\n ''', m.UndefinedLocal)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First differing element 0:\nE \nE \nE \nE - []\nE ? ^ ^^\nE \nE + []\nE ? ^^^ ^\nE : for input:\nE \nE def foo():\nE a = range(1, 10)\nE range = a\nE return range\nE \nE foo()\nE \nE print(range)\nE \nE expected outputs:\nE []\nE but got:\nE (none):7:1: undefined name 'foo'\n", "\n============================================================\nFailure #2: pyflakes/test/test_builtin.py::TestBuiltins::test_global_shadowing_builtin\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n def f():\n global range\n range = None\n print(range)\n\n f()\n \nexpected outputs:\n[]\nbut got:\n(none):7:1: undefined name 'f'\n\nTraceback:\n\n> def test_global_shadowing_builtin(self):\n> self.flakes('''\n def f():\n global range\n range = None\n print(range)\n \n f()\n ''')\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE def f():\nE global range\nE range = None\nE print(range)\nE \nE f()\nE \nE expected outputs:\nE []\nE but got:\nE (none):7:1: undefined name 'f'\n", "Failure #3: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #4: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #5: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #6: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_function", "Failure #7: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_function", "Failure #8: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_func_call", "Failure #9: pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop", "Failure #10: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody", "Failure #11: pyflakes/test/test_doctests.py::TestOther::test_classRedefinedAsFunction", "Failure #12: pyflakes/test/test_doctests.py::TestOther::test_classRedefinition", "Failure #13: pyflakes/test/test_doctests.py::TestOther::test_classWithReturn", "Failure #14: pyflakes/test/test_doctests.py::TestOther::test_classWithYield", "Failure #15: pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom", "Failure #16: pyflakes/test/test_doctests.py::TestOther::test_continueOutsideLoop", "Failure #17: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptNotLast", "Failure #18: pyflakes/test/test_doctests.py::TestOther::test_duplicateArgs", "Failure #19: pyflakes/test/test_doctests.py::TestOther::test_functionRedefinedAsClass", "Failure #20: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #21: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #22: pyflakes/test/test_doctests.py::TestOther::test_moduleWithReturn", "Failure #23: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYield", "Failure #24: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYieldFrom", "Failure #25: pyflakes/test/test_doctests.py::TestOther::test_redefinedClassFunction", "Failure #26: pyflakes/test/test_doctests.py::TestOther::test_redefinedFunction", "Failure #27: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfFunction", "Failure #28: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #29: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #30: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #31: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction", "Failure #32: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreImportation", "Failure #33: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #34: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentErrors", "Failure #35: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #36: pyflakes/test/test_doctests.py::TestOther::test_unused_global_in_class", "Failure #37: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #38: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #39: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_in_clas", "Failure #40: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #41: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #42: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #43: pyflakes/test/test_doctests.py::TestImports::test_functionNamesAreBoundNow", "Failure #44: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #45: pyflakes/test/test_doctests.py::TestImports::test_futureImportStar", "Failure #46: pyflakes/test/test_doctests.py::TestImports::test_futureImportUndefined", "Failure #47: pyflakes/test/test_doctests.py::TestImports::test_importInClass", "Failure #48: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #49: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #50: pyflakes/test/test_doctests.py::TestImports::test_localImportStar", "Failure #51: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #52: pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass", "Failure #53: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #54: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #55: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFunction", "Failure #56: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #57: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #58: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #59: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #60: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #61: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #62: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #63: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #64: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #65: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #66: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #67: pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative", "Failure #68: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #69: pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport", "Failure #70: pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import", "Failure #71: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #72: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #73: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #74: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #75: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #76: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined", "Failure #77: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #78: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #79: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #80: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #81: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #82: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #83: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #84: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #85: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #86: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath", "Failure #87: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #88: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #89: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined", "Failure #90: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #91: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #92: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #93: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #94: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #95: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #96: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #97: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #98: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #99: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #100: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #101: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #102: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #103: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #104: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #105: pyflakes/test/test_doctests.py::Test::test_global_undefined", "Failure #106: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #107: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #108: pyflakes/test/test_doctests.py::Test::test_indentationErrorInDoctest", "Failure #109: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #110: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #111: pyflakes/test/test_doctests.py::Test::test_noOffsetSyntaxErrorInDoctest", "Failure #112: pyflakes/test/test_doctests.py::Test::test_offsetInDoctests", "Failure #113: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #114: pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs", "Failure #115: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #116: pyflakes/test/test_doctests.py::Test::test_syntaxErrorInDoctest", "Failure #117: pyflakes/test/test_imports.py::Test::test_functionNamesAreBoundNow", "Failure #118: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #119: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #120: pyflakes/test/test_imports.py::Test::test_localImportStar", "Failure #121: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #122: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #123: pyflakes/test/test_imports.py::Test::test_redefinedByFunction", "Failure #124: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunction", "Failure #125: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunctionTwice", "Failure #126: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #127: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #128: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #129: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #130: pyflakes/test/test_imports.py::Test::test_usedInGlobal", "Failure #131: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #132: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #133: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #134: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #135: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #136: pyflakes/test/test_other.py::Test::test_breakOutsideLoop", "Failure #137: pyflakes/test/test_other.py::Test::test_classFunctionDecorator", "Failure #138: pyflakes/test/test_other.py::Test::test_classRedefinedAsFunction", "Failure #139: pyflakes/test/test_other.py::Test::test_continueOutsideLoop", "Failure #140: pyflakes/test/test_other.py::Test::test_duplicateArgs", "Failure #141: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #142: pyflakes/test/test_other.py::Test::test_functionRedefinedAsClass", "Failure #143: pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope", "Failure #144: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #145: pyflakes/test/test_other.py::Test::test_redefinedClassFunction", "Failure #146: pyflakes/test/test_other.py::Test::test_redefinedFunction", "Failure #147: pyflakes/test/test_other.py::Test::test_redefinedIfFunction", "Failure #148: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #149: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #150: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #151: pyflakes/test/test_other.py::Test::test_redefinedTryFunction", "Failure #152: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreImportation", "Failure #153: pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable", "Failure #154: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #155: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #156: pyflakes/test/test_other.py::Test::test_unused_nonlocal_in_clas", "Failure #157: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #158: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #159: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #160: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #161: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #162: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #163: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #164: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #165: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #166: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #167: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse", "Failure #168: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import", "Failure #169: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #170: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #171: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #172: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #173: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #174: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #175: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #176: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #177: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #178: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #179: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #180: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_not_a_typing_overload", "Failure #181: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #182: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #183: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #184: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #185: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #186: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #187: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #188: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #189: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #190: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #191: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync", "Failure #192: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #193: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #194: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #195: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #196: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #197: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #198: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #199: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #200: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs", "Failure #201: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #202: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #203: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #204: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #205: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #206: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #207: pyflakes/test/test_undefined_names.py::Test::test_nestedClass", "Failure #208: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #209: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #210: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #211: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_builtin.py", "test_builtin_unbound_local" ], [ "pyflakes/test/test_builtin.py", "test_global_shadowing_builtin" ] ] }, "complexity_info": { "centrality": { "distance_discount": 16.85888000000001, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 7, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.022754491017964076, "bidirectional_harmonic": 0.06454590818363276, "degree": 7 }, "line_count": 11, "code_line_count": 11, "cyclomatic": 5, "halstead_volume": 22.458839376460833, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.handleNodeStore", "test_info": { "success": false, "failed": 241, "passed": 1982, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst differing element 0:\n\n\n\n- []\n? ^ ^^\n\n+ []\n? ^^^ ^\n : for input:\n\n def foo():\n a = range(1, 10)\n range = a\n return range\n\n foo()\n\n print(range)\n \nexpected outputs:\n[]\nbut got:\n(none):4:13: undefined name 'a'\n\nTraceback:\n\n> def test_builtin_unbound_local(self):\n> self.flakes('''\n def foo():\n a = range(1, 10)\n range = a\n return range\n \n foo()\n \n print(range)\n ''', m.UndefinedLocal)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First differing element 0:\nE \nE \nE \nE - []\nE ? ^ ^^\nE \nE + []\nE ? ^^^ ^\nE : for input:\nE \nE def foo():\nE a = range(1, 10)\nE range = a\nE return range\nE \nE foo()\nE \nE print(range)\nE \nE expected outputs:\nE []\nE but got:\nE (none):4:13: undefined name 'a'\n", "\n============================================================\nFailure #2: pyflakes/test/test_builtin.py::TestBuiltins::test_global_shadowing_builtin\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n def f():\n global range\n range = None\n print(range)\n\n f()\n \nexpected outputs:\n[]\nbut got:\n(none):3:5: `global range` is unused: name is never assigned in scope\n\nTraceback:\n\n> def test_global_shadowing_builtin(self):\n> self.flakes('''\n def f():\n global range\n range = None\n print(range)\n \n f()\n ''')\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE def f():\nE global range\nE range = None\nE print(range)\nE \nE f()\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:5: `global range` is unused: name is never assigned in scope\n", "Failure #3: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #4: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #5: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #6: pyflakes/test/test_dict.py::Test::test_duplicate_variable_keys", "Failure #7: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values", "Failure #8: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values_same_value", "Failure #9: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_instance_attributes", "Failure #10: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_vars", "Failure #11: pyflakes/test/test_doctests.py::TestOther::test_attrAugmentedAssignment", "Failure #12: pyflakes/test/test_doctests.py::TestOther::test_classNameDefinedPreviously", "Failure #13: pyflakes/test/test_doctests.py::TestOther::test_comparison", "Failure #14: pyflakes/test/test_doctests.py::TestOther::test_containment", "Failure #15: pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentWithUse", "Failure #16: pyflakes/test/test_doctests.py::TestOther::test_extendedSlice", "Failure #17: pyflakes/test/test_doctests.py::TestOther::test_global_nonlocal_in_class_bodies", "Failure #18: pyflakes/test/test_doctests.py::TestOther::test_identity", "Failure #19: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #20: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseInListComp", "Failure #21: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #22: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #23: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #24: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #25: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #26: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #27: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #28: pyflakes/test/test_doctests.py::TestOther::test_varAugmentedAssignment", "Failure #29: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #30: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #31: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #32: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #33: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #34: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #35: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #36: pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment", "Failure #37: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #38: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #39: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarUnpack", "Failure #40: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobal", "Failure #41: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobalMultipleNames", "Failure #42: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInDictionaryComprehension", "Failure #43: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInGenerator", "Failure #44: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInGenExp", "Failure #45: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInListComp", "Failure #46: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #47: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditional", "Failure #48: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditionalNested", "Failure #49: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delExceptionInExcept", "Failure #50: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhile", "Failure #51: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileNested", "Failure #52: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileTestUsage", "Failure #53: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #54: pyflakes/test/test_doctests.py::TestUndefinedNames::test_functionsNeedGlobalScope", "Failure #55: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalFromNestedScope", "Failure #56: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #57: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #58: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #59: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #60: pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks", "Failure #61: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #62: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #63: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #64: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #65: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #66: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #67: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #68: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #69: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #70: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #71: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #72: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #73: pyflakes/test/test_doctests.py::Test::test_ignore_nested_function", "Failure #74: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #75: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #76: pyflakes/test/test_imports.py::Test::test_redefinedByExcept", "Failure #77: pyflakes/test/test_imports.py::Test::test_redefinedByFor", "Failure #78: pyflakes/test/test_imports.py::Test::test_redefinedIf", "Failure #79: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #80: pyflakes/test/test_imports.py::Test::test_redefinedWhileUnused", "Failure #81: pyflakes/test/test_imports.py::Test::test_shadowedByFor", "Failure #82: pyflakes/test/test_imports.py::Test::test_shadowedByForDeep", "Failure #83: pyflakes/test/test_imports.py::Test::test_usedInAssignment", "Failure #84: pyflakes/test/test_imports.py::TestSpecialAll::test_all_mixed_attributes_and_strings", "Failure #85: pyflakes/test/test_imports.py::TestSpecialAll::test_augmentedAssignment", "Failure #86: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #87: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #88: pyflakes/test/test_imports.py::TestSpecialAll::test_list_concatenation_assignment", "Failure #89: pyflakes/test/test_imports.py::TestSpecialAll::test_redefinedByGenExp", "Failure #90: pyflakes/test/test_imports.py::TestSpecialAll::test_tuple_concatenation_assignment", "Failure #91: pyflakes/test/test_imports.py::TestSpecialAll::test_unboundExported", "Failure #92: pyflakes/test/test_imports.py::TestSpecialAll::test_warningSuppressed", "Failure #93: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str", "Failure #94: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str_end", "Failure #95: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_true", "Failure #96: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_true_end", "Failure #97: pyflakes/test/test_is_literal.py::Test::test_is_bytes", "Failure #98: pyflakes/test/test_is_literal.py::Test::test_is_false", "Failure #99: pyflakes/test/test_is_literal.py::Test::test_is_int", "Failure #100: pyflakes/test/test_is_literal.py::Test::test_is_not_bytes", "Failure #101: pyflakes/test/test_is_literal.py::Test::test_is_not_false", "Failure #102: pyflakes/test/test_is_literal.py::Test::test_is_not_int", "Failure #103: pyflakes/test/test_is_literal.py::Test::test_is_not_str", "Failure #104: pyflakes/test/test_is_literal.py::Test::test_is_not_true", "Failure #105: pyflakes/test/test_is_literal.py::Test::test_is_not_unicode", "Failure #106: pyflakes/test/test_is_literal.py::Test::test_is_str", "Failure #107: pyflakes/test/test_is_literal.py::Test::test_is_true", "Failure #108: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant", "Failure #109: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant_containing_constants", "Failure #110: pyflakes/test/test_is_literal.py::Test::test_is_tuple_containing_variables_ok", "Failure #111: pyflakes/test/test_is_literal.py::Test::test_is_unicode", "Failure #112: pyflakes/test/test_is_literal.py::Test::test_left_is_bytes", "Failure #113: pyflakes/test/test_is_literal.py::Test::test_left_is_false", "Failure #114: pyflakes/test/test_is_literal.py::Test::test_left_is_int", "Failure #115: pyflakes/test/test_is_literal.py::Test::test_left_is_not_bytes", "Failure #116: pyflakes/test/test_is_literal.py::Test::test_left_is_not_false", "Failure #117: pyflakes/test/test_is_literal.py::Test::test_left_is_not_int", "Failure #118: pyflakes/test/test_is_literal.py::Test::test_left_is_not_str", "Failure #119: pyflakes/test/test_is_literal.py::Test::test_left_is_not_true", "Failure #120: pyflakes/test/test_is_literal.py::Test::test_left_is_not_unicode", "Failure #121: pyflakes/test/test_is_literal.py::Test::test_left_is_str", "Failure #122: pyflakes/test/test_is_literal.py::Test::test_left_is_true", "Failure #123: pyflakes/test/test_is_literal.py::Test::test_left_is_unicode", "Failure #124: pyflakes/test/test_match.py::TestMatch::test_match_bindings", "Failure #125: pyflakes/test/test_match.py::TestMatch::test_match_double_star", "Failure #126: pyflakes/test/test_match.py::TestMatch::test_match_pattern_matched_class", "Failure #127: pyflakes/test/test_match.py::TestMatch::test_match_star", "Failure #128: pyflakes/test/test_other.py::Test::test_attrAugmentedAssignment", "Failure #129: pyflakes/test/test_other.py::Test::test_classNameDefinedPreviously", "Failure #130: pyflakes/test/test_other.py::Test::test_comparison", "Failure #131: pyflakes/test/test_other.py::Test::test_containment", "Failure #132: pyflakes/test/test_other.py::Test::test_doubleAssignmentWithUse", "Failure #133: pyflakes/test/test_other.py::Test::test_extendedSlice", "Failure #134: pyflakes/test/test_other.py::Test::test_global_nonlocal_in_class_bodies", "Failure #135: pyflakes/test/test_other.py::Test::test_identity", "Failure #136: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #137: pyflakes/test/test_other.py::Test::test_redefinedIfElseInListComp", "Failure #138: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #139: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #140: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #141: pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable", "Failure #142: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #143: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #144: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #145: pyflakes/test/test_other.py::Test::test_varAugmentedAssignment", "Failure #146: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_with_message", "Failure #147: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_without_message", "Failure #148: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToGlobal", "Failure #149: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToNonlocal", "Failure #150: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr", "Failure #151: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_after_annotation", "Failure #152: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope", "Failure #153: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope_reassigns_parameter", "Failure #154: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_nested", "Failure #155: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignmentInsideLoop", "Failure #156: pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall", "Failure #157: pyflakes/test/test_other.py::TestUnusedAssignment::test_closedOver", "Failure #158: pyflakes/test/test_other.py::TestUnusedAssignment::test_dictComprehension", "Failure #159: pyflakes/test/test_other.py::TestUnusedAssignment::test_doubleClosedOver", "Failure #160: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExcept", "Failure #161: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #162: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUsedInExcept", "Failure #163: pyflakes/test/test_other.py::TestUnusedAssignment::test_exception_unused_in_except_star", "Failure #164: pyflakes/test/test_other.py::TestUnusedAssignment::test_f_string", "Failure #165: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #166: pyflakes/test/test_other.py::TestUnusedAssignment::test_setComprehensionAndLiteral", "Failure #167: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #168: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #169: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #170: pyflakes/test/test_other.py::TestUnusedAssignment::test_variableUsedInLoop", "Failure #171: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementComplicatedTarget", "Failure #172: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementListNames", "Failure #173: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNameDefinedInBody", "Failure #174: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNoNames", "Failure #175: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleName", "Failure #176: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameRedefined", "Failure #177: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNames", "Failure #178: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined", "Failure #179: pyflakes/test/test_other.py::TestStringFormatting::test_f_string_without_placeholders", "Failure #180: pyflakes/test/test_other.py::TestStringFormatting::test_invalid_dot_format_calls", "Failure #181: pyflakes/test/test_other.py::TestStringFormatting::test_ok_percent_format_cannot_determine_element_count", "Failure #182: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncFor", "Failure #183: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem", "Failure #184: pyflakes/test/test_other.py::TestAsyncStatements::test_formatstring", "Failure #185: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncFor", "Failure #186: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse", "Failure #187: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_function_assignment", "Failure #188: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #189: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #190: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #191: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #192: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #193: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #194: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #195: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_TypeVarTuple", "Failure #196: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_classes", "Failure #197: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #198: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #199: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_functions", "Failure #200: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_statements", "Failure #201: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #202: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #203: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #204: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #205: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #206: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #207: pyflakes/test/test_undefined_names.py::Test::test_definedAsStarUnpack", "Failure #208: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobal", "Failure #209: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobalMultipleNames", "Failure #210: pyflakes/test/test_undefined_names.py::Test::test_definedFromLambdaInDictionaryComprehension", "Failure #211: pyflakes/test/test_undefined_names.py::Test::test_definedFromLambdaInGenerator", "Failure #212: pyflakes/test/test_undefined_names.py::Test::test_definedInClass", "Failure #213: pyflakes/test/test_undefined_names.py::Test::test_definedInClassNested", "Failure #214: pyflakes/test/test_undefined_names.py::Test::test_definedInGenExp", "Failure #215: pyflakes/test/test_undefined_names.py::Test::test_definedInListComp", "Failure #216: pyflakes/test/test_undefined_names.py::Test::test_del", "Failure #217: pyflakes/test/test_undefined_names.py::Test::test_delConditional", "Failure #218: pyflakes/test/test_undefined_names.py::Test::test_delConditionalNested", "Failure #219: pyflakes/test/test_undefined_names.py::Test::test_delExceptionInExcept", "Failure #220: pyflakes/test/test_undefined_names.py::Test::test_delWhile", "Failure #221: pyflakes/test/test_undefined_names.py::Test::test_delWhileNested", "Failure #222: pyflakes/test/test_undefined_names.py::Test::test_delWhileTestUsage", "Failure #223: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #224: pyflakes/test/test_undefined_names.py::Test::test_functionsNeedGlobalScope", "Failure #225: pyflakes/test/test_undefined_names.py::Test::test_globalFromNestedScope", "Failure #226: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #227: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #228: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #229: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #230: pyflakes/test/test_undefined_names.py::Test::test_namesDeclaredInExceptBlocks", "Failure #231: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #232: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionName", "Failure #233: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #234: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #235: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #236: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #237: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #238: pyflakes/test/test_undefined_names.py::Test::test_undefinedInGenExpNested", "Failure #239: pyflakes/test/test_undefined_names.py::Test::test_undefinedInListComp", "Failure #240: pyflakes/test/test_undefined_names.py::Test::test_undefinedInLoop", "Failure #241: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_builtin.py", "test_builtin_unbound_local" ], [ "pyflakes/test/test_builtin.py", "test_global_shadowing_builtin" ] ] }, "complexity_info": { "centrality": { "distance_discount": 9.337600000000002, "in_degree": 4, "true_in_degree": 4.0, "out_degree": 7, "betweenness": 8.229418225019227e-05, "pagerank": 0.0005259715994020927, "harmonic": 0.014346307385229542, "bidirectional_harmonic": 0.06933632734530942, "degree": 11 }, "line_count": 35, "code_line_count": 35, "cyclomatic": 19, "halstead_volume": 268.8361000750002, "halstead_difficulty": 5.666666666666667 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.handleNode", "test_info": { "success": false, "failed": 304, "passed": 1919, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_checkRecursive\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: 0 != 2\n\nTraceback:\n\n> def test_checkRecursive(self):\n \"\"\"\n L{checkRecursive} descends into each directory, finding Python files\n and reporting problems.\n \"\"\"\n tempdir = tempfile.mkdtemp()\n try:\n os.mkdir(os.path.join(tempdir, 'foo'))\n file1 = os.path.join(tempdir, 'foo', 'bar.py')\n with open(file1, 'wb') as fd:\n fd.write(b\"import baz\\n\")\n file2 = os.path.join(tempdir, 'baz.py')\n with open(file2, 'wb') as fd:\n fd.write(b\"import contraband\")\n log = []\n reporter = LoggingReporter(log)\n warnings = checkRecursive([tempdir], reporter)\n> self.assertEqual(warnings, 2)\nE AssertionError: 0 != 2\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::CheckTests::test_pyflakesWarning\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: 0 != 1\n\nTraceback:\n\n> def test_pyflakesWarning(self):\n \"\"\"\n If the source file has a pyflakes warning, this is reported as a\n 'flake'.\n \"\"\"\n with self.makeTempFile(\"import foo\") as sourcePath:\n count, errors = self.getErrors(sourcePath)\n> self.assertEqual(count, 1)\nE AssertionError: 0 != 1\n", "Failure #3: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #4: pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin", "Failure #5: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #6: pyflakes/test/test_api.py::TestMain::test_readFromStdin", "Failure #7: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local", "Failure #8: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #9: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #10: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #11: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_function", "Failure #12: pyflakes/test/test_dict.py::Test::test_duplicate_key_float_and_int", "Failure #13: pyflakes/test/test_dict.py::Test::test_duplicate_keys", "Failure #14: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bools", "Failure #15: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bools_false", "Failure #16: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_function", "Failure #17: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_lambda", "Failure #18: pyflakes/test/test_dict.py::Test::test_duplicate_keys_ints", "Failure #19: pyflakes/test/test_dict.py::Test::test_duplicate_keys_none", "Failure #20: pyflakes/test/test_dict.py::Test::test_duplicate_keys_tuples", "Failure #21: pyflakes/test/test_dict.py::Test::test_duplicate_keys_tuples_int_and_float", "Failure #22: pyflakes/test/test_dict.py::Test::test_duplicate_values_bytes_vs_unicode_py3", "Failure #23: pyflakes/test/test_dict.py::Test::test_duplicate_variable_keys", "Failure #24: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values", "Failure #25: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values_same_value", "Failure #26: pyflakes/test/test_dict.py::Test::test_multiple_duplicate_keys", "Failure #27: pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop", "Failure #28: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody", "Failure #29: pyflakes/test/test_doctests.py::TestOther::test_classRedefinedAsFunction", "Failure #30: pyflakes/test/test_doctests.py::TestOther::test_classRedefinition", "Failure #31: pyflakes/test/test_doctests.py::TestOther::test_classWithReturn", "Failure #32: pyflakes/test/test_doctests.py::TestOther::test_classWithYield", "Failure #33: pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom", "Failure #34: pyflakes/test/test_doctests.py::TestOther::test_continueOutsideLoop", "Failure #35: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptNotLast", "Failure #36: pyflakes/test/test_doctests.py::TestOther::test_duplicateArgs", "Failure #37: pyflakes/test/test_doctests.py::TestOther::test_functionRedefinedAsClass", "Failure #38: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #39: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #40: pyflakes/test/test_doctests.py::TestOther::test_moduleWithReturn", "Failure #41: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYield", "Failure #42: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYieldFrom", "Failure #43: pyflakes/test/test_doctests.py::TestOther::test_redefinedClassFunction", "Failure #44: pyflakes/test/test_doctests.py::TestOther::test_redefinedFunction", "Failure #45: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfFunction", "Failure #46: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #47: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #48: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #49: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction", "Failure #50: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreImportation", "Failure #51: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #52: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentErrors", "Failure #53: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #54: pyflakes/test/test_doctests.py::TestOther::test_unused_global_in_class", "Failure #55: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #56: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #57: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_in_clas", "Failure #58: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #59: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #60: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #61: pyflakes/test/test_doctests.py::TestImports::test_functionNamesAreBoundNow", "Failure #62: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #63: pyflakes/test/test_doctests.py::TestImports::test_futureImportStar", "Failure #64: pyflakes/test/test_doctests.py::TestImports::test_futureImportUndefined", "Failure #65: pyflakes/test/test_doctests.py::TestImports::test_importInClass", "Failure #66: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #67: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #68: pyflakes/test/test_doctests.py::TestImports::test_localImportStar", "Failure #69: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #70: pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass", "Failure #71: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #72: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #73: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFunction", "Failure #74: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #75: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #76: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #77: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #78: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #79: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #80: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #81: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #82: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #83: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #84: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #85: pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative", "Failure #86: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #87: pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport", "Failure #88: pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import", "Failure #89: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #90: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #91: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #92: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #93: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #94: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined", "Failure #95: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #96: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #97: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #98: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #99: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #100: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #101: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #102: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #103: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #104: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath", "Failure #105: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #106: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #107: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined", "Failure #108: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #109: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #110: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #111: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #112: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #113: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #114: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #115: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #116: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #117: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #118: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #119: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #120: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #121: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #122: pyflakes/test/test_doctests.py::Test::test_globalUnderscoreInDoctest", "Failure #123: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #124: pyflakes/test/test_doctests.py::Test::test_global_undefined", "Failure #125: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #126: pyflakes/test/test_doctests.py::Test::test_indentationErrorInDoctest", "Failure #127: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #128: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #129: pyflakes/test/test_doctests.py::Test::test_noOffsetSyntaxErrorInDoctest", "Failure #130: pyflakes/test/test_doctests.py::Test::test_offsetAfterDoctests", "Failure #131: pyflakes/test/test_doctests.py::Test::test_offsetInDoctests", "Failure #132: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #133: pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs", "Failure #134: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #135: pyflakes/test/test_doctests.py::Test::test_syntaxErrorInDoctest", "Failure #136: pyflakes/test/test_imports.py::TestImportationObject::test_unusedImport_underscore", "Failure #137: pyflakes/test/test_imports.py::Test::test_aliasedImport", "Failure #138: pyflakes/test/test_imports.py::Test::test_duplicateSubmoduleImport", "Failure #139: pyflakes/test/test_imports.py::Test::test_functionNamesAreBoundNow", "Failure #140: pyflakes/test/test_imports.py::Test::test_futureImportFirst", "Failure #141: pyflakes/test/test_imports.py::Test::test_futureImportStar", "Failure #142: pyflakes/test/test_imports.py::Test::test_futureImportUndefined", "Failure #143: pyflakes/test/test_imports.py::Test::test_importInClass", "Failure #144: pyflakes/test/test_imports.py::Test::test_importStar", "Failure #145: pyflakes/test/test_imports.py::Test::test_importStar_relative", "Failure #146: pyflakes/test/test_imports.py::Test::test_localImportStar", "Failure #147: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #148: pyflakes/test/test_imports.py::Test::test_redefinedByClass", "Failure #149: pyflakes/test/test_imports.py::Test::test_redefinedByExcept", "Failure #150: pyflakes/test/test_imports.py::Test::test_redefinedByFor", "Failure #151: pyflakes/test/test_imports.py::Test::test_redefinedByFunction", "Failure #152: pyflakes/test/test_imports.py::Test::test_redefinedIf", "Failure #153: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunction", "Failure #154: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunctionTwice", "Failure #155: pyflakes/test/test_imports.py::Test::test_redefinedTry", "Failure #156: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #157: pyflakes/test/test_imports.py::Test::test_redefinedWhileUnused", "Failure #158: pyflakes/test/test_imports.py::Test::test_shadowedByFor", "Failure #159: pyflakes/test/test_imports.py::Test::test_shadowedByForDeep", "Failure #160: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #161: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #162: pyflakes/test/test_imports.py::Test::test_unusedImport", "Failure #163: pyflakes/test/test_imports.py::Test::test_unusedImport_relative", "Failure #164: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #165: pyflakes/test/test_imports.py::Test::test_unusedPackageImport", "Failure #166: pyflakes/test/test_imports.py::Test::test_unused_package_with_submodule_import", "Failure #167: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #168: pyflakes/test/test_imports.py::Test::test_usedInGetattr", "Failure #169: pyflakes/test/test_imports.py::Test::test_usedInGlobal", "Failure #170: pyflakes/test/test_imports.py::TestSpecialAll::test_augmentedAssignment", "Failure #171: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInClass", "Failure #172: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #173: pyflakes/test/test_imports.py::TestSpecialAll::test_ignored_when_not_directly_assigned", "Failure #174: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #175: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarNotExported", "Failure #176: pyflakes/test/test_imports.py::TestSpecialAll::test_list_concatenation_assignment", "Failure #177: pyflakes/test/test_imports.py::TestSpecialAll::test_redefinedByGenExp", "Failure #178: pyflakes/test/test_imports.py::TestSpecialAll::test_tuple_concatenation_assignment", "Failure #179: pyflakes/test/test_imports.py::TestSpecialAll::test_unboundExported", "Failure #180: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #181: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #182: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str", "Failure #183: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str_end", "Failure #184: pyflakes/test/test_is_literal.py::Test::test_is_bytes", "Failure #185: pyflakes/test/test_is_literal.py::Test::test_is_int", "Failure #186: pyflakes/test/test_is_literal.py::Test::test_is_not_bytes", "Failure #187: pyflakes/test/test_is_literal.py::Test::test_is_not_int", "Failure #188: pyflakes/test/test_is_literal.py::Test::test_is_not_str", "Failure #189: pyflakes/test/test_is_literal.py::Test::test_is_not_unicode", "Failure #190: pyflakes/test/test_is_literal.py::Test::test_is_str", "Failure #191: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant", "Failure #192: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant_containing_constants", "Failure #193: pyflakes/test/test_is_literal.py::Test::test_is_unicode", "Failure #194: pyflakes/test/test_is_literal.py::Test::test_left_is_bytes", "Failure #195: pyflakes/test/test_is_literal.py::Test::test_left_is_int", "Failure #196: pyflakes/test/test_is_literal.py::Test::test_left_is_not_bytes", "Failure #197: pyflakes/test/test_is_literal.py::Test::test_left_is_not_int", "Failure #198: pyflakes/test/test_is_literal.py::Test::test_left_is_not_str", "Failure #199: pyflakes/test/test_is_literal.py::Test::test_left_is_not_unicode", "Failure #200: pyflakes/test/test_is_literal.py::Test::test_left_is_str", "Failure #201: pyflakes/test/test_is_literal.py::Test::test_left_is_unicode", "Failure #202: pyflakes/test/test_other.py::Test::test_breakOutsideLoop", "Failure #203: pyflakes/test/test_other.py::Test::test_classNameUndefinedInClassBody", "Failure #204: pyflakes/test/test_other.py::Test::test_classRedefinedAsFunction", "Failure #205: pyflakes/test/test_other.py::Test::test_classRedefinition", "Failure #206: pyflakes/test/test_other.py::Test::test_classWithReturn", "Failure #207: pyflakes/test/test_other.py::Test::test_classWithYield", "Failure #208: pyflakes/test/test_other.py::Test::test_classWithYieldFrom", "Failure #209: pyflakes/test/test_other.py::Test::test_continueOutsideLoop", "Failure #210: pyflakes/test/test_other.py::Test::test_defaultExceptNotLast", "Failure #211: pyflakes/test/test_other.py::Test::test_duplicateArgs", "Failure #212: pyflakes/test/test_other.py::Test::test_functionRedefinedAsClass", "Failure #213: pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope", "Failure #214: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #215: pyflakes/test/test_other.py::Test::test_moduleWithReturn", "Failure #216: pyflakes/test/test_other.py::Test::test_moduleWithYield", "Failure #217: pyflakes/test/test_other.py::Test::test_moduleWithYieldFrom", "Failure #218: pyflakes/test/test_other.py::Test::test_redefinedClassFunction", "Failure #219: pyflakes/test/test_other.py::Test::test_redefinedFunction", "Failure #220: pyflakes/test/test_other.py::Test::test_redefinedIfFunction", "Failure #221: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #222: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #223: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #224: pyflakes/test/test_other.py::Test::test_redefinedTryFunction", "Failure #225: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreImportation", "Failure #226: pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable", "Failure #227: pyflakes/test/test_other.py::Test::test_starredAssignmentErrors", "Failure #228: pyflakes/test/test_other.py::Test::test_undefinedBaseClass", "Failure #229: pyflakes/test/test_other.py::Test::test_unused_global_in_class", "Failure #230: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #231: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #232: pyflakes/test/test_other.py::Test::test_unused_nonlocal_in_clas", "Failure #233: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #234: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_tuple", "Failure #235: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExcept", "Failure #236: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #237: pyflakes/test/test_other.py::TestUnusedAssignment::test_exception_unused_in_except_star", "Failure #238: pyflakes/test/test_other.py::TestUnusedAssignment::test_if_tuple", "Failure #239: pyflakes/test/test_other.py::TestUnusedAssignment::test_ifexp", "Failure #240: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #241: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #242: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #243: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #244: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameRedefined", "Failure #245: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameUndefined", "Failure #246: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined", "Failure #247: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined", "Failure #248: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesUndefined", "Failure #249: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInExpression", "Failure #250: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInside", "Failure #251: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #252: pyflakes/test/test_other.py::TestStringFormatting::test_f_string_without_placeholders", "Failure #253: pyflakes/test/test_other.py::TestStringFormatting::test_invalid_dot_format_calls", "Failure #254: pyflakes/test/test_other.py::TestStringFormatting::test_invalid_percent_format_calls", "Failure #255: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #256: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse", "Failure #257: pyflakes/test/test_other.py::TestAsyncStatements::test_raise_notimplemented", "Failure #258: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future", "Failure #259: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #260: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #261: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #262: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #263: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_not_a_typing_overload", "Failure #264: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #265: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #266: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #267: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #268: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #269: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unassigned_annotation_is_undefined", "Failure #270: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #271: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #272: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotation_references_self_name_undefined", "Failure #273: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #274: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #275: pyflakes/test/test_undefined_names.py::Test::test_del", "Failure #276: pyflakes/test/test_undefined_names.py::Test::test_delUndefined", "Failure #277: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #278: pyflakes/test/test_undefined_names.py::Test::test_globalImportStar", "Failure #279: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #280: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #281: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #282: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #283: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #284: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #285: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #286: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsPath", "Failure #287: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #288: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #289: pyflakes/test/test_undefined_names.py::Test::test_undefined", "Failure #290: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #291: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionName", "Failure #292: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #293: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #294: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #295: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #296: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #297: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInComprehension", "Failure #298: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInDictionaryComprehension", "Failure #299: pyflakes/test/test_undefined_names.py::Test::test_undefinedInGenExpNested", "Failure #300: pyflakes/test/test_undefined_names.py::Test::test_undefinedInListComp", "Failure #301: pyflakes/test/test_undefined_names.py::Test::test_undefinedInLoop", "Failure #302: pyflakes/test/test_undefined_names.py::Test::test_undefinedWithErrorHandler", "Failure #303: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack", "Failure #304: pyflakes/test/test_undefined_names.py::NameTests::test_impossibleContext" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_checkRecursive" ], [ "pyflakes/test/test_api.py", "test_pyflakesWarning" ] ] }, "complexity_info": { "centrality": { "distance_discount": 1.6, "in_degree": 15, "true_in_degree": 27.00000000000001, "out_degree": 2, "betweenness": 0.00013466320731849644, "pagerank": 0.001930282515659478, "harmonic": 0.0029940119760479044, "bidirectional_harmonic": 0.07287924151696612, "degree": 17 }, "line_count": 22, "code_line_count": 22, "cyclomatic": 8, "halstead_volume": 153.24725426256592, "halstead_difficulty": 4.277777777777778 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.handleNodeLoad", "test_info": { "success": false, "failed": 310, "passed": 1913, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [, ] != []\n\nFirst differing element 0:\n\n\n\nFirst list contains 1 additional elements.\nFirst extra element 1:\n\n\n- [,\n? ^^ ^ ---- - ^\n\n+ []\n? ^^^^^ ^^^ ^\n\n- ] : for input:\n\n def foo():\n a = range(1, 10)\n range = a\n return range\n\n foo()\n\n print(range)\n \nexpected outputs:\n[]\nbut got:\n(none):3:5: local variable 'a' is assigned to but never used\n(none):4:5: local variable 'range' is assigned to but never used\n\nTraceback:\n\n> def test_builtin_unbound_local(self):\n> self.flakes('''\n def foo():\n a = range(1, 10)\n range = a\n return range\n \n foo()\n \n print(range)\n ''', m.UndefinedLocal)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [, ] != []\nE \nE First differing element 0:\nE \nE \nE \nE First list contains 1 additional elements.\nE First extra element 1:\nE \nE \nE - [,\nE ? ^^ ^ ---- - ^\nE \nE + []\nE ? ^^^^^ ^^^ ^\nE \nE - ] : for input:\nE \nE def foo():\nE a = range(1, 10)\nE range = a\nE return range\nE \nE foo()\nE \nE print(range)\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:5: local variable 'a' is assigned to but never used\nE (none):4:5: local variable 'range' is assigned to but never used\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestOther::test_classFunctionDecorator\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\ndef doctest_something():\n \"\"\"\n \n >>> class A:\n ... def a(): pass\n ... a = classmethod(a)\n \"\"\"\n\nexpected outputs:\n[]\nbut got:\n(none):6:16: redefinition of unused 'a' from line 5\n\nTraceback:\n\n> def test_classFunctionDecorator(self):\n \"\"\"\n Test that shadowing a function definition in a class suite with a\n decorated version of that function does not raise a warning.\n \"\"\"\n> self.flakes('''\n class A:\n def a(): pass\n a = classmethod(a)\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE def doctest_something():\nE \"\"\"\nE \nE >>> class A:\nE ... def a(): pass\nE ... a = classmethod(a)\nE \"\"\"\nE \nE expected outputs:\nE []\nE but got:\nE (none):6:16: redefinition of unused 'a' from line 5\n", "Failure #3: pyflakes/test/test_doctests.py::TestOther::test_classNameDefinedPreviously", "Failure #4: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody", "Failure #5: pyflakes/test/test_doctests.py::TestOther::test_functionDecorator", "Failure #6: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #7: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #8: pyflakes/test/test_doctests.py::TestOther::test_modernProperty", "Failure #9: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #10: pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule", "Failure #11: pyflakes/test/test_doctests.py::TestImports::test_assignRHSFirst", "Failure #12: pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport", "Failure #13: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #14: pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater", "Failure #15: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #16: pyflakes/test/test_doctests.py::TestImports::test_importInClass", "Failure #17: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #18: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #19: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #20: pyflakes/test/test_doctests.py::TestImports::test_nestedFunctionsNestScope", "Failure #21: pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine", "Failure #22: pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope", "Failure #23: pyflakes/test/test_doctests.py::TestImports::test_packageImport", "Failure #24: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #25: pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass", "Failure #26: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #27: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #28: pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass", "Failure #29: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #30: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #31: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #32: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #33: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #34: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #35: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #36: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #37: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #38: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #39: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #40: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #41: pyflakes/test/test_doctests.py::TestImports::test_usedImport_relative", "Failure #42: pyflakes/test/test_doctests.py::TestImports::test_usedInAssert", "Failure #43: pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment", "Failure #44: pyflakes/test/test_doctests.py::TestImports::test_usedInAttributeAssign", "Failure #45: pyflakes/test/test_doctests.py::TestImports::test_usedInCall", "Failure #46: pyflakes/test/test_doctests.py::TestImports::test_usedInClass", "Failure #47: pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase", "Failure #48: pyflakes/test/test_doctests.py::TestImports::test_usedInDict", "Failure #49: pyflakes/test/test_doctests.py::TestImports::test_usedInElifConditional", "Failure #50: pyflakes/test/test_doctests.py::TestImports::test_usedInElse", "Failure #51: pyflakes/test/test_doctests.py::TestImports::test_usedInExcept", "Failure #52: pyflakes/test/test_doctests.py::TestImports::test_usedInExec", "Failure #53: pyflakes/test/test_doctests.py::TestImports::test_usedInFor", "Failure #54: pyflakes/test/test_doctests.py::TestImports::test_usedInForElse", "Failure #55: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #56: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #57: pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody", "Failure #58: pyflakes/test/test_doctests.py::TestImports::test_usedInIfConditional", "Failure #59: pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg", "Failure #60: pyflakes/test/test_doctests.py::TestImports::test_usedInLambda", "Failure #61: pyflakes/test/test_doctests.py::TestImports::test_usedInList", "Failure #62: pyflakes/test/test_doctests.py::TestImports::test_usedInListComp", "Failure #63: pyflakes/test/test_doctests.py::TestImports::test_usedInLogic", "Failure #64: pyflakes/test/test_doctests.py::TestImports::test_usedInOperators", "Failure #65: pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault", "Failure #66: pyflakes/test/test_doctests.py::TestImports::test_usedInRaise", "Failure #67: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #68: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice", "Failure #69: pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj", "Failure #70: pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript", "Failure #71: pyflakes/test/test_doctests.py::TestImports::test_usedInTry", "Failure #72: pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally", "Failure #73: pyflakes/test/test_doctests.py::TestImports::test_usedInTuple", "Failure #74: pyflakes/test/test_doctests.py::TestImports::test_usedInWhile", "Failure #75: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #76: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import", "Failure #77: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import_of_alias", "Failure #78: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #79: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #80: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #81: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhile", "Failure #82: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileNested", "Failure #83: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileTestUsage", "Failure #84: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #85: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #86: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #87: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #88: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #89: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs", "Failure #90: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #91: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #92: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #93: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #94: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath", "Failure #95: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #96: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #97: pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined", "Failure #98: pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks", "Failure #99: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined", "Failure #100: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #101: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #102: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #103: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #104: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #105: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #106: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #107: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #108: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #109: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #110: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #111: pyflakes/test/test_doctests.py::Test::test_global_undefined", "Failure #112: pyflakes/test/test_doctests.py::Test::test_ignore_nested_function", "Failure #113: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #114: pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter", "Failure #115: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #116: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #117: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #118: pyflakes/test/test_doctests.py::Test::test_offsetAfterDoctests", "Failure #119: pyflakes/test/test_doctests.py::Test::test_offsetInDoctests", "Failure #120: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #121: pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs", "Failure #122: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #123: pyflakes/test/test_imports.py::Test::test_aliasedImportShadowModule", "Failure #124: pyflakes/test/test_imports.py::Test::test_assignRHSFirst", "Failure #125: pyflakes/test/test_imports.py::Test::test_differentSubmoduleImport", "Failure #126: pyflakes/test/test_imports.py::Test::test_duplicateSubmoduleImport", "Failure #127: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #128: pyflakes/test/test_imports.py::Test::test_futureImportFirst", "Failure #129: pyflakes/test/test_imports.py::Test::test_importInClass", "Failure #130: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #131: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #132: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #133: pyflakes/test/test_imports.py::Test::test_nestedFunctionsNestScope", "Failure #134: pyflakes/test/test_imports.py::Test::test_nonGlobalDoesNotRedefine", "Failure #135: pyflakes/test/test_imports.py::Test::test_notUsedInNestedScope", "Failure #136: pyflakes/test/test_imports.py::Test::test_packageImport", "Failure #137: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #138: pyflakes/test/test_imports.py::Test::test_redefinedBySubclass", "Failure #139: pyflakes/test/test_imports.py::Test::test_redefinedIf", "Failure #140: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #141: pyflakes/test/test_imports.py::Test::test_redefinedInClass", "Failure #142: pyflakes/test/test_imports.py::Test::test_redefinedTry", "Failure #143: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #144: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #145: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #146: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #147: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #148: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #149: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #150: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #151: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #152: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #153: pyflakes/test/test_imports.py::Test::test_usedImport", "Failure #154: pyflakes/test/test_imports.py::Test::test_usedImport_relative", "Failure #155: pyflakes/test/test_imports.py::Test::test_usedInAssert", "Failure #156: pyflakes/test/test_imports.py::Test::test_usedInAssignment", "Failure #157: pyflakes/test/test_imports.py::Test::test_usedInAttributeAssign", "Failure #158: pyflakes/test/test_imports.py::Test::test_usedInCall", "Failure #159: pyflakes/test/test_imports.py::Test::test_usedInClass", "Failure #160: pyflakes/test/test_imports.py::Test::test_usedInClassBase", "Failure #161: pyflakes/test/test_imports.py::Test::test_usedInDict", "Failure #162: pyflakes/test/test_imports.py::Test::test_usedInElifConditional", "Failure #163: pyflakes/test/test_imports.py::Test::test_usedInElse", "Failure #164: pyflakes/test/test_imports.py::Test::test_usedInExcept", "Failure #165: pyflakes/test/test_imports.py::Test::test_usedInExec", "Failure #166: pyflakes/test/test_imports.py::Test::test_usedInFor", "Failure #167: pyflakes/test/test_imports.py::Test::test_usedInForElse", "Failure #168: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #169: pyflakes/test/test_imports.py::Test::test_usedInGetattr", "Failure #170: pyflakes/test/test_imports.py::Test::test_usedInIfBody", "Failure #171: pyflakes/test/test_imports.py::Test::test_usedInIfConditional", "Failure #172: pyflakes/test/test_imports.py::Test::test_usedInKeywordArg", "Failure #173: pyflakes/test/test_imports.py::Test::test_usedInLambda", "Failure #174: pyflakes/test/test_imports.py::Test::test_usedInList", "Failure #175: pyflakes/test/test_imports.py::Test::test_usedInListComp", "Failure #176: pyflakes/test/test_imports.py::Test::test_usedInLogic", "Failure #177: pyflakes/test/test_imports.py::Test::test_usedInOperators", "Failure #178: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #179: pyflakes/test/test_imports.py::Test::test_usedInRaise", "Failure #180: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #181: pyflakes/test/test_imports.py::Test::test_usedInSlice", "Failure #182: pyflakes/test/test_imports.py::Test::test_usedInSliceObj", "Failure #183: pyflakes/test/test_imports.py::Test::test_usedInSubscript", "Failure #184: pyflakes/test/test_imports.py::Test::test_usedInTry", "Failure #185: pyflakes/test/test_imports.py::Test::test_usedInTryFinally", "Failure #186: pyflakes/test/test_imports.py::Test::test_usedInTuple", "Failure #187: pyflakes/test/test_imports.py::Test::test_usedInWhile", "Failure #188: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #189: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import", "Failure #190: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import_of_alias", "Failure #191: pyflakes/test/test_imports.py::TestSpecialAll::test_all_mixed_attributes_and_strings", "Failure #192: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes", "Failure #193: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes_added", "Failure #194: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_names", "Failure #195: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #196: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #197: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #198: pyflakes/test/test_imports.py::TestSpecialAll::test_usedInGenExp", "Failure #199: pyflakes/test/test_match.py::TestMatch::test_match_bindings", "Failure #200: pyflakes/test/test_match.py::TestMatch::test_match_pattern_matched_class", "Failure #201: pyflakes/test/test_other.py::Test::test_classFunctionDecorator", "Failure #202: pyflakes/test/test_other.py::Test::test_classNameDefinedPreviously", "Failure #203: pyflakes/test/test_other.py::Test::test_classNameUndefinedInClassBody", "Failure #204: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #205: pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope", "Failure #206: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #207: pyflakes/test/test_other.py::Test::test_modernProperty", "Failure #208: pyflakes/test/test_other.py::Test::test_undefinedBaseClass", "Failure #209: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr", "Failure #210: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope_reassigns_parameter", "Failure #211: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignmentInsideLoop", "Failure #212: pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall", "Failure #213: pyflakes/test/test_other.py::TestUnusedAssignment::test_closedOver", "Failure #214: pyflakes/test/test_other.py::TestUnusedAssignment::test_doubleClosedOver", "Failure #215: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #216: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #217: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUsedInExcept", "Failure #218: pyflakes/test/test_other.py::TestUnusedAssignment::test_ifexp", "Failure #219: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #220: pyflakes/test/test_other.py::TestUnusedAssignment::test_variableUsedInLoop", "Failure #221: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementAttributeName", "Failure #222: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameUndefined", "Failure #223: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscript", "Failure #224: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined", "Failure #225: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesUndefined", "Failure #226: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInExpression", "Failure #227: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInside", "Failure #228: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #229: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #230: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncFor", "Failure #231: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem", "Failure #232: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncFor", "Failure #233: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse", "Failure #234: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future", "Failure #235: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #236: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import", "Failure #237: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #238: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #239: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #240: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #241: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import", "Failure #242: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #243: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #244: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #245: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #246: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #247: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #248: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #249: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #250: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #251: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #252: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #253: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #254: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #255: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #256: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #257: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #258: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #259: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #260: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #261: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #262: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #263: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #264: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #265: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_cast_literal_str_to_str", "Failure #266: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #267: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #268: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #269: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #270: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #271: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #272: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync", "Failure #273: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol", "Failure #274: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unassigned_annotation_is_undefined", "Failure #275: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #276: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotation_references_self_name_undefined", "Failure #277: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #278: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #279: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #280: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #281: pyflakes/test/test_undefined_names.py::Test::test_del", "Failure #282: pyflakes/test/test_undefined_names.py::Test::test_delWhile", "Failure #283: pyflakes/test/test_undefined_names.py::Test::test_delWhileNested", "Failure #284: pyflakes/test/test_undefined_names.py::Test::test_delWhileTestUsage", "Failure #285: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #286: pyflakes/test/test_undefined_names.py::Test::test_globalImportStar", "Failure #287: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #288: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #289: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #290: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs", "Failure #291: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #292: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #293: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #294: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #295: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsPath", "Failure #296: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #297: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #298: pyflakes/test/test_undefined_names.py::Test::test_metaClassUndefined", "Failure #299: pyflakes/test/test_undefined_names.py::Test::test_namesDeclaredInExceptBlocks", "Failure #300: pyflakes/test/test_undefined_names.py::Test::test_undefined", "Failure #301: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #302: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionName", "Failure #303: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #304: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #305: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInComprehension", "Failure #306: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInDictionaryComprehension", "Failure #307: pyflakes/test/test_undefined_names.py::Test::test_undefinedInGenExpNested", "Failure #308: pyflakes/test/test_undefined_names.py::Test::test_undefinedInListComp", "Failure #309: pyflakes/test/test_undefined_names.py::Test::test_undefinedInLoop", "Failure #310: pyflakes/test/test_undefined_names.py::Test::test_undefinedWithErrorHandler" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_builtin.py", "test_builtin_unbound_local" ], [ "pyflakes/test/test_doctests.py", "test_classFunctionDecorator" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.4000000000000004, "in_degree": 2, "true_in_degree": 2.0, "out_degree": 3, "betweenness": 1.0473805013660832e-05, "pagerank": 0.00036715246636771304, "harmonic": 0.004491017964071856, "bidirectional_harmonic": 0.060503992015968074, "degree": 5 }, "line_count": 54, "code_line_count": 54, "cyclomatic": 28, "halstead_volume": 302.627697999753, "halstead_difficulty": 6.403846153846154 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.NAME", "test_info": { "success": false, "failed": 348, "passed": 1875, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n def foo():\n a = range(1, 10)\n range = a\n return range\n\n foo()\n\n print(range)\n \nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_builtin_unbound_local(self):\n> self.flakes('''\n def foo():\n a = range(1, 10)\n range = a\n return range\n \n foo()\n \n print(range)\n ''', m.UndefinedLocal)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE def foo():\nE a = range(1, 10)\nE range = a\nE return range\nE \nE foo()\nE \nE print(range)\nE \nE expected outputs:\nE []\nE but got:\n", "\n============================================================\nFailure #2: pyflakes/test/test_builtin.py::TestBuiltins::test_global_shadowing_builtin\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n def f():\n global range\n range = None\n print(range)\n\n f()\n \nexpected outputs:\n[]\nbut got:\n(none):3:5: `global range` is unused: name is never assigned in scope\n\nTraceback:\n\n> def test_global_shadowing_builtin(self):\n> self.flakes('''\n def f():\n global range\n range = None\n print(range)\n \n f()\n ''')\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE def f():\nE global range\nE range = None\nE print(range)\nE \nE f()\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:5: `global range` is unused: name is never assigned in scope\n", "Failure #3: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #4: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #5: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #6: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody", "Failure #7: pyflakes/test/test_doctests.py::TestOther::test_functionDecorator", "Failure #8: pyflakes/test/test_doctests.py::TestOther::test_global_nonlocal_in_class_bodies", "Failure #9: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #10: pyflakes/test/test_doctests.py::TestOther::test_modernProperty", "Failure #11: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #12: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #13: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #14: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #15: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #16: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #17: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #18: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #19: pyflakes/test/test_doctests.py::TestOther::test_varAugmentedAssignment", "Failure #20: pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule", "Failure #21: pyflakes/test/test_doctests.py::TestImports::test_assignRHSFirst", "Failure #22: pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport", "Failure #23: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #24: pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater", "Failure #25: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #26: pyflakes/test/test_doctests.py::TestImports::test_importInClass", "Failure #27: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #28: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #29: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #30: pyflakes/test/test_doctests.py::TestImports::test_nestedFunctionsNestScope", "Failure #31: pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine", "Failure #32: pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope", "Failure #33: pyflakes/test/test_doctests.py::TestImports::test_packageImport", "Failure #34: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #35: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #36: pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass", "Failure #37: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #38: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #39: pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass", "Failure #40: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #41: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #42: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #43: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #44: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #45: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #46: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #47: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #48: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #49: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #50: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #51: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #52: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #53: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #54: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #55: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #56: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #57: pyflakes/test/test_doctests.py::TestImports::test_usedImport_relative", "Failure #58: pyflakes/test/test_doctests.py::TestImports::test_usedInAssert", "Failure #59: pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment", "Failure #60: pyflakes/test/test_doctests.py::TestImports::test_usedInAttributeAssign", "Failure #61: pyflakes/test/test_doctests.py::TestImports::test_usedInCall", "Failure #62: pyflakes/test/test_doctests.py::TestImports::test_usedInClass", "Failure #63: pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase", "Failure #64: pyflakes/test/test_doctests.py::TestImports::test_usedInDict", "Failure #65: pyflakes/test/test_doctests.py::TestImports::test_usedInElifConditional", "Failure #66: pyflakes/test/test_doctests.py::TestImports::test_usedInElse", "Failure #67: pyflakes/test/test_doctests.py::TestImports::test_usedInExcept", "Failure #68: pyflakes/test/test_doctests.py::TestImports::test_usedInExec", "Failure #69: pyflakes/test/test_doctests.py::TestImports::test_usedInFor", "Failure #70: pyflakes/test/test_doctests.py::TestImports::test_usedInForElse", "Failure #71: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #72: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #73: pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody", "Failure #74: pyflakes/test/test_doctests.py::TestImports::test_usedInIfConditional", "Failure #75: pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg", "Failure #76: pyflakes/test/test_doctests.py::TestImports::test_usedInLambda", "Failure #77: pyflakes/test/test_doctests.py::TestImports::test_usedInList", "Failure #78: pyflakes/test/test_doctests.py::TestImports::test_usedInListComp", "Failure #79: pyflakes/test/test_doctests.py::TestImports::test_usedInLogic", "Failure #80: pyflakes/test/test_doctests.py::TestImports::test_usedInOperators", "Failure #81: pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault", "Failure #82: pyflakes/test/test_doctests.py::TestImports::test_usedInRaise", "Failure #83: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #84: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice", "Failure #85: pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj", "Failure #86: pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript", "Failure #87: pyflakes/test/test_doctests.py::TestImports::test_usedInTry", "Failure #88: pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally", "Failure #89: pyflakes/test/test_doctests.py::TestImports::test_usedInTuple", "Failure #90: pyflakes/test/test_doctests.py::TestImports::test_usedInWhile", "Failure #91: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #92: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import", "Failure #93: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import_of_alias", "Failure #94: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #95: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #96: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobal", "Failure #97: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobalMultipleNames", "Failure #98: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #99: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delExceptionInExcept", "Failure #100: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delGlobal", "Failure #101: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined", "Failure #102: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #103: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #104: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #105: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #106: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #107: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs", "Failure #108: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #109: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #110: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #111: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #112: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath", "Failure #113: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #114: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #115: pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined", "Failure #116: pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks", "Failure #117: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined", "Failure #118: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #119: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #120: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #121: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #122: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #123: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #124: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #125: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #126: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #127: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #128: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #129: pyflakes/test/test_doctests.py::Test::test_global_undefined", "Failure #130: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #131: pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter", "Failure #132: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #133: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #134: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #135: pyflakes/test/test_doctests.py::Test::test_offsetAfterDoctests", "Failure #136: pyflakes/test/test_doctests.py::Test::test_offsetInDoctests", "Failure #137: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #138: pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs", "Failure #139: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #140: pyflakes/test/test_imports.py::Test::test_aliasedImportShadowModule", "Failure #141: pyflakes/test/test_imports.py::Test::test_assignRHSFirst", "Failure #142: pyflakes/test/test_imports.py::Test::test_differentSubmoduleImport", "Failure #143: pyflakes/test/test_imports.py::Test::test_duplicateSubmoduleImport", "Failure #144: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #145: pyflakes/test/test_imports.py::Test::test_futureImportFirst", "Failure #146: pyflakes/test/test_imports.py::Test::test_importInClass", "Failure #147: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #148: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #149: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #150: pyflakes/test/test_imports.py::Test::test_nestedFunctionsNestScope", "Failure #151: pyflakes/test/test_imports.py::Test::test_nonGlobalDoesNotRedefine", "Failure #152: pyflakes/test/test_imports.py::Test::test_notUsedInNestedScope", "Failure #153: pyflakes/test/test_imports.py::Test::test_packageImport", "Failure #154: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #155: pyflakes/test/test_imports.py::Test::test_redefinedByFor", "Failure #156: pyflakes/test/test_imports.py::Test::test_redefinedBySubclass", "Failure #157: pyflakes/test/test_imports.py::Test::test_redefinedIf", "Failure #158: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #159: pyflakes/test/test_imports.py::Test::test_redefinedInClass", "Failure #160: pyflakes/test/test_imports.py::Test::test_redefinedTry", "Failure #161: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #162: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #163: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #164: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElseFinally", "Failure #165: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptFinally", "Failure #166: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #167: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #168: pyflakes/test/test_imports.py::Test::test_redefinedWhileUnused", "Failure #169: pyflakes/test/test_imports.py::Test::test_shadowedByFor", "Failure #170: pyflakes/test/test_imports.py::Test::test_shadowedByForDeep", "Failure #171: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #172: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #173: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #174: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #175: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #176: pyflakes/test/test_imports.py::Test::test_usedImport", "Failure #177: pyflakes/test/test_imports.py::Test::test_usedImport_relative", "Failure #178: pyflakes/test/test_imports.py::Test::test_usedInAssert", "Failure #179: pyflakes/test/test_imports.py::Test::test_usedInAssignment", "Failure #180: pyflakes/test/test_imports.py::Test::test_usedInAttributeAssign", "Failure #181: pyflakes/test/test_imports.py::Test::test_usedInCall", "Failure #182: pyflakes/test/test_imports.py::Test::test_usedInClass", "Failure #183: pyflakes/test/test_imports.py::Test::test_usedInClassBase", "Failure #184: pyflakes/test/test_imports.py::Test::test_usedInDict", "Failure #185: pyflakes/test/test_imports.py::Test::test_usedInElifConditional", "Failure #186: pyflakes/test/test_imports.py::Test::test_usedInElse", "Failure #187: pyflakes/test/test_imports.py::Test::test_usedInExcept", "Failure #188: pyflakes/test/test_imports.py::Test::test_usedInExec", "Failure #189: pyflakes/test/test_imports.py::Test::test_usedInFor", "Failure #190: pyflakes/test/test_imports.py::Test::test_usedInForElse", "Failure #191: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #192: pyflakes/test/test_imports.py::Test::test_usedInGetattr", "Failure #193: pyflakes/test/test_imports.py::Test::test_usedInIfBody", "Failure #194: pyflakes/test/test_imports.py::Test::test_usedInIfConditional", "Failure #195: pyflakes/test/test_imports.py::Test::test_usedInKeywordArg", "Failure #196: pyflakes/test/test_imports.py::Test::test_usedInLambda", "Failure #197: pyflakes/test/test_imports.py::Test::test_usedInList", "Failure #198: pyflakes/test/test_imports.py::Test::test_usedInListComp", "Failure #199: pyflakes/test/test_imports.py::Test::test_usedInLogic", "Failure #200: pyflakes/test/test_imports.py::Test::test_usedInOperators", "Failure #201: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #202: pyflakes/test/test_imports.py::Test::test_usedInRaise", "Failure #203: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #204: pyflakes/test/test_imports.py::Test::test_usedInSlice", "Failure #205: pyflakes/test/test_imports.py::Test::test_usedInSliceObj", "Failure #206: pyflakes/test/test_imports.py::Test::test_usedInSubscript", "Failure #207: pyflakes/test/test_imports.py::Test::test_usedInTry", "Failure #208: pyflakes/test/test_imports.py::Test::test_usedInTryFinally", "Failure #209: pyflakes/test/test_imports.py::Test::test_usedInTuple", "Failure #210: pyflakes/test/test_imports.py::Test::test_usedInWhile", "Failure #211: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #212: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import", "Failure #213: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import_of_alias", "Failure #214: pyflakes/test/test_imports.py::TestSpecialAll::test_all_mixed_attributes_and_strings", "Failure #215: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes", "Failure #216: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes_added", "Failure #217: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_names", "Failure #218: pyflakes/test/test_imports.py::TestSpecialAll::test_augmentedAssignment", "Failure #219: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #220: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #221: pyflakes/test/test_imports.py::TestSpecialAll::test_list_concatenation_assignment", "Failure #222: pyflakes/test/test_imports.py::TestSpecialAll::test_redefinedByGenExp", "Failure #223: pyflakes/test/test_imports.py::TestSpecialAll::test_tuple_concatenation_assignment", "Failure #224: pyflakes/test/test_imports.py::TestSpecialAll::test_unboundExported", "Failure #225: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #226: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #227: pyflakes/test/test_imports.py::TestSpecialAll::test_usedInGenExp", "Failure #228: pyflakes/test/test_imports.py::TestSpecialAll::test_warningSuppressed", "Failure #229: pyflakes/test/test_match.py::TestMatch::test_match_bindings", "Failure #230: pyflakes/test/test_match.py::TestMatch::test_match_pattern_matched_class", "Failure #231: pyflakes/test/test_other.py::Test::test_classNameUndefinedInClassBody", "Failure #232: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #233: pyflakes/test/test_other.py::Test::test_global_nonlocal_in_class_bodies", "Failure #234: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #235: pyflakes/test/test_other.py::Test::test_modernProperty", "Failure #236: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #237: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #238: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #239: pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable", "Failure #240: pyflakes/test/test_other.py::Test::test_undefinedBaseClass", "Failure #241: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #242: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #243: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #244: pyflakes/test/test_other.py::Test::test_varAugmentedAssignment", "Failure #245: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToGlobal", "Failure #246: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToNonlocal", "Failure #247: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr", "Failure #248: pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall", "Failure #249: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #250: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #251: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUsedInExcept", "Failure #252: pyflakes/test/test_other.py::TestUnusedAssignment::test_ifexp", "Failure #253: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #254: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #255: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #256: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #257: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementAttributeName", "Failure #258: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameRedefined", "Failure #259: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameUndefined", "Failure #260: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscript", "Failure #261: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined", "Failure #262: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined", "Failure #263: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesUndefined", "Failure #264: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInExpression", "Failure #265: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInside", "Failure #266: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #267: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #268: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future", "Failure #269: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #270: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import", "Failure #271: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #272: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #273: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #274: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #275: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import", "Failure #276: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #277: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #278: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #279: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #280: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #281: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #282: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #283: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #284: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #285: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #286: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #287: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #288: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #289: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #290: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #291: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #292: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #293: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #294: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #295: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #296: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #297: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #298: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #299: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_cast_literal_str_to_str", "Failure #300: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #301: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #302: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #303: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #304: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #305: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #306: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync", "Failure #307: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol", "Failure #308: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unassigned_annotation_is_undefined", "Failure #309: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #310: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #311: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotation_references_self_name_undefined", "Failure #312: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #313: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #314: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #315: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #316: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobal", "Failure #317: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobalMultipleNames", "Failure #318: pyflakes/test/test_undefined_names.py::Test::test_del", "Failure #319: pyflakes/test/test_undefined_names.py::Test::test_delExceptionInExcept", "Failure #320: pyflakes/test/test_undefined_names.py::Test::test_delGlobal", "Failure #321: pyflakes/test/test_undefined_names.py::Test::test_delUndefined", "Failure #322: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #323: pyflakes/test/test_undefined_names.py::Test::test_globalImportStar", "Failure #324: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #325: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #326: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #327: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs", "Failure #328: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #329: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #330: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #331: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #332: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsPath", "Failure #333: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #334: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #335: pyflakes/test/test_undefined_names.py::Test::test_metaClassUndefined", "Failure #336: pyflakes/test/test_undefined_names.py::Test::test_namesDeclaredInExceptBlocks", "Failure #337: pyflakes/test/test_undefined_names.py::Test::test_undefined", "Failure #338: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #339: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionName", "Failure #340: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #341: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInComprehension", "Failure #342: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInDictionaryComprehension", "Failure #343: pyflakes/test/test_undefined_names.py::Test::test_undefinedInGenExpNested", "Failure #344: pyflakes/test/test_undefined_names.py::Test::test_undefinedInListComp", "Failure #345: pyflakes/test/test_undefined_names.py::Test::test_undefinedInLoop", "Failure #346: pyflakes/test/test_undefined_names.py::Test::test_undefinedWithErrorHandler", "Failure #347: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack", "Failure #348: pyflakes/test/test_undefined_names.py::NameTests::test_impossibleContext" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_builtin.py", "test_builtin_unbound_local" ], [ "pyflakes/test/test_builtin.py", "test_global_shadowing_builtin" ] ] }, "complexity_info": { "centrality": { "distance_discount": 10.670080000000002, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 4, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.014021956087824349, "bidirectional_harmonic": 0.05244510978043912, "degree": 4 }, "line_count": 14, "code_line_count": 14, "cyclomatic": 7, "halstead_volume": 19.651484454403228, "halstead_difficulty": 1.0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.descendantOf", "test_info": { "success": false, "failed": 35, "passed": 2188, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseFunction\nLocation: /tmp/benchmark_nv1h4wby/pyflakes/checker.py:955\nError: TypeError: unsupported operand type(s) for ^: 'NoneType' and 'NoneType'\n\nTraceback:\n\n> def test_redefinedIfElseFunction(self):\n \"\"\"\n Test that shadowing a function definition twice in an if\n and else block does not raise a warning.\n \"\"\"\n> self.flakes('''\n if True:\n def a(): pass\n else:\n def a(): pass\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> w = checker.Checker(tree, withDoctest=self.withDoctest, **kw)\n\n> self._run_deferred()\n\n> handler()\n\n> self.deferFunction(lambda: self.handleDoctests(node))\n\n> self.handleChildren(tree)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.handleChildren(node)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.addBinding(node, FunctionDefinition(node.name, node))\n\n> not self.differentForks(node, existing.source)):\n\n> def differentForks(self, lnode, rnode):\n \"\"\"True, if lnode and rnode are located on different forks of IF/TRY\"\"\"\n ancestor = self.getCommonAncestor(lnode, rnode, self.root)\n parts = getAlternatives(ancestor)\n if parts:\n for items in parts:\n> if self.descendantOf(lnode, items, ancestor) ^ \\\n self.descendantOf(rnode, items, ancestor):\nE TypeError: unsupported operand type(s) for ^: 'NoneType' and 'NoneType'\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseInListComp\nLocation: /tmp/benchmark_nv1h4wby/pyflakes/checker.py:955\nError: TypeError: unsupported operand type(s) for ^: 'NoneType' and 'NoneType'\n\nTraceback:\n\n> def test_redefinedIfElseInListComp(self):\n \"\"\"\n Test that shadowing a variable in a list comprehension in\n an if and else block does not raise a warning.\n \"\"\"\n> self.flakes('''\n if False:\n a = 1\n else:\n [a for a in '12']\n ''')\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> w = checker.Checker(tree, withDoctest=self.withDoctest, **kw)\n\n> self._run_deferred()\n\n> handler()\n\n> self.deferFunction(lambda: self.handleDoctests(node))\n\n> self.handleChildren(tree)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.handleChildren(node)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.handleChildren(node)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.handleNodeStore(node)\n\n> self.addBinding(node, binding)\n\n> not self.differentForks(node, existing.source)):\n\n> def differentForks(self, lnode, rnode):\n \"\"\"True, if lnode and rnode are located on different forks of IF/TRY\"\"\"\n ancestor = self.getCommonAncestor(lnode, rnode, self.root)\n parts = getAlternatives(ancestor)\n if parts:\n for items in parts:\n> if self.descendantOf(lnode, items, ancestor) ^ \\\n self.descendantOf(rnode, items, ancestor):\nE TypeError: unsupported operand type(s) for ^: 'NoneType' and 'NoneType'\n", "Failure #3: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfFunction", "Failure #4: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryExceptFunction", "Failure #5: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction", "Failure #6: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #7: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #8: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #9: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #10: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #11: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #12: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #13: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #14: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #15: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #16: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #17: pyflakes/test/test_imports.py::Test::test_redefinedIf", "Failure #18: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #19: pyflakes/test/test_imports.py::Test::test_redefinedTry", "Failure #20: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #21: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #22: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #23: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElseFinally", "Failure #24: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptFinally", "Failure #25: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #26: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #27: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #28: pyflakes/test/test_match.py::TestMatch::test_defined_in_different_branches", "Failure #29: pyflakes/test/test_other.py::Test::test_redefinedIfElseFunction", "Failure #30: pyflakes/test/test_other.py::Test::test_redefinedIfElseInListComp", "Failure #31: pyflakes/test/test_other.py::Test::test_redefinedIfFunction", "Failure #32: pyflakes/test/test_other.py::Test::test_redefinedTryExceptFunction", "Failure #33: pyflakes/test/test_other.py::Test::test_redefinedTryFunction", "Failure #34: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #35: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_redefinedIfElseFunction" ], [ "pyflakes/test/test_doctests.py", "test_redefinedIfElseInListComp" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 6.9200000000000035, "out_degree": 1, "betweenness": 0.0, "pagerank": 0.00032451290878131897, "harmonic": 0.0014970059880239522, "bidirectional_harmonic": 0.04097162817222694, "degree": 2 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 3, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "getNodeName", "test_info": { "success": false, "failed": 353, "passed": 1870, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nSecond list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n def foo():\n a = range(1, 10)\n range = a\n return range\n\n foo()\n\n print(range)\n \nexpected outputs:\n[]\nbut got:\n\nTraceback:\n\n> def test_builtin_unbound_local(self):\n> self.flakes('''\n def foo():\n a = range(1, 10)\n range = a\n return range\n \n foo()\n \n print(range)\n ''', m.UndefinedLocal)\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE Second list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE def foo():\nE a = range(1, 10)\nE range = a\nE return range\nE \nE foo()\nE \nE print(range)\nE \nE expected outputs:\nE []\nE but got:\n", "\n============================================================\nFailure #2: pyflakes/test/test_builtin.py::TestBuiltins::test_global_shadowing_builtin\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: Lists differ: [] != []\n\nFirst list contains 1 additional elements.\nFirst extra element 0:\n\n\n- []\n+ [] : for input:\n\n def f():\n global range\n range = None\n print(range)\n\n f()\n \nexpected outputs:\n[]\nbut got:\n(none):3:5: `global range` is unused: name is never assigned in scope\n\nTraceback:\n\n> def test_global_shadowing_builtin(self):\n> self.flakes('''\n def f():\n global range\n range = None\n print(range)\n \n f()\n ''')\n\n> self.assertEqual(outputs, expectedOutputs, '''\\\nE AssertionError: Lists differ: [] != []\nE \nE First list contains 1 additional elements.\nE First extra element 0:\nE \nE \nE - []\nE + [] : for input:\nE \nE def f():\nE global range\nE range = None\nE print(range)\nE \nE f()\nE \nE expected outputs:\nE []\nE but got:\nE (none):3:5: `global range` is unused: name is never assigned in scope\n", "Failure #3: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #4: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #5: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #6: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody", "Failure #7: pyflakes/test/test_doctests.py::TestOther::test_functionDecorator", "Failure #8: pyflakes/test/test_doctests.py::TestOther::test_global_nonlocal_in_class_bodies", "Failure #9: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #10: pyflakes/test/test_doctests.py::TestOther::test_modernProperty", "Failure #11: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #12: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #13: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #14: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #15: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #16: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #17: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #18: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #19: pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule", "Failure #20: pyflakes/test/test_doctests.py::TestImports::test_assignRHSFirst", "Failure #21: pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport", "Failure #22: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #23: pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater", "Failure #24: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #25: pyflakes/test/test_doctests.py::TestImports::test_importInClass", "Failure #26: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #27: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #28: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #29: pyflakes/test/test_doctests.py::TestImports::test_nestedFunctionsNestScope", "Failure #30: pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine", "Failure #31: pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope", "Failure #32: pyflakes/test/test_doctests.py::TestImports::test_packageImport", "Failure #33: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #34: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #35: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #36: pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass", "Failure #37: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #38: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #39: pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass", "Failure #40: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #41: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #42: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #43: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #44: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #45: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #46: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #47: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #48: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #49: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #50: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #51: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #52: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #53: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #54: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #55: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #56: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #57: pyflakes/test/test_doctests.py::TestImports::test_usedImport_relative", "Failure #58: pyflakes/test/test_doctests.py::TestImports::test_usedInAssert", "Failure #59: pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment", "Failure #60: pyflakes/test/test_doctests.py::TestImports::test_usedInAttributeAssign", "Failure #61: pyflakes/test/test_doctests.py::TestImports::test_usedInCall", "Failure #62: pyflakes/test/test_doctests.py::TestImports::test_usedInClass", "Failure #63: pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase", "Failure #64: pyflakes/test/test_doctests.py::TestImports::test_usedInDict", "Failure #65: pyflakes/test/test_doctests.py::TestImports::test_usedInElifConditional", "Failure #66: pyflakes/test/test_doctests.py::TestImports::test_usedInElse", "Failure #67: pyflakes/test/test_doctests.py::TestImports::test_usedInExcept", "Failure #68: pyflakes/test/test_doctests.py::TestImports::test_usedInExec", "Failure #69: pyflakes/test/test_doctests.py::TestImports::test_usedInFor", "Failure #70: pyflakes/test/test_doctests.py::TestImports::test_usedInForElse", "Failure #71: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #72: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #73: pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody", "Failure #74: pyflakes/test/test_doctests.py::TestImports::test_usedInIfConditional", "Failure #75: pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg", "Failure #76: pyflakes/test/test_doctests.py::TestImports::test_usedInLambda", "Failure #77: pyflakes/test/test_doctests.py::TestImports::test_usedInList", "Failure #78: pyflakes/test/test_doctests.py::TestImports::test_usedInListComp", "Failure #79: pyflakes/test/test_doctests.py::TestImports::test_usedInLogic", "Failure #80: pyflakes/test/test_doctests.py::TestImports::test_usedInOperators", "Failure #81: pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault", "Failure #82: pyflakes/test/test_doctests.py::TestImports::test_usedInRaise", "Failure #83: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #84: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice", "Failure #85: pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj", "Failure #86: pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript", "Failure #87: pyflakes/test/test_doctests.py::TestImports::test_usedInTry", "Failure #88: pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally", "Failure #89: pyflakes/test/test_doctests.py::TestImports::test_usedInTuple", "Failure #90: pyflakes/test/test_doctests.py::TestImports::test_usedInWhile", "Failure #91: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #92: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import", "Failure #93: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import_of_alias", "Failure #94: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #95: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #96: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobal", "Failure #97: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobalMultipleNames", "Failure #98: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #99: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delGlobal", "Failure #100: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined", "Failure #101: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #102: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #103: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #104: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #105: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #106: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs", "Failure #107: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #108: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #109: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #110: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #111: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath", "Failure #112: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #113: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #114: pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined", "Failure #115: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined", "Failure #116: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #117: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #118: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #119: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #120: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #121: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #122: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #123: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #124: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #125: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #126: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #127: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #128: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #129: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #130: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #131: pyflakes/test/test_doctests.py::Test::test_global_undefined", "Failure #132: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #133: pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter", "Failure #134: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #135: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #136: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #137: pyflakes/test/test_doctests.py::Test::test_offsetAfterDoctests", "Failure #138: pyflakes/test/test_doctests.py::Test::test_offsetInDoctests", "Failure #139: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #140: pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs", "Failure #141: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #142: pyflakes/test/test_imports.py::Test::test_aliasedImportShadowModule", "Failure #143: pyflakes/test/test_imports.py::Test::test_assignRHSFirst", "Failure #144: pyflakes/test/test_imports.py::Test::test_differentSubmoduleImport", "Failure #145: pyflakes/test/test_imports.py::Test::test_duplicateSubmoduleImport", "Failure #146: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #147: pyflakes/test/test_imports.py::Test::test_futureImportFirst", "Failure #148: pyflakes/test/test_imports.py::Test::test_importInClass", "Failure #149: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #150: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #151: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #152: pyflakes/test/test_imports.py::Test::test_nestedFunctionsNestScope", "Failure #153: pyflakes/test/test_imports.py::Test::test_nonGlobalDoesNotRedefine", "Failure #154: pyflakes/test/test_imports.py::Test::test_notUsedInNestedScope", "Failure #155: pyflakes/test/test_imports.py::Test::test_packageImport", "Failure #156: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #157: pyflakes/test/test_imports.py::Test::test_redefinedByExcept", "Failure #158: pyflakes/test/test_imports.py::Test::test_redefinedByFor", "Failure #159: pyflakes/test/test_imports.py::Test::test_redefinedBySubclass", "Failure #160: pyflakes/test/test_imports.py::Test::test_redefinedIf", "Failure #161: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #162: pyflakes/test/test_imports.py::Test::test_redefinedInClass", "Failure #163: pyflakes/test/test_imports.py::Test::test_redefinedTry", "Failure #164: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #165: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #166: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #167: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElseFinally", "Failure #168: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptFinally", "Failure #169: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #170: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #171: pyflakes/test/test_imports.py::Test::test_redefinedWhileUnused", "Failure #172: pyflakes/test/test_imports.py::Test::test_shadowedByFor", "Failure #173: pyflakes/test/test_imports.py::Test::test_shadowedByForDeep", "Failure #174: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #175: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #176: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #177: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #178: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #179: pyflakes/test/test_imports.py::Test::test_usedImport", "Failure #180: pyflakes/test/test_imports.py::Test::test_usedImport_relative", "Failure #181: pyflakes/test/test_imports.py::Test::test_usedInAssert", "Failure #182: pyflakes/test/test_imports.py::Test::test_usedInAssignment", "Failure #183: pyflakes/test/test_imports.py::Test::test_usedInAttributeAssign", "Failure #184: pyflakes/test/test_imports.py::Test::test_usedInCall", "Failure #185: pyflakes/test/test_imports.py::Test::test_usedInClass", "Failure #186: pyflakes/test/test_imports.py::Test::test_usedInClassBase", "Failure #187: pyflakes/test/test_imports.py::Test::test_usedInDict", "Failure #188: pyflakes/test/test_imports.py::Test::test_usedInElifConditional", "Failure #189: pyflakes/test/test_imports.py::Test::test_usedInElse", "Failure #190: pyflakes/test/test_imports.py::Test::test_usedInExcept", "Failure #191: pyflakes/test/test_imports.py::Test::test_usedInExec", "Failure #192: pyflakes/test/test_imports.py::Test::test_usedInFor", "Failure #193: pyflakes/test/test_imports.py::Test::test_usedInForElse", "Failure #194: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #195: pyflakes/test/test_imports.py::Test::test_usedInGetattr", "Failure #196: pyflakes/test/test_imports.py::Test::test_usedInIfBody", "Failure #197: pyflakes/test/test_imports.py::Test::test_usedInIfConditional", "Failure #198: pyflakes/test/test_imports.py::Test::test_usedInKeywordArg", "Failure #199: pyflakes/test/test_imports.py::Test::test_usedInLambda", "Failure #200: pyflakes/test/test_imports.py::Test::test_usedInList", "Failure #201: pyflakes/test/test_imports.py::Test::test_usedInListComp", "Failure #202: pyflakes/test/test_imports.py::Test::test_usedInLogic", "Failure #203: pyflakes/test/test_imports.py::Test::test_usedInOperators", "Failure #204: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #205: pyflakes/test/test_imports.py::Test::test_usedInRaise", "Failure #206: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #207: pyflakes/test/test_imports.py::Test::test_usedInSlice", "Failure #208: pyflakes/test/test_imports.py::Test::test_usedInSliceObj", "Failure #209: pyflakes/test/test_imports.py::Test::test_usedInSubscript", "Failure #210: pyflakes/test/test_imports.py::Test::test_usedInTry", "Failure #211: pyflakes/test/test_imports.py::Test::test_usedInTryFinally", "Failure #212: pyflakes/test/test_imports.py::Test::test_usedInTuple", "Failure #213: pyflakes/test/test_imports.py::Test::test_usedInWhile", "Failure #214: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #215: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import", "Failure #216: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import_of_alias", "Failure #217: pyflakes/test/test_imports.py::TestSpecialAll::test_all_mixed_attributes_and_strings", "Failure #218: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes", "Failure #219: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes_added", "Failure #220: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_names", "Failure #221: pyflakes/test/test_imports.py::TestSpecialAll::test_augmentedAssignment", "Failure #222: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #223: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #224: pyflakes/test/test_imports.py::TestSpecialAll::test_list_concatenation_assignment", "Failure #225: pyflakes/test/test_imports.py::TestSpecialAll::test_redefinedByGenExp", "Failure #226: pyflakes/test/test_imports.py::TestSpecialAll::test_tuple_concatenation_assignment", "Failure #227: pyflakes/test/test_imports.py::TestSpecialAll::test_unboundExported", "Failure #228: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #229: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #230: pyflakes/test/test_imports.py::TestSpecialAll::test_usedInGenExp", "Failure #231: pyflakes/test/test_imports.py::TestSpecialAll::test_warningSuppressed", "Failure #232: pyflakes/test/test_match.py::TestMatch::test_match_pattern_matched_class", "Failure #233: pyflakes/test/test_other.py::Test::test_classNameUndefinedInClassBody", "Failure #234: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #235: pyflakes/test/test_other.py::Test::test_global_nonlocal_in_class_bodies", "Failure #236: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #237: pyflakes/test/test_other.py::Test::test_modernProperty", "Failure #238: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #239: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #240: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #241: pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable", "Failure #242: pyflakes/test/test_other.py::Test::test_undefinedBaseClass", "Failure #243: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #244: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #245: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #246: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToGlobal", "Failure #247: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToNonlocal", "Failure #248: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr", "Failure #249: pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall", "Failure #250: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #251: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #252: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExcept", "Failure #253: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #254: pyflakes/test/test_other.py::TestUnusedAssignment::test_exception_unused_in_except_star", "Failure #255: pyflakes/test/test_other.py::TestUnusedAssignment::test_ifexp", "Failure #256: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #257: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #258: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #259: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #260: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementAttributeName", "Failure #261: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameRedefined", "Failure #262: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameUndefined", "Failure #263: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscript", "Failure #264: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined", "Failure #265: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined", "Failure #266: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesUndefined", "Failure #267: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInExpression", "Failure #268: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInside", "Failure #269: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #270: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #271: pyflakes/test/test_other.py::TestAsyncStatements::test_raise_notimplemented", "Failure #272: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future", "Failure #273: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #274: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import", "Failure #275: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #276: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #277: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #278: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #279: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import", "Failure #280: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #281: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #282: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #283: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #284: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #285: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #286: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #287: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #288: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #289: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #290: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #291: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #292: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #293: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #294: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #295: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #296: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #297: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #298: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #299: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #300: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #301: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #302: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #303: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_cast_literal_str_to_str", "Failure #304: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #305: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #306: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #307: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #308: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #309: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #310: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync", "Failure #311: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol", "Failure #312: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unassigned_annotation_is_undefined", "Failure #313: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #314: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #315: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotation_references_self_name_undefined", "Failure #316: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #317: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #318: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #319: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #320: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobal", "Failure #321: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobalMultipleNames", "Failure #322: pyflakes/test/test_undefined_names.py::Test::test_del", "Failure #323: pyflakes/test/test_undefined_names.py::Test::test_delGlobal", "Failure #324: pyflakes/test/test_undefined_names.py::Test::test_delUndefined", "Failure #325: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #326: pyflakes/test/test_undefined_names.py::Test::test_globalImportStar", "Failure #327: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #328: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #329: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #330: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs", "Failure #331: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #332: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #333: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #334: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #335: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsPath", "Failure #336: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #337: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #338: pyflakes/test/test_undefined_names.py::Test::test_metaClassUndefined", "Failure #339: pyflakes/test/test_undefined_names.py::Test::test_undefined", "Failure #340: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #341: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionName", "Failure #342: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #343: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #344: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #345: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #346: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #347: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInComprehension", "Failure #348: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInDictionaryComprehension", "Failure #349: pyflakes/test/test_undefined_names.py::Test::test_undefinedInGenExpNested", "Failure #350: pyflakes/test/test_undefined_names.py::Test::test_undefinedInListComp", "Failure #351: pyflakes/test/test_undefined_names.py::Test::test_undefinedInLoop", "Failure #352: pyflakes/test/test_undefined_names.py::Test::test_undefinedWithErrorHandler", "Failure #353: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_builtin.py", "test_builtin_unbound_local" ], [ "pyflakes/test/test_builtin.py", "test_global_shadowing_builtin" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 5, "true_in_degree": 9.8, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0007998778827674568, "harmonic": 0.0, "bidirectional_harmonic": 0.05546407185628742, "degree": 5 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 4, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker._getAncestor", "test_info": { "success": false, "failed": 10, "passed": 2213, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_doctests.py::TestOther::test_duplicateArgs\nLocation: /tmp/benchmark_4mzswjq4/pyflakes/checker.py:908\nError: AttributeError: 'NoneType' object has no attribute '_pyflakes_parent'\n\nTraceback:\n\n> def test_duplicateArgs(self):\n> self.flakes('def fu(bar, bar): pass', m.DuplicateArgument)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> w = checker.Checker(tree, withDoctest=self.withDoctest, **kw)\n\n> self._run_deferred()\n\n> handler()\n\n> self.handleChildren(\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.handleChildren(node, omit=('defaults', 'kw_defaults'))\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.addBinding(node, Argument(node.arg, self.getScopeNode(node)))\n\n> parent_stmt = self.getParent(value.source)\n\n> def getParent(self, node):\n # Lookup the first parent which is not Tuple, List or Starred\n while True:\n> node = node._pyflakes_parent\nE AttributeError: 'NoneType' object has no attribute '_pyflakes_parent'\n", "\n============================================================\nFailure #2: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda\nLocation: /tmp/benchmark_4mzswjq4/pyflakes/checker.py:908\nError: AttributeError: 'NoneType' object has no attribute '_pyflakes_parent'\n\nTraceback:\n\n> def test_shadowedByLambda(self):\n> self.flakes('import fu; lambda fu: fu',\n m.UnusedImport, m.RedefinedWhileUnused)\n\n> return super().flakes(self.doctestify(input), *args, **kw)\n\n> w = checker.Checker(tree, withDoctest=self.withDoctest, **kw)\n\n> self._run_deferred()\n\n> handler()\n\n> self.handleChildren(\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.handleChildren(node, omit=('defaults', 'kw_defaults'))\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.addBinding(node, Argument(node.arg, self.getScopeNode(node)))\n\n> parent_stmt = self.getParent(value.source)\n\n> def getParent(self, node):\n # Lookup the first parent which is not Tuple, List or Starred\n while True:\n> node = node._pyflakes_parent\nE AttributeError: 'NoneType' object has no attribute '_pyflakes_parent'\n", "Failure #3: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #4: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #5: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #6: pyflakes/test/test_other.py::Test::test_duplicateArgs", "Failure #7: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope_reassigns_parameter", "Failure #8: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_async_def", "Failure #9: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #10: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_doctests.py", "test_duplicateArgs" ], [ "pyflakes/test/test_doctests.py", "test_shadowedByLambda" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.8, "in_degree": 1, "true_in_degree": 1.8, "out_degree": 1, "betweenness": 2.2443867886416075e-06, "pagerank": 0.0004957959641255606, "harmonic": 0.0014970059880239522, "bidirectional_harmonic": 0.043815939549472445, "degree": 2 }, "line_count": 9, "code_line_count": 9, "cyclomatic": 4, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.__init__", "test_info": { "success": false, "failed": 686, "passed": 1537, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_CRLFLineEndings\nLocation: /tmp/benchmark_y8ivzzrh/pyflakes/api.py:48\nError: AttributeError: 'Checker' object has no attribute 'messages'\n\nTraceback:\n\n> def test_CRLFLineEndings(self):\n \"\"\"\n Source files with Windows CR LF line endings are parsed successfully.\n \"\"\"\n with self.makeTempFile(\"x = 42\\r\\n\") as sourcePath:\n> self.assertHasErrors(sourcePath, [])\n\n> count = withStderrTo(err, checkPath, path)\n\n> return f(*args, **kwargs)\n\n> return check(codestr, filename, reporter)\n\n> def check(codeString, filename, reporter=None):\n \"\"\"\n Check the Python source given by C{codeString} for flakes.\n \n @param codeString: The Python source to check.\n @type codeString: C{str}\n \n @param filename: The name of the file the source came from, used to report\n errors.\n @type filename: C{str}\n \n @param reporter: A L{Reporter} instance, where errors and warnings will be\n reported.\n \n @return: The number of warnings emitted.\n @rtype: C{int}\n \"\"\"\n if reporter is None:\n reporter = modReporter._makeDefaultReporter()\n # First, compile into an AST and handle syntax errors.\n try:\n tree = ast.parse(codeString, filename=filename)\n except SyntaxError as e:\n reporter.syntaxError(filename, e.args[0], e.lineno, e.offset, e.text)\n return 1\n except Exception:\n reporter.unexpectedError(filename, 'problem decoding source')\n return 1\n # Okay, it's syntactically valid. Now check it.\n w = checker.Checker(tree, filename=filename)\n> w.messages.sort(key=lambda m: m.lineno)\nE AttributeError: 'Checker' object has no attribute 'messages'\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::CheckTests::test_checkRecursive\nLocation: /tmp/benchmark_y8ivzzrh/pyflakes/api.py:48\nError: AttributeError: 'Checker' object has no attribute 'messages'\n\nTraceback:\n\n> def test_checkRecursive(self):\n \"\"\"\n L{checkRecursive} descends into each directory, finding Python files\n and reporting problems.\n \"\"\"\n tempdir = tempfile.mkdtemp()\n try:\n os.mkdir(os.path.join(tempdir, 'foo'))\n file1 = os.path.join(tempdir, 'foo', 'bar.py')\n with open(file1, 'wb') as fd:\n fd.write(b\"import baz\\n\")\n file2 = os.path.join(tempdir, 'baz.py')\n with open(file2, 'wb') as fd:\n fd.write(b\"import contraband\")\n log = []\n reporter = LoggingReporter(log)\n> warnings = checkRecursive([tempdir], reporter)\n\n> warnings += checkPath(sourcePath, reporter)\n\n> return check(codestr, filename, reporter)\n\n> def check(codeString, filename, reporter=None):\n \"\"\"\n Check the Python source given by C{codeString} for flakes.\n \n @param codeString: The Python source to check.\n @type codeString: C{str}\n \n @param filename: The name of the file the source came from, used to report\n errors.\n @type filename: C{str}\n \n @param reporter: A L{Reporter} instance, where errors and warnings will be\n reported.\n \n @return: The number of warnings emitted.\n @rtype: C{int}\n \"\"\"\n if reporter is None:\n reporter = modReporter._makeDefaultReporter()\n # First, compile into an AST and handle syntax errors.\n try:\n tree = ast.parse(codeString, filename=filename)\n except SyntaxError as e:\n reporter.syntaxError(filename, e.args[0], e.lineno, e.offset, e.text)\n return 1\n except Exception:\n reporter.unexpectedError(filename, 'problem decoding source')\n return 1\n # Okay, it's syntactically valid. Now check it.\n w = checker.Checker(tree, filename=filename)\n> w.messages.sort(key=lambda m: m.lineno)\nE AttributeError: 'Checker' object has no attribute 'messages'\n", "Failure #3: pyflakes/test/test_api.py::CheckTests::test_encodedFileUTF8", "Failure #4: pyflakes/test/test_api.py::CheckTests::test_missingTrailingNewline", "Failure #5: pyflakes/test/test_api.py::CheckTests::test_pyflakesWarning", "Failure #6: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #7: pyflakes/test/test_api.py::IntegrationTests::test_goodFile", "Failure #8: pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin", "Failure #9: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #10: pyflakes/test/test_api.py::TestMain::test_goodFile", "Failure #11: pyflakes/test/test_api.py::TestMain::test_readFromStdin", "Failure #12: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local", "Failure #13: pyflakes/test/test_builtin.py::TestBuiltins::test_global_shadowing_builtin", "Failure #14: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #15: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #16: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_async_function", "Failure #17: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #18: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_function", "Failure #19: pyflakes/test/test_dict.py::Test::test_duplicate_key_float_and_int", "Failure #20: pyflakes/test/test_dict.py::Test::test_duplicate_keys", "Failure #21: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bools", "Failure #22: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bools_false", "Failure #23: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bytes_vs_unicode_py3", "Failure #24: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_function", "Failure #25: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_lambda", "Failure #26: pyflakes/test/test_dict.py::Test::test_duplicate_keys_ints", "Failure #27: pyflakes/test/test_dict.py::Test::test_duplicate_keys_none", "Failure #28: pyflakes/test/test_dict.py::Test::test_duplicate_keys_tuples", "Failure #29: pyflakes/test/test_dict.py::Test::test_duplicate_keys_tuples_int_and_float", "Failure #30: pyflakes/test/test_dict.py::Test::test_duplicate_values_bytes_vs_unicode_py3", "Failure #31: pyflakes/test/test_dict.py::Test::test_duplicate_variable_keys", "Failure #32: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values", "Failure #33: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values_same_value", "Failure #34: pyflakes/test/test_dict.py::Test::test_multiple_duplicate_keys", "Failure #35: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_error_same_value", "Failure #36: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors", "Failure #37: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_bool_or_none", "Failure #38: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_func_call", "Failure #39: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_instance_attributes", "Failure #40: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_ints", "Failure #41: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_tuples", "Failure #42: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_vars", "Failure #43: pyflakes/test/test_dict.py::Test::test_no_duplicate_keys_tuples_same_first_element", "Failure #44: pyflakes/test/test_doctests.py::TestOther::test_attrAugmentedAssignment", "Failure #45: pyflakes/test/test_doctests.py::TestOther::test_breakInsideLoop", "Failure #46: pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop", "Failure #47: pyflakes/test/test_doctests.py::TestOther::test_classFunctionDecorator", "Failure #48: pyflakes/test/test_doctests.py::TestOther::test_classNameDefinedPreviously", "Failure #49: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody", "Failure #50: pyflakes/test/test_doctests.py::TestOther::test_classRedefinedAsFunction", "Failure #51: pyflakes/test/test_doctests.py::TestOther::test_classRedefinition", "Failure #52: pyflakes/test/test_doctests.py::TestOther::test_classWithReturn", "Failure #53: pyflakes/test/test_doctests.py::TestOther::test_classWithYield", "Failure #54: pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom", "Failure #55: pyflakes/test/test_doctests.py::TestOther::test_comparison", "Failure #56: pyflakes/test/test_doctests.py::TestOther::test_containment", "Failure #57: pyflakes/test/test_doctests.py::TestOther::test_continueInsideLoop", "Failure #58: pyflakes/test/test_doctests.py::TestOther::test_continueOutsideLoop", "Failure #59: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptLast", "Failure #60: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptNotLast", "Failure #61: pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentConditionally", "Failure #62: pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentWithUse", "Failure #63: pyflakes/test/test_doctests.py::TestOther::test_duplicateArgs", "Failure #64: pyflakes/test/test_doctests.py::TestOther::test_ellipsis", "Failure #65: pyflakes/test/test_doctests.py::TestOther::test_extendedSlice", "Failure #66: pyflakes/test/test_doctests.py::TestOther::test_functionDecorator", "Failure #67: pyflakes/test/test_doctests.py::TestOther::test_functionRedefinedAsClass", "Failure #68: pyflakes/test/test_doctests.py::TestOther::test_function_arguments", "Failure #69: pyflakes/test/test_doctests.py::TestOther::test_function_arguments_python3", "Failure #70: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #71: pyflakes/test/test_doctests.py::TestOther::test_global_nonlocal_in_class_bodies", "Failure #72: pyflakes/test/test_doctests.py::TestOther::test_identity", "Failure #73: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #74: pyflakes/test/test_doctests.py::TestOther::test_loopControl", "Failure #75: pyflakes/test/test_doctests.py::TestOther::test_modernProperty", "Failure #76: pyflakes/test/test_doctests.py::TestOther::test_moduleWithReturn", "Failure #77: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYield", "Failure #78: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYieldFrom", "Failure #79: pyflakes/test/test_doctests.py::TestOther::test_redefinedClassFunction", "Failure #80: pyflakes/test/test_doctests.py::TestOther::test_redefinedFunction", "Failure #81: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseFunction", "Failure #82: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseInListComp", "Failure #83: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfFunction", "Failure #84: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #85: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #86: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #87: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryExceptFunction", "Failure #88: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction", "Failure #89: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreFunction", "Failure #90: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreImportation", "Failure #91: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #92: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentErrors", "Failure #93: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentNoError", "Failure #94: pyflakes/test/test_doctests.py::TestOther::test_unaryPlus", "Failure #95: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #96: pyflakes/test/test_doctests.py::TestOther::test_unused_global_in_class", "Failure #97: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #98: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #99: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_in_clas", "Failure #100: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #101: pyflakes/test/test_doctests.py::TestOther::test_varAugmentedAssignment", "Failure #102: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #103: pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule", "Failure #104: pyflakes/test/test_doctests.py::TestImports::test_assignRHSFirst", "Failure #105: pyflakes/test/test_doctests.py::TestImports::test_assignedToGlobal", "Failure #106: pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport", "Failure #107: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #108: pyflakes/test/test_doctests.py::TestImports::test_functionNamesAreBoundNow", "Failure #109: pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater", "Failure #110: pyflakes/test/test_doctests.py::TestImports::test_futureImport", "Failure #111: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #112: pyflakes/test/test_doctests.py::TestImports::test_futureImportStar", "Failure #113: pyflakes/test/test_doctests.py::TestImports::test_futureImportUndefined", "Failure #114: pyflakes/test/test_doctests.py::TestImports::test_futureImportUsed", "Failure #115: pyflakes/test/test_doctests.py::TestImports::test_ignoreNonImportRedefinitions", "Failure #116: pyflakes/test/test_doctests.py::TestImports::test_importInClass", "Failure #117: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #118: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #119: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #120: pyflakes/test/test_doctests.py::TestImports::test_importedInClass", "Failure #121: pyflakes/test/test_doctests.py::TestImports::test_localImportStar", "Failure #122: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #123: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #124: pyflakes/test/test_doctests.py::TestImports::test_nestedFunctionsNestScope", "Failure #125: pyflakes/test/test_doctests.py::TestImports::test_newAssignment", "Failure #126: pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine", "Failure #127: pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope", "Failure #128: pyflakes/test/test_doctests.py::TestImports::test_packageImport", "Failure #129: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #130: pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass", "Failure #131: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #132: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #133: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFunction", "Failure #134: pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass", "Failure #135: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #136: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #137: pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass", "Failure #138: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #139: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #140: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #141: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #142: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #143: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #144: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #145: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #146: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #147: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #148: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #149: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #150: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #151: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #152: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #153: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #154: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #155: pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative", "Failure #156: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #157: pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport", "Failure #158: pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import", "Failure #159: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #160: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #161: pyflakes/test/test_doctests.py::TestImports::test_usedImport_relative", "Failure #162: pyflakes/test/test_doctests.py::TestImports::test_usedInAssert", "Failure #163: pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment", "Failure #164: pyflakes/test/test_doctests.py::TestImports::test_usedInAttributeAssign", "Failure #165: pyflakes/test/test_doctests.py::TestImports::test_usedInCall", "Failure #166: pyflakes/test/test_doctests.py::TestImports::test_usedInClass", "Failure #167: pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase", "Failure #168: pyflakes/test/test_doctests.py::TestImports::test_usedInDict", "Failure #169: pyflakes/test/test_doctests.py::TestImports::test_usedInElifConditional", "Failure #170: pyflakes/test/test_doctests.py::TestImports::test_usedInElse", "Failure #171: pyflakes/test/test_doctests.py::TestImports::test_usedInExcept", "Failure #172: pyflakes/test/test_doctests.py::TestImports::test_usedInExec", "Failure #173: pyflakes/test/test_doctests.py::TestImports::test_usedInFor", "Failure #174: pyflakes/test/test_doctests.py::TestImports::test_usedInForElse", "Failure #175: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #176: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #177: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #178: pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody", "Failure #179: pyflakes/test/test_doctests.py::TestImports::test_usedInIfConditional", "Failure #180: pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg", "Failure #181: pyflakes/test/test_doctests.py::TestImports::test_usedInLambda", "Failure #182: pyflakes/test/test_doctests.py::TestImports::test_usedInList", "Failure #183: pyflakes/test/test_doctests.py::TestImports::test_usedInListComp", "Failure #184: pyflakes/test/test_doctests.py::TestImports::test_usedInLogic", "Failure #185: pyflakes/test/test_doctests.py::TestImports::test_usedInOperators", "Failure #186: pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault", "Failure #187: pyflakes/test/test_doctests.py::TestImports::test_usedInRaise", "Failure #188: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #189: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice", "Failure #190: pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj", "Failure #191: pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript", "Failure #192: pyflakes/test/test_doctests.py::TestImports::test_usedInTry", "Failure #193: pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally", "Failure #194: pyflakes/test/test_doctests.py::TestImports::test_usedInTuple", "Failure #195: pyflakes/test/test_doctests.py::TestImports::test_usedInWhile", "Failure #196: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #197: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import", "Failure #198: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import_of_alias", "Failure #199: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #200: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #201: pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtinWindowsError", "Failure #202: pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtins", "Failure #203: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarArgs", "Failure #204: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarUnpack", "Failure #205: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobal", "Failure #206: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobalMultipleNames", "Failure #207: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInDictionaryComprehension", "Failure #208: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInGenerator", "Failure #209: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClass", "Failure #210: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClassNested", "Failure #211: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInGenExp", "Failure #212: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInListComp", "Failure #213: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #214: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditional", "Failure #215: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditionalNested", "Failure #216: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delExceptionInExcept", "Failure #217: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delGlobal", "Failure #218: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined", "Failure #219: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhile", "Failure #220: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileNested", "Failure #221: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileTestUsage", "Failure #222: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #223: pyflakes/test/test_doctests.py::TestUndefinedNames::test_dunderClass", "Failure #224: pyflakes/test/test_doctests.py::TestUndefinedNames::test_functionsNeedGlobalScope", "Failure #225: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalFromNestedScope", "Failure #226: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #227: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #228: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #229: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #230: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs", "Failure #231: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #232: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #233: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #234: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #235: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsBuiltins", "Failure #236: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsFile", "Failure #237: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsName", "Failure #238: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath", "Failure #239: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #240: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #241: pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined", "Failure #242: pyflakes/test/test_doctests.py::TestUndefinedNames::test_moduleAnnotations", "Failure #243: pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks", "Failure #244: pyflakes/test/test_doctests.py::TestUndefinedNames::test_nestedClass", "Failure #245: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined", "Failure #246: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #247: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #248: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #249: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #250: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #251: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #252: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #253: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #254: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #255: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #256: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #257: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #258: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #259: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #260: pyflakes/test/test_doctests.py::TestUndefinedNames::test_usedAsStarUnpack", "Failure #261: pyflakes/test/test_doctests.py::Test::test_doctestCanReferToClass", "Failure #262: pyflakes/test/test_doctests.py::Test::test_doctestCanReferToFunction", "Failure #263: pyflakes/test/test_doctests.py::Test::test_globalUnderscoreInDoctest", "Failure #264: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #265: pyflakes/test/test_doctests.py::Test::test_global_undefined", "Failure #266: pyflakes/test/test_doctests.py::Test::test_ignore_nested_function", "Failure #267: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #268: pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter", "Failure #269: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #270: pyflakes/test/test_doctests.py::Test::test_indentationErrorInDoctest", "Failure #271: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #272: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #273: pyflakes/test/test_doctests.py::Test::test_noOffsetSyntaxErrorInDoctest", "Failure #274: pyflakes/test/test_doctests.py::Test::test_offsetAfterDoctests", "Failure #275: pyflakes/test/test_doctests.py::Test::test_offsetInDoctests", "Failure #276: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #277: pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs", "Failure #278: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #279: pyflakes/test/test_doctests.py::Test::test_singleUnderscoreInDoctest", "Failure #280: pyflakes/test/test_doctests.py::Test::test_syntaxErrorInDoctest", "Failure #281: pyflakes/test/test_imports.py::TestImportationObject::test_unusedImport_underscore", "Failure #282: pyflakes/test/test_imports.py::Test::test_aliasedImport", "Failure #283: pyflakes/test/test_imports.py::Test::test_aliasedImportShadowModule", "Failure #284: pyflakes/test/test_imports.py::Test::test_assignRHSFirst", "Failure #285: pyflakes/test/test_imports.py::Test::test_assignedToGlobal", "Failure #286: pyflakes/test/test_imports.py::Test::test_differentSubmoduleImport", "Failure #287: pyflakes/test/test_imports.py::Test::test_duplicateSubmoduleImport", "Failure #288: pyflakes/test/test_imports.py::Test::test_functionNamesAreBoundNow", "Failure #289: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #290: pyflakes/test/test_imports.py::Test::test_futureImport", "Failure #291: pyflakes/test/test_imports.py::Test::test_futureImportFirst", "Failure #292: pyflakes/test/test_imports.py::Test::test_futureImportStar", "Failure #293: pyflakes/test/test_imports.py::Test::test_futureImportUndefined", "Failure #294: pyflakes/test/test_imports.py::Test::test_futureImportUsed", "Failure #295: pyflakes/test/test_imports.py::Test::test_ignoreNonImportRedefinitions", "Failure #296: pyflakes/test/test_imports.py::Test::test_importInClass", "Failure #297: pyflakes/test/test_imports.py::Test::test_importStar", "Failure #298: pyflakes/test/test_imports.py::Test::test_importStar_relative", "Failure #299: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #300: pyflakes/test/test_imports.py::Test::test_importedInClass", "Failure #301: pyflakes/test/test_imports.py::Test::test_localImportStar", "Failure #302: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #303: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #304: pyflakes/test/test_imports.py::Test::test_nestedFunctionsNestScope", "Failure #305: pyflakes/test/test_imports.py::Test::test_newAssignment", "Failure #306: pyflakes/test/test_imports.py::Test::test_nonGlobalDoesNotRedefine", "Failure #307: pyflakes/test/test_imports.py::Test::test_notUsedInNestedScope", "Failure #308: pyflakes/test/test_imports.py::Test::test_packageImport", "Failure #309: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #310: pyflakes/test/test_imports.py::Test::test_redefinedByClass", "Failure #311: pyflakes/test/test_imports.py::Test::test_redefinedByExcept", "Failure #312: pyflakes/test/test_imports.py::Test::test_redefinedByFor", "Failure #313: pyflakes/test/test_imports.py::Test::test_redefinedByFunction", "Failure #314: pyflakes/test/test_imports.py::Test::test_redefinedBySubclass", "Failure #315: pyflakes/test/test_imports.py::Test::test_redefinedIf", "Failure #316: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #317: pyflakes/test/test_imports.py::Test::test_redefinedInClass", "Failure #318: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunction", "Failure #319: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunctionTwice", "Failure #320: pyflakes/test/test_imports.py::Test::test_redefinedTry", "Failure #321: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #322: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #323: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #324: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElseFinally", "Failure #325: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptFinally", "Failure #326: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #327: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #328: pyflakes/test/test_imports.py::Test::test_redefinedWhileUnused", "Failure #329: pyflakes/test/test_imports.py::Test::test_shadowedByFor", "Failure #330: pyflakes/test/test_imports.py::Test::test_shadowedByForDeep", "Failure #331: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #332: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #333: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #334: pyflakes/test/test_imports.py::Test::test_unusedImport", "Failure #335: pyflakes/test/test_imports.py::Test::test_unusedImport_relative", "Failure #336: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #337: pyflakes/test/test_imports.py::Test::test_unusedPackageImport", "Failure #338: pyflakes/test/test_imports.py::Test::test_unused_package_with_submodule_import", "Failure #339: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #340: pyflakes/test/test_imports.py::Test::test_usedImport", "Failure #341: pyflakes/test/test_imports.py::Test::test_usedImport_relative", "Failure #342: pyflakes/test/test_imports.py::Test::test_usedInAssert", "Failure #343: pyflakes/test/test_imports.py::Test::test_usedInAssignment", "Failure #344: pyflakes/test/test_imports.py::Test::test_usedInAttributeAssign", "Failure #345: pyflakes/test/test_imports.py::Test::test_usedInCall", "Failure #346: pyflakes/test/test_imports.py::Test::test_usedInClass", "Failure #347: pyflakes/test/test_imports.py::Test::test_usedInClassBase", "Failure #348: pyflakes/test/test_imports.py::Test::test_usedInDict", "Failure #349: pyflakes/test/test_imports.py::Test::test_usedInElifConditional", "Failure #350: pyflakes/test/test_imports.py::Test::test_usedInElse", "Failure #351: pyflakes/test/test_imports.py::Test::test_usedInExcept", "Failure #352: pyflakes/test/test_imports.py::Test::test_usedInExec", "Failure #353: pyflakes/test/test_imports.py::Test::test_usedInFor", "Failure #354: pyflakes/test/test_imports.py::Test::test_usedInForElse", "Failure #355: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #356: pyflakes/test/test_imports.py::Test::test_usedInGetattr", "Failure #357: pyflakes/test/test_imports.py::Test::test_usedInGlobal", "Failure #358: pyflakes/test/test_imports.py::Test::test_usedInIfBody", "Failure #359: pyflakes/test/test_imports.py::Test::test_usedInIfConditional", "Failure #360: pyflakes/test/test_imports.py::Test::test_usedInKeywordArg", "Failure #361: pyflakes/test/test_imports.py::Test::test_usedInLambda", "Failure #362: pyflakes/test/test_imports.py::Test::test_usedInList", "Failure #363: pyflakes/test/test_imports.py::Test::test_usedInListComp", "Failure #364: pyflakes/test/test_imports.py::Test::test_usedInLogic", "Failure #365: pyflakes/test/test_imports.py::Test::test_usedInOperators", "Failure #366: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #367: pyflakes/test/test_imports.py::Test::test_usedInRaise", "Failure #368: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #369: pyflakes/test/test_imports.py::Test::test_usedInSlice", "Failure #370: pyflakes/test/test_imports.py::Test::test_usedInSliceObj", "Failure #371: pyflakes/test/test_imports.py::Test::test_usedInSubscript", "Failure #372: pyflakes/test/test_imports.py::Test::test_usedInTry", "Failure #373: pyflakes/test/test_imports.py::Test::test_usedInTryFinally", "Failure #374: pyflakes/test/test_imports.py::Test::test_usedInTuple", "Failure #375: pyflakes/test/test_imports.py::Test::test_usedInWhile", "Failure #376: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #377: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import", "Failure #378: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import_of_alias", "Failure #379: pyflakes/test/test_imports.py::TestSpecialAll::test_all_mixed_attributes_and_strings", "Failure #380: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes", "Failure #381: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes_added", "Failure #382: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_names", "Failure #383: pyflakes/test/test_imports.py::TestSpecialAll::test_augmentedAssignment", "Failure #384: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInClass", "Failure #385: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #386: pyflakes/test/test_imports.py::TestSpecialAll::test_ignored_when_not_directly_assigned", "Failure #387: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #388: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarNotExported", "Failure #389: pyflakes/test/test_imports.py::TestSpecialAll::test_list_concatenation_assignment", "Failure #390: pyflakes/test/test_imports.py::TestSpecialAll::test_redefinedByGenExp", "Failure #391: pyflakes/test/test_imports.py::TestSpecialAll::test_tuple_concatenation_assignment", "Failure #392: pyflakes/test/test_imports.py::TestSpecialAll::test_unboundExported", "Failure #393: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #394: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #395: pyflakes/test/test_imports.py::TestSpecialAll::test_usedInGenExp", "Failure #396: pyflakes/test/test_imports.py::TestSpecialAll::test_warningSuppressed", "Failure #397: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str", "Failure #398: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str_end", "Failure #399: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_true", "Failure #400: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_true_end", "Failure #401: pyflakes/test/test_is_literal.py::Test::test_is_bytes", "Failure #402: pyflakes/test/test_is_literal.py::Test::test_is_false", "Failure #403: pyflakes/test/test_is_literal.py::Test::test_is_int", "Failure #404: pyflakes/test/test_is_literal.py::Test::test_is_not_bytes", "Failure #405: pyflakes/test/test_is_literal.py::Test::test_is_not_false", "Failure #406: pyflakes/test/test_is_literal.py::Test::test_is_not_int", "Failure #407: pyflakes/test/test_is_literal.py::Test::test_is_not_str", "Failure #408: pyflakes/test/test_is_literal.py::Test::test_is_not_true", "Failure #409: pyflakes/test/test_is_literal.py::Test::test_is_not_unicode", "Failure #410: pyflakes/test/test_is_literal.py::Test::test_is_str", "Failure #411: pyflakes/test/test_is_literal.py::Test::test_is_true", "Failure #412: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant", "Failure #413: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant_containing_constants", "Failure #414: pyflakes/test/test_is_literal.py::Test::test_is_tuple_containing_variables_ok", "Failure #415: pyflakes/test/test_is_literal.py::Test::test_is_unicode", "Failure #416: pyflakes/test/test_is_literal.py::Test::test_left_is_bytes", "Failure #417: pyflakes/test/test_is_literal.py::Test::test_left_is_false", "Failure #418: pyflakes/test/test_is_literal.py::Test::test_left_is_int", "Failure #419: pyflakes/test/test_is_literal.py::Test::test_left_is_not_bytes", "Failure #420: pyflakes/test/test_is_literal.py::Test::test_left_is_not_false", "Failure #421: pyflakes/test/test_is_literal.py::Test::test_left_is_not_int", "Failure #422: pyflakes/test/test_is_literal.py::Test::test_left_is_not_str", "Failure #423: pyflakes/test/test_is_literal.py::Test::test_left_is_not_true", "Failure #424: pyflakes/test/test_is_literal.py::Test::test_left_is_not_unicode", "Failure #425: pyflakes/test/test_is_literal.py::Test::test_left_is_str", "Failure #426: pyflakes/test/test_is_literal.py::Test::test_left_is_true", "Failure #427: pyflakes/test/test_is_literal.py::Test::test_left_is_unicode", "Failure #428: pyflakes/test/test_match.py::TestMatch::test_defined_in_different_branches", "Failure #429: pyflakes/test/test_match.py::TestMatch::test_match_bindings", "Failure #430: pyflakes/test/test_match.py::TestMatch::test_match_double_star", "Failure #431: pyflakes/test/test_match.py::TestMatch::test_match_or_pattern", "Failure #432: pyflakes/test/test_match.py::TestMatch::test_match_pattern_matched_class", "Failure #433: pyflakes/test/test_match.py::TestMatch::test_match_placeholder", "Failure #434: pyflakes/test/test_match.py::TestMatch::test_match_singleton", "Failure #435: pyflakes/test/test_match.py::TestMatch::test_match_star", "Failure #436: pyflakes/test/test_other.py::Test::test_attrAugmentedAssignment", "Failure #437: pyflakes/test/test_other.py::Test::test_breakInsideLoop", "Failure #438: pyflakes/test/test_other.py::Test::test_breakOutsideLoop", "Failure #439: pyflakes/test/test_other.py::Test::test_classFunctionDecorator", "Failure #440: pyflakes/test/test_other.py::Test::test_classNameDefinedPreviously", "Failure #441: pyflakes/test/test_other.py::Test::test_classNameUndefinedInClassBody", "Failure #442: pyflakes/test/test_other.py::Test::test_classRedefinedAsFunction", "Failure #443: pyflakes/test/test_other.py::Test::test_classRedefinition", "Failure #444: pyflakes/test/test_other.py::Test::test_classWithReturn", "Failure #445: pyflakes/test/test_other.py::Test::test_classWithYield", "Failure #446: pyflakes/test/test_other.py::Test::test_classWithYieldFrom", "Failure #447: pyflakes/test/test_other.py::Test::test_comparison", "Failure #448: pyflakes/test/test_other.py::Test::test_containment", "Failure #449: pyflakes/test/test_other.py::Test::test_continueInsideLoop", "Failure #450: pyflakes/test/test_other.py::Test::test_continueOutsideLoop", "Failure #451: pyflakes/test/test_other.py::Test::test_defaultExceptLast", "Failure #452: pyflakes/test/test_other.py::Test::test_defaultExceptNotLast", "Failure #453: pyflakes/test/test_other.py::Test::test_doubleAssignmentConditionally", "Failure #454: pyflakes/test/test_other.py::Test::test_doubleAssignmentWithUse", "Failure #455: pyflakes/test/test_other.py::Test::test_duplicateArgs", "Failure #456: pyflakes/test/test_other.py::Test::test_ellipsis", "Failure #457: pyflakes/test/test_other.py::Test::test_extendedSlice", "Failure #458: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #459: pyflakes/test/test_other.py::Test::test_functionRedefinedAsClass", "Failure #460: pyflakes/test/test_other.py::Test::test_function_arguments", "Failure #461: pyflakes/test/test_other.py::Test::test_function_arguments_python3", "Failure #462: pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope", "Failure #463: pyflakes/test/test_other.py::Test::test_global_nonlocal_in_class_bodies", "Failure #464: pyflakes/test/test_other.py::Test::test_identity", "Failure #465: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #466: pyflakes/test/test_other.py::Test::test_loopControl", "Failure #467: pyflakes/test/test_other.py::Test::test_modernProperty", "Failure #468: pyflakes/test/test_other.py::Test::test_moduleWithReturn", "Failure #469: pyflakes/test/test_other.py::Test::test_moduleWithYield", "Failure #470: pyflakes/test/test_other.py::Test::test_moduleWithYieldFrom", "Failure #471: pyflakes/test/test_other.py::Test::test_redefinedClassFunction", "Failure #472: pyflakes/test/test_other.py::Test::test_redefinedFunction", "Failure #473: pyflakes/test/test_other.py::Test::test_redefinedIfElseFunction", "Failure #474: pyflakes/test/test_other.py::Test::test_redefinedIfElseInListComp", "Failure #475: pyflakes/test/test_other.py::Test::test_redefinedIfFunction", "Failure #476: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #477: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #478: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #479: pyflakes/test/test_other.py::Test::test_redefinedTryExceptFunction", "Failure #480: pyflakes/test/test_other.py::Test::test_redefinedTryFunction", "Failure #481: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreFunction", "Failure #482: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreImportation", "Failure #483: pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable", "Failure #484: pyflakes/test/test_other.py::Test::test_starredAssignmentErrors", "Failure #485: pyflakes/test/test_other.py::Test::test_starredAssignmentNoError", "Failure #486: pyflakes/test/test_other.py::Test::test_unaryPlus", "Failure #487: pyflakes/test/test_other.py::Test::test_undefinedBaseClass", "Failure #488: pyflakes/test/test_other.py::Test::test_unused_global_in_class", "Failure #489: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #490: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #491: pyflakes/test/test_other.py::Test::test_unused_nonlocal_in_clas", "Failure #492: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #493: pyflakes/test/test_other.py::Test::test_varAugmentedAssignment", "Failure #494: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_static", "Failure #495: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_tuple", "Failure #496: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_tuple_empty", "Failure #497: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_with_message", "Failure #498: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_without_message", "Failure #499: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInForLoop", "Failure #500: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInListComprehension", "Failure #501: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToGlobal", "Failure #502: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToMember", "Failure #503: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToNonlocal", "Failure #504: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr", "Failure #505: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_after_annotation", "Failure #506: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope", "Failure #507: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope_reassigns_parameter", "Failure #508: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_nested", "Failure #509: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignmentInsideLoop", "Failure #510: pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall", "Failure #511: pyflakes/test/test_other.py::TestUnusedAssignment::test_closedOver", "Failure #512: pyflakes/test/test_other.py::TestUnusedAssignment::test_debuggerskipSpecialVariable", "Failure #513: pyflakes/test/test_other.py::TestUnusedAssignment::test_dictComprehension", "Failure #514: pyflakes/test/test_other.py::TestUnusedAssignment::test_doubleClosedOver", "Failure #515: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #516: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #517: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExcept", "Failure #518: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #519: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUsedInExcept", "Failure #520: pyflakes/test/test_other.py::TestUnusedAssignment::test_exception_unused_in_except_star", "Failure #521: pyflakes/test/test_other.py::TestUnusedAssignment::test_f_string", "Failure #522: pyflakes/test/test_other.py::TestUnusedAssignment::test_generatorExpression", "Failure #523: pyflakes/test/test_other.py::TestUnusedAssignment::test_if_tuple", "Failure #524: pyflakes/test/test_other.py::TestUnusedAssignment::test_ifexp", "Failure #525: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #526: pyflakes/test/test_other.py::TestUnusedAssignment::test_setComprehensionAndLiteral", "Failure #527: pyflakes/test/test_other.py::TestUnusedAssignment::test_tracebackhideSpecialVariable", "Failure #528: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #529: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedUnderscoreVariable", "Failure #530: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #531: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableAsLocals", "Failure #532: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #533: pyflakes/test/test_other.py::TestUnusedAssignment::test_variableUsedInLoop", "Failure #534: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementAttributeName", "Failure #535: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementComplicatedTarget", "Failure #536: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementListNames", "Failure #537: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNameDefinedInBody", "Failure #538: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNoNames", "Failure #539: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleName", "Failure #540: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameRedefined", "Failure #541: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameUndefined", "Failure #542: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscript", "Failure #543: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined", "Failure #544: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNames", "Failure #545: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined", "Failure #546: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesUndefined", "Failure #547: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInExpression", "Failure #548: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInside", "Failure #549: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #550: pyflakes/test/test_other.py::TestStringFormatting::test_f_string_without_placeholders", "Failure #551: pyflakes/test/test_other.py::TestStringFormatting::test_invalid_dot_format_calls", "Failure #552: pyflakes/test/test_other.py::TestStringFormatting::test_invalid_percent_format_calls", "Failure #553: pyflakes/test/test_other.py::TestStringFormatting::test_ok_percent_format_cannot_determine_element_count", "Failure #554: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDef", "Failure #555: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefAwait", "Failure #556: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #557: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncFor", "Failure #558: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncForUnderscoreLoopVar", "Failure #559: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWith", "Failure #560: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem", "Failure #561: pyflakes/test/test_other.py::TestAsyncStatements::test_formatstring", "Failure #562: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncFor", "Failure #563: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse", "Failure #564: pyflakes/test/test_other.py::TestAsyncStatements::test_matmul", "Failure #565: pyflakes/test/test_other.py::TestAsyncStatements::test_raise_notimplemented", "Failure #566: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future", "Failure #567: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_as_condition_test", "Failure #568: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_augmented_assign", "Failure #569: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_function_assignment", "Failure #570: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_in_lambda", "Failure #571: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_returned_in_function", "Failure #572: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_valid_print", "Failure #573: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #574: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import", "Failure #575: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_async_def", "Failure #576: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #577: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #578: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #579: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #580: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import", "Failure #581: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #582: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #583: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #584: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #585: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #586: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #587: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #588: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #589: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #590: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_not_a_typing_overload", "Failure #591: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #592: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #593: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #594: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #595: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #596: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #597: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #598: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #599: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #600: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #601: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #602: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #603: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #604: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #605: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_cast_literal_str_to_str", "Failure #606: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #607: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_TypeVarTuple", "Failure #608: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_classes", "Failure #609: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #610: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #611: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_functions", "Failure #612: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_statements", "Failure #613: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #614: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #615: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #616: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync", "Failure #617: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol", "Failure #618: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unassigned_annotation_is_undefined", "Failure #619: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #620: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #621: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotation_references_self_name_undefined", "Failure #622: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #623: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #624: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #625: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #626: pyflakes/test/test_undefined_names.py::Test::test_builtinWindowsError", "Failure #627: pyflakes/test/test_undefined_names.py::Test::test_builtins", "Failure #628: pyflakes/test/test_undefined_names.py::Test::test_definedAsStarArgs", "Failure #629: pyflakes/test/test_undefined_names.py::Test::test_definedAsStarUnpack", "Failure #630: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobal", "Failure #631: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobalMultipleNames", "Failure #632: pyflakes/test/test_undefined_names.py::Test::test_definedFromLambdaInDictionaryComprehension", "Failure #633: pyflakes/test/test_undefined_names.py::Test::test_definedFromLambdaInGenerator", "Failure #634: pyflakes/test/test_undefined_names.py::Test::test_definedInClass", "Failure #635: pyflakes/test/test_undefined_names.py::Test::test_definedInClassNested", "Failure #636: pyflakes/test/test_undefined_names.py::Test::test_definedInGenExp", "Failure #637: pyflakes/test/test_undefined_names.py::Test::test_definedInListComp", "Failure #638: pyflakes/test/test_undefined_names.py::Test::test_del", "Failure #639: pyflakes/test/test_undefined_names.py::Test::test_delConditional", "Failure #640: pyflakes/test/test_undefined_names.py::Test::test_delConditionalNested", "Failure #641: pyflakes/test/test_undefined_names.py::Test::test_delExceptionInExcept", "Failure #642: pyflakes/test/test_undefined_names.py::Test::test_delGlobal", "Failure #643: pyflakes/test/test_undefined_names.py::Test::test_delUndefined", "Failure #644: pyflakes/test/test_undefined_names.py::Test::test_delWhile", "Failure #645: pyflakes/test/test_undefined_names.py::Test::test_delWhileNested", "Failure #646: pyflakes/test/test_undefined_names.py::Test::test_delWhileTestUsage", "Failure #647: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #648: pyflakes/test/test_undefined_names.py::Test::test_dunderClass", "Failure #649: pyflakes/test/test_undefined_names.py::Test::test_functionsNeedGlobalScope", "Failure #650: pyflakes/test/test_undefined_names.py::Test::test_globalFromNestedScope", "Failure #651: pyflakes/test/test_undefined_names.py::Test::test_globalImportStar", "Failure #652: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #653: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #654: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #655: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs", "Failure #656: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #657: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #658: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #659: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #660: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsBuiltins", "Failure #661: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsFile", "Failure #662: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsName", "Failure #663: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsPath", "Failure #664: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #665: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #666: pyflakes/test/test_undefined_names.py::Test::test_metaClassUndefined", "Failure #667: pyflakes/test/test_undefined_names.py::Test::test_moduleAnnotations", "Failure #668: pyflakes/test/test_undefined_names.py::Test::test_namesDeclaredInExceptBlocks", "Failure #669: pyflakes/test/test_undefined_names.py::Test::test_nestedClass", "Failure #670: pyflakes/test/test_undefined_names.py::Test::test_undefined", "Failure #671: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #672: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionName", "Failure #673: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #674: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #675: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #676: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #677: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #678: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInComprehension", "Failure #679: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInDictionaryComprehension", "Failure #680: pyflakes/test/test_undefined_names.py::Test::test_undefinedInGenExpNested", "Failure #681: pyflakes/test/test_undefined_names.py::Test::test_undefinedInListComp", "Failure #682: pyflakes/test/test_undefined_names.py::Test::test_undefinedInLoop", "Failure #683: pyflakes/test/test_undefined_names.py::Test::test_undefinedWithErrorHandler", "Failure #684: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack", "Failure #685: pyflakes/test/test_undefined_names.py::Test::test_usedAsStarUnpack", "Failure #686: pyflakes/test/test_undefined_names.py::NameTests::test_impossibleContext" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_CRLFLineEndings" ], [ "pyflakes/test/test_api.py", "test_checkRecursive" ] ] }, "complexity_info": { "centrality": { "distance_discount": 13.401600000000006, "in_degree": 0, "true_in_degree": 0.0, "out_degree": 6, "betweenness": 0.0, "pagerank": 0.00022421524663677133, "harmonic": 0.018338323353293412, "bidirectional_harmonic": 0.06494510978043913, "degree": 6 }, "line_count": 29, "code_line_count": 29, "cyclomatic": 5, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.addBinding", "test_info": { "success": false, "failed": 562, "passed": 1661, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_checkRecursive\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: 0 != 2\n\nTraceback:\n\n> def test_checkRecursive(self):\n \"\"\"\n L{checkRecursive} descends into each directory, finding Python files\n and reporting problems.\n \"\"\"\n tempdir = tempfile.mkdtemp()\n try:\n os.mkdir(os.path.join(tempdir, 'foo'))\n file1 = os.path.join(tempdir, 'foo', 'bar.py')\n with open(file1, 'wb') as fd:\n fd.write(b\"import baz\\n\")\n file2 = os.path.join(tempdir, 'baz.py')\n with open(file2, 'wb') as fd:\n fd.write(b\"import contraband\")\n log = []\n reporter = LoggingReporter(log)\n warnings = checkRecursive([tempdir], reporter)\n> self.assertEqual(warnings, 2)\nE AssertionError: 0 != 2\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::CheckTests::test_pyflakesWarning\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: 0 != 1\n\nTraceback:\n\n> def test_pyflakesWarning(self):\n \"\"\"\n If the source file has a pyflakes warning, this is reported as a\n 'flake'.\n \"\"\"\n with self.makeTempFile(\"import foo\") as sourcePath:\n count, errors = self.getErrors(sourcePath)\n> self.assertEqual(count, 1)\nE AssertionError: 0 != 1\n", "Failure #3: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #4: pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin", "Failure #5: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #6: pyflakes/test/test_api.py::TestMain::test_readFromStdin", "Failure #7: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local", "Failure #8: pyflakes/test/test_builtin.py::TestBuiltins::test_global_shadowing_builtin", "Failure #9: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #10: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #11: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #12: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_function", "Failure #13: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_function", "Failure #14: pyflakes/test/test_dict.py::Test::test_duplicate_variable_keys", "Failure #15: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values", "Failure #16: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values_same_value", "Failure #17: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_func_call", "Failure #18: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_instance_attributes", "Failure #19: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_vars", "Failure #20: pyflakes/test/test_doctests.py::TestOther::test_attrAugmentedAssignment", "Failure #21: pyflakes/test/test_doctests.py::TestOther::test_breakInsideLoop", "Failure #22: pyflakes/test/test_doctests.py::TestOther::test_classFunctionDecorator", "Failure #23: pyflakes/test/test_doctests.py::TestOther::test_classNameDefinedPreviously", "Failure #24: pyflakes/test/test_doctests.py::TestOther::test_classRedefinedAsFunction", "Failure #25: pyflakes/test/test_doctests.py::TestOther::test_classRedefinition", "Failure #26: pyflakes/test/test_doctests.py::TestOther::test_classWithReturn", "Failure #27: pyflakes/test/test_doctests.py::TestOther::test_classWithYield", "Failure #28: pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom", "Failure #29: pyflakes/test/test_doctests.py::TestOther::test_comparison", "Failure #30: pyflakes/test/test_doctests.py::TestOther::test_containment", "Failure #31: pyflakes/test/test_doctests.py::TestOther::test_continueInsideLoop", "Failure #32: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptLast", "Failure #33: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptNotLast", "Failure #34: pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentWithUse", "Failure #35: pyflakes/test/test_doctests.py::TestOther::test_extendedSlice", "Failure #36: pyflakes/test/test_doctests.py::TestOther::test_functionDecorator", "Failure #37: pyflakes/test/test_doctests.py::TestOther::test_functionRedefinedAsClass", "Failure #38: pyflakes/test/test_doctests.py::TestOther::test_global_nonlocal_in_class_bodies", "Failure #39: pyflakes/test/test_doctests.py::TestOther::test_identity", "Failure #40: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #41: pyflakes/test/test_doctests.py::TestOther::test_modernProperty", "Failure #42: pyflakes/test/test_doctests.py::TestOther::test_redefinedClassFunction", "Failure #43: pyflakes/test/test_doctests.py::TestOther::test_redefinedFunction", "Failure #44: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseInListComp", "Failure #45: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfFunction", "Failure #46: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #47: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #48: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #49: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction", "Failure #50: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreImportation", "Failure #51: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #52: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentErrors", "Failure #53: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentNoError", "Failure #54: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #55: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #56: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #57: pyflakes/test/test_doctests.py::TestOther::test_varAugmentedAssignment", "Failure #58: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #59: pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule", "Failure #60: pyflakes/test/test_doctests.py::TestImports::test_assignRHSFirst", "Failure #61: pyflakes/test/test_doctests.py::TestImports::test_assignedToGlobal", "Failure #62: pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport", "Failure #63: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #64: pyflakes/test/test_doctests.py::TestImports::test_functionNamesAreBoundNow", "Failure #65: pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater", "Failure #66: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #67: pyflakes/test/test_doctests.py::TestImports::test_futureImportUsed", "Failure #68: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #69: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #70: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #71: pyflakes/test/test_doctests.py::TestImports::test_importedInClass", "Failure #72: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #73: pyflakes/test/test_doctests.py::TestImports::test_nestedFunctionsNestScope", "Failure #74: pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine", "Failure #75: pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope", "Failure #76: pyflakes/test/test_doctests.py::TestImports::test_packageImport", "Failure #77: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #78: pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass", "Failure #79: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #80: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #81: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFunction", "Failure #82: pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass", "Failure #83: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #84: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #85: pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass", "Failure #86: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #87: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #88: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #89: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #90: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #91: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #92: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #93: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #94: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #95: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #96: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #97: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #98: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #99: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #100: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #101: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #102: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #103: pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative", "Failure #104: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #105: pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport", "Failure #106: pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import", "Failure #107: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #108: pyflakes/test/test_doctests.py::TestImports::test_usedImport_relative", "Failure #109: pyflakes/test/test_doctests.py::TestImports::test_usedInAssert", "Failure #110: pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment", "Failure #111: pyflakes/test/test_doctests.py::TestImports::test_usedInAttributeAssign", "Failure #112: pyflakes/test/test_doctests.py::TestImports::test_usedInCall", "Failure #113: pyflakes/test/test_doctests.py::TestImports::test_usedInClass", "Failure #114: pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase", "Failure #115: pyflakes/test/test_doctests.py::TestImports::test_usedInDict", "Failure #116: pyflakes/test/test_doctests.py::TestImports::test_usedInElifConditional", "Failure #117: pyflakes/test/test_doctests.py::TestImports::test_usedInElse", "Failure #118: pyflakes/test/test_doctests.py::TestImports::test_usedInExcept", "Failure #119: pyflakes/test/test_doctests.py::TestImports::test_usedInExec", "Failure #120: pyflakes/test/test_doctests.py::TestImports::test_usedInFor", "Failure #121: pyflakes/test/test_doctests.py::TestImports::test_usedInForElse", "Failure #122: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #123: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #124: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #125: pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody", "Failure #126: pyflakes/test/test_doctests.py::TestImports::test_usedInIfConditional", "Failure #127: pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg", "Failure #128: pyflakes/test/test_doctests.py::TestImports::test_usedInLambda", "Failure #129: pyflakes/test/test_doctests.py::TestImports::test_usedInList", "Failure #130: pyflakes/test/test_doctests.py::TestImports::test_usedInListComp", "Failure #131: pyflakes/test/test_doctests.py::TestImports::test_usedInLogic", "Failure #132: pyflakes/test/test_doctests.py::TestImports::test_usedInOperators", "Failure #133: pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault", "Failure #134: pyflakes/test/test_doctests.py::TestImports::test_usedInRaise", "Failure #135: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #136: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice", "Failure #137: pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj", "Failure #138: pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript", "Failure #139: pyflakes/test/test_doctests.py::TestImports::test_usedInTry", "Failure #140: pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally", "Failure #141: pyflakes/test/test_doctests.py::TestImports::test_usedInTuple", "Failure #142: pyflakes/test/test_doctests.py::TestImports::test_usedInWhile", "Failure #143: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #144: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import", "Failure #145: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import_of_alias", "Failure #146: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #147: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #148: pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtinWindowsError", "Failure #149: pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtins", "Failure #150: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarArgs", "Failure #151: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarUnpack", "Failure #152: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobal", "Failure #153: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobalMultipleNames", "Failure #154: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInDictionaryComprehension", "Failure #155: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInGenerator", "Failure #156: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClass", "Failure #157: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClassNested", "Failure #158: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInGenExp", "Failure #159: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInListComp", "Failure #160: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #161: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditional", "Failure #162: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditionalNested", "Failure #163: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delExceptionInExcept", "Failure #164: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhile", "Failure #165: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileNested", "Failure #166: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileTestUsage", "Failure #167: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #168: pyflakes/test/test_doctests.py::TestUndefinedNames::test_dunderClass", "Failure #169: pyflakes/test/test_doctests.py::TestUndefinedNames::test_functionsNeedGlobalScope", "Failure #170: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalFromNestedScope", "Failure #171: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #172: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #173: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs", "Failure #174: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #175: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #176: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #177: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsBuiltins", "Failure #178: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsFile", "Failure #179: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsName", "Failure #180: pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined", "Failure #181: pyflakes/test/test_doctests.py::TestUndefinedNames::test_moduleAnnotations", "Failure #182: pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks", "Failure #183: pyflakes/test/test_doctests.py::TestUndefinedNames::test_nestedClass", "Failure #184: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #185: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #186: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #187: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #188: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #189: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #190: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #191: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #192: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #193: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #194: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #195: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #196: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #197: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #198: pyflakes/test/test_doctests.py::TestUndefinedNames::test_usedAsStarUnpack", "Failure #199: pyflakes/test/test_doctests.py::Test::test_doctestCanReferToClass", "Failure #200: pyflakes/test/test_doctests.py::Test::test_doctestCanReferToFunction", "Failure #201: pyflakes/test/test_doctests.py::Test::test_globalUnderscoreInDoctest", "Failure #202: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #203: pyflakes/test/test_doctests.py::Test::test_ignore_nested_function", "Failure #204: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #205: pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter", "Failure #206: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #207: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #208: pyflakes/test/test_doctests.py::Test::test_singleUnderscoreInDoctest", "Failure #209: pyflakes/test/test_imports.py::TestImportationObject::test_unusedImport_underscore", "Failure #210: pyflakes/test/test_imports.py::Test::test_aliasedImport", "Failure #211: pyflakes/test/test_imports.py::Test::test_aliasedImportShadowModule", "Failure #212: pyflakes/test/test_imports.py::Test::test_assignRHSFirst", "Failure #213: pyflakes/test/test_imports.py::Test::test_assignedToGlobal", "Failure #214: pyflakes/test/test_imports.py::Test::test_differentSubmoduleImport", "Failure #215: pyflakes/test/test_imports.py::Test::test_duplicateSubmoduleImport", "Failure #216: pyflakes/test/test_imports.py::Test::test_functionNamesAreBoundNow", "Failure #217: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #218: pyflakes/test/test_imports.py::Test::test_futureImportFirst", "Failure #219: pyflakes/test/test_imports.py::Test::test_futureImportUsed", "Failure #220: pyflakes/test/test_imports.py::Test::test_importStar", "Failure #221: pyflakes/test/test_imports.py::Test::test_importStar_relative", "Failure #222: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #223: pyflakes/test/test_imports.py::Test::test_importedInClass", "Failure #224: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #225: pyflakes/test/test_imports.py::Test::test_nestedFunctionsNestScope", "Failure #226: pyflakes/test/test_imports.py::Test::test_nonGlobalDoesNotRedefine", "Failure #227: pyflakes/test/test_imports.py::Test::test_notUsedInNestedScope", "Failure #228: pyflakes/test/test_imports.py::Test::test_packageImport", "Failure #229: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #230: pyflakes/test/test_imports.py::Test::test_redefinedByClass", "Failure #231: pyflakes/test/test_imports.py::Test::test_redefinedByExcept", "Failure #232: pyflakes/test/test_imports.py::Test::test_redefinedByFor", "Failure #233: pyflakes/test/test_imports.py::Test::test_redefinedByFunction", "Failure #234: pyflakes/test/test_imports.py::Test::test_redefinedBySubclass", "Failure #235: pyflakes/test/test_imports.py::Test::test_redefinedIf", "Failure #236: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #237: pyflakes/test/test_imports.py::Test::test_redefinedInClass", "Failure #238: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunction", "Failure #239: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunctionTwice", "Failure #240: pyflakes/test/test_imports.py::Test::test_redefinedTry", "Failure #241: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #242: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #243: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #244: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElseFinally", "Failure #245: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptFinally", "Failure #246: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #247: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #248: pyflakes/test/test_imports.py::Test::test_redefinedWhileUnused", "Failure #249: pyflakes/test/test_imports.py::Test::test_shadowedByFor", "Failure #250: pyflakes/test/test_imports.py::Test::test_shadowedByForDeep", "Failure #251: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #252: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #253: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #254: pyflakes/test/test_imports.py::Test::test_unusedImport", "Failure #255: pyflakes/test/test_imports.py::Test::test_unusedImport_relative", "Failure #256: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #257: pyflakes/test/test_imports.py::Test::test_unusedPackageImport", "Failure #258: pyflakes/test/test_imports.py::Test::test_unused_package_with_submodule_import", "Failure #259: pyflakes/test/test_imports.py::Test::test_usedImport", "Failure #260: pyflakes/test/test_imports.py::Test::test_usedImport_relative", "Failure #261: pyflakes/test/test_imports.py::Test::test_usedInAssert", "Failure #262: pyflakes/test/test_imports.py::Test::test_usedInAssignment", "Failure #263: pyflakes/test/test_imports.py::Test::test_usedInAttributeAssign", "Failure #264: pyflakes/test/test_imports.py::Test::test_usedInCall", "Failure #265: pyflakes/test/test_imports.py::Test::test_usedInClass", "Failure #266: pyflakes/test/test_imports.py::Test::test_usedInClassBase", "Failure #267: pyflakes/test/test_imports.py::Test::test_usedInDict", "Failure #268: pyflakes/test/test_imports.py::Test::test_usedInElifConditional", "Failure #269: pyflakes/test/test_imports.py::Test::test_usedInElse", "Failure #270: pyflakes/test/test_imports.py::Test::test_usedInExcept", "Failure #271: pyflakes/test/test_imports.py::Test::test_usedInExec", "Failure #272: pyflakes/test/test_imports.py::Test::test_usedInFor", "Failure #273: pyflakes/test/test_imports.py::Test::test_usedInForElse", "Failure #274: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #275: pyflakes/test/test_imports.py::Test::test_usedInGetattr", "Failure #276: pyflakes/test/test_imports.py::Test::test_usedInGlobal", "Failure #277: pyflakes/test/test_imports.py::Test::test_usedInIfBody", "Failure #278: pyflakes/test/test_imports.py::Test::test_usedInIfConditional", "Failure #279: pyflakes/test/test_imports.py::Test::test_usedInKeywordArg", "Failure #280: pyflakes/test/test_imports.py::Test::test_usedInLambda", "Failure #281: pyflakes/test/test_imports.py::Test::test_usedInList", "Failure #282: pyflakes/test/test_imports.py::Test::test_usedInListComp", "Failure #283: pyflakes/test/test_imports.py::Test::test_usedInLogic", "Failure #284: pyflakes/test/test_imports.py::Test::test_usedInOperators", "Failure #285: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #286: pyflakes/test/test_imports.py::Test::test_usedInRaise", "Failure #287: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #288: pyflakes/test/test_imports.py::Test::test_usedInSlice", "Failure #289: pyflakes/test/test_imports.py::Test::test_usedInSliceObj", "Failure #290: pyflakes/test/test_imports.py::Test::test_usedInSubscript", "Failure #291: pyflakes/test/test_imports.py::Test::test_usedInTry", "Failure #292: pyflakes/test/test_imports.py::Test::test_usedInTryFinally", "Failure #293: pyflakes/test/test_imports.py::Test::test_usedInTuple", "Failure #294: pyflakes/test/test_imports.py::Test::test_usedInWhile", "Failure #295: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #296: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import", "Failure #297: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import_of_alias", "Failure #298: pyflakes/test/test_imports.py::TestSpecialAll::test_all_mixed_attributes_and_strings", "Failure #299: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes", "Failure #300: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes_added", "Failure #301: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_names", "Failure #302: pyflakes/test/test_imports.py::TestSpecialAll::test_augmentedAssignment", "Failure #303: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInClass", "Failure #304: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #305: pyflakes/test/test_imports.py::TestSpecialAll::test_ignored_when_not_directly_assigned", "Failure #306: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #307: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarNotExported", "Failure #308: pyflakes/test/test_imports.py::TestSpecialAll::test_list_concatenation_assignment", "Failure #309: pyflakes/test/test_imports.py::TestSpecialAll::test_redefinedByGenExp", "Failure #310: pyflakes/test/test_imports.py::TestSpecialAll::test_tuple_concatenation_assignment", "Failure #311: pyflakes/test/test_imports.py::TestSpecialAll::test_unboundExported", "Failure #312: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #313: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #314: pyflakes/test/test_imports.py::TestSpecialAll::test_usedInGenExp", "Failure #315: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str", "Failure #316: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str_end", "Failure #317: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_true", "Failure #318: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_true_end", "Failure #319: pyflakes/test/test_is_literal.py::Test::test_is_bytes", "Failure #320: pyflakes/test/test_is_literal.py::Test::test_is_false", "Failure #321: pyflakes/test/test_is_literal.py::Test::test_is_int", "Failure #322: pyflakes/test/test_is_literal.py::Test::test_is_not_bytes", "Failure #323: pyflakes/test/test_is_literal.py::Test::test_is_not_false", "Failure #324: pyflakes/test/test_is_literal.py::Test::test_is_not_int", "Failure #325: pyflakes/test/test_is_literal.py::Test::test_is_not_str", "Failure #326: pyflakes/test/test_is_literal.py::Test::test_is_not_true", "Failure #327: pyflakes/test/test_is_literal.py::Test::test_is_not_unicode", "Failure #328: pyflakes/test/test_is_literal.py::Test::test_is_str", "Failure #329: pyflakes/test/test_is_literal.py::Test::test_is_true", "Failure #330: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant", "Failure #331: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant_containing_constants", "Failure #332: pyflakes/test/test_is_literal.py::Test::test_is_tuple_containing_variables_ok", "Failure #333: pyflakes/test/test_is_literal.py::Test::test_is_unicode", "Failure #334: pyflakes/test/test_is_literal.py::Test::test_left_is_bytes", "Failure #335: pyflakes/test/test_is_literal.py::Test::test_left_is_false", "Failure #336: pyflakes/test/test_is_literal.py::Test::test_left_is_int", "Failure #337: pyflakes/test/test_is_literal.py::Test::test_left_is_not_bytes", "Failure #338: pyflakes/test/test_is_literal.py::Test::test_left_is_not_false", "Failure #339: pyflakes/test/test_is_literal.py::Test::test_left_is_not_int", "Failure #340: pyflakes/test/test_is_literal.py::Test::test_left_is_not_str", "Failure #341: pyflakes/test/test_is_literal.py::Test::test_left_is_not_true", "Failure #342: pyflakes/test/test_is_literal.py::Test::test_left_is_not_unicode", "Failure #343: pyflakes/test/test_is_literal.py::Test::test_left_is_str", "Failure #344: pyflakes/test/test_is_literal.py::Test::test_left_is_true", "Failure #345: pyflakes/test/test_is_literal.py::Test::test_left_is_unicode", "Failure #346: pyflakes/test/test_match.py::TestMatch::test_defined_in_different_branches", "Failure #347: pyflakes/test/test_match.py::TestMatch::test_match_bindings", "Failure #348: pyflakes/test/test_match.py::TestMatch::test_match_double_star", "Failure #349: pyflakes/test/test_match.py::TestMatch::test_match_or_pattern", "Failure #350: pyflakes/test/test_match.py::TestMatch::test_match_pattern_matched_class", "Failure #351: pyflakes/test/test_match.py::TestMatch::test_match_placeholder", "Failure #352: pyflakes/test/test_match.py::TestMatch::test_match_singleton", "Failure #353: pyflakes/test/test_match.py::TestMatch::test_match_star", "Failure #354: pyflakes/test/test_other.py::Test::test_attrAugmentedAssignment", "Failure #355: pyflakes/test/test_other.py::Test::test_breakInsideLoop", "Failure #356: pyflakes/test/test_other.py::Test::test_classFunctionDecorator", "Failure #357: pyflakes/test/test_other.py::Test::test_classNameDefinedPreviously", "Failure #358: pyflakes/test/test_other.py::Test::test_classRedefinedAsFunction", "Failure #359: pyflakes/test/test_other.py::Test::test_classRedefinition", "Failure #360: pyflakes/test/test_other.py::Test::test_classWithReturn", "Failure #361: pyflakes/test/test_other.py::Test::test_classWithYield", "Failure #362: pyflakes/test/test_other.py::Test::test_classWithYieldFrom", "Failure #363: pyflakes/test/test_other.py::Test::test_comparison", "Failure #364: pyflakes/test/test_other.py::Test::test_containment", "Failure #365: pyflakes/test/test_other.py::Test::test_continueInsideLoop", "Failure #366: pyflakes/test/test_other.py::Test::test_defaultExceptLast", "Failure #367: pyflakes/test/test_other.py::Test::test_defaultExceptNotLast", "Failure #368: pyflakes/test/test_other.py::Test::test_doubleAssignmentWithUse", "Failure #369: pyflakes/test/test_other.py::Test::test_extendedSlice", "Failure #370: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #371: pyflakes/test/test_other.py::Test::test_functionRedefinedAsClass", "Failure #372: pyflakes/test/test_other.py::Test::test_global_nonlocal_in_class_bodies", "Failure #373: pyflakes/test/test_other.py::Test::test_identity", "Failure #374: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #375: pyflakes/test/test_other.py::Test::test_modernProperty", "Failure #376: pyflakes/test/test_other.py::Test::test_redefinedClassFunction", "Failure #377: pyflakes/test/test_other.py::Test::test_redefinedFunction", "Failure #378: pyflakes/test/test_other.py::Test::test_redefinedIfElseInListComp", "Failure #379: pyflakes/test/test_other.py::Test::test_redefinedIfFunction", "Failure #380: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #381: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #382: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #383: pyflakes/test/test_other.py::Test::test_redefinedTryFunction", "Failure #384: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreImportation", "Failure #385: pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable", "Failure #386: pyflakes/test/test_other.py::Test::test_starredAssignmentErrors", "Failure #387: pyflakes/test/test_other.py::Test::test_starredAssignmentNoError", "Failure #388: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #389: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #390: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #391: pyflakes/test/test_other.py::Test::test_varAugmentedAssignment", "Failure #392: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_with_message", "Failure #393: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_without_message", "Failure #394: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInForLoop", "Failure #395: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInListComprehension", "Failure #396: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToGlobal", "Failure #397: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToMember", "Failure #398: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToNonlocal", "Failure #399: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr", "Failure #400: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_after_annotation", "Failure #401: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope", "Failure #402: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope_reassigns_parameter", "Failure #403: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_nested", "Failure #404: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignmentInsideLoop", "Failure #405: pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall", "Failure #406: pyflakes/test/test_other.py::TestUnusedAssignment::test_closedOver", "Failure #407: pyflakes/test/test_other.py::TestUnusedAssignment::test_dictComprehension", "Failure #408: pyflakes/test/test_other.py::TestUnusedAssignment::test_doubleClosedOver", "Failure #409: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #410: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #411: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExcept", "Failure #412: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #413: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUsedInExcept", "Failure #414: pyflakes/test/test_other.py::TestUnusedAssignment::test_exception_unused_in_except_star", "Failure #415: pyflakes/test/test_other.py::TestUnusedAssignment::test_f_string", "Failure #416: pyflakes/test/test_other.py::TestUnusedAssignment::test_generatorExpression", "Failure #417: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #418: pyflakes/test/test_other.py::TestUnusedAssignment::test_setComprehensionAndLiteral", "Failure #419: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #420: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedUnderscoreVariable", "Failure #421: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #422: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableAsLocals", "Failure #423: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #424: pyflakes/test/test_other.py::TestUnusedAssignment::test_variableUsedInLoop", "Failure #425: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementAttributeName", "Failure #426: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementComplicatedTarget", "Failure #427: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementListNames", "Failure #428: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNameDefinedInBody", "Failure #429: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNoNames", "Failure #430: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleName", "Failure #431: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameRedefined", "Failure #432: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameUndefined", "Failure #433: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscript", "Failure #434: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined", "Failure #435: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNames", "Failure #436: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined", "Failure #437: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesUndefined", "Failure #438: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInside", "Failure #439: pyflakes/test/test_other.py::TestStringFormatting::test_f_string_without_placeholders", "Failure #440: pyflakes/test/test_other.py::TestStringFormatting::test_invalid_dot_format_calls", "Failure #441: pyflakes/test/test_other.py::TestStringFormatting::test_ok_percent_format_cannot_determine_element_count", "Failure #442: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefAwait", "Failure #443: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncFor", "Failure #444: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncForUnderscoreLoopVar", "Failure #445: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWith", "Failure #446: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem", "Failure #447: pyflakes/test/test_other.py::TestAsyncStatements::test_formatstring", "Failure #448: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncFor", "Failure #449: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse", "Failure #450: pyflakes/test/test_other.py::TestAsyncStatements::test_matmul", "Failure #451: pyflakes/test/test_other.py::TestAsyncStatements::test_raise_notimplemented", "Failure #452: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future", "Failure #453: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_as_condition_test", "Failure #454: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_augmented_assign", "Failure #455: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_function_assignment", "Failure #456: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_in_lambda", "Failure #457: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_returned_in_function", "Failure #458: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_valid_print", "Failure #459: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #460: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import", "Failure #461: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_async_def", "Failure #462: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #463: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #464: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #465: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #466: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import", "Failure #467: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #468: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #469: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #470: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #471: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #472: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #473: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #474: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #475: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #476: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_not_a_typing_overload", "Failure #477: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #478: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #479: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #480: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #481: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #482: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #483: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #484: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #485: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #486: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #487: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #488: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #489: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #490: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #491: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_cast_literal_str_to_str", "Failure #492: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #493: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_TypeVarTuple", "Failure #494: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_classes", "Failure #495: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #496: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #497: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_functions", "Failure #498: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_statements", "Failure #499: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #500: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #501: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #502: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync", "Failure #503: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol", "Failure #504: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unassigned_annotation_is_undefined", "Failure #505: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #506: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #507: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotation_references_self_name_undefined", "Failure #508: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #509: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #510: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #511: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #512: pyflakes/test/test_undefined_names.py::Test::test_builtinWindowsError", "Failure #513: pyflakes/test/test_undefined_names.py::Test::test_builtins", "Failure #514: pyflakes/test/test_undefined_names.py::Test::test_definedAsStarArgs", "Failure #515: pyflakes/test/test_undefined_names.py::Test::test_definedAsStarUnpack", "Failure #516: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobal", "Failure #517: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobalMultipleNames", "Failure #518: pyflakes/test/test_undefined_names.py::Test::test_definedFromLambdaInDictionaryComprehension", "Failure #519: pyflakes/test/test_undefined_names.py::Test::test_definedFromLambdaInGenerator", "Failure #520: pyflakes/test/test_undefined_names.py::Test::test_definedInClass", "Failure #521: pyflakes/test/test_undefined_names.py::Test::test_definedInClassNested", "Failure #522: pyflakes/test/test_undefined_names.py::Test::test_definedInGenExp", "Failure #523: pyflakes/test/test_undefined_names.py::Test::test_definedInListComp", "Failure #524: pyflakes/test/test_undefined_names.py::Test::test_del", "Failure #525: pyflakes/test/test_undefined_names.py::Test::test_delConditional", "Failure #526: pyflakes/test/test_undefined_names.py::Test::test_delConditionalNested", "Failure #527: pyflakes/test/test_undefined_names.py::Test::test_delExceptionInExcept", "Failure #528: pyflakes/test/test_undefined_names.py::Test::test_delWhile", "Failure #529: pyflakes/test/test_undefined_names.py::Test::test_delWhileNested", "Failure #530: pyflakes/test/test_undefined_names.py::Test::test_delWhileTestUsage", "Failure #531: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #532: pyflakes/test/test_undefined_names.py::Test::test_dunderClass", "Failure #533: pyflakes/test/test_undefined_names.py::Test::test_functionsNeedGlobalScope", "Failure #534: pyflakes/test/test_undefined_names.py::Test::test_globalFromNestedScope", "Failure #535: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #536: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #537: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs", "Failure #538: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #539: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #540: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #541: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsBuiltins", "Failure #542: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsFile", "Failure #543: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsName", "Failure #544: pyflakes/test/test_undefined_names.py::Test::test_metaClassUndefined", "Failure #545: pyflakes/test/test_undefined_names.py::Test::test_moduleAnnotations", "Failure #546: pyflakes/test/test_undefined_names.py::Test::test_namesDeclaredInExceptBlocks", "Failure #547: pyflakes/test/test_undefined_names.py::Test::test_nestedClass", "Failure #548: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #549: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionName", "Failure #550: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #551: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #552: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #553: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #554: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #555: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInComprehension", "Failure #556: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInDictionaryComprehension", "Failure #557: pyflakes/test/test_undefined_names.py::Test::test_undefinedInGenExpNested", "Failure #558: pyflakes/test/test_undefined_names.py::Test::test_undefinedInListComp", "Failure #559: pyflakes/test/test_undefined_names.py::Test::test_undefinedInLoop", "Failure #560: pyflakes/test/test_undefined_names.py::Test::test_undefinedWithErrorHandler", "Failure #561: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack", "Failure #562: pyflakes/test/test_undefined_names.py::Test::test_usedAsStarUnpack" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_checkRecursive" ], [ "pyflakes/test/test_api.py", "test_pyflakesWarning" ] ] }, "complexity_info": { "centrality": { "distance_discount": 6.272000000000002, "in_degree": 8, "true_in_degree": 11.200000000000003, "out_degree": 4, "betweenness": 0.00018366565220383823, "pagerank": 0.0006107129510997224, "harmonic": 0.009481037924151696, "bidirectional_harmonic": 0.07669660678642719, "degree": 12 }, "line_count": 40, "code_line_count": 40, "cyclomatic": 25, "halstead_volume": 299.8556500836541, "halstead_difficulty": 5.285714285714286 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker.in_scope", "test_info": { "success": false, "failed": 686, "passed": 1537, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_CRLFLineEndings\nLocation: /usr/lib/python3.12/contextlib.py:137\nError: TypeError: 'NoneType' object is not an iterator\n\nTraceback:\n\n> def test_CRLFLineEndings(self):\n \"\"\"\n Source files with Windows CR LF line endings are parsed successfully.\n \"\"\"\n with self.makeTempFile(\"x = 42\\r\\n\") as sourcePath:\n> self.assertHasErrors(sourcePath, [])\n\n> count = withStderrTo(err, checkPath, path)\n\n> return f(*args, **kwargs)\n\n> return check(codestr, filename, reporter)\n\n> w = checker.Checker(tree, filename=filename)\n\n> with self.in_scope(scope_tp):\n\n> def __enter__(self):\n # do not keep args and kwds alive unnecessarily\n # they are only needed for recreation, which is not possible anymore\n del self.args, self.kwds, self.func\n try:\n> return next(self.gen)\nE TypeError: 'NoneType' object is not an iterator\n", "\n============================================================\nFailure #2: pyflakes/test/test_api.py::CheckTests::test_checkRecursive\nLocation: /usr/lib/python3.12/contextlib.py:137\nError: TypeError: 'NoneType' object is not an iterator\n\nTraceback:\n\n> def test_checkRecursive(self):\n \"\"\"\n L{checkRecursive} descends into each directory, finding Python files\n and reporting problems.\n \"\"\"\n tempdir = tempfile.mkdtemp()\n try:\n os.mkdir(os.path.join(tempdir, 'foo'))\n file1 = os.path.join(tempdir, 'foo', 'bar.py')\n with open(file1, 'wb') as fd:\n fd.write(b\"import baz\\n\")\n file2 = os.path.join(tempdir, 'baz.py')\n with open(file2, 'wb') as fd:\n fd.write(b\"import contraband\")\n log = []\n reporter = LoggingReporter(log)\n> warnings = checkRecursive([tempdir], reporter)\n\n> warnings += checkPath(sourcePath, reporter)\n\n> return check(codestr, filename, reporter)\n\n> w = checker.Checker(tree, filename=filename)\n\n> with self.in_scope(scope_tp):\n\n> def __enter__(self):\n # do not keep args and kwds alive unnecessarily\n # they are only needed for recreation, which is not possible anymore\n del self.args, self.kwds, self.func\n try:\n> return next(self.gen)\nE TypeError: 'NoneType' object is not an iterator\n", "Failure #3: pyflakes/test/test_api.py::CheckTests::test_encodedFileUTF8", "Failure #4: pyflakes/test/test_api.py::CheckTests::test_missingTrailingNewline", "Failure #5: pyflakes/test/test_api.py::CheckTests::test_pyflakesWarning", "Failure #6: pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes", "Failure #7: pyflakes/test/test_api.py::IntegrationTests::test_goodFile", "Failure #8: pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin", "Failure #9: pyflakes/test/test_api.py::TestMain::test_fileWithFlakes", "Failure #10: pyflakes/test/test_api.py::TestMain::test_goodFile", "Failure #11: pyflakes/test/test_api.py::TestMain::test_readFromStdin", "Failure #12: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local", "Failure #13: pyflakes/test/test_builtin.py::TestBuiltins::test_global_shadowing_builtin", "Failure #14: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #15: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #16: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_async_function", "Failure #17: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #18: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_function", "Failure #19: pyflakes/test/test_dict.py::Test::test_duplicate_key_float_and_int", "Failure #20: pyflakes/test/test_dict.py::Test::test_duplicate_keys", "Failure #21: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bools", "Failure #22: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bools_false", "Failure #23: pyflakes/test/test_dict.py::Test::test_duplicate_keys_bytes_vs_unicode_py3", "Failure #24: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_function", "Failure #25: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_lambda", "Failure #26: pyflakes/test/test_dict.py::Test::test_duplicate_keys_ints", "Failure #27: pyflakes/test/test_dict.py::Test::test_duplicate_keys_none", "Failure #28: pyflakes/test/test_dict.py::Test::test_duplicate_keys_tuples", "Failure #29: pyflakes/test/test_dict.py::Test::test_duplicate_keys_tuples_int_and_float", "Failure #30: pyflakes/test/test_dict.py::Test::test_duplicate_values_bytes_vs_unicode_py3", "Failure #31: pyflakes/test/test_dict.py::Test::test_duplicate_variable_keys", "Failure #32: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values", "Failure #33: pyflakes/test/test_dict.py::Test::test_duplicate_variable_values_same_value", "Failure #34: pyflakes/test/test_dict.py::Test::test_multiple_duplicate_keys", "Failure #35: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_error_same_value", "Failure #36: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors", "Failure #37: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_bool_or_none", "Failure #38: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_func_call", "Failure #39: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_instance_attributes", "Failure #40: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_ints", "Failure #41: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_tuples", "Failure #42: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_vars", "Failure #43: pyflakes/test/test_dict.py::Test::test_no_duplicate_keys_tuples_same_first_element", "Failure #44: pyflakes/test/test_doctests.py::TestOther::test_attrAugmentedAssignment", "Failure #45: pyflakes/test/test_doctests.py::TestOther::test_breakInsideLoop", "Failure #46: pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop", "Failure #47: pyflakes/test/test_doctests.py::TestOther::test_classFunctionDecorator", "Failure #48: pyflakes/test/test_doctests.py::TestOther::test_classNameDefinedPreviously", "Failure #49: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody", "Failure #50: pyflakes/test/test_doctests.py::TestOther::test_classRedefinedAsFunction", "Failure #51: pyflakes/test/test_doctests.py::TestOther::test_classRedefinition", "Failure #52: pyflakes/test/test_doctests.py::TestOther::test_classWithReturn", "Failure #53: pyflakes/test/test_doctests.py::TestOther::test_classWithYield", "Failure #54: pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom", "Failure #55: pyflakes/test/test_doctests.py::TestOther::test_comparison", "Failure #56: pyflakes/test/test_doctests.py::TestOther::test_containment", "Failure #57: pyflakes/test/test_doctests.py::TestOther::test_continueInsideLoop", "Failure #58: pyflakes/test/test_doctests.py::TestOther::test_continueOutsideLoop", "Failure #59: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptLast", "Failure #60: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptNotLast", "Failure #61: pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentConditionally", "Failure #62: pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentWithUse", "Failure #63: pyflakes/test/test_doctests.py::TestOther::test_duplicateArgs", "Failure #64: pyflakes/test/test_doctests.py::TestOther::test_ellipsis", "Failure #65: pyflakes/test/test_doctests.py::TestOther::test_extendedSlice", "Failure #66: pyflakes/test/test_doctests.py::TestOther::test_functionDecorator", "Failure #67: pyflakes/test/test_doctests.py::TestOther::test_functionRedefinedAsClass", "Failure #68: pyflakes/test/test_doctests.py::TestOther::test_function_arguments", "Failure #69: pyflakes/test/test_doctests.py::TestOther::test_function_arguments_python3", "Failure #70: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #71: pyflakes/test/test_doctests.py::TestOther::test_global_nonlocal_in_class_bodies", "Failure #72: pyflakes/test/test_doctests.py::TestOther::test_identity", "Failure #73: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #74: pyflakes/test/test_doctests.py::TestOther::test_loopControl", "Failure #75: pyflakes/test/test_doctests.py::TestOther::test_modernProperty", "Failure #76: pyflakes/test/test_doctests.py::TestOther::test_moduleWithReturn", "Failure #77: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYield", "Failure #78: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYieldFrom", "Failure #79: pyflakes/test/test_doctests.py::TestOther::test_redefinedClassFunction", "Failure #80: pyflakes/test/test_doctests.py::TestOther::test_redefinedFunction", "Failure #81: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseFunction", "Failure #82: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseInListComp", "Failure #83: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfFunction", "Failure #84: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #85: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #86: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #87: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryExceptFunction", "Failure #88: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction", "Failure #89: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreFunction", "Failure #90: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreImportation", "Failure #91: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #92: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentErrors", "Failure #93: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentNoError", "Failure #94: pyflakes/test/test_doctests.py::TestOther::test_unaryPlus", "Failure #95: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #96: pyflakes/test/test_doctests.py::TestOther::test_unused_global_in_class", "Failure #97: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #98: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #99: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_in_clas", "Failure #100: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #101: pyflakes/test/test_doctests.py::TestOther::test_varAugmentedAssignment", "Failure #102: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #103: pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule", "Failure #104: pyflakes/test/test_doctests.py::TestImports::test_assignRHSFirst", "Failure #105: pyflakes/test/test_doctests.py::TestImports::test_assignedToGlobal", "Failure #106: pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport", "Failure #107: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #108: pyflakes/test/test_doctests.py::TestImports::test_functionNamesAreBoundNow", "Failure #109: pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater", "Failure #110: pyflakes/test/test_doctests.py::TestImports::test_futureImport", "Failure #111: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #112: pyflakes/test/test_doctests.py::TestImports::test_futureImportStar", "Failure #113: pyflakes/test/test_doctests.py::TestImports::test_futureImportUndefined", "Failure #114: pyflakes/test/test_doctests.py::TestImports::test_futureImportUsed", "Failure #115: pyflakes/test/test_doctests.py::TestImports::test_ignoreNonImportRedefinitions", "Failure #116: pyflakes/test/test_doctests.py::TestImports::test_importInClass", "Failure #117: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #118: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #119: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #120: pyflakes/test/test_doctests.py::TestImports::test_importedInClass", "Failure #121: pyflakes/test/test_doctests.py::TestImports::test_localImportStar", "Failure #122: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #123: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #124: pyflakes/test/test_doctests.py::TestImports::test_nestedFunctionsNestScope", "Failure #125: pyflakes/test/test_doctests.py::TestImports::test_newAssignment", "Failure #126: pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine", "Failure #127: pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope", "Failure #128: pyflakes/test/test_doctests.py::TestImports::test_packageImport", "Failure #129: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #130: pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass", "Failure #131: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #132: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #133: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFunction", "Failure #134: pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass", "Failure #135: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #136: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #137: pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass", "Failure #138: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #139: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #140: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #141: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #142: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #143: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #144: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #145: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #146: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #147: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #148: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #149: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #150: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #151: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #152: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #153: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #154: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #155: pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative", "Failure #156: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #157: pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport", "Failure #158: pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import", "Failure #159: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #160: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #161: pyflakes/test/test_doctests.py::TestImports::test_usedImport_relative", "Failure #162: pyflakes/test/test_doctests.py::TestImports::test_usedInAssert", "Failure #163: pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment", "Failure #164: pyflakes/test/test_doctests.py::TestImports::test_usedInAttributeAssign", "Failure #165: pyflakes/test/test_doctests.py::TestImports::test_usedInCall", "Failure #166: pyflakes/test/test_doctests.py::TestImports::test_usedInClass", "Failure #167: pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase", "Failure #168: pyflakes/test/test_doctests.py::TestImports::test_usedInDict", "Failure #169: pyflakes/test/test_doctests.py::TestImports::test_usedInElifConditional", "Failure #170: pyflakes/test/test_doctests.py::TestImports::test_usedInElse", "Failure #171: pyflakes/test/test_doctests.py::TestImports::test_usedInExcept", "Failure #172: pyflakes/test/test_doctests.py::TestImports::test_usedInExec", "Failure #173: pyflakes/test/test_doctests.py::TestImports::test_usedInFor", "Failure #174: pyflakes/test/test_doctests.py::TestImports::test_usedInForElse", "Failure #175: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #176: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #177: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #178: pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody", "Failure #179: pyflakes/test/test_doctests.py::TestImports::test_usedInIfConditional", "Failure #180: pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg", "Failure #181: pyflakes/test/test_doctests.py::TestImports::test_usedInLambda", "Failure #182: pyflakes/test/test_doctests.py::TestImports::test_usedInList", "Failure #183: pyflakes/test/test_doctests.py::TestImports::test_usedInListComp", "Failure #184: pyflakes/test/test_doctests.py::TestImports::test_usedInLogic", "Failure #185: pyflakes/test/test_doctests.py::TestImports::test_usedInOperators", "Failure #186: pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault", "Failure #187: pyflakes/test/test_doctests.py::TestImports::test_usedInRaise", "Failure #188: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #189: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice", "Failure #190: pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj", "Failure #191: pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript", "Failure #192: pyflakes/test/test_doctests.py::TestImports::test_usedInTry", "Failure #193: pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally", "Failure #194: pyflakes/test/test_doctests.py::TestImports::test_usedInTuple", "Failure #195: pyflakes/test/test_doctests.py::TestImports::test_usedInWhile", "Failure #196: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #197: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import", "Failure #198: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import_of_alias", "Failure #199: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #200: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #201: pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtinWindowsError", "Failure #202: pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtins", "Failure #203: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarArgs", "Failure #204: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarUnpack", "Failure #205: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobal", "Failure #206: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobalMultipleNames", "Failure #207: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInDictionaryComprehension", "Failure #208: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInGenerator", "Failure #209: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClass", "Failure #210: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClassNested", "Failure #211: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInGenExp", "Failure #212: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInListComp", "Failure #213: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #214: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditional", "Failure #215: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditionalNested", "Failure #216: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delExceptionInExcept", "Failure #217: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delGlobal", "Failure #218: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined", "Failure #219: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhile", "Failure #220: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileNested", "Failure #221: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileTestUsage", "Failure #222: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #223: pyflakes/test/test_doctests.py::TestUndefinedNames::test_dunderClass", "Failure #224: pyflakes/test/test_doctests.py::TestUndefinedNames::test_functionsNeedGlobalScope", "Failure #225: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalFromNestedScope", "Failure #226: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #227: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #228: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #229: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #230: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs", "Failure #231: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #232: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #233: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #234: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #235: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsBuiltins", "Failure #236: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsFile", "Failure #237: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsName", "Failure #238: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath", "Failure #239: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #240: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #241: pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined", "Failure #242: pyflakes/test/test_doctests.py::TestUndefinedNames::test_moduleAnnotations", "Failure #243: pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks", "Failure #244: pyflakes/test/test_doctests.py::TestUndefinedNames::test_nestedClass", "Failure #245: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined", "Failure #246: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #247: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #248: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #249: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #250: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #251: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #252: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #253: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #254: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #255: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #256: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #257: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #258: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #259: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #260: pyflakes/test/test_doctests.py::TestUndefinedNames::test_usedAsStarUnpack", "Failure #261: pyflakes/test/test_doctests.py::Test::test_doctestCanReferToClass", "Failure #262: pyflakes/test/test_doctests.py::Test::test_doctestCanReferToFunction", "Failure #263: pyflakes/test/test_doctests.py::Test::test_globalUnderscoreInDoctest", "Failure #264: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #265: pyflakes/test/test_doctests.py::Test::test_global_undefined", "Failure #266: pyflakes/test/test_doctests.py::Test::test_ignore_nested_function", "Failure #267: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #268: pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter", "Failure #269: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #270: pyflakes/test/test_doctests.py::Test::test_indentationErrorInDoctest", "Failure #271: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #272: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #273: pyflakes/test/test_doctests.py::Test::test_noOffsetSyntaxErrorInDoctest", "Failure #274: pyflakes/test/test_doctests.py::Test::test_offsetAfterDoctests", "Failure #275: pyflakes/test/test_doctests.py::Test::test_offsetInDoctests", "Failure #276: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #277: pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs", "Failure #278: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #279: pyflakes/test/test_doctests.py::Test::test_singleUnderscoreInDoctest", "Failure #280: pyflakes/test/test_doctests.py::Test::test_syntaxErrorInDoctest", "Failure #281: pyflakes/test/test_imports.py::TestImportationObject::test_unusedImport_underscore", "Failure #282: pyflakes/test/test_imports.py::Test::test_aliasedImport", "Failure #283: pyflakes/test/test_imports.py::Test::test_aliasedImportShadowModule", "Failure #284: pyflakes/test/test_imports.py::Test::test_assignRHSFirst", "Failure #285: pyflakes/test/test_imports.py::Test::test_assignedToGlobal", "Failure #286: pyflakes/test/test_imports.py::Test::test_differentSubmoduleImport", "Failure #287: pyflakes/test/test_imports.py::Test::test_duplicateSubmoduleImport", "Failure #288: pyflakes/test/test_imports.py::Test::test_functionNamesAreBoundNow", "Failure #289: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #290: pyflakes/test/test_imports.py::Test::test_futureImport", "Failure #291: pyflakes/test/test_imports.py::Test::test_futureImportFirst", "Failure #292: pyflakes/test/test_imports.py::Test::test_futureImportStar", "Failure #293: pyflakes/test/test_imports.py::Test::test_futureImportUndefined", "Failure #294: pyflakes/test/test_imports.py::Test::test_futureImportUsed", "Failure #295: pyflakes/test/test_imports.py::Test::test_ignoreNonImportRedefinitions", "Failure #296: pyflakes/test/test_imports.py::Test::test_importInClass", "Failure #297: pyflakes/test/test_imports.py::Test::test_importStar", "Failure #298: pyflakes/test/test_imports.py::Test::test_importStar_relative", "Failure #299: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #300: pyflakes/test/test_imports.py::Test::test_importedInClass", "Failure #301: pyflakes/test/test_imports.py::Test::test_localImportStar", "Failure #302: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #303: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #304: pyflakes/test/test_imports.py::Test::test_nestedFunctionsNestScope", "Failure #305: pyflakes/test/test_imports.py::Test::test_newAssignment", "Failure #306: pyflakes/test/test_imports.py::Test::test_nonGlobalDoesNotRedefine", "Failure #307: pyflakes/test/test_imports.py::Test::test_notUsedInNestedScope", "Failure #308: pyflakes/test/test_imports.py::Test::test_packageImport", "Failure #309: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #310: pyflakes/test/test_imports.py::Test::test_redefinedByClass", "Failure #311: pyflakes/test/test_imports.py::Test::test_redefinedByExcept", "Failure #312: pyflakes/test/test_imports.py::Test::test_redefinedByFor", "Failure #313: pyflakes/test/test_imports.py::Test::test_redefinedByFunction", "Failure #314: pyflakes/test/test_imports.py::Test::test_redefinedBySubclass", "Failure #315: pyflakes/test/test_imports.py::Test::test_redefinedIf", "Failure #316: pyflakes/test/test_imports.py::Test::test_redefinedIfElse", "Failure #317: pyflakes/test/test_imports.py::Test::test_redefinedInClass", "Failure #318: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunction", "Failure #319: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunctionTwice", "Failure #320: pyflakes/test/test_imports.py::Test::test_redefinedTry", "Failure #321: pyflakes/test/test_imports.py::Test::test_redefinedTryElse", "Failure #322: pyflakes/test/test_imports.py::Test::test_redefinedTryExcept", "Failure #323: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElse", "Failure #324: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptElseFinally", "Failure #325: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptFinally", "Failure #326: pyflakes/test/test_imports.py::Test::test_redefinedTryExceptMulti", "Failure #327: pyflakes/test/test_imports.py::Test::test_redefinedTryNested", "Failure #328: pyflakes/test/test_imports.py::Test::test_redefinedWhileUnused", "Failure #329: pyflakes/test/test_imports.py::Test::test_shadowedByFor", "Failure #330: pyflakes/test/test_imports.py::Test::test_shadowedByForDeep", "Failure #331: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #332: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #333: pyflakes/test/test_imports.py::Test::test_tryingMultipleImports", "Failure #334: pyflakes/test/test_imports.py::Test::test_unusedImport", "Failure #335: pyflakes/test/test_imports.py::Test::test_unusedImport_relative", "Failure #336: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #337: pyflakes/test/test_imports.py::Test::test_unusedPackageImport", "Failure #338: pyflakes/test/test_imports.py::Test::test_unused_package_with_submodule_import", "Failure #339: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #340: pyflakes/test/test_imports.py::Test::test_usedImport", "Failure #341: pyflakes/test/test_imports.py::Test::test_usedImport_relative", "Failure #342: pyflakes/test/test_imports.py::Test::test_usedInAssert", "Failure #343: pyflakes/test/test_imports.py::Test::test_usedInAssignment", "Failure #344: pyflakes/test/test_imports.py::Test::test_usedInAttributeAssign", "Failure #345: pyflakes/test/test_imports.py::Test::test_usedInCall", "Failure #346: pyflakes/test/test_imports.py::Test::test_usedInClass", "Failure #347: pyflakes/test/test_imports.py::Test::test_usedInClassBase", "Failure #348: pyflakes/test/test_imports.py::Test::test_usedInDict", "Failure #349: pyflakes/test/test_imports.py::Test::test_usedInElifConditional", "Failure #350: pyflakes/test/test_imports.py::Test::test_usedInElse", "Failure #351: pyflakes/test/test_imports.py::Test::test_usedInExcept", "Failure #352: pyflakes/test/test_imports.py::Test::test_usedInExec", "Failure #353: pyflakes/test/test_imports.py::Test::test_usedInFor", "Failure #354: pyflakes/test/test_imports.py::Test::test_usedInForElse", "Failure #355: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #356: pyflakes/test/test_imports.py::Test::test_usedInGetattr", "Failure #357: pyflakes/test/test_imports.py::Test::test_usedInGlobal", "Failure #358: pyflakes/test/test_imports.py::Test::test_usedInIfBody", "Failure #359: pyflakes/test/test_imports.py::Test::test_usedInIfConditional", "Failure #360: pyflakes/test/test_imports.py::Test::test_usedInKeywordArg", "Failure #361: pyflakes/test/test_imports.py::Test::test_usedInLambda", "Failure #362: pyflakes/test/test_imports.py::Test::test_usedInList", "Failure #363: pyflakes/test/test_imports.py::Test::test_usedInListComp", "Failure #364: pyflakes/test/test_imports.py::Test::test_usedInLogic", "Failure #365: pyflakes/test/test_imports.py::Test::test_usedInOperators", "Failure #366: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #367: pyflakes/test/test_imports.py::Test::test_usedInRaise", "Failure #368: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #369: pyflakes/test/test_imports.py::Test::test_usedInSlice", "Failure #370: pyflakes/test/test_imports.py::Test::test_usedInSliceObj", "Failure #371: pyflakes/test/test_imports.py::Test::test_usedInSubscript", "Failure #372: pyflakes/test/test_imports.py::Test::test_usedInTry", "Failure #373: pyflakes/test/test_imports.py::Test::test_usedInTryFinally", "Failure #374: pyflakes/test/test_imports.py::Test::test_usedInTuple", "Failure #375: pyflakes/test/test_imports.py::Test::test_usedInWhile", "Failure #376: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #377: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import", "Failure #378: pyflakes/test/test_imports.py::Test::test_used_package_with_submodule_import_of_alias", "Failure #379: pyflakes/test/test_imports.py::TestSpecialAll::test_all_mixed_attributes_and_strings", "Failure #380: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes", "Failure #381: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_attributes_added", "Failure #382: pyflakes/test/test_imports.py::TestSpecialAll::test_all_with_names", "Failure #383: pyflakes/test/test_imports.py::TestSpecialAll::test_augmentedAssignment", "Failure #384: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInClass", "Failure #385: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #386: pyflakes/test/test_imports.py::TestSpecialAll::test_ignored_when_not_directly_assigned", "Failure #387: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarExported", "Failure #388: pyflakes/test/test_imports.py::TestSpecialAll::test_importStarNotExported", "Failure #389: pyflakes/test/test_imports.py::TestSpecialAll::test_list_concatenation_assignment", "Failure #390: pyflakes/test/test_imports.py::TestSpecialAll::test_redefinedByGenExp", "Failure #391: pyflakes/test/test_imports.py::TestSpecialAll::test_tuple_concatenation_assignment", "Failure #392: pyflakes/test/test_imports.py::TestSpecialAll::test_unboundExported", "Failure #393: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #394: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #395: pyflakes/test/test_imports.py::TestSpecialAll::test_usedInGenExp", "Failure #396: pyflakes/test/test_imports.py::TestSpecialAll::test_warningSuppressed", "Failure #397: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str", "Failure #398: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_str_end", "Failure #399: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_true", "Failure #400: pyflakes/test/test_is_literal.py::Test::test_chained_operators_is_true_end", "Failure #401: pyflakes/test/test_is_literal.py::Test::test_is_bytes", "Failure #402: pyflakes/test/test_is_literal.py::Test::test_is_false", "Failure #403: pyflakes/test/test_is_literal.py::Test::test_is_int", "Failure #404: pyflakes/test/test_is_literal.py::Test::test_is_not_bytes", "Failure #405: pyflakes/test/test_is_literal.py::Test::test_is_not_false", "Failure #406: pyflakes/test/test_is_literal.py::Test::test_is_not_int", "Failure #407: pyflakes/test/test_is_literal.py::Test::test_is_not_str", "Failure #408: pyflakes/test/test_is_literal.py::Test::test_is_not_true", "Failure #409: pyflakes/test/test_is_literal.py::Test::test_is_not_unicode", "Failure #410: pyflakes/test/test_is_literal.py::Test::test_is_str", "Failure #411: pyflakes/test/test_is_literal.py::Test::test_is_true", "Failure #412: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant", "Failure #413: pyflakes/test/test_is_literal.py::Test::test_is_tuple_constant_containing_constants", "Failure #414: pyflakes/test/test_is_literal.py::Test::test_is_tuple_containing_variables_ok", "Failure #415: pyflakes/test/test_is_literal.py::Test::test_is_unicode", "Failure #416: pyflakes/test/test_is_literal.py::Test::test_left_is_bytes", "Failure #417: pyflakes/test/test_is_literal.py::Test::test_left_is_false", "Failure #418: pyflakes/test/test_is_literal.py::Test::test_left_is_int", "Failure #419: pyflakes/test/test_is_literal.py::Test::test_left_is_not_bytes", "Failure #420: pyflakes/test/test_is_literal.py::Test::test_left_is_not_false", "Failure #421: pyflakes/test/test_is_literal.py::Test::test_left_is_not_int", "Failure #422: pyflakes/test/test_is_literal.py::Test::test_left_is_not_str", "Failure #423: pyflakes/test/test_is_literal.py::Test::test_left_is_not_true", "Failure #424: pyflakes/test/test_is_literal.py::Test::test_left_is_not_unicode", "Failure #425: pyflakes/test/test_is_literal.py::Test::test_left_is_str", "Failure #426: pyflakes/test/test_is_literal.py::Test::test_left_is_true", "Failure #427: pyflakes/test/test_is_literal.py::Test::test_left_is_unicode", "Failure #428: pyflakes/test/test_match.py::TestMatch::test_defined_in_different_branches", "Failure #429: pyflakes/test/test_match.py::TestMatch::test_match_bindings", "Failure #430: pyflakes/test/test_match.py::TestMatch::test_match_double_star", "Failure #431: pyflakes/test/test_match.py::TestMatch::test_match_or_pattern", "Failure #432: pyflakes/test/test_match.py::TestMatch::test_match_pattern_matched_class", "Failure #433: pyflakes/test/test_match.py::TestMatch::test_match_placeholder", "Failure #434: pyflakes/test/test_match.py::TestMatch::test_match_singleton", "Failure #435: pyflakes/test/test_match.py::TestMatch::test_match_star", "Failure #436: pyflakes/test/test_other.py::Test::test_attrAugmentedAssignment", "Failure #437: pyflakes/test/test_other.py::Test::test_breakInsideLoop", "Failure #438: pyflakes/test/test_other.py::Test::test_breakOutsideLoop", "Failure #439: pyflakes/test/test_other.py::Test::test_classFunctionDecorator", "Failure #440: pyflakes/test/test_other.py::Test::test_classNameDefinedPreviously", "Failure #441: pyflakes/test/test_other.py::Test::test_classNameUndefinedInClassBody", "Failure #442: pyflakes/test/test_other.py::Test::test_classRedefinedAsFunction", "Failure #443: pyflakes/test/test_other.py::Test::test_classRedefinition", "Failure #444: pyflakes/test/test_other.py::Test::test_classWithReturn", "Failure #445: pyflakes/test/test_other.py::Test::test_classWithYield", "Failure #446: pyflakes/test/test_other.py::Test::test_classWithYieldFrom", "Failure #447: pyflakes/test/test_other.py::Test::test_comparison", "Failure #448: pyflakes/test/test_other.py::Test::test_containment", "Failure #449: pyflakes/test/test_other.py::Test::test_continueInsideLoop", "Failure #450: pyflakes/test/test_other.py::Test::test_continueOutsideLoop", "Failure #451: pyflakes/test/test_other.py::Test::test_defaultExceptLast", "Failure #452: pyflakes/test/test_other.py::Test::test_defaultExceptNotLast", "Failure #453: pyflakes/test/test_other.py::Test::test_doubleAssignmentConditionally", "Failure #454: pyflakes/test/test_other.py::Test::test_doubleAssignmentWithUse", "Failure #455: pyflakes/test/test_other.py::Test::test_duplicateArgs", "Failure #456: pyflakes/test/test_other.py::Test::test_ellipsis", "Failure #457: pyflakes/test/test_other.py::Test::test_extendedSlice", "Failure #458: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #459: pyflakes/test/test_other.py::Test::test_functionRedefinedAsClass", "Failure #460: pyflakes/test/test_other.py::Test::test_function_arguments", "Failure #461: pyflakes/test/test_other.py::Test::test_function_arguments_python3", "Failure #462: pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope", "Failure #463: pyflakes/test/test_other.py::Test::test_global_nonlocal_in_class_bodies", "Failure #464: pyflakes/test/test_other.py::Test::test_identity", "Failure #465: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #466: pyflakes/test/test_other.py::Test::test_loopControl", "Failure #467: pyflakes/test/test_other.py::Test::test_modernProperty", "Failure #468: pyflakes/test/test_other.py::Test::test_moduleWithReturn", "Failure #469: pyflakes/test/test_other.py::Test::test_moduleWithYield", "Failure #470: pyflakes/test/test_other.py::Test::test_moduleWithYieldFrom", "Failure #471: pyflakes/test/test_other.py::Test::test_redefinedClassFunction", "Failure #472: pyflakes/test/test_other.py::Test::test_redefinedFunction", "Failure #473: pyflakes/test/test_other.py::Test::test_redefinedIfElseFunction", "Failure #474: pyflakes/test/test_other.py::Test::test_redefinedIfElseInListComp", "Failure #475: pyflakes/test/test_other.py::Test::test_redefinedIfFunction", "Failure #476: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #477: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #478: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #479: pyflakes/test/test_other.py::Test::test_redefinedTryExceptFunction", "Failure #480: pyflakes/test/test_other.py::Test::test_redefinedTryFunction", "Failure #481: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreFunction", "Failure #482: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreImportation", "Failure #483: pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable", "Failure #484: pyflakes/test/test_other.py::Test::test_starredAssignmentErrors", "Failure #485: pyflakes/test/test_other.py::Test::test_starredAssignmentNoError", "Failure #486: pyflakes/test/test_other.py::Test::test_unaryPlus", "Failure #487: pyflakes/test/test_other.py::Test::test_undefinedBaseClass", "Failure #488: pyflakes/test/test_other.py::Test::test_unused_global_in_class", "Failure #489: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #490: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #491: pyflakes/test/test_other.py::Test::test_unused_nonlocal_in_clas", "Failure #492: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #493: pyflakes/test/test_other.py::Test::test_varAugmentedAssignment", "Failure #494: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_static", "Failure #495: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_tuple", "Failure #496: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_tuple_empty", "Failure #497: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_with_message", "Failure #498: pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_without_message", "Failure #499: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInForLoop", "Failure #500: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInListComprehension", "Failure #501: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToGlobal", "Failure #502: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToMember", "Failure #503: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToNonlocal", "Failure #504: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr", "Failure #505: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_after_annotation", "Failure #506: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope", "Failure #507: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope_reassigns_parameter", "Failure #508: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_nested", "Failure #509: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignmentInsideLoop", "Failure #510: pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall", "Failure #511: pyflakes/test/test_other.py::TestUnusedAssignment::test_closedOver", "Failure #512: pyflakes/test/test_other.py::TestUnusedAssignment::test_debuggerskipSpecialVariable", "Failure #513: pyflakes/test/test_other.py::TestUnusedAssignment::test_dictComprehension", "Failure #514: pyflakes/test/test_other.py::TestUnusedAssignment::test_doubleClosedOver", "Failure #515: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #516: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #517: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExcept", "Failure #518: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #519: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUsedInExcept", "Failure #520: pyflakes/test/test_other.py::TestUnusedAssignment::test_exception_unused_in_except_star", "Failure #521: pyflakes/test/test_other.py::TestUnusedAssignment::test_f_string", "Failure #522: pyflakes/test/test_other.py::TestUnusedAssignment::test_generatorExpression", "Failure #523: pyflakes/test/test_other.py::TestUnusedAssignment::test_if_tuple", "Failure #524: pyflakes/test/test_other.py::TestUnusedAssignment::test_ifexp", "Failure #525: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #526: pyflakes/test/test_other.py::TestUnusedAssignment::test_setComprehensionAndLiteral", "Failure #527: pyflakes/test/test_other.py::TestUnusedAssignment::test_tracebackhideSpecialVariable", "Failure #528: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #529: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedUnderscoreVariable", "Failure #530: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #531: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableAsLocals", "Failure #532: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #533: pyflakes/test/test_other.py::TestUnusedAssignment::test_variableUsedInLoop", "Failure #534: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementAttributeName", "Failure #535: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementComplicatedTarget", "Failure #536: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementListNames", "Failure #537: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNameDefinedInBody", "Failure #538: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNoNames", "Failure #539: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleName", "Failure #540: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameRedefined", "Failure #541: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameUndefined", "Failure #542: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscript", "Failure #543: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined", "Failure #544: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNames", "Failure #545: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined", "Failure #546: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesUndefined", "Failure #547: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInExpression", "Failure #548: pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInside", "Failure #549: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #550: pyflakes/test/test_other.py::TestStringFormatting::test_f_string_without_placeholders", "Failure #551: pyflakes/test/test_other.py::TestStringFormatting::test_invalid_dot_format_calls", "Failure #552: pyflakes/test/test_other.py::TestStringFormatting::test_invalid_percent_format_calls", "Failure #553: pyflakes/test/test_other.py::TestStringFormatting::test_ok_percent_format_cannot_determine_element_count", "Failure #554: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDef", "Failure #555: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefAwait", "Failure #556: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #557: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncFor", "Failure #558: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncForUnderscoreLoopVar", "Failure #559: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWith", "Failure #560: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem", "Failure #561: pyflakes/test/test_other.py::TestAsyncStatements::test_formatstring", "Failure #562: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncFor", "Failure #563: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse", "Failure #564: pyflakes/test/test_other.py::TestAsyncStatements::test_matmul", "Failure #565: pyflakes/test/test_other.py::TestAsyncStatements::test_raise_notimplemented", "Failure #566: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future", "Failure #567: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_as_condition_test", "Failure #568: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_augmented_assign", "Failure #569: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_function_assignment", "Failure #570: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_in_lambda", "Failure #571: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_returned_in_function", "Failure #572: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_valid_print", "Failure #573: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #574: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import", "Failure #575: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_async_def", "Failure #576: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #577: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #578: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #579: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #580: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import", "Failure #581: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #582: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #583: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #584: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #585: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #586: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #587: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #588: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #589: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #590: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_not_a_typing_overload", "Failure #591: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #592: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #593: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #594: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #595: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #596: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #597: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #598: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #599: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #600: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #601: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #602: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #603: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #604: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #605: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_cast_literal_str_to_str", "Failure #606: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #607: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_TypeVarTuple", "Failure #608: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_classes", "Failure #609: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #610: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #611: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_functions", "Failure #612: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_statements", "Failure #613: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #614: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #615: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #616: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync", "Failure #617: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol", "Failure #618: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unassigned_annotation_is_undefined", "Failure #619: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #620: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #621: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotation_references_self_name_undefined", "Failure #622: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #623: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #624: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #625: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #626: pyflakes/test/test_undefined_names.py::Test::test_builtinWindowsError", "Failure #627: pyflakes/test/test_undefined_names.py::Test::test_builtins", "Failure #628: pyflakes/test/test_undefined_names.py::Test::test_definedAsStarArgs", "Failure #629: pyflakes/test/test_undefined_names.py::Test::test_definedAsStarUnpack", "Failure #630: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobal", "Failure #631: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobalMultipleNames", "Failure #632: pyflakes/test/test_undefined_names.py::Test::test_definedFromLambdaInDictionaryComprehension", "Failure #633: pyflakes/test/test_undefined_names.py::Test::test_definedFromLambdaInGenerator", "Failure #634: pyflakes/test/test_undefined_names.py::Test::test_definedInClass", "Failure #635: pyflakes/test/test_undefined_names.py::Test::test_definedInClassNested", "Failure #636: pyflakes/test/test_undefined_names.py::Test::test_definedInGenExp", "Failure #637: pyflakes/test/test_undefined_names.py::Test::test_definedInListComp", "Failure #638: pyflakes/test/test_undefined_names.py::Test::test_del", "Failure #639: pyflakes/test/test_undefined_names.py::Test::test_delConditional", "Failure #640: pyflakes/test/test_undefined_names.py::Test::test_delConditionalNested", "Failure #641: pyflakes/test/test_undefined_names.py::Test::test_delExceptionInExcept", "Failure #642: pyflakes/test/test_undefined_names.py::Test::test_delGlobal", "Failure #643: pyflakes/test/test_undefined_names.py::Test::test_delUndefined", "Failure #644: pyflakes/test/test_undefined_names.py::Test::test_delWhile", "Failure #645: pyflakes/test/test_undefined_names.py::Test::test_delWhileNested", "Failure #646: pyflakes/test/test_undefined_names.py::Test::test_delWhileTestUsage", "Failure #647: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #648: pyflakes/test/test_undefined_names.py::Test::test_dunderClass", "Failure #649: pyflakes/test/test_undefined_names.py::Test::test_functionsNeedGlobalScope", "Failure #650: pyflakes/test/test_undefined_names.py::Test::test_globalFromNestedScope", "Failure #651: pyflakes/test/test_undefined_names.py::Test::test_globalImportStar", "Failure #652: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #653: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #654: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #655: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs", "Failure #656: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #657: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #658: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #659: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #660: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsBuiltins", "Failure #661: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsFile", "Failure #662: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsName", "Failure #663: pyflakes/test/test_undefined_names.py::Test::test_magicGlobalsPath", "Failure #664: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #665: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #666: pyflakes/test/test_undefined_names.py::Test::test_metaClassUndefined", "Failure #667: pyflakes/test/test_undefined_names.py::Test::test_moduleAnnotations", "Failure #668: pyflakes/test/test_undefined_names.py::Test::test_namesDeclaredInExceptBlocks", "Failure #669: pyflakes/test/test_undefined_names.py::Test::test_nestedClass", "Failure #670: pyflakes/test/test_undefined_names.py::Test::test_undefined", "Failure #671: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #672: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionName", "Failure #673: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #674: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #675: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #676: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #677: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #678: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInComprehension", "Failure #679: pyflakes/test/test_undefined_names.py::Test::test_undefinedFromLambdaInDictionaryComprehension", "Failure #680: pyflakes/test/test_undefined_names.py::Test::test_undefinedInGenExpNested", "Failure #681: pyflakes/test/test_undefined_names.py::Test::test_undefinedInListComp", "Failure #682: pyflakes/test/test_undefined_names.py::Test::test_undefinedInLoop", "Failure #683: pyflakes/test/test_undefined_names.py::Test::test_undefinedWithErrorHandler", "Failure #684: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack", "Failure #685: pyflakes/test/test_undefined_names.py::Test::test_usedAsStarUnpack", "Failure #686: pyflakes/test/test_undefined_names.py::NameTests::test_impossibleContext" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_CRLFLineEndings" ], [ "pyflakes/test/test_api.py", "test_checkRecursive" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 6, "true_in_degree": 7.6, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0005990284005979074, "harmonic": 0.0, "bidirectional_harmonic": 0.05583832335329342, "degree": 6 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker._type_param_scope", "test_info": { "success": false, "failed": 426, "passed": 1797, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_missingTrailingNewline\nLocation: /usr/lib/python3.12/contextlib.py:137\nError: TypeError: 'NoneType' object is not an iterator\n\nTraceback:\n\n> def test_missingTrailingNewline(self):\n \"\"\"\n Source which doesn't end with a newline shouldn't cause any\n exception to be raised nor an error indicator to be returned by\n L{check}.\n \"\"\"\n with self.makeTempFile(\"def foo():\\n\\tpass\\n\\t\") as fName:\n> self.assertHasErrors(fName, [])\n\n> count = withStderrTo(err, checkPath, path)\n\n> return f(*args, **kwargs)\n\n> return check(codestr, filename, reporter)\n\n> w = checker.Checker(tree, filename=filename)\n\n> self.handleChildren(tree)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> with self._type_param_scope(node):\n\n> def __enter__(self):\n # do not keep args and kwds alive unnecessarily\n # they are only needed for recreation, which is not possible anymore\n del self.args, self.kwds, self.func\n try:\n> return next(self.gen)\nE TypeError: 'NoneType' object is not an iterator\n", "\n============================================================\nFailure #2: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local\nLocation: /usr/lib/python3.12/contextlib.py:137\nError: TypeError: 'NoneType' object is not an iterator\n\nTraceback:\n\n> def test_builtin_unbound_local(self):\n> self.flakes('''\n def foo():\n a = range(1, 10)\n range = a\n return range\n \n foo()\n \n print(range)\n ''', m.UndefinedLocal)\n\n> w = checker.Checker(tree, withDoctest=self.withDoctest, **kw)\n\n> self.handleChildren(tree)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> with self._type_param_scope(node):\n\n> def __enter__(self):\n # do not keep args and kwds alive unnecessarily\n # they are only needed for recreation, which is not possible anymore\n del self.args, self.kwds, self.func\n try:\n> return next(self.gen)\nE TypeError: 'NoneType' object is not an iterator\n", "Failure #3: pyflakes/test/test_builtin.py::TestBuiltins::test_global_shadowing_builtin", "Failure #4: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #5: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #6: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #7: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_function", "Failure #8: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_function", "Failure #9: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_func_call", "Failure #10: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_instance_attributes", "Failure #11: pyflakes/test/test_doctests.py::TestOther::test_attrAugmentedAssignment", "Failure #12: pyflakes/test/test_doctests.py::TestOther::test_breakInsideLoop", "Failure #13: pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop", "Failure #14: pyflakes/test/test_doctests.py::TestOther::test_classFunctionDecorator", "Failure #15: pyflakes/test/test_doctests.py::TestOther::test_classNameDefinedPreviously", "Failure #16: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody", "Failure #17: pyflakes/test/test_doctests.py::TestOther::test_classRedefinedAsFunction", "Failure #18: pyflakes/test/test_doctests.py::TestOther::test_classRedefinition", "Failure #19: pyflakes/test/test_doctests.py::TestOther::test_classWithReturn", "Failure #20: pyflakes/test/test_doctests.py::TestOther::test_classWithYield", "Failure #21: pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom", "Failure #22: pyflakes/test/test_doctests.py::TestOther::test_comparison", "Failure #23: pyflakes/test/test_doctests.py::TestOther::test_containment", "Failure #24: pyflakes/test/test_doctests.py::TestOther::test_continueInsideLoop", "Failure #25: pyflakes/test/test_doctests.py::TestOther::test_continueOutsideLoop", "Failure #26: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptLast", "Failure #27: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptNotLast", "Failure #28: pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentConditionally", "Failure #29: pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentWithUse", "Failure #30: pyflakes/test/test_doctests.py::TestOther::test_duplicateArgs", "Failure #31: pyflakes/test/test_doctests.py::TestOther::test_ellipsis", "Failure #32: pyflakes/test/test_doctests.py::TestOther::test_extendedSlice", "Failure #33: pyflakes/test/test_doctests.py::TestOther::test_functionDecorator", "Failure #34: pyflakes/test/test_doctests.py::TestOther::test_functionRedefinedAsClass", "Failure #35: pyflakes/test/test_doctests.py::TestOther::test_function_arguments", "Failure #36: pyflakes/test/test_doctests.py::TestOther::test_function_arguments_python3", "Failure #37: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #38: pyflakes/test/test_doctests.py::TestOther::test_global_nonlocal_in_class_bodies", "Failure #39: pyflakes/test/test_doctests.py::TestOther::test_identity", "Failure #40: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #41: pyflakes/test/test_doctests.py::TestOther::test_loopControl", "Failure #42: pyflakes/test/test_doctests.py::TestOther::test_modernProperty", "Failure #43: pyflakes/test/test_doctests.py::TestOther::test_moduleWithReturn", "Failure #44: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYield", "Failure #45: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYieldFrom", "Failure #46: pyflakes/test/test_doctests.py::TestOther::test_redefinedClassFunction", "Failure #47: pyflakes/test/test_doctests.py::TestOther::test_redefinedFunction", "Failure #48: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseFunction", "Failure #49: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseInListComp", "Failure #50: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfFunction", "Failure #51: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #52: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #53: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #54: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryExceptFunction", "Failure #55: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction", "Failure #56: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreFunction", "Failure #57: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreImportation", "Failure #58: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #59: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentErrors", "Failure #60: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentNoError", "Failure #61: pyflakes/test/test_doctests.py::TestOther::test_unaryPlus", "Failure #62: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #63: pyflakes/test/test_doctests.py::TestOther::test_unused_global_in_class", "Failure #64: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #65: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #66: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_in_clas", "Failure #67: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #68: pyflakes/test/test_doctests.py::TestOther::test_varAugmentedAssignment", "Failure #69: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #70: pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule", "Failure #71: pyflakes/test/test_doctests.py::TestImports::test_assignRHSFirst", "Failure #72: pyflakes/test/test_doctests.py::TestImports::test_assignedToGlobal", "Failure #73: pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport", "Failure #74: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #75: pyflakes/test/test_doctests.py::TestImports::test_functionNamesAreBoundNow", "Failure #76: pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater", "Failure #77: pyflakes/test/test_doctests.py::TestImports::test_futureImport", "Failure #78: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #79: pyflakes/test/test_doctests.py::TestImports::test_futureImportStar", "Failure #80: pyflakes/test/test_doctests.py::TestImports::test_futureImportUndefined", "Failure #81: pyflakes/test/test_doctests.py::TestImports::test_futureImportUsed", "Failure #82: pyflakes/test/test_doctests.py::TestImports::test_ignoreNonImportRedefinitions", "Failure #83: pyflakes/test/test_doctests.py::TestImports::test_importInClass", "Failure #84: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #85: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #86: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #87: pyflakes/test/test_doctests.py::TestImports::test_importedInClass", "Failure #88: pyflakes/test/test_doctests.py::TestImports::test_localImportStar", "Failure #89: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #90: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #91: pyflakes/test/test_doctests.py::TestImports::test_nestedFunctionsNestScope", "Failure #92: pyflakes/test/test_doctests.py::TestImports::test_newAssignment", "Failure #93: pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine", "Failure #94: pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope", "Failure #95: pyflakes/test/test_doctests.py::TestImports::test_packageImport", "Failure #96: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #97: pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass", "Failure #98: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #99: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #100: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFunction", "Failure #101: pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass", "Failure #102: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #103: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #104: pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass", "Failure #105: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #106: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #107: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #108: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #109: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #110: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #111: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #112: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #113: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #114: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #115: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #116: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #117: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #118: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #119: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #120: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #121: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #122: pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative", "Failure #123: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #124: pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport", "Failure #125: pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import", "Failure #126: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #127: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #128: pyflakes/test/test_doctests.py::TestImports::test_usedImport_relative", "Failure #129: pyflakes/test/test_doctests.py::TestImports::test_usedInAssert", "Failure #130: pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment", "Failure #131: pyflakes/test/test_doctests.py::TestImports::test_usedInAttributeAssign", "Failure #132: pyflakes/test/test_doctests.py::TestImports::test_usedInCall", "Failure #133: pyflakes/test/test_doctests.py::TestImports::test_usedInClass", "Failure #134: pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase", "Failure #135: pyflakes/test/test_doctests.py::TestImports::test_usedInDict", "Failure #136: pyflakes/test/test_doctests.py::TestImports::test_usedInElifConditional", "Failure #137: pyflakes/test/test_doctests.py::TestImports::test_usedInElse", "Failure #138: pyflakes/test/test_doctests.py::TestImports::test_usedInExcept", "Failure #139: pyflakes/test/test_doctests.py::TestImports::test_usedInExec", "Failure #140: pyflakes/test/test_doctests.py::TestImports::test_usedInFor", "Failure #141: pyflakes/test/test_doctests.py::TestImports::test_usedInForElse", "Failure #142: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #143: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #144: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #145: pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody", "Failure #146: pyflakes/test/test_doctests.py::TestImports::test_usedInIfConditional", "Failure #147: pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg", "Failure #148: pyflakes/test/test_doctests.py::TestImports::test_usedInLambda", "Failure #149: pyflakes/test/test_doctests.py::TestImports::test_usedInList", "Failure #150: pyflakes/test/test_doctests.py::TestImports::test_usedInListComp", "Failure #151: pyflakes/test/test_doctests.py::TestImports::test_usedInLogic", "Failure #152: pyflakes/test/test_doctests.py::TestImports::test_usedInOperators", "Failure #153: pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault", "Failure #154: pyflakes/test/test_doctests.py::TestImports::test_usedInRaise", "Failure #155: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #156: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice", "Failure #157: pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj", "Failure #158: pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript", "Failure #159: pyflakes/test/test_doctests.py::TestImports::test_usedInTry", "Failure #160: pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally", "Failure #161: pyflakes/test/test_doctests.py::TestImports::test_usedInTuple", "Failure #162: pyflakes/test/test_doctests.py::TestImports::test_usedInWhile", "Failure #163: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #164: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import", "Failure #165: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import_of_alias", "Failure #166: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #167: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #168: pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtinWindowsError", "Failure #169: pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtins", "Failure #170: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarArgs", "Failure #171: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarUnpack", "Failure #172: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobal", "Failure #173: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobalMultipleNames", "Failure #174: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInDictionaryComprehension", "Failure #175: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInGenerator", "Failure #176: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClass", "Failure #177: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClassNested", "Failure #178: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInGenExp", "Failure #179: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInListComp", "Failure #180: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #181: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditional", "Failure #182: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditionalNested", "Failure #183: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delExceptionInExcept", "Failure #184: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delGlobal", "Failure #185: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined", "Failure #186: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhile", "Failure #187: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileNested", "Failure #188: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileTestUsage", "Failure #189: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #190: pyflakes/test/test_doctests.py::TestUndefinedNames::test_dunderClass", "Failure #191: pyflakes/test/test_doctests.py::TestUndefinedNames::test_functionsNeedGlobalScope", "Failure #192: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalFromNestedScope", "Failure #193: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #194: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #195: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #196: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #197: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs", "Failure #198: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #199: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #200: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #201: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #202: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsBuiltins", "Failure #203: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsFile", "Failure #204: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsName", "Failure #205: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath", "Failure #206: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #207: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #208: pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined", "Failure #209: pyflakes/test/test_doctests.py::TestUndefinedNames::test_moduleAnnotations", "Failure #210: pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks", "Failure #211: pyflakes/test/test_doctests.py::TestUndefinedNames::test_nestedClass", "Failure #212: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined", "Failure #213: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #214: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #215: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #216: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #217: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #218: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #219: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #220: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #221: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #222: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #223: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #224: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #225: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #226: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #227: pyflakes/test/test_doctests.py::TestUndefinedNames::test_usedAsStarUnpack", "Failure #228: pyflakes/test/test_doctests.py::Test::test_doctestCanReferToClass", "Failure #229: pyflakes/test/test_doctests.py::Test::test_doctestCanReferToFunction", "Failure #230: pyflakes/test/test_doctests.py::Test::test_globalUnderscoreInDoctest", "Failure #231: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #232: pyflakes/test/test_doctests.py::Test::test_global_undefined", "Failure #233: pyflakes/test/test_doctests.py::Test::test_ignore_nested_function", "Failure #234: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #235: pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter", "Failure #236: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #237: pyflakes/test/test_doctests.py::Test::test_indentationErrorInDoctest", "Failure #238: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #239: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #240: pyflakes/test/test_doctests.py::Test::test_noOffsetSyntaxErrorInDoctest", "Failure #241: pyflakes/test/test_doctests.py::Test::test_offsetAfterDoctests", "Failure #242: pyflakes/test/test_doctests.py::Test::test_offsetInDoctests", "Failure #243: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #244: pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs", "Failure #245: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #246: pyflakes/test/test_doctests.py::Test::test_singleUnderscoreInDoctest", "Failure #247: pyflakes/test/test_doctests.py::Test::test_syntaxErrorInDoctest", "Failure #248: pyflakes/test/test_imports.py::Test::test_assignedToGlobal", "Failure #249: pyflakes/test/test_imports.py::Test::test_functionNamesAreBoundNow", "Failure #250: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #251: pyflakes/test/test_imports.py::Test::test_importInClass", "Failure #252: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #253: pyflakes/test/test_imports.py::Test::test_importedInClass", "Failure #254: pyflakes/test/test_imports.py::Test::test_localImportStar", "Failure #255: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #256: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #257: pyflakes/test/test_imports.py::Test::test_nestedFunctionsNestScope", "Failure #258: pyflakes/test/test_imports.py::Test::test_nonGlobalDoesNotRedefine", "Failure #259: pyflakes/test/test_imports.py::Test::test_notUsedInNestedScope", "Failure #260: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #261: pyflakes/test/test_imports.py::Test::test_redefinedByClass", "Failure #262: pyflakes/test/test_imports.py::Test::test_redefinedByFunction", "Failure #263: pyflakes/test/test_imports.py::Test::test_redefinedBySubclass", "Failure #264: pyflakes/test/test_imports.py::Test::test_redefinedInClass", "Failure #265: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunction", "Failure #266: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunctionTwice", "Failure #267: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #268: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #269: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #270: pyflakes/test/test_imports.py::Test::test_usedInClass", "Failure #271: pyflakes/test/test_imports.py::Test::test_usedInClassBase", "Failure #272: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #273: pyflakes/test/test_imports.py::Test::test_usedInGlobal", "Failure #274: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #275: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #276: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #277: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInClass", "Failure #278: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #279: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsClassDecorator", "Failure #280: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #281: pyflakes/test/test_match.py::TestMatch::test_defined_in_different_branches", "Failure #282: pyflakes/test/test_match.py::TestMatch::test_match_bindings", "Failure #283: pyflakes/test/test_match.py::TestMatch::test_match_placeholder", "Failure #284: pyflakes/test/test_other.py::Test::test_breakOutsideLoop", "Failure #285: pyflakes/test/test_other.py::Test::test_classFunctionDecorator", "Failure #286: pyflakes/test/test_other.py::Test::test_classNameDefinedPreviously", "Failure #287: pyflakes/test/test_other.py::Test::test_classNameUndefinedInClassBody", "Failure #288: pyflakes/test/test_other.py::Test::test_classRedefinedAsFunction", "Failure #289: pyflakes/test/test_other.py::Test::test_classRedefinition", "Failure #290: pyflakes/test/test_other.py::Test::test_classWithReturn", "Failure #291: pyflakes/test/test_other.py::Test::test_classWithYield", "Failure #292: pyflakes/test/test_other.py::Test::test_classWithYieldFrom", "Failure #293: pyflakes/test/test_other.py::Test::test_continueOutsideLoop", "Failure #294: pyflakes/test/test_other.py::Test::test_duplicateArgs", "Failure #295: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #296: pyflakes/test/test_other.py::Test::test_functionRedefinedAsClass", "Failure #297: pyflakes/test/test_other.py::Test::test_function_arguments", "Failure #298: pyflakes/test/test_other.py::Test::test_function_arguments_python3", "Failure #299: pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope", "Failure #300: pyflakes/test/test_other.py::Test::test_global_nonlocal_in_class_bodies", "Failure #301: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #302: pyflakes/test/test_other.py::Test::test_modernProperty", "Failure #303: pyflakes/test/test_other.py::Test::test_redefinedClassFunction", "Failure #304: pyflakes/test/test_other.py::Test::test_redefinedFunction", "Failure #305: pyflakes/test/test_other.py::Test::test_redefinedIfElseFunction", "Failure #306: pyflakes/test/test_other.py::Test::test_redefinedIfFunction", "Failure #307: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #308: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #309: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #310: pyflakes/test/test_other.py::Test::test_redefinedTryExceptFunction", "Failure #311: pyflakes/test/test_other.py::Test::test_redefinedTryFunction", "Failure #312: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreFunction", "Failure #313: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreImportation", "Failure #314: pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable", "Failure #315: pyflakes/test/test_other.py::Test::test_undefinedBaseClass", "Failure #316: pyflakes/test/test_other.py::Test::test_unused_global_in_class", "Failure #317: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #318: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #319: pyflakes/test/test_other.py::Test::test_unused_nonlocal_in_clas", "Failure #320: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #321: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInForLoop", "Failure #322: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInListComprehension", "Failure #323: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToGlobal", "Failure #324: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToMember", "Failure #325: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToNonlocal", "Failure #326: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope_reassigns_parameter", "Failure #327: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignmentInsideLoop", "Failure #328: pyflakes/test/test_other.py::TestUnusedAssignment::test_closedOver", "Failure #329: pyflakes/test/test_other.py::TestUnusedAssignment::test_debuggerskipSpecialVariable", "Failure #330: pyflakes/test/test_other.py::TestUnusedAssignment::test_doubleClosedOver", "Failure #331: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #332: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #333: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #334: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUsedInExcept", "Failure #335: pyflakes/test/test_other.py::TestUnusedAssignment::test_generatorExpression", "Failure #336: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #337: pyflakes/test/test_other.py::TestUnusedAssignment::test_tracebackhideSpecialVariable", "Failure #338: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #339: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedUnderscoreVariable", "Failure #340: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #341: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableAsLocals", "Failure #342: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #343: pyflakes/test/test_other.py::TestUnusedAssignment::test_variableUsedInLoop", "Failure #344: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #345: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDef", "Failure #346: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefAwait", "Failure #347: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #348: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncFor", "Failure #349: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncForUnderscoreLoopVar", "Failure #350: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWith", "Failure #351: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem", "Failure #352: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncFor", "Failure #353: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse", "Failure #354: pyflakes/test/test_other.py::TestAsyncStatements::test_matmul", "Failure #355: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_returned_in_function", "Failure #356: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #357: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import", "Failure #358: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_async_def", "Failure #359: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #360: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #361: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #362: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #363: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #364: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #365: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #366: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #367: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #368: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #369: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #370: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #371: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_not_a_typing_overload", "Failure #372: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #373: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #374: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #375: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #376: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #377: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #378: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #379: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #380: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #381: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_TypeVarTuple", "Failure #382: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_classes", "Failure #383: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #384: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #385: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_functions", "Failure #386: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_statements", "Failure #387: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #388: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #389: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync", "Failure #390: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol", "Failure #391: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #392: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #393: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #394: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #395: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #396: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #397: pyflakes/test/test_undefined_names.py::Test::test_definedAsStarArgs", "Failure #398: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobal", "Failure #399: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobalMultipleNames", "Failure #400: pyflakes/test/test_undefined_names.py::Test::test_definedInClass", "Failure #401: pyflakes/test/test_undefined_names.py::Test::test_definedInClassNested", "Failure #402: pyflakes/test/test_undefined_names.py::Test::test_delGlobal", "Failure #403: pyflakes/test/test_undefined_names.py::Test::test_delWhile", "Failure #404: pyflakes/test/test_undefined_names.py::Test::test_delWhileNested", "Failure #405: pyflakes/test/test_undefined_names.py::Test::test_delWhileTestUsage", "Failure #406: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #407: pyflakes/test/test_undefined_names.py::Test::test_dunderClass", "Failure #408: pyflakes/test/test_undefined_names.py::Test::test_functionsNeedGlobalScope", "Failure #409: pyflakes/test/test_undefined_names.py::Test::test_globalFromNestedScope", "Failure #410: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #411: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #412: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #413: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs", "Failure #414: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #415: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #416: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #417: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #418: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #419: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #420: pyflakes/test/test_undefined_names.py::Test::test_metaClassUndefined", "Failure #421: pyflakes/test/test_undefined_names.py::Test::test_nestedClass", "Failure #422: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #423: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #424: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #425: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack", "Failure #426: pyflakes/test/test_undefined_names.py::Test::test_usedAsStarUnpack" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_missingTrailingNewline" ], [ "pyflakes/test/test_builtin.py", "test_builtin_unbound_local" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.8800000000000003, "in_degree": 3, "true_in_degree": 3.0, "out_degree": 2, "betweenness": 2.9925157181888098e-06, "pagerank": 0.00034219517403373913, "harmonic": 0.004491017964071856, "bidirectional_harmonic": 0.056861277445109784, "degree": 5 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 3, "halstead_volume": 4.754887502163469, "halstead_difficulty": 0.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pyflakes/", "code_path": "pyflakes/", "name": "pyflakes", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/PyCQA/pyflakes.git", "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586, "stats": { "exists": true, "files_count": 21, "functions_count": 733, "total_lines": 9747, "avg_lines_per_file": 464.14285714285717, "avg_lines_per_func": 13.297407912687586 }, "commit": "78ee5319b390b62c0e881976ed475e2fe650daca", "repos_final_path": "/home/ubuntu/repos-final/pyflakes/" }, "fpath": "pyflakes/checker.py", "function_name": "Checker._enter_annotation", "test_info": { "success": false, "failed": 421, "passed": 1802, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: pyflakes/test/test_api.py::CheckTests::test_missingTrailingNewline\nLocation: /usr/lib/python3.12/contextlib.py:137\nError: TypeError: 'NoneType' object is not an iterator\n\nTraceback:\n\n> def test_missingTrailingNewline(self):\n \"\"\"\n Source which doesn't end with a newline shouldn't cause any\n exception to be raised nor an error indicator to be returned by\n L{check}.\n \"\"\"\n with self.makeTempFile(\"def foo():\\n\\tpass\\n\\t\") as fName:\n> self.assertHasErrors(fName, [])\n\n> count = withStderrTo(err, checkPath, path)\n\n> return f(*args, **kwargs)\n\n> return check(codestr, filename, reporter)\n\n> w = checker.Checker(tree, filename=filename)\n\n> self.handleChildren(tree)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.LAMBDA(node)\n\n> self.handleAnnotation(annotation, node)\n\n> with self._enter_annotation():\n\n> def __enter__(self):\n # do not keep args and kwds alive unnecessarily\n # they are only needed for recreation, which is not possible anymore\n del self.args, self.kwds, self.func\n try:\n> return next(self.gen)\nE TypeError: 'NoneType' object is not an iterator\n", "\n============================================================\nFailure #2: pyflakes/test/test_builtin.py::TestBuiltins::test_builtin_unbound_local\nLocation: /usr/lib/python3.12/contextlib.py:137\nError: TypeError: 'NoneType' object is not an iterator\n\nTraceback:\n\n> def test_builtin_unbound_local(self):\n> self.flakes('''\n def foo():\n a = range(1, 10)\n range = a\n return range\n \n foo()\n \n print(range)\n ''', m.UndefinedLocal)\n\n> w = checker.Checker(tree, withDoctest=self.withDoctest, **kw)\n\n> self.handleChildren(tree)\n\n> self.handleNode(node, tree)\n\n> handler(node)\n\n> self.LAMBDA(node)\n\n> self.handleAnnotation(annotation, node)\n\n> with self._enter_annotation():\n\n> def __enter__(self):\n # do not keep args and kwds alive unnecessarily\n # they are only needed for recreation, which is not possible anymore\n del self.args, self.kwds, self.func\n try:\n> return next(self.gen)\nE TypeError: 'NoneType' object is not an iterator\n", "Failure #3: pyflakes/test/test_builtin.py::TestBuiltins::test_global_shadowing_builtin", "Failure #4: pyflakes/test/test_code_segment.py::TestCodeSegments::test_class_segment", "Failure #5: pyflakes/test/test_code_segment.py::TestCodeSegments::test_function_segment", "Failure #6: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_class", "Failure #7: pyflakes/test/test_code_segment.py::TestCodeSegments::test_scope_function", "Failure #8: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_function", "Failure #9: pyflakes/test/test_dict.py::Test::test_duplicate_keys_in_lambda", "Failure #10: pyflakes/test/test_dict.py::Test::test_no_duplicate_key_errors_func_call", "Failure #11: pyflakes/test/test_doctests.py::TestOther::test_attrAugmentedAssignment", "Failure #12: pyflakes/test/test_doctests.py::TestOther::test_breakInsideLoop", "Failure #13: pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop", "Failure #14: pyflakes/test/test_doctests.py::TestOther::test_classFunctionDecorator", "Failure #15: pyflakes/test/test_doctests.py::TestOther::test_classNameDefinedPreviously", "Failure #16: pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody", "Failure #17: pyflakes/test/test_doctests.py::TestOther::test_classRedefinedAsFunction", "Failure #18: pyflakes/test/test_doctests.py::TestOther::test_classRedefinition", "Failure #19: pyflakes/test/test_doctests.py::TestOther::test_classWithReturn", "Failure #20: pyflakes/test/test_doctests.py::TestOther::test_classWithYield", "Failure #21: pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom", "Failure #22: pyflakes/test/test_doctests.py::TestOther::test_comparison", "Failure #23: pyflakes/test/test_doctests.py::TestOther::test_containment", "Failure #24: pyflakes/test/test_doctests.py::TestOther::test_continueInsideLoop", "Failure #25: pyflakes/test/test_doctests.py::TestOther::test_continueOutsideLoop", "Failure #26: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptLast", "Failure #27: pyflakes/test/test_doctests.py::TestOther::test_defaultExceptNotLast", "Failure #28: pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentConditionally", "Failure #29: pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentWithUse", "Failure #30: pyflakes/test/test_doctests.py::TestOther::test_duplicateArgs", "Failure #31: pyflakes/test/test_doctests.py::TestOther::test_ellipsis", "Failure #32: pyflakes/test/test_doctests.py::TestOther::test_extendedSlice", "Failure #33: pyflakes/test/test_doctests.py::TestOther::test_functionDecorator", "Failure #34: pyflakes/test/test_doctests.py::TestOther::test_functionRedefinedAsClass", "Failure #35: pyflakes/test/test_doctests.py::TestOther::test_function_arguments", "Failure #36: pyflakes/test/test_doctests.py::TestOther::test_function_arguments_python3", "Failure #37: pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope", "Failure #38: pyflakes/test/test_doctests.py::TestOther::test_global_nonlocal_in_class_bodies", "Failure #39: pyflakes/test/test_doctests.py::TestOther::test_identity", "Failure #40: pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment", "Failure #41: pyflakes/test/test_doctests.py::TestOther::test_loopControl", "Failure #42: pyflakes/test/test_doctests.py::TestOther::test_modernProperty", "Failure #43: pyflakes/test/test_doctests.py::TestOther::test_moduleWithReturn", "Failure #44: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYield", "Failure #45: pyflakes/test/test_doctests.py::TestOther::test_moduleWithYieldFrom", "Failure #46: pyflakes/test/test_doctests.py::TestOther::test_redefinedClassFunction", "Failure #47: pyflakes/test/test_doctests.py::TestOther::test_redefinedFunction", "Failure #48: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseFunction", "Failure #49: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseInListComp", "Failure #50: pyflakes/test/test_doctests.py::TestOther::test_redefinedIfFunction", "Failure #51: pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension", "Failure #52: pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator", "Failure #53: pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension", "Failure #54: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryExceptFunction", "Failure #55: pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction", "Failure #56: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreFunction", "Failure #57: pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreImportation", "Failure #58: pyflakes/test/test_doctests.py::TestOther::test_redefined_function_shadows_variable", "Failure #59: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentErrors", "Failure #60: pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentNoError", "Failure #61: pyflakes/test/test_doctests.py::TestOther::test_unaryPlus", "Failure #62: pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass", "Failure #63: pyflakes/test/test_doctests.py::TestOther::test_unused_global_in_class", "Failure #64: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement", "Failure #65: pyflakes/test/test_doctests.py::TestOther::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #66: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_in_clas", "Failure #67: pyflakes/test/test_doctests.py::TestOther::test_unused_nonlocal_statement", "Failure #68: pyflakes/test/test_doctests.py::TestOther::test_varAugmentedAssignment", "Failure #69: pyflakes/test/test_doctests.py::TestImports::test_aliasedImport", "Failure #70: pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule", "Failure #71: pyflakes/test/test_doctests.py::TestImports::test_assignRHSFirst", "Failure #72: pyflakes/test/test_doctests.py::TestImports::test_assignedToGlobal", "Failure #73: pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport", "Failure #74: pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport", "Failure #75: pyflakes/test/test_doctests.py::TestImports::test_functionNamesAreBoundNow", "Failure #76: pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater", "Failure #77: pyflakes/test/test_doctests.py::TestImports::test_futureImport", "Failure #78: pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst", "Failure #79: pyflakes/test/test_doctests.py::TestImports::test_futureImportStar", "Failure #80: pyflakes/test/test_doctests.py::TestImports::test_futureImportUndefined", "Failure #81: pyflakes/test/test_doctests.py::TestImports::test_futureImportUsed", "Failure #82: pyflakes/test/test_doctests.py::TestImports::test_ignoreNonImportRedefinitions", "Failure #83: pyflakes/test/test_doctests.py::TestImports::test_importInClass", "Failure #84: pyflakes/test/test_doctests.py::TestImports::test_importStar", "Failure #85: pyflakes/test/test_doctests.py::TestImports::test_importStar_relative", "Failure #86: pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition", "Failure #87: pyflakes/test/test_doctests.py::TestImports::test_importedInClass", "Failure #88: pyflakes/test/test_doctests.py::TestImports::test_localImportStar", "Failure #89: pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope", "Failure #90: pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope", "Failure #91: pyflakes/test/test_doctests.py::TestImports::test_nestedFunctionsNestScope", "Failure #92: pyflakes/test/test_doctests.py::TestImports::test_newAssignment", "Failure #93: pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine", "Failure #94: pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope", "Failure #95: pyflakes/test/test_doctests.py::TestImports::test_packageImport", "Failure #96: pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater", "Failure #97: pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass", "Failure #98: pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept", "Failure #99: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor", "Failure #100: pyflakes/test/test_doctests.py::TestImports::test_redefinedByFunction", "Failure #101: pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass", "Failure #102: pyflakes/test/test_doctests.py::TestImports::test_redefinedIf", "Failure #103: pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse", "Failure #104: pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass", "Failure #105: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction", "Failure #106: pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice", "Failure #107: pyflakes/test/test_doctests.py::TestImports::test_redefinedTry", "Failure #108: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse", "Failure #109: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept", "Failure #110: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse", "Failure #111: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally", "Failure #112: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally", "Failure #113: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti", "Failure #114: pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested", "Failure #115: pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused", "Failure #116: pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor", "Failure #117: pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep", "Failure #118: pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda", "Failure #119: pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter", "Failure #120: pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports", "Failure #121: pyflakes/test/test_doctests.py::TestImports::test_unusedImport", "Failure #122: pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative", "Failure #123: pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope", "Failure #124: pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport", "Failure #125: pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import", "Failure #126: pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal", "Failure #127: pyflakes/test/test_doctests.py::TestImports::test_usedImport", "Failure #128: pyflakes/test/test_doctests.py::TestImports::test_usedImport_relative", "Failure #129: pyflakes/test/test_doctests.py::TestImports::test_usedInAssert", "Failure #130: pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment", "Failure #131: pyflakes/test/test_doctests.py::TestImports::test_usedInAttributeAssign", "Failure #132: pyflakes/test/test_doctests.py::TestImports::test_usedInCall", "Failure #133: pyflakes/test/test_doctests.py::TestImports::test_usedInClass", "Failure #134: pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase", "Failure #135: pyflakes/test/test_doctests.py::TestImports::test_usedInDict", "Failure #136: pyflakes/test/test_doctests.py::TestImports::test_usedInElifConditional", "Failure #137: pyflakes/test/test_doctests.py::TestImports::test_usedInElse", "Failure #138: pyflakes/test/test_doctests.py::TestImports::test_usedInExcept", "Failure #139: pyflakes/test/test_doctests.py::TestImports::test_usedInExec", "Failure #140: pyflakes/test/test_doctests.py::TestImports::test_usedInFor", "Failure #141: pyflakes/test/test_doctests.py::TestImports::test_usedInForElse", "Failure #142: pyflakes/test/test_doctests.py::TestImports::test_usedInFunction", "Failure #143: pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr", "Failure #144: pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal", "Failure #145: pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody", "Failure #146: pyflakes/test/test_doctests.py::TestImports::test_usedInIfConditional", "Failure #147: pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg", "Failure #148: pyflakes/test/test_doctests.py::TestImports::test_usedInLambda", "Failure #149: pyflakes/test/test_doctests.py::TestImports::test_usedInList", "Failure #150: pyflakes/test/test_doctests.py::TestImports::test_usedInListComp", "Failure #151: pyflakes/test/test_doctests.py::TestImports::test_usedInLogic", "Failure #152: pyflakes/test/test_doctests.py::TestImports::test_usedInOperators", "Failure #153: pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault", "Failure #154: pyflakes/test/test_doctests.py::TestImports::test_usedInRaise", "Failure #155: pyflakes/test/test_doctests.py::TestImports::test_usedInReturn", "Failure #156: pyflakes/test/test_doctests.py::TestImports::test_usedInSlice", "Failure #157: pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj", "Failure #158: pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript", "Failure #159: pyflakes/test/test_doctests.py::TestImports::test_usedInTry", "Failure #160: pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally", "Failure #161: pyflakes/test/test_doctests.py::TestImports::test_usedInTuple", "Failure #162: pyflakes/test/test_doctests.py::TestImports::test_usedInWhile", "Failure #163: pyflakes/test/test_doctests.py::TestImports::test_usedInYield", "Failure #164: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import", "Failure #165: pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import_of_alias", "Failure #166: pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined", "Failure #167: pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass", "Failure #168: pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtinWindowsError", "Failure #169: pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtins", "Failure #170: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarArgs", "Failure #171: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarUnpack", "Failure #172: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobal", "Failure #173: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobalMultipleNames", "Failure #174: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInDictionaryComprehension", "Failure #175: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInGenerator", "Failure #176: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClass", "Failure #177: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClassNested", "Failure #178: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInGenExp", "Failure #179: pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInListComp", "Failure #180: pyflakes/test/test_doctests.py::TestUndefinedNames::test_del", "Failure #181: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditional", "Failure #182: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditionalNested", "Failure #183: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delExceptionInExcept", "Failure #184: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delGlobal", "Failure #185: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined", "Failure #186: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhile", "Failure #187: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileNested", "Failure #188: pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileTestUsage", "Failure #189: pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName", "Failure #190: pyflakes/test/test_doctests.py::TestUndefinedNames::test_dunderClass", "Failure #191: pyflakes/test/test_doctests.py::TestUndefinedNames::test_functionsNeedGlobalScope", "Failure #192: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalFromNestedScope", "Failure #193: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar", "Failure #194: pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope", "Failure #195: pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only", "Failure #196: pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored", "Failure #197: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs", "Failure #198: pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined", "Failure #199: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope", "Failure #200: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2", "Failure #201: pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3", "Failure #202: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsBuiltins", "Failure #203: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsFile", "Failure #204: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsName", "Failure #205: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath", "Failure #206: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope", "Failure #207: pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicQualnameInClassScope", "Failure #208: pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined", "Failure #209: pyflakes/test/test_doctests.py::TestUndefinedNames::test_moduleAnnotations", "Failure #210: pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks", "Failure #211: pyflakes/test/test_doctests.py::TestUndefinedNames::test_nestedClass", "Failure #212: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined", "Failure #213: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment", "Failure #214: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName", "Failure #215: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #216: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #217: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2", "Failure #218: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1", "Failure #219: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2", "Failure #220: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension", "Failure #221: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension", "Failure #222: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested", "Failure #223: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp", "Failure #224: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop", "Failure #225: pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler", "Failure #226: pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack", "Failure #227: pyflakes/test/test_doctests.py::TestUndefinedNames::test_usedAsStarUnpack", "Failure #228: pyflakes/test/test_doctests.py::Test::test_doctestCanReferToClass", "Failure #229: pyflakes/test/test_doctests.py::Test::test_doctestCanReferToFunction", "Failure #230: pyflakes/test/test_doctests.py::Test::test_globalUnderscoreInDoctest", "Failure #231: pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution", "Failure #232: pyflakes/test/test_doctests.py::Test::test_global_undefined", "Failure #233: pyflakes/test/test_doctests.py::Test::test_ignore_nested_function", "Failure #234: pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest", "Failure #235: pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter", "Failure #236: pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class", "Failure #237: pyflakes/test/test_doctests.py::Test::test_indentationErrorInDoctest", "Failure #238: pyflakes/test/test_doctests.py::Test::test_nested_class", "Failure #239: pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored", "Failure #240: pyflakes/test/test_doctests.py::Test::test_noOffsetSyntaxErrorInDoctest", "Failure #241: pyflakes/test/test_doctests.py::Test::test_offsetAfterDoctests", "Failure #242: pyflakes/test/test_doctests.py::Test::test_offsetInDoctests", "Failure #243: pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests", "Failure #244: pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs", "Failure #245: pyflakes/test/test_doctests.py::Test::test_scope_class", "Failure #246: pyflakes/test/test_doctests.py::Test::test_singleUnderscoreInDoctest", "Failure #247: pyflakes/test/test_doctests.py::Test::test_syntaxErrorInDoctest", "Failure #248: pyflakes/test/test_imports.py::Test::test_assignedToGlobal", "Failure #249: pyflakes/test/test_imports.py::Test::test_functionNamesAreBoundNow", "Failure #250: pyflakes/test/test_imports.py::Test::test_functionsRunLater", "Failure #251: pyflakes/test/test_imports.py::Test::test_importUsedInMethodDefinition", "Failure #252: pyflakes/test/test_imports.py::Test::test_importedInClass", "Failure #253: pyflakes/test/test_imports.py::Test::test_localImportStar", "Failure #254: pyflakes/test/test_imports.py::Test::test_methodsDontUseClassScope", "Failure #255: pyflakes/test/test_imports.py::Test::test_nestedClassAndFunctionScope", "Failure #256: pyflakes/test/test_imports.py::Test::test_nestedFunctionsNestScope", "Failure #257: pyflakes/test/test_imports.py::Test::test_nonGlobalDoesNotRedefine", "Failure #258: pyflakes/test/test_imports.py::Test::test_notUsedInNestedScope", "Failure #259: pyflakes/test/test_imports.py::Test::test_redefinedButUsedLater", "Failure #260: pyflakes/test/test_imports.py::Test::test_redefinedByFunction", "Failure #261: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunction", "Failure #262: pyflakes/test/test_imports.py::Test::test_redefinedInNestedFunctionTwice", "Failure #263: pyflakes/test/test_imports.py::Test::test_shadowedByLambda", "Failure #264: pyflakes/test/test_imports.py::Test::test_shadowedByParameter", "Failure #265: pyflakes/test/test_imports.py::Test::test_unusedInNestedScope", "Failure #266: pyflakes/test/test_imports.py::Test::test_usedAndGlobal", "Failure #267: pyflakes/test/test_imports.py::Test::test_usedInFunction", "Failure #268: pyflakes/test/test_imports.py::Test::test_usedInGlobal", "Failure #269: pyflakes/test/test_imports.py::Test::test_usedInParameterDefault", "Failure #270: pyflakes/test/test_imports.py::Test::test_usedInReturn", "Failure #271: pyflakes/test/test_imports.py::Test::test_usedInYield", "Failure #272: pyflakes/test/test_imports.py::TestSpecialAll::test_ignoredInFunction", "Failure #273: pyflakes/test/test_imports.py::TestSpecialAll::test_usedAsDecorator", "Failure #274: pyflakes/test/test_match.py::TestMatch::test_defined_in_different_branches", "Failure #275: pyflakes/test/test_match.py::TestMatch::test_match_bindings", "Failure #276: pyflakes/test/test_match.py::TestMatch::test_match_placeholder", "Failure #277: pyflakes/test/test_other.py::Test::test_breakOutsideLoop", "Failure #278: pyflakes/test/test_other.py::Test::test_classFunctionDecorator", "Failure #279: pyflakes/test/test_other.py::Test::test_classRedefinedAsFunction", "Failure #280: pyflakes/test/test_other.py::Test::test_continueOutsideLoop", "Failure #281: pyflakes/test/test_other.py::Test::test_duplicateArgs", "Failure #282: pyflakes/test/test_other.py::Test::test_functionDecorator", "Failure #283: pyflakes/test/test_other.py::Test::test_functionRedefinedAsClass", "Failure #284: pyflakes/test/test_other.py::Test::test_function_arguments", "Failure #285: pyflakes/test/test_other.py::Test::test_function_arguments_python3", "Failure #286: pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope", "Failure #287: pyflakes/test/test_other.py::Test::test_global_nonlocal_in_class_bodies", "Failure #288: pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment", "Failure #289: pyflakes/test/test_other.py::Test::test_modernProperty", "Failure #290: pyflakes/test/test_other.py::Test::test_redefinedClassFunction", "Failure #291: pyflakes/test/test_other.py::Test::test_redefinedFunction", "Failure #292: pyflakes/test/test_other.py::Test::test_redefinedIfElseFunction", "Failure #293: pyflakes/test/test_other.py::Test::test_redefinedIfFunction", "Failure #294: pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension", "Failure #295: pyflakes/test/test_other.py::Test::test_redefinedInGenerator", "Failure #296: pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension", "Failure #297: pyflakes/test/test_other.py::Test::test_redefinedTryExceptFunction", "Failure #298: pyflakes/test/test_other.py::Test::test_redefinedTryFunction", "Failure #299: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreFunction", "Failure #300: pyflakes/test/test_other.py::Test::test_redefinedUnderscoreImportation", "Failure #301: pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable", "Failure #302: pyflakes/test/test_other.py::Test::test_unused_global_statement", "Failure #303: pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope", "Failure #304: pyflakes/test/test_other.py::Test::test_unused_nonlocal_in_clas", "Failure #305: pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement", "Failure #306: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInForLoop", "Failure #307: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInListComprehension", "Failure #308: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToGlobal", "Failure #309: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToMember", "Failure #310: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToNonlocal", "Failure #311: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_after_annotation", "Failure #312: pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope_reassigns_parameter", "Failure #313: pyflakes/test/test_other.py::TestUnusedAssignment::test_assignmentInsideLoop", "Failure #314: pyflakes/test/test_other.py::TestUnusedAssignment::test_closedOver", "Failure #315: pyflakes/test/test_other.py::TestUnusedAssignment::test_debuggerskipSpecialVariable", "Failure #316: pyflakes/test/test_other.py::TestUnusedAssignment::test_doubleClosedOver", "Failure #317: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction", "Failure #318: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple", "Failure #319: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction", "Failure #320: pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUsedInExcept", "Failure #321: pyflakes/test/test_other.py::TestUnusedAssignment::test_generatorExpression", "Failure #322: pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking", "Failure #323: pyflakes/test/test_other.py::TestUnusedAssignment::test_tracebackhideSpecialVariable", "Failure #324: pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking", "Failure #325: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedUnderscoreVariable", "Failure #326: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable", "Failure #327: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableAsLocals", "Failure #328: pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals", "Failure #329: pyflakes/test/test_other.py::TestUnusedAssignment::test_variableUsedInLoop", "Failure #330: pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined", "Failure #331: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDef", "Failure #332: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefAwait", "Failure #333: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined", "Failure #334: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncFor", "Failure #335: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncForUnderscoreLoopVar", "Failure #336: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWith", "Failure #337: pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem", "Failure #338: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncFor", "Failure #339: pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse", "Failure #340: pyflakes/test/test_other.py::TestAsyncStatements::test_matmul", "Failure #341: pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_returned_in_function", "Failure #342: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_TypeAlias_annotations", "Failure #343: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_aliased_import", "Failure #344: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_async_def", "Failure #345: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type", "Failure #346: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_missing_forward_type_multiple_args", "Failure #347: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args", "Failure #348: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotated_type_typing_with_string_args_in_union", "Failure #349: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_annotating_an_import", "Failure #350: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_deferred_twice_annotation", "Failure #351: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_forward_annotations_for_classes_in_scope", "Failure #352: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_idomiatic_typing_guards", "Failure #353: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_some_other_module", "Failure #354: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing", "Failure #355: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_type_typing_extensions", "Failure #356: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_literal_union_type_typing", "Failure #357: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_namedtypes_classes", "Failure #358: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_nested_partially_quoted_type_assignment", "Failure #359: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_not_a_typing_overload", "Failure #360: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_in_class", "Failure #361: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_overload_with_multiple_decorators", "Failure #362: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partial_string_annotations_with_future_annotations", "Failure #363: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_annotation", "Failure #364: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_partially_quoted_type_assignment", "Failure #365: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_positional_only_argument_annotations", "Failure #366: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_postponed_annotations", "Failure #367: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_bound", "Failure #368: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_TypeVar_constraints", "Failure #369: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast", "Failure #370: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_quoted_type_cast_renamed_import", "Failure #371: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_class_scope_variable", "Failure #372: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_return_annotation_is_function_body_variable", "Failure #373: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_annotation_clobbers_all", "Failure #374: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_cast_literal_str_to_str", "Failure #375: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_ParamSpec", "Failure #376: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_TypeVarTuple", "Failure #377: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_classes", "Failure #378: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_class_scopes", "Failure #379: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_do_not_escape_function_scopes", "Failure #380: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_parameters_functions", "Failure #381: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_type_statements", "Failure #382: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typednames_correct_forward_ref", "Failure #383: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingExtensionsOverload", "Failure #384: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverload", "Failure #385: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typingOverloadAsync", "Failure #386: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_typing_guard_for_protocol", "Failure #387: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unassigned_annotation_is_undefined", "Failure #388: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation", "Failure #389: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_unused_annotation_in_outer_scope_reassigned_in_local_scope", "Failure #390: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotation_references_self_name_undefined", "Failure #391: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variable_annotations", "Failure #392: pyflakes/test/test_type_annotations.py::TestTypeAnnotations::test_variadic_generics", "Failure #393: pyflakes/test/test_undefined_names.py::Test::test_annotationUndefined", "Failure #394: pyflakes/test/test_undefined_names.py::Test::test_badNestedClass", "Failure #395: pyflakes/test/test_undefined_names.py::Test::test_definedAsStarArgs", "Failure #396: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobal", "Failure #397: pyflakes/test/test_undefined_names.py::Test::test_definedByGlobalMultipleNames", "Failure #398: pyflakes/test/test_undefined_names.py::Test::test_delGlobal", "Failure #399: pyflakes/test/test_undefined_names.py::Test::test_delWhile", "Failure #400: pyflakes/test/test_undefined_names.py::Test::test_delWhileNested", "Failure #401: pyflakes/test/test_undefined_names.py::Test::test_delWhileTestUsage", "Failure #402: pyflakes/test/test_undefined_names.py::Test::test_doubleNestingReportsClosestName", "Failure #403: pyflakes/test/test_undefined_names.py::Test::test_dunderClass", "Failure #404: pyflakes/test/test_undefined_names.py::Test::test_functionsNeedGlobalScope", "Failure #405: pyflakes/test/test_undefined_names.py::Test::test_globalFromNestedScope", "Failure #406: pyflakes/test/test_undefined_names.py::Test::test_globalInGlobalScope", "Failure #407: pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only", "Failure #408: pyflakes/test/test_undefined_names.py::Test::test_intermediateClassScopeIgnored", "Failure #409: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgs", "Failure #410: pyflakes/test/test_undefined_names.py::Test::test_keywordOnlyArgsUndefined", "Failure #411: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope", "Failure #412: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope2", "Failure #413: pyflakes/test/test_undefined_names.py::Test::test_laterRedefinedGlobalFromNestedScope3", "Failure #414: pyflakes/test/test_undefined_names.py::Test::test_magicModuleInClassScope", "Failure #415: pyflakes/test/test_undefined_names.py::Test::test_magicQualnameInClassScope", "Failure #416: pyflakes/test/test_undefined_names.py::Test::test_nestedClass", "Failure #417: pyflakes/test/test_undefined_names.py::Test::test_undefinedAugmentedAssignment", "Failure #418: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1", "Failure #419: pyflakes/test/test_undefined_names.py::Test::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2", "Failure #420: pyflakes/test/test_undefined_names.py::Test::test_unusedAsStarUnpack", "Failure #421: pyflakes/test/test_undefined_names.py::Test::test_usedAsStarUnpack" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "pyflakes/test/test_api.py", "test_missingTrailingNewline" ], [ "pyflakes/test/test_builtin.py", "test_builtin_unbound_local" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 4, "true_in_degree": 6.720000000000001, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.0008530831478775181, "harmonic": 0.0, "bidirectional_harmonic": 0.04767607641859136, "degree": 4 }, "line_count": 7, "code_line_count": 7, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pytm/", "code_path": "pytm/", "name": "pytm", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/OWASP/pytm.git", "exists": true, "files_count": 6, "functions_count": 137, "total_lines": 2519, "avg_lines_per_file": 419.8333333333333, "avg_lines_per_func": 18.386861313868614, "stats": { "exists": true, "files_count": 6, "functions_count": 137, "total_lines": 2519, "avg_lines_per_file": 419.8333333333333, "avg_lines_per_func": 18.386861313868614 }, "commit": "0c8f23c4feed1970c205962cea23c8166ba7739e", "repos_final_path": "/home/ubuntu/repos-final/pytm/" }, "fpath": "pytm/pytm.py", "function_name": "TM.check", "test_info": { "success": false, "failed": 13, "passed": 368, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: tests/test_private_func.py::TestAttributes::test_defaults\nLocation: /usr/lib/python3.12/unittest/case.py:727\nError: AssertionError: None is not true\n\nTraceback:\n\n> def test_defaults(self):\n tm = TM(\"TM\")\n user_data = Data(\"HTTP\")\n user = Actor(\"User\", data=user_data)\n user.controls.authenticatesDestination=True\n \n json_data = Data(\"JSON\")\n server = Server(\n \"Server\", port=443, protocol=\"HTTPS\", isEncrypted=True, data=json_data\n )\n sql_resp = Data(\"SQL resp\")\n db = Datastore(\n \"PostgreSQL\",\n port=5432,\n protocol=\"PostgreSQL\",\n data=sql_resp,\n )\n db.controls.isEncrypted=False\n db.type = DatastoreType.SQL\n worker = Process(\"Task queue worker\")\n \n req_get_data = Data(\"HTTP GET\")\n req_get = Dataflow(user, server, \"HTTP GET\", data=req_get_data)\n server_query_data = Data(\"SQL\")\n server_query = Dataflow(server, db, \"Query\", data=server_query_data)\n result_data = Data(\"Results\")\n result = Dataflow(db, server, \"Results\", data=result_data, isResponse=True)\n resp_get_data = Data(\"HTTP Response\")\n resp_get = Dataflow(server, user, \"HTTP Response\", data=resp_get_data, isResponse=True)\n \n test_assumption = Assumption(\"test assumption\")\n resp_get.assumptions = [test_assumption]\n \n req_post_data = Data(\"JSON\")\n req_post = Dataflow(user, server, \"HTTP POST\", data=req_post_data)\n resp_post = Dataflow(server, user, \"HTTP Response\", isResponse=True)\n test_assumption_exclude = Assumption(\"test assumption\", exclude=[\"ABCD\", \"BCDE\"])\n resp_post.assumptions = [test_assumption_exclude]\n \n sql_data = Data(\"SQL\")\n worker_query = Dataflow(worker, db, \"Query\", data=sql_data)\n Dataflow(db, worker, \"Results\", isResponse=True)\n \n cookie = Data(\"Auth Cookie\", carriedBy=[req_get, req_post])\n \n> self.assertTrue(tm.check())\nE AssertionError: None is not true\n", "\n============================================================\nFailure #2: tests/test_private_func.py::TestAttributes::test_responses\nLocation: /usr/lib/python3.12/unittest/case.py:727\nError: AssertionError: None is not true\n\nTraceback:\n\n> def test_responses(self):\n tm = TM(\"my test tm\", description=\"aa\", isOrdered=True)\n \n user = Actor(\"User\")\n web = Server(\"Web Server\")\n db = Datastore(\"SQL Database\")\n \n http_req = Dataflow(user, web, \"http req\")\n insert = Dataflow(web, db, \"insert data\")\n query = Dataflow(web, db, \"query\")\n query_resp = Dataflow(db, web, \"query results\", responseTo=query)\n http_resp = Dataflow(web, user, \"http resp\")\n http_resp.responseTo = http_req\n \n> self.assertTrue(tm.check())\nE AssertionError: None is not true\n", "Failure #3: tests/test_private_func.py::TestMethod::test_defaults", "Failure #4: tests/test_pytmfunc.py::TestTM::test_dfd", "Failure #5: tests/test_pytmfunc.py::TestTM::test_dfd_colormap", "Failure #6: tests/test_pytmfunc.py::TestTM::test_dfd_duplicates_ignore", "Failure #7: tests/test_pytmfunc.py::TestTM::test_dfd_duplicates_raise", "Failure #8: tests/test_pytmfunc.py::TestTM::test_json_dumps", "Failure #9: tests/test_pytmfunc.py::TestTM::test_json_loads", "Failure #10: tests/test_pytmfunc.py::TestTM::test_multilevel_dfd", "Failure #11: tests/test_pytmfunc.py::TestTM::test_report", "Failure #12: tests/test_pytmfunc.py::TestTM::test_seq", "Failure #13: tests/test_pytmfunc.py::TestTM::test_seq_unused" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "tests/test_private_func.py", "test_defaults" ], [ "tests/test_private_func.py", "test_responses" ] ] }, "complexity_info": { "centrality": { "distance_discount": 5.4399999999999995, "in_degree": 1, "true_in_degree": 1.8, "out_degree": 6, "betweenness": 0.0019474196689386564, "pagerank": 0.002143039772727273, "harmonic": 0.08227848101265822, "bidirectional_harmonic": 0.2970765521398432, "degree": 7 }, "line_count": 27, "code_line_count": 27, "cyclomatic": 10, "halstead_volume": 31.699250014423125, "halstead_difficulty": 1.5 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pytm/", "code_path": "pytm/", "name": "pytm", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/OWASP/pytm.git", "exists": true, "files_count": 6, "functions_count": 137, "total_lines": 2519, "avg_lines_per_file": 419.8333333333333, "avg_lines_per_func": 18.386861313868614, "stats": { "exists": true, "files_count": 6, "functions_count": 137, "total_lines": 2519, "avg_lines_per_file": 419.8333333333333, "avg_lines_per_func": 18.386861313868614 }, "commit": "0c8f23c4feed1970c205962cea23c8166ba7739e", "repos_final_path": "/home/ubuntu/repos-final/pytm/" }, "fpath": "pytm/pytm.py", "function_name": "Element._uniq_name", "test_info": { "success": false, "failed": 7, "passed": 374, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: tests/test_private_func.py::TestUniqueNames::test_duplicate_boundary_names_have_different_unique_names\nLocation: /usr/lib/python3.12/unittest/case.py:894\nError: AssertionError: None == None\n\nTraceback:\n\n> def test_duplicate_boundary_names_have_different_unique_names(self):\n random.seed(0)\n object_1 = Boundary(\"foo\")\n object_2 = Boundary(\"foo\")\n \n object_1_uniq_name = object_1._uniq_name()\n object_2_uniq_name = object_2._uniq_name()\n \n> self.assertNotEqual(object_1_uniq_name, object_2_uniq_name)\nE AssertionError: None == None\n", "\n============================================================\nFailure #2: tests/test_pytmfunc.py::TestTM::test_dfd\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: 'digr[374 chars]ster_None {\\n graph [\\n font[2736 chars]n\\n}' != 'digr[374 chars]ster_boundary_Companynet_88f2d9c06f {\\n [3183 chars]n\\n}'\n digraph tm {\n graph [\n fontname = Arial;\n fontsize = 14;\n ]\n node [\n fontname = Arial;\n fontsize = 14;\n rankdir = lr;\n ]\n edge [\n shape = none;\n arrowtail = onormal;\n fontname = Arial;\n fontsize = 12;\n ]\n labelloc = \"t\";\n fontsize = 20;\n nodesep = 1;\n \n- subgraph cluster_None {\n+ subgraph cluster_boundary_Companynet_88f2d9c06f {\n graph [\n fontsize = 10;\n fontcolor = black;\n style = dashed;\n color = firebrick2;\n label = <Company net>;\n ]\n \n- subgraph cluster_None {\n+ subgraph cluster_boundary_dmz_579e9aae81 {\n graph [\n fontsize = 10;\n fontcolor = black;\n style = dashed;\n color = firebrick2;\n label = <dmz>;\n ]\n \n- None [\n+ server_Gateway_f8af758679 [\n shape = circle;\n color = black;\n fontcolor = black;\n label = \"Gateway\";\n margin = 0.02;\n ]\n \n }\n \n- subgraph cluster_None {\n+ subgraph cluster_boundary_backend_f2eb7a3ff7 {\n graph [\n fontsize = 10;\n fontcolor = black;\n style = dashed;\n color = firebrick2;\n label = <backend>;\n ]\n \n- None [\n+ server_WebServer_2c440ebe53 [\n shape = circle;\n color = black;\n fontcolor = black;\n label = \"Web Server\";\n margin = 0.02;\n ]\n \n- None [\n+ datastore_SQLDatabase_0291419f72 [\n shape = none;\n fixedsize = shape;\n image = \"/tmp/benchmark_tijxutbo/pytm/images/datastore_black.png\";\n imagescale = true;\n color = black;\n fontcolor = black;\n xlabel = \"SQL Database\";\n label = \"\";\n ]\n \n }\n \n }\n \n- subgraph cluster_None {\n+ subgraph cluster_boundary_Internet_acf3059e70 {\n graph [\n fontsize = 10;\n fontcolor = black;\n style = dashed;\n color = firebrick2;\n label = <Internet>;\n ]\n \n- None [\n+ actor_User_d2006ce1bb [\n shape = square;\n color = black;\n fontcolor = black;\n label = \"User\";\n margin = 0.02;\n ]\n \n }\n \n- None -> None [\n+ actor_User_d2006ce1bb -> server_Gateway_f8af758679 [\n color = black;\n fontcolor = black;\n dir = forward;\n label = \"User enters\\ncomments (*)\";\n ]\n \n- None -> None [\n+ server_Gateway_f8af758679 -> server_WebServer_2c440ebe53 [\n color = black;\n fontcolor = black;\n dir = forward;\n label = \"Request\";\n ]\n \n- None -> None [\n+ server_WebServer_2c440ebe53 -> datastore_SQLDatabase_0291419f72 [\n color = black;\n fontcolor = black;\n dir = forward;\n label = \"Insert query with\\ncomments\";\n ]\n \n- None -> None [\n+ datastore_SQLDatabase_0291419f72 -> server_WebServer_2c440ebe53 [\n color = black;\n fontcolor = black;\n dir = forward;\n label = \"Retrieve comments\";\n ]\n \n- None -> None [\n+ server_WebServer_2c440ebe53 -> server_Gateway_f8af758679 [\n color = black;\n fontcolor = black;\n dir = forward;\n label = \"Response\";\n ]\n \n- None -> None [\n+ server_Gateway_f8af758679 -> actor_User_d2006ce1bb [\n color = black;\n fontcolor = black;\n dir = forward;\n label = \"Show comments (*)\";\n ]\n \n }\n\nTraceback:\n\n> def test_dfd(self):\n dir_path = os.path.dirname(os.path.realpath(__file__))\n install_path = os.path.dirname(os.path.realpath(pytm.__file__))\n \n with open(os.path.join(dir_path, \"dfd.dot\")) as x:\n expected = (\n x.read().strip().replace(\"INSTALL_PATH\", os.path.dirname(install_path))\n )\n \n random.seed(0)\n \n TM.reset()\n tm = TM(\"my test tm\", description=\"aaa\")\n internet = Boundary(\"Internet\")\n net = Boundary(\"Company net\")\n dmz = Boundary(\"dmz\", inBoundary=net)\n backend = Boundary(\"backend\", inBoundary=net)\n user = Actor(\"User\", inBoundary=internet)\n gw = Server(\"Gateway\", inBoundary=dmz)\n web = Server(\"Web Server\", inBoundary=backend)\n db = Datastore(\"SQL Database\", inBoundary=backend, isEncryptedAtRest=True)\n comment = Data(\"Comment\", isStored=True)\n \n Dataflow(user, gw, \"User enters comments (*)\")\n Dataflow(gw, web, \"Request\")\n Dataflow(web, db, \"Insert query with comments\", data=[comment])\n Dataflow(db, web, \"Retrieve comments\")\n Dataflow(web, gw, \"Response\")\n Dataflow(gw, user, \"Show comments (*)\")\n \n self.assertTrue(tm.check())\n output = tm.dfd()\n \n self.maxDiff = None\n> self.assertEqual(output, expected)\nE AssertionError: 'digr[374 chars]ster_None {\\n graph [\\n font[2736 chars]n\\n}' != 'digr[374 chars]ster_boundary_Companynet_88f2d9c06f {\\n [3183 chars]n\\n}'\nE digraph tm {\nE graph [\nE fontname = Arial;\nE fontsize = 14;\nE ]\nE node [\nE fontname = Arial;\nE fontsize = 14;\nE rankdir = lr;\nE ]\nE edge [\nE shape = none;\nE arrowtail = onormal;\nE fontname = Arial;\nE fontsize = 12;\nE ]\nE labelloc = \"t\";\nE fontsize = 20;\nE nodesep = 1;\nE \nE - subgraph cluster_None {\nE + subgraph cluster_boundary_Companynet_88f2d9c06f {\nE graph [\nE fontsize = 10;\nE fontcolor = black;\nE style = dashed;\nE color = firebrick2;\nE label = <Company net>;\nE ]\nE \nE - subgraph cluster_None {\nE + subgraph cluster_boundary_dmz_579e9aae81 {\nE graph [\nE fontsize = 10;\nE fontcolor = black;\nE style = dashed;\nE color = firebrick2;\nE label = <dmz>;\nE ]\nE \nE - None [\nE + server_Gateway_f8af758679 [\nE shape = circle;\nE color = black;\nE fontcolor = black;\nE label = \"Gateway\";\nE margin = 0.02;\nE ]\nE \nE }\nE \nE - subgraph cluster_None {\nE + subgraph cluster_boundary_backend_f2eb7a3ff7 {\nE graph [\nE fontsize = 10;\nE fontcolor = black;\nE style = dashed;\nE color = firebrick2;\nE label = <backend>;\nE ]\nE \nE - None [\nE + server_WebServer_2c440ebe53 [\nE shape = circle;\nE color = black;\nE fontcolor = black;\nE label = \"Web Server\";\nE margin = 0.02;\nE ]\nE \nE - None [\nE + datastore_SQLDatabase_0291419f72 [\nE shape = none;\nE fixedsize = shape;\nE image = \"/tmp/benchmark_tijxutbo/pytm/images/datastore_black.png\";\nE imagescale = true;\nE color = black;\nE fontcolor = black;\nE xlabel = \"SQL Database\";\nE label = \"\";\nE ]\nE \nE }\nE \nE }\nE \nE - subgraph cluster_None {\nE + subgraph cluster_boundary_Internet_acf3059e70 {\nE graph [\nE fontsize = 10;\nE fontcolor = black;\nE style = dashed;\nE color = firebrick2;\nE label = <Internet>;\nE ]\nE \nE - None [\nE + actor_User_d2006ce1bb [\nE shape = square;\nE color = black;\nE fontcolor = black;\nE label = \"User\";\nE margin = 0.02;\nE ]\nE \nE }\nE \nE - None -> None [\nE + actor_User_d2006ce1bb -> server_Gateway_f8af758679 [\nE color = black;\nE fontcolor = black;\nE dir = forward;\nE label = \"User enters\\ncomments (*)\";\nE ]\nE \nE - None -> None [\nE + server_Gateway_f8af758679 -> server_WebServer_2c440ebe53 [\nE color = black;\nE fontcolor = black;\nE dir = forward;\nE label = \"Request\";\nE ]\nE \nE - None -> None [\nE + server_WebServer_2c440ebe53 -> datastore_SQLDatabase_0291419f72 [\nE color = black;\nE fontcolor = black;\nE dir = forward;\nE label = \"Insert query with\\ncomments\";\nE ]\nE \nE - None -> None [\nE + datastore_SQLDatabase_0291419f72 -> server_WebServer_2c440ebe53 [\nE color = black;\nE fontcolor = black;\nE dir = forward;\nE label = \"Retrieve comments\";\nE ]\nE \nE - None -> None [\nE + server_WebServer_2c440ebe53 -> server_Gateway_f8af758679 [\nE color = black;\nE fontcolor = black;\nE dir = forward;\nE label = \"Response\";\nE ]\nE \nE - None -> None [\nE + server_Gateway_f8af758679 -> actor_User_d2006ce1bb [\nE color = black;\nE fontcolor = black;\nE dir = forward;\nE label = \"Show comments (*)\";\nE ]\nE \nE }\n", "Failure #3: tests/test_pytmfunc.py::TestTM::test_dfd_colormap", "Failure #4: tests/test_pytmfunc.py::TestTM::test_dfd_duplicates_ignore", "Failure #5: tests/test_pytmfunc.py::TestTM::test_multilevel_dfd", "Failure #6: tests/test_pytmfunc.py::TestTM::test_seq", "Failure #7: tests/test_pytmfunc.py::TestTM::test_seq_unused" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "tests/test_private_func.py", "test_duplicate_boundary_names_have_different_unique_names" ], [ "tests/test_pytmfunc.py", "test_dfd" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 6, "true_in_degree": 7.4399999999999995, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.004406104403409092, "harmonic": 0.0, "bidirectional_harmonic": 0.29642354832228235, "degree": 6 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 3, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pytm/", "code_path": "pytm/", "name": "pytm", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/OWASP/pytm.git", "exists": true, "files_count": 6, "functions_count": 137, "total_lines": 2519, "avg_lines_per_file": 419.8333333333333, "avg_lines_per_func": 18.386861313868614, "stats": { "exists": true, "files_count": 6, "functions_count": 137, "total_lines": 2519, "avg_lines_per_file": 419.8333333333333, "avg_lines_per_func": 18.386861313868614 }, "commit": "0c8f23c4feed1970c205962cea23c8166ba7739e", "repos_final_path": "/home/ubuntu/repos-final/pytm/" }, "fpath": "pytm/pytm.py", "function_name": "Dataflow.__init__", "test_info": { "success": false, "failed": 26, "passed": 355, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: tests/test_private_func.py::TestAttributes::test_defaults\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: -1 != 443\n\nTraceback:\n\n> def test_defaults(self):\n tm = TM(\"TM\")\n user_data = Data(\"HTTP\")\n user = Actor(\"User\", data=user_data)\n user.controls.authenticatesDestination=True\n \n json_data = Data(\"JSON\")\n server = Server(\n \"Server\", port=443, protocol=\"HTTPS\", isEncrypted=True, data=json_data\n )\n sql_resp = Data(\"SQL resp\")\n db = Datastore(\n \"PostgreSQL\",\n port=5432,\n protocol=\"PostgreSQL\",\n data=sql_resp,\n )\n db.controls.isEncrypted=False\n db.type = DatastoreType.SQL\n worker = Process(\"Task queue worker\")\n \n req_get_data = Data(\"HTTP GET\")\n req_get = Dataflow(user, server, \"HTTP GET\", data=req_get_data)\n server_query_data = Data(\"SQL\")\n server_query = Dataflow(server, db, \"Query\", data=server_query_data)\n result_data = Data(\"Results\")\n result = Dataflow(db, server, \"Results\", data=result_data, isResponse=True)\n resp_get_data = Data(\"HTTP Response\")\n resp_get = Dataflow(server, user, \"HTTP Response\", data=resp_get_data, isResponse=True)\n \n test_assumption = Assumption(\"test assumption\")\n resp_get.assumptions = [test_assumption]\n \n req_post_data = Data(\"JSON\")\n req_post = Dataflow(user, server, \"HTTP POST\", data=req_post_data)\n resp_post = Dataflow(server, user, \"HTTP Response\", isResponse=True)\n test_assumption_exclude = Assumption(\"test assumption\", exclude=[\"ABCD\", \"BCDE\"])\n resp_post.assumptions = [test_assumption_exclude]\n \n sql_data = Data(\"SQL\")\n worker_query = Dataflow(worker, db, \"Query\", data=sql_data)\n Dataflow(db, worker, \"Results\", isResponse=True)\n \n cookie = Data(\"Auth Cookie\", carriedBy=[req_get, req_post])\n \n self.assertTrue(tm.check())\n \n self.assertEqual(req_get.srcPort, -1)\n> self.assertEqual(req_get.dstPort, server.port)\nE AssertionError: -1 != 443\n", "\n============================================================\nFailure #2: tests/test_private_func.py::TestAttributes::test_responses\nLocation: /usr/lib/python3.12/unittest/case.py:878\nError: AssertionError: None != \n\nTraceback:\n\n> def test_responses(self):\n tm = TM(\"my test tm\", description=\"aa\", isOrdered=True)\n \n user = Actor(\"User\")\n web = Server(\"Web Server\")\n db = Datastore(\"SQL Database\")\n \n http_req = Dataflow(user, web, \"http req\")\n insert = Dataflow(web, db, \"insert data\")\n query = Dataflow(web, db, \"query\")\n query_resp = Dataflow(db, web, \"query results\", responseTo=query)\n http_resp = Dataflow(web, user, \"http resp\")\n http_resp.responseTo = http_req\n \n self.assertTrue(tm.check())\n \n> self.assertEqual(http_req.response, http_resp)\nE AssertionError: None != \n", "Failure #3: tests/test_private_func.py::TestMethod::test_defaults", "Failure #4: tests/test_pytmfunc.py::TestTM::test_dfd", "Failure #5: tests/test_pytmfunc.py::TestTM::test_dfd_colormap", "Failure #6: tests/test_pytmfunc.py::TestTM::test_dfd_duplicates_ignore", "Failure #7: tests/test_pytmfunc.py::TestTM::test_dfd_duplicates_raise", "Failure #8: tests/test_pytmfunc.py::TestTM::test_json_dumps", "Failure #9: tests/test_pytmfunc.py::TestTM::test_json_loads", "Failure #10: tests/test_pytmfunc.py::TestTM::test_multilevel_dfd", "Failure #11: tests/test_pytmfunc.py::TestTM::test_report", "Failure #12: tests/test_pytmfunc.py::TestTM::test_resolve", "Failure #13: tests/test_pytmfunc.py::TestTM::test_seq", "Failure #14: tests/test_pytmfunc.py::TestTM::test_seq_unused", "Failure #15: tests/test_pytmfunc.py::Testpytm::test_AC04", "Failure #16: tests/test_pytmfunc.py::Testpytm::test_AC05", "Failure #17: tests/test_pytmfunc.py::Testpytm::test_AC10", "Failure #18: tests/test_pytmfunc.py::Testpytm::test_AC23", "Failure #19: tests/test_pytmfunc.py::Testpytm::test_AC24", "Failure #20: tests/test_pytmfunc.py::Testpytm::test_CR02", "Failure #21: tests/test_pytmfunc.py::Testpytm::test_CR06", "Failure #22: tests/test_pytmfunc.py::Testpytm::test_CR08", "Failure #23: tests/test_pytmfunc.py::Testpytm::test_DE01", "Failure #24: tests/test_pytmfunc.py::Testpytm::test_DE03", "Failure #25: tests/test_pytmfunc.py::Testpytm::test_DR01", "Failure #26: tests/test_pytmfunc.py::Testpytm::test_DS06" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "tests/test_private_func.py", "test_defaults" ], [ "tests/test_private_func.py", "test_responses" ] ] }, "complexity_info": { "centrality": { "distance_discount": 0.0, "in_degree": 3, "true_in_degree": 3.8, "out_degree": 0, "betweenness": 0.0, "pagerank": 0.006994921875000001, "harmonic": 0.0, "bidirectional_harmonic": 0.1513667415566149, "degree": 3 }, "line_count": 6, "code_line_count": 6, "cyclomatic": 1, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pytm/", "code_path": "pytm/", "name": "pytm", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/OWASP/pytm.git", "exists": true, "files_count": 6, "functions_count": 137, "total_lines": 2519, "avg_lines_per_file": 419.8333333333333, "avg_lines_per_func": 18.386861313868614, "stats": { "exists": true, "files_count": 6, "functions_count": 137, "total_lines": 2519, "avg_lines_per_file": 419.8333333333333, "avg_lines_per_func": 18.386861313868614 }, "commit": "0c8f23c4feed1970c205962cea23c8166ba7739e", "repos_final_path": "/home/ubuntu/repos-final/pytm/" }, "fpath": "pytm/pytm.py", "function_name": "TM.__init__", "test_info": { "success": false, "failed": 10, "passed": 371, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: tests/test_private_func.py::TestAttributes::test_load_threats\nLocation: /usr/lib/python3.12/unittest/case.py:894\nError: AssertionError: 0 == 0\n\nTraceback:\n\n> def test_load_threats(self):\n tm = TM(\"TM\")\n> self.assertNotEqual(len(TM._threats), 0)\nE AssertionError: 0 == 0\n", "\n============================================================\nFailure #2: tests/test_pytmfunc.py::TestTM::test_dfd_colormap\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: 'digr[958 chars]or = darkgreen; fillcolor=\"#00630022\"; style=f[3239 chars]n\\n}' != 'digr[958 chars]or = firebrick3; fillcolor=\"#b2222222\"; style=[3173 chars]n\\n}'\n digraph tm {\n graph [\n fontname = Arial;\n fontsize = 14;\n ]\n node [\n fontname = Arial;\n fontsize = 14;\n rankdir = lr;\n ]\n edge [\n shape = none;\n arrowtail = onormal;\n fontname = Arial;\n fontsize = 12;\n ]\n labelloc = \"t\";\n fontsize = 20;\n nodesep = 1;\n \n subgraph cluster_boundary_Companynet_88f2d9c06f {\n graph [\n fontsize = 10;\n fontcolor = black;\n style = dashed;\n color = black;\n label = <Company net>;\n ]\n \n subgraph cluster_boundary_dmz_579e9aae81 {\n graph [\n fontsize = 10;\n fontcolor = black;\n style = dashed;\n color = black;\n label = <dmz>;\n ]\n \n server_Gateway_f8af758679 [\n shape = circle;\n- color = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? ^^^^^ ^^ ^^^^^^\n+ color = firebrick3; fillcolor=\"#b2222222\"; style=filled ;\n? ^^ ^^^^^^ ^^^^^^ +\n fontcolor = black;\n label = \"Gateway\";\n margin = 0.02;\n ]\n \n }\n \n subgraph cluster_boundary_backend_f2eb7a3ff7 {\n graph [\n fontsize = 10;\n fontcolor = black;\n style = dashed;\n color = black;\n label = <backend>;\n ]\n \n server_WebServer_2c440ebe53 [\n shape = circle;\n- color = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? ^^^^^ ^^ ^^^^^^\n+ color = firebrick3; fillcolor=\"#b2222222\"; style=filled ;\n? ^^ ^^^^^^ ^^^^^^ +\n fontcolor = black;\n label = \"Web Server\";\n margin = 0.02;\n ]\n \n datastore_SQLDatabase_0291419f72 [\n shape = none;\n fixedsize = shape;\n- image = \"/tmp/benchmark_xsc0o6ht/pytm/images/datastore_darkgreen.png\";\n? --------\n+ image = \"/tmp/benchmark_xsc0o6ht/pytm/images/datastore_gold.png\";\n? +++\n imagescale = true;\n- color = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ color = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n fontcolor = black;\n xlabel = \"SQL Database\";\n label = \"\";\n ]\n \n }\n \n }\n \n subgraph cluster_boundary_Internet_acf3059e70 {\n graph [\n fontsize = 10;\n fontcolor = black;\n style = dashed;\n color = black;\n label = <Internet>;\n ]\n \n actor_User_d2006ce1bb [\n shape = square;\n color = darkgreen; fillcolor=\"#00630022\"; style=filled;\n fontcolor = black;\n label = \"User\";\n margin = 0.02;\n ]\n \n }\n \n actor_User_d2006ce1bb -> server_Gateway_f8af758679 [\n- color = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ color = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n- fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n dir = forward;\n label = \"User enters\\ncomments (*)\";\n ]\n \n server_Gateway_f8af758679 -> server_WebServer_2c440ebe53 [\n- color = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ color = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n- fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n dir = forward;\n label = \"Request\";\n ]\n \n server_WebServer_2c440ebe53 -> datastore_SQLDatabase_0291419f72 [\n- color = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ color = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n- fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n dir = forward;\n label = \"Insert query with\\ncomments\";\n ]\n \n datastore_SQLDatabase_0291419f72 -> server_WebServer_2c440ebe53 [\n- color = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ color = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n- fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n dir = forward;\n label = \"Retrieve comments\";\n ]\n \n server_WebServer_2c440ebe53 -> server_Gateway_f8af758679 [\n- color = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ color = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n- fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n dir = forward;\n label = \"Response\";\n ]\n \n server_Gateway_f8af758679 -> actor_User_d2006ce1bb [\n- color = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ color = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n- fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\n? -------- ^^^^\n+ fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\n? +++ ^^^^\n dir = forward;\n label = \"Show comments (*)\";\n ]\n \n }\n\nTraceback:\n\n> def test_dfd_colormap(self):\n dir_path = os.path.dirname(os.path.realpath(__file__))\n install_path = os.path.dirname(os.path.realpath(pytm.__file__))\n \n with open(os.path.join(dir_path, \"dfd_colormap.dot\")) as x:\n expected = (\n x.read().strip().replace(\"INSTALL_PATH\", os.path.dirname(install_path))\n )\n \n random.seed(0)\n \n TM.reset()\n tm = TM(\"my test tm\", description=\"aaa\")\n internet = Boundary(\"Internet\")\n net = Boundary(\"Company net\")\n dmz = Boundary(\"dmz\", inBoundary=net)\n backend = Boundary(\"backend\", inBoundary=net)\n user = Actor(\"User\", inBoundary=internet)\n gw = Server(\"Gateway\", inBoundary=dmz)\n web = Server(\"Web Server\", inBoundary=backend)\n db = Datastore(\"SQL Database\", inBoundary=backend, isEncryptedAtRest=True)\n comment = Data(\"Comment\", isStored=True)\n \n Dataflow(user, gw, \"User enters comments (*)\")\n Dataflow(gw, web, \"Request\")\n Dataflow(web, db, \"Insert query with comments\", data=[comment])\n Dataflow(db, web, \"Retrieve comments\")\n Dataflow(web, gw, \"Response\")\n Dataflow(gw, user, \"Show comments (*)\")\n \n self.assertTrue(tm.check())\n tm.resolve()\n output = tm.dfd(colormap=True)\n \n self.maxDiff = None\n> self.assertEqual(output, expected)\nE AssertionError: 'digr[958 chars]or = darkgreen; fillcolor=\"#00630022\"; style=f[3239 chars]n\\n}' != 'digr[958 chars]or = firebrick3; fillcolor=\"#b2222222\"; style=[3173 chars]n\\n}'\nE digraph tm {\nE graph [\nE fontname = Arial;\nE fontsize = 14;\nE ]\nE node [\nE fontname = Arial;\nE fontsize = 14;\nE rankdir = lr;\nE ]\nE edge [\nE shape = none;\nE arrowtail = onormal;\nE fontname = Arial;\nE fontsize = 12;\nE ]\nE labelloc = \"t\";\nE fontsize = 20;\nE nodesep = 1;\nE \nE subgraph cluster_boundary_Companynet_88f2d9c06f {\nE graph [\nE fontsize = 10;\nE fontcolor = black;\nE style = dashed;\nE color = black;\nE label = <Company net>;\nE ]\nE \nE subgraph cluster_boundary_dmz_579e9aae81 {\nE graph [\nE fontsize = 10;\nE fontcolor = black;\nE style = dashed;\nE color = black;\nE label = <dmz>;\nE ]\nE \nE server_Gateway_f8af758679 [\nE shape = circle;\nE - color = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? ^^^^^ ^^ ^^^^^^\nE + color = firebrick3; fillcolor=\"#b2222222\"; style=filled ;\nE ? ^^ ^^^^^^ ^^^^^^ +\nE fontcolor = black;\nE label = \"Gateway\";\nE margin = 0.02;\nE ]\nE \nE }\nE \nE subgraph cluster_boundary_backend_f2eb7a3ff7 {\nE graph [\nE fontsize = 10;\nE fontcolor = black;\nE style = dashed;\nE color = black;\nE label = <backend>;\nE ]\nE \nE server_WebServer_2c440ebe53 [\nE shape = circle;\nE - color = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? ^^^^^ ^^ ^^^^^^\nE + color = firebrick3; fillcolor=\"#b2222222\"; style=filled ;\nE ? ^^ ^^^^^^ ^^^^^^ +\nE fontcolor = black;\nE label = \"Web Server\";\nE margin = 0.02;\nE ]\nE \nE datastore_SQLDatabase_0291419f72 [\nE shape = none;\nE fixedsize = shape;\nE - image = \"/tmp/benchmark_xsc0o6ht/pytm/images/datastore_darkgreen.png\";\nE ? --------\nE + image = \"/tmp/benchmark_xsc0o6ht/pytm/images/datastore_gold.png\";\nE ? +++\nE imagescale = true;\nE - color = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + color = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE fontcolor = black;\nE xlabel = \"SQL Database\";\nE label = \"\";\nE ]\nE \nE }\nE \nE }\nE \nE subgraph cluster_boundary_Internet_acf3059e70 {\nE graph [\nE fontsize = 10;\nE fontcolor = black;\nE style = dashed;\nE color = black;\nE label = <Internet>;\nE ]\nE \nE actor_User_d2006ce1bb [\nE shape = square;\nE color = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE fontcolor = black;\nE label = \"User\";\nE margin = 0.02;\nE ]\nE \nE }\nE \nE actor_User_d2006ce1bb -> server_Gateway_f8af758679 [\nE - color = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + color = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE - fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE dir = forward;\nE label = \"User enters\\ncomments (*)\";\nE ]\nE \nE server_Gateway_f8af758679 -> server_WebServer_2c440ebe53 [\nE - color = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + color = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE - fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE dir = forward;\nE label = \"Request\";\nE ]\nE \nE server_WebServer_2c440ebe53 -> datastore_SQLDatabase_0291419f72 [\nE - color = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + color = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE - fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE dir = forward;\nE label = \"Insert query with\\ncomments\";\nE ]\nE \nE datastore_SQLDatabase_0291419f72 -> server_WebServer_2c440ebe53 [\nE - color = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + color = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE - fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE dir = forward;\nE label = \"Retrieve comments\";\nE ]\nE \nE server_WebServer_2c440ebe53 -> server_Gateway_f8af758679 [\nE - color = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + color = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE - fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE dir = forward;\nE label = \"Response\";\nE ]\nE \nE server_Gateway_f8af758679 -> actor_User_d2006ce1bb [\nE - color = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + color = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE - fontcolor = darkgreen; fillcolor=\"#00630022\"; style=filled;\nE ? -------- ^^^^\nE + fontcolor = gold; fillcolor=\"#ffd80022\"; style=filled;\nE ? +++ ^^^^\nE dir = forward;\nE label = \"Show comments (*)\";\nE ]\nE \nE }\n", "Failure #3: tests/test_pytmfunc.py::TestTM::test_dfd_duplicates_ignore", "Failure #4: tests/test_pytmfunc.py::TestTM::test_dfd_duplicates_raise", "Failure #5: tests/test_pytmfunc.py::TestTM::test_exclude_threats_by_assumptions", "Failure #6: tests/test_pytmfunc.py::TestTM::test_exclude_threats_ignore", "Failure #7: tests/test_pytmfunc.py::TestTM::test_json_dumps", "Failure #8: tests/test_pytmfunc.py::TestTM::test_multilevel_dfd", "Failure #9: tests/test_pytmfunc.py::TestTM::test_report", "Failure #10: tests/test_pytmfunc.py::TestTM::test_seq_unused" ], "had_execution_error": false, "error_message": "", "failed_tests": [ [ "tests/test_private_func.py", "test_load_threats" ], [ "tests/test_pytmfunc.py", "test_dfd_colormap" ] ] }, "complexity_info": { "centrality": { "distance_discount": 2.72, "in_degree": 1, "true_in_degree": 1.0, "out_degree": 1, "betweenness": 0.0001622849724115547, "pagerank": 0.0022734375000000003, "harmonic": 0.03164556962025317, "bidirectional_harmonic": 0.21104581072935494, "degree": 2 }, "line_count": 8, "code_line_count": 8, "cyclomatic": 2, "halstead_volume": 0, "halstead_difficulty": 0 }, "corruption": null }, { "repo": { "path": "/home/ubuntu/repos/pytm/", "code_path": "pytm/", "name": "pytm", "test_command": "source venv/bin/activate && ./venv/bin/pytest", "url": "https://github.com/OWASP/pytm.git", "exists": true, "files_count": 6, "functions_count": 137, "total_lines": 2519, "avg_lines_per_file": 419.8333333333333, "avg_lines_per_func": 18.386861313868614, "stats": { "exists": true, "files_count": 6, "functions_count": 137, "total_lines": 2519, "avg_lines_per_file": 419.8333333333333, "avg_lines_per_func": 18.386861313868614 }, "commit": "0c8f23c4feed1970c205962cea23c8166ba7739e", "repos_final_path": "/home/ubuntu/repos-final/pytm/" }, "fpath": "pytm/pytm.py", "function_name": "Finding.__init__", "test_info": { "success": false, "failed": 6, "passed": 375, "deselected": 0, "failures_info": [ "\n============================================================\nFailure #1: tests/test_private_func.py::TestFunction::test_encode_threat_data\nLocation: /usr/lib/python3.12/unittest/case.py:715\nError: AssertionError: '' != 'A test description'\n+ A test description\n\nTraceback:\n\n> def test_encode_threat_data(self):\n findings = [\n Finding(\n description=\"A test description\",\n severity=\"High\",\n id=\"1\",\n threat_id=\"INP01\",\n cvss=\"9.876\",\n response=\"A test response\",\n ),\n Finding(\n description=\"An escape test