jaclang 0.7.33__py3-none-any.whl → 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jaclang might be problematic. Click here for more details.
- jaclang/__init__.py +7 -414
- jaclang/cli/cli.md +5 -5
- jaclang/cli/cli.py +311 -214
- jaclang/cli/cmdreg.py +188 -31
- jaclang/compiler/__init__.py +10 -15
- jaclang/compiler/{codeloc.py → codeinfo.py} +11 -30
- jaclang/compiler/constant.py +10 -33
- jaclang/compiler/jac.lark +61 -92
- jaclang/compiler/larkparse/jac_parser.py +3444 -0
- jaclang/compiler/parser.py +1054 -1341
- jaclang/compiler/passes/__init__.py +2 -2
- jaclang/compiler/passes/main/__init__.py +33 -14
- jaclang/compiler/passes/main/annex_pass.py +85 -0
- jaclang/compiler/passes/main/cfg_build_pass.py +275 -0
- jaclang/compiler/passes/main/def_impl_match_pass.py +146 -102
- jaclang/compiler/passes/main/def_use_pass.py +64 -269
- jaclang/compiler/passes/main/import_pass.py +175 -360
- jaclang/compiler/passes/main/inheritance_pass.py +107 -105
- jaclang/compiler/passes/main/pyast_gen_pass.py +1129 -1600
- jaclang/compiler/passes/main/pyast_load_pass.py +540 -584
- jaclang/compiler/passes/main/pybc_gen_pass.py +38 -35
- jaclang/compiler/passes/main/pyjac_ast_link_pass.py +46 -160
- jaclang/compiler/passes/main/sym_tab_build_pass.py +113 -1202
- jaclang/compiler/passes/main/sym_tab_link_pass.py +141 -0
- jaclang/{tests → compiler/passes/main/tests}/fixtures/access_modifier.jac +10 -9
- jaclang/compiler/passes/main/tests/fixtures/atest.impl.jac +3 -0
- jaclang/compiler/passes/main/tests/fixtures/atest.jac +11 -0
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.impl/getme.impl.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.impl.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.jac +3 -3
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.something.else.impl.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/base.impl.jac +8 -0
- jaclang/compiler/passes/main/tests/fixtures/base.jac +4 -4
- jaclang/compiler/passes/main/tests/fixtures/base2.impl.jac +8 -0
- jaclang/compiler/passes/main/tests/fixtures/base2.jac +4 -4
- jaclang/compiler/passes/main/tests/fixtures/blip.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/cfg_ability_test.jac +23 -0
- jaclang/compiler/passes/main/tests/fixtures/cfg_gen.jac +19 -0
- jaclang/compiler/passes/main/tests/fixtures/circular_import.jac +7 -0
- jaclang/compiler/passes/main/tests/fixtures/data_spatial_types.jac +12 -12
- jaclang/compiler/passes/main/tests/fixtures/decls.jac +4 -4
- jaclang/compiler/passes/main/tests/fixtures/defn_decl_mismatch.jac +4 -4
- jaclang/compiler/passes/main/tests/fixtures/defs_and_uses.jac +6 -6
- jaclang/compiler/passes/main/tests/fixtures/enumerations.jac +13 -0
- jaclang/compiler/passes/main/tests/fixtures/fstrings.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/func.jac +2 -2
- jaclang/compiler/passes/main/tests/fixtures/func2.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/game1.jac +4 -4
- jaclang/compiler/passes/main/tests/fixtures/impl/defs1.jac +2 -2
- jaclang/compiler/passes/main/tests/fixtures/impl/defs2.jac +2 -2
- jaclang/compiler/passes/main/tests/fixtures/impl/imps.jac +0 -8
- jaclang/compiler/passes/main/tests/fixtures/impl_grab.impl.jac +5 -0
- jaclang/{tests → compiler/passes/main/tests}/fixtures/impl_grab.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/incautoimpl.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/main_err.impl.jac +6 -0
- jaclang/compiler/passes/main/tests/fixtures/main_err.jac +6 -0
- jaclang/compiler/passes/main/tests/fixtures/mod_type_assign.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/mtest.impl.jac +6 -0
- jaclang/{tests → compiler/passes/main/tests}/fixtures/mtest.jac +1 -1
- jaclang/{tests → compiler/passes/main/tests}/fixtures/nested_impls.jac +14 -15
- jaclang/compiler/passes/main/tests/fixtures/py_imp_test.jac +7 -7
- jaclang/compiler/passes/main/tests/fixtures/second_err.jac +4 -0
- jaclang/compiler/passes/main/tests/fixtures/str2doc.py +3 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/action/__init__.py +5 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/action/actions.jac +23 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/main.jac +14 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/no_dupls.jac +35 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/one.jac +8 -0
- jaclang/compiler/passes/main/tests/fixtures/type_info.jac +4 -4
- jaclang/compiler/passes/main/tests/test_cfg_build_pass.py +99 -0
- jaclang/compiler/passes/main/tests/test_decl_impl_match_pass.py +157 -0
- jaclang/compiler/passes/main/tests/test_def_use_pass.py +4 -6
- jaclang/compiler/passes/main/tests/test_import_pass.py +59 -46
- jaclang/compiler/passes/main/tests/test_pyast_build_pass.py +15 -0
- jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py +25 -34
- jaclang/compiler/passes/main/tests/test_pybc_gen_pass.py +3 -3
- jaclang/compiler/passes/main/tests/test_sub_node_pass.py +8 -7
- jaclang/compiler/passes/main/tests/test_sym_tab_build_pass.py +4 -4
- jaclang/compiler/passes/main/tests/test_sym_tab_link_pass.py +62 -0
- jaclang/compiler/passes/tool/__init__.py +2 -0
- jaclang/compiler/passes/tool/doc_ir.py +179 -0
- jaclang/compiler/passes/tool/doc_ir_gen_pass.py +1210 -0
- jaclang/compiler/passes/tool/fuse_comments_pass.py +90 -70
- jaclang/compiler/passes/tool/jac_formatter_pass.py +122 -2554
- jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +249 -97
- jaclang/compiler/passes/tool/tests/fixtures/corelib_fmt.jac +94 -97
- jaclang/compiler/passes/tool/tests/fixtures/doc_string.jac +2 -2
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/access_mod_check.jac +5 -5
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/archetype_test.jac +13 -0
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/decorator_stack.jac +7 -7
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/line_spacing.jac +8 -8
- jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.dot +3 -3
- jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.txt +3 -3
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/ability_impl_long_comprehension.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/call_with_many_parameters.jac +2 -2
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/simple_walker.jac +3 -3
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/try_block_and_walker_spawn_and_fstrings.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/type_annotation.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/simple_walk.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac +10 -4
- jaclang/compiler/passes/tool/tests/test_doc_ir_gen_pass.py +29 -0
- jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +63 -88
- jaclang/compiler/passes/tool/tests/test_unparse_validate.py +27 -28
- jaclang/compiler/passes/transform.py +56 -16
- jaclang/compiler/passes/{ir_pass.py → uni_pass.py} +35 -52
- jaclang/compiler/program.py +205 -0
- jaclang/compiler/tests/fixtures/codegentext.jac +31 -0
- jaclang/compiler/tests/fixtures/fam.jac +10 -10
- jaclang/compiler/tests/fixtures/hello_world.jac +1 -1
- jaclang/compiler/tests/fixtures/staticcheck.jac +2 -2
- jaclang/compiler/tests/test_importer.py +21 -16
- jaclang/compiler/tests/test_parser.py +38 -17
- jaclang/compiler/{absyntree.py → unitree.py} +1120 -1012
- jaclang/langserve/engine.py +183 -171
- jaclang/langserve/sem_manager.py +26 -22
- jaclang/langserve/server.py +6 -15
- jaclang/langserve/tests/fixtures/base_module_structure.jac +7 -7
- jaclang/langserve/tests/fixtures/circle.jac +6 -6
- jaclang/langserve/tests/fixtures/circle_err.jac +6 -6
- jaclang/langserve/tests/fixtures/circle_pure.impl.jac +5 -5
- jaclang/langserve/tests/fixtures/circle_pure.jac +7 -7
- jaclang/langserve/tests/fixtures/circle_pure_err.impl.jac +2 -2
- jaclang/langserve/tests/fixtures/circle_pure_err.jac +7 -7
- jaclang/langserve/tests/fixtures/import_include_statements.jac +6 -6
- jaclang/langserve/tests/fixtures/rename.jac +6 -6
- jaclang/langserve/tests/server_test/test_lang_serve.py +262 -0
- jaclang/langserve/tests/server_test/utils.py +115 -0
- jaclang/langserve/tests/test_sem_tokens.py +2 -2
- jaclang/langserve/tests/test_server.py +41 -23
- jaclang/langserve/utils.jac +438 -0
- jaclang/runtimelib/{architype.py → archetype.py} +85 -61
- jaclang/runtimelib/builtin.py +92 -0
- jaclang/runtimelib/constructs.py +11 -13
- jaclang/runtimelib/importer.py +63 -51
- jaclang/runtimelib/machine.py +1551 -144
- jaclang/runtimelib/memory.py +6 -6
- jaclang/{plugin → runtimelib}/tests/fixtures/graph_purger.jac +1 -1
- jaclang/{plugin → runtimelib}/tests/fixtures/impl_match.jac +2 -2
- jaclang/runtimelib/tests/fixtures/impl_match_impl.jac +3 -0
- jaclang/{plugin → runtimelib}/tests/fixtures/other_root_access.jac +7 -7
- jaclang/{plugin → runtimelib}/tests/fixtures/savable_object.jac +3 -5
- jaclang/{plugin → runtimelib}/tests/fixtures/simple_node_connection.jac +6 -6
- jaclang/{plugin → runtimelib}/tests/fixtures/simple_persistent.jac +1 -1
- jaclang/runtimelib/tests/test_features.py +72 -0
- jaclang/{plugin → runtimelib}/tests/test_jaseci.py +6 -5
- jaclang/runtimelib/utils.py +31 -63
- jaclang/settings.py +1 -6
- jaclang/tests/fixtures/{abc.jac → abc_check.jac} +6 -6
- jaclang/tests/fixtures/arch_rel_import_creation.jac +4 -4
- jaclang/tests/fixtures/async_ability.jac +18 -0
- jaclang/tests/fixtures/async_walker.jac +23 -0
- jaclang/tests/fixtures/baddy.jac +1 -1
- jaclang/tests/fixtures/base_class1.jac +2 -2
- jaclang/tests/fixtures/base_class2.jac +2 -2
- jaclang/tests/fixtures/base_class_complex_expr.jac +3 -3
- jaclang/tests/fixtures/builtin_dotgen.jac +1 -1
- jaclang/tests/fixtures/builtin_dotgen_json.jac +21 -0
- jaclang/tests/fixtures/byllmissue.jac +1 -1
- jaclang/tests/fixtures/chandra_bugs.jac +1 -1
- jaclang/tests/fixtures/chandra_bugs2.jac +1 -1
- jaclang/tests/fixtures/cls_method.jac +6 -6
- jaclang/tests/fixtures/concurrency.jac +39 -0
- jaclang/tests/fixtures/connect_traverse_syntax.jac +18 -0
- jaclang/tests/fixtures/create_dynamic_archetype.jac +35 -0
- jaclang/tests/fixtures/decl_defn_param_name.jac +4 -4
- jaclang/tests/fixtures/deep/deeper/__init__.jac +1 -0
- jaclang/tests/fixtures/deep/deeper/deep_outer_import.jac +2 -3
- jaclang/tests/fixtures/deep/deeper/deep_outer_import2.jac +3 -3
- jaclang/tests/fixtures/deep/deeper/snd_lev.jac +2 -2
- jaclang/tests/fixtures/deep/mycode.jac +1 -1
- jaclang/tests/fixtures/deep/one_lev.jac +3 -4
- jaclang/tests/fixtures/deep/one_lev_dup.jac +2 -2
- jaclang/tests/fixtures/deep_convert.jac +1 -1
- jaclang/tests/fixtures/deep_import.jac +2 -2
- jaclang/tests/fixtures/deep_import_interp.jac +8 -0
- jaclang/tests/fixtures/deep_import_mods.jac +3 -3
- jaclang/tests/fixtures/deferred_field.jac +1 -1
- jaclang/tests/fixtures/del_clean.jac +7 -0
- jaclang/tests/fixtures/disconn.jac +3 -3
- jaclang/tests/fixtures/dynamic_archetype.jac +34 -0
- jaclang/tests/fixtures/edge_node_walk.jac +12 -12
- jaclang/tests/fixtures/edge_ops.jac +7 -7
- jaclang/tests/fixtures/edges_walk.jac +10 -10
- jaclang/tests/fixtures/edgetypeissue.jac +1 -1
- jaclang/tests/fixtures/enum_inside_archtype.jac +4 -4
- jaclang/tests/fixtures/err.impl.jac +1 -1
- jaclang/tests/fixtures/err.jac +2 -2
- jaclang/tests/fixtures/err_runtime.jac +2 -2
- jaclang/tests/fixtures/foo.jac +7 -7
- jaclang/tests/fixtures/game1.jac +4 -4
- jaclang/tests/fixtures/gendot_bubble_sort.jac +4 -4
- jaclang/tests/fixtures/glob_multivar_statement.jac +1 -1
- jaclang/tests/fixtures/guess_game.jac +5 -5
- jaclang/tests/fixtures/has_goodness.jac +1 -1
- jaclang/tests/fixtures/hash_init_check.jac +3 -3
- jaclang/tests/fixtures/hello.jac +1 -1
- jaclang/tests/fixtures/ignore.jac +3 -3
- jaclang/tests/fixtures/ignore_dup.jac +3 -3
- jaclang/tests/fixtures/impl_match_confused.impl.jac +1 -1
- jaclang/tests/fixtures/import.jac +9 -9
- jaclang/tests/fixtures/import_all.jac +1 -1
- jaclang/tests/fixtures/index_slice.jac +1 -1
- jaclang/tests/fixtures/inherit_check.jac +3 -3
- jaclang/tests/fixtures/jac_from_py.py +4 -0
- jaclang/tests/fixtures/jacsamp.jac +1 -1
- jaclang/tests/fixtures/jactest_main.jac +1 -1
- jaclang/tests/fixtures/jp_importer.jac +7 -8
- jaclang/tests/fixtures/jp_importer_auto.jac +3 -3
- jaclang/tests/fixtures/lambda.jac +2 -2
- jaclang/tests/fixtures/needs_import.jac +6 -6
- jaclang/tests/fixtures/needs_import_1.jac +1 -1
- jaclang/tests/fixtures/needs_import_2.jac +1 -1
- jaclang/tests/fixtures/needs_import_3.jac +1 -1
- jaclang/tests/fixtures/needs_import_dup.jac +6 -6
- jaclang/tests/fixtures/node_del.jac +60 -0
- jaclang/tests/fixtures/nosigself.jac +3 -3
- jaclang/tests/fixtures/py2jac.py +30 -0
- jaclang/tests/fixtures/py_bool_expr.py +7 -0
- jaclang/tests/fixtures/py_namedexpr.py +7 -0
- jaclang/tests/fixtures/pyfunc_3.py +0 -2
- jaclang/tests/fixtures/random_check.jac +5 -5
- jaclang/tests/fixtures/refs_target.jac +17 -0
- jaclang/tests/fixtures/simple_archs.jac +2 -2
- jaclang/tests/fixtures/simple_walk.jac +52 -0
- jaclang/tests/fixtures/slice_vals.jac +3 -3
- jaclang/tests/fixtures/sub_abil_sep.jac +3 -3
- jaclang/tests/fixtures/sub_abil_sep_multilev.jac +3 -3
- jaclang/tests/fixtures/trailing_comma.jac +4 -4
- jaclang/tests/fixtures/type_info.jac +5 -5
- jaclang/{compiler/passes/main/tests → tests}/fixtures/uninitialized_hasvars.jac +1 -1
- jaclang/tests/fixtures/visit_order.jac +4 -4
- jaclang/tests/fixtures/walker_override.jac +2 -2
- jaclang/tests/fixtures/walker_update.jac +5 -5
- jaclang/tests/fixtures/with_context.jac +4 -4
- jaclang/tests/test_bugs.py +2 -2
- jaclang/tests/test_cli.py +118 -223
- jaclang/tests/test_language.py +474 -468
- jaclang/tests/test_man_code.py +2 -2
- jaclang/tests/test_reference.py +4 -4
- jaclang/tests/test_settings.py +16 -16
- jaclang/tests/test_typecheck.py +555 -0
- jaclang/utils/__init__.py +4 -0
- jaclang/utils/helpers.py +12 -27
- jaclang/utils/lang_tools.py +84 -74
- jaclang/utils/module_resolver.py +69 -0
- jaclang/utils/test.py +8 -5
- jaclang/utils/tests/test_lang_tools.py +38 -13
- jaclang/utils/treeprinter.py +177 -40
- jaclang/vendor/__init__.py +1 -2
- jaclang/vendor/attr/__init__.py +14 -44
- jaclang/vendor/attr/__init__.pyi +155 -321
- jaclang/vendor/attr/_cmp.py +25 -15
- jaclang/vendor/attr/_cmp.pyi +7 -7
- jaclang/vendor/attr/_compat.py +15 -8
- jaclang/vendor/attr/_config.py +1 -1
- jaclang/vendor/attr/_funcs.py +148 -163
- jaclang/vendor/attr/_make.py +859 -855
- jaclang/vendor/attr/_next_gen.py +426 -32
- jaclang/vendor/attr/converters.py +67 -49
- jaclang/vendor/attr/converters.pyi +13 -7
- jaclang/vendor/attr/filters.py +17 -11
- jaclang/vendor/attr/filters.pyi +3 -3
- jaclang/vendor/attr/setters.py +11 -5
- jaclang/vendor/attr/setters.pyi +2 -1
- jaclang/vendor/attr/validators.py +191 -162
- jaclang/vendor/attr/validators.pyi +25 -27
- jaclang/vendor/attrs/__init__.py +9 -5
- jaclang/vendor/attrs/__init__.pyi +225 -29
- jaclang/vendor/attrs-25.3.0.dist-info/INSTALLER +1 -0
- jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/METADATA +83 -53
- jaclang/vendor/attrs-25.3.0.dist-info/RECORD +56 -0
- jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/WHEEL +1 -1
- jaclang/vendor/bin/dmypy +8 -0
- jaclang/vendor/bin/mypy +8 -0
- jaclang/vendor/bin/mypyc +8 -0
- jaclang/vendor/bin/stubgen +8 -0
- jaclang/vendor/bin/stubtest +8 -0
- jaclang/vendor/cattr/gen.py +2 -2
- jaclang/vendor/cattr/preconf/bson.py +1 -0
- jaclang/vendor/cattr/preconf/json.py +1 -0
- jaclang/vendor/cattr/preconf/msgpack.py +1 -0
- jaclang/vendor/cattr/preconf/orjson.py +1 -0
- jaclang/vendor/cattr/preconf/pyyaml.py +1 -0
- jaclang/vendor/cattr/preconf/tomlkit.py +1 -0
- jaclang/vendor/cattr/preconf/ujson.py +1 -0
- jaclang/vendor/cattrs/__init__.py +21 -21
- jaclang/vendor/cattrs/_compat.py +176 -62
- jaclang/vendor/cattrs/_generics.py +5 -3
- jaclang/vendor/cattrs/cols.py +289 -0
- jaclang/vendor/cattrs/converters.py +505 -187
- jaclang/vendor/cattrs/disambiguators.py +118 -45
- jaclang/vendor/cattrs/dispatch.py +66 -36
- jaclang/vendor/cattrs/fns.py +6 -1
- jaclang/vendor/cattrs/gen/__init__.py +365 -202
- jaclang/vendor/cattrs/gen/_generics.py +41 -5
- jaclang/vendor/cattrs/gen/_lc.py +3 -2
- jaclang/vendor/cattrs/gen/_shared.py +39 -32
- jaclang/vendor/cattrs/gen/typeddicts.py +75 -88
- jaclang/vendor/cattrs/preconf/__init__.py +20 -0
- jaclang/vendor/cattrs/preconf/bson.py +7 -8
- jaclang/vendor/cattrs/preconf/cbor2.py +3 -0
- jaclang/vendor/cattrs/preconf/json.py +8 -4
- jaclang/vendor/cattrs/preconf/msgpack.py +3 -0
- jaclang/vendor/cattrs/preconf/msgspec.py +185 -0
- jaclang/vendor/cattrs/preconf/orjson.py +20 -7
- jaclang/vendor/cattrs/preconf/pyyaml.py +15 -3
- jaclang/vendor/cattrs/preconf/tomlkit.py +3 -1
- jaclang/vendor/cattrs/preconf/ujson.py +3 -0
- jaclang/vendor/cattrs/strategies/__init__.py +1 -0
- jaclang/vendor/cattrs/strategies/_class_methods.py +1 -1
- jaclang/vendor/cattrs/strategies/_subclasses.py +43 -29
- jaclang/vendor/cattrs/strategies/_unions.py +47 -24
- jaclang/vendor/cattrs/v.py +1 -0
- jaclang/vendor/cattrs-24.1.3.dist-info/INSTALLER +1 -0
- jaclang/vendor/cattrs-24.1.3.dist-info/METADATA +161 -0
- jaclang/vendor/cattrs-24.1.3.dist-info/RECORD +96 -0
- jaclang/vendor/{cattrs-23.2.3.dist-info → cattrs-24.1.3.dist-info}/WHEEL +1 -1
- jaclang/vendor/lark/__init__.py +38 -38
- jaclang/vendor/lark/__pyinstaller/__init__.py +6 -6
- jaclang/vendor/lark/__pyinstaller/hook-lark.py +14 -14
- jaclang/vendor/lark/ast_utils.py +59 -59
- jaclang/vendor/lark/common.py +86 -89
- jaclang/vendor/lark/exceptions.py +292 -292
- jaclang/vendor/lark/grammar.py +130 -130
- jaclang/vendor/lark/grammars/common.lark +59 -59
- jaclang/vendor/lark/grammars/lark.lark +62 -62
- jaclang/vendor/lark/grammars/python.lark +302 -302
- jaclang/vendor/lark/grammars/unicode.lark +7 -7
- jaclang/vendor/lark/indenter.py +143 -112
- jaclang/vendor/lark/lark.py +658 -661
- jaclang/vendor/lark/lexer.py +678 -678
- jaclang/vendor/lark/load_grammar.py +1428 -1428
- jaclang/vendor/lark/parse_tree_builder.py +391 -391
- jaclang/vendor/lark/parser_frontends.py +257 -257
- jaclang/vendor/lark/parsers/cyk.py +340 -340
- jaclang/vendor/lark/parsers/earley.py +317 -308
- jaclang/vendor/lark/parsers/earley_common.py +42 -42
- jaclang/vendor/lark/parsers/earley_forest.py +802 -810
- jaclang/vendor/lark/parsers/grammar_analysis.py +203 -203
- jaclang/vendor/lark/parsers/lalr_analysis.py +332 -332
- jaclang/vendor/lark/parsers/lalr_interactive_parser.py +158 -157
- jaclang/vendor/lark/parsers/lalr_parser.py +122 -122
- jaclang/vendor/lark/parsers/lalr_parser_state.py +110 -110
- jaclang/vendor/lark/parsers/xearley.py +165 -165
- jaclang/vendor/lark/reconstruct.py +107 -107
- jaclang/vendor/lark/tools/__init__.py +70 -71
- jaclang/vendor/lark/tools/nearley.py +202 -202
- jaclang/vendor/lark/tools/serialize.py +32 -32
- jaclang/vendor/lark/tools/standalone.py +196 -196
- jaclang/vendor/lark/tree.py +267 -272
- jaclang/vendor/lark/tree_matcher.py +186 -186
- jaclang/vendor/lark/utils.py +346 -361
- jaclang/vendor/lark/visitors.py +596 -593
- jaclang/vendor/lark-1.2.2.dist-info/INSTALLER +1 -0
- jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/METADATA +48 -47
- jaclang/vendor/lark-1.2.2.dist-info/RECORD +83 -0
- jaclang/vendor/{mypy_extensions-1.0.0.dist-info → lark-1.2.2.dist-info}/WHEEL +1 -1
- jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info/licenses}/LICENSE +18 -18
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/INSTALLER +1 -0
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/METADATA +2 -1
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/RECORD +17 -10
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/WHEEL +1 -1
- jaclang/vendor/pluggy/_version.py +7 -2
- jaclang/vendor/pluggy-1.5.0.dist-info/INSTALLER +1 -0
- jaclang/vendor/pluggy-1.5.0.dist-info/METADATA +6 -5
- jaclang/vendor/pluggy-1.5.0.dist-info/RECORD +24 -14
- jaclang/vendor/pluggy-1.5.0.dist-info/WHEEL +1 -1
- jaclang/vendor/pygls-1.3.1.dist-info/INSTALLER +1 -0
- jaclang/vendor/pygls-1.3.1.dist-info/METADATA +2 -2
- jaclang/vendor/pygls-1.3.1.dist-info/RECORD +45 -24
- jaclang/vendor/pygls-1.3.1.dist-info/WHEEL +1 -1
- {jaclang-0.7.33.dist-info → jaclang-0.8.0.dist-info}/METADATA +4 -4
- jaclang-0.8.0.dist-info/RECORD +552 -0
- {jaclang-0.7.33.dist-info → jaclang-0.8.0.dist-info}/WHEEL +1 -1
- jaclang/compiler/.gitignore +0 -1
- jaclang/compiler/compile.py +0 -119
- jaclang/compiler/passes/main/access_modifier_pass.py +0 -130
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py +0 -656
- jaclang/compiler/passes/main/py_collect_dep_pass.py +0 -78
- jaclang/compiler/passes/main/pyout_pass.py +0 -86
- jaclang/compiler/passes/main/registry_pass.py +0 -156
- jaclang/compiler/passes/main/schedules.py +0 -47
- jaclang/compiler/passes/main/sub_node_tab_pass.py +0 -36
- jaclang/compiler/passes/main/tests/fixtures/registry.jac +0 -36
- jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py +0 -114
- jaclang/compiler/passes/main/tests/test_registry_pass.py +0 -31
- jaclang/compiler/passes/main/tests/test_type_check_pass.py +0 -91
- jaclang/compiler/passes/main/tests/test_typeinfo_pass.py +0 -29
- jaclang/compiler/passes/main/type_check_pass.py +0 -128
- jaclang/compiler/passes/tool/schedules.py +0 -18
- jaclang/compiler/passes/tool/tests/fixtures/genai/essay_review.jac +0 -36
- jaclang/compiler/passes/tool/tests/fixtures/genai/expert_answer.jac +0 -17
- jaclang/compiler/passes/tool/tests/fixtures/genai/joke_gen.jac +0 -32
- jaclang/compiler/passes/tool/tests/fixtures/genai/odd_word_out.jac +0 -27
- jaclang/compiler/passes/tool/tests/fixtures/genai/personality_finder.jac +0 -35
- jaclang/compiler/passes/tool/tests/fixtures/genai/text_to_type.jac +0 -25
- jaclang/compiler/passes/tool/tests/fixtures/genai/translator.jac +0 -13
- jaclang/compiler/passes/tool/tests/fixtures/genai/wikipedia.jac +0 -63
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/architype_test.jac +0 -13
- jaclang/compiler/passes/utils/mypy_ast_build.py +0 -940
- jaclang/compiler/py_info.py +0 -22
- jaclang/compiler/semtable.py +0 -159
- jaclang/compiler/symtable.py +0 -297
- jaclang/langserve/utils.py +0 -458
- jaclang/plugin/__init__.py +0 -7
- jaclang/plugin/builtin.py +0 -57
- jaclang/plugin/default.py +0 -1443
- jaclang/plugin/feature.py +0 -574
- jaclang/plugin/plugin.md +0 -471
- jaclang/plugin/spec.py +0 -536
- jaclang/plugin/tests/fixtures/impl_match_impl.jac +0 -3
- jaclang/plugin/tests/test_features.py +0 -56
- jaclang/runtimelib/context.py +0 -191
- jaclang/tests/fixtures/create_dynamic_architype.jac +0 -35
- jaclang/tests/fixtures/dynamic_architype.jac +0 -34
- jaclang/tests/fixtures/impl_grab.impl.jac +0 -5
- jaclang/tests/fixtures/mtest.impl.jac +0 -6
- jaclang/tests/fixtures/registry.jac +0 -58
- jaclang/tests/fixtures/semstr.jac +0 -30
- jaclang/tests/main.jac +0 -2
- jaclang/utils/profiler.py +0 -62
- jaclang/vendor/attrs-23.2.0.dist-info/RECORD +0 -35
- jaclang/vendor/cattrs-23.2.3.dist-info/METADATA +0 -221
- jaclang/vendor/cattrs-23.2.3.dist-info/RECORD +0 -48
- jaclang/vendor/lark-1.1.9.dist-info/RECORD +0 -46
- jaclang/vendor/lark-1.1.9.dist-info/WHEEL +0 -5
- jaclang/vendor/mypy/__init__.py +0 -1
- jaclang/vendor/mypy/__main__.py +0 -37
- jaclang/vendor/mypy/api.py +0 -94
- jaclang/vendor/mypy/applytype.py +0 -172
- jaclang/vendor/mypy/argmap.py +0 -268
- jaclang/vendor/mypy/binder.py +0 -538
- jaclang/vendor/mypy/bogus_type.py +0 -27
- jaclang/vendor/mypy/build.py +0 -3562
- jaclang/vendor/mypy/checker.py +0 -8445
- jaclang/vendor/mypy/checkexpr.py +0 -6623
- jaclang/vendor/mypy/checkmember.py +0 -1363
- jaclang/vendor/mypy/checkpattern.py +0 -801
- jaclang/vendor/mypy/checkstrformat.py +0 -1109
- jaclang/vendor/mypy/config_parser.py +0 -670
- jaclang/vendor/mypy/constant_fold.py +0 -187
- jaclang/vendor/mypy/constraints.py +0 -1636
- jaclang/vendor/mypy/copytype.py +0 -133
- jaclang/vendor/mypy/defaults.py +0 -46
- jaclang/vendor/mypy/dmypy/__main__.py +0 -6
- jaclang/vendor/mypy/dmypy/client.py +0 -749
- jaclang/vendor/mypy/dmypy_os.py +0 -42
- jaclang/vendor/mypy/dmypy_server.py +0 -1107
- jaclang/vendor/mypy/dmypy_util.py +0 -117
- jaclang/vendor/mypy/erasetype.py +0 -278
- jaclang/vendor/mypy/errorcodes.py +0 -291
- jaclang/vendor/mypy/errors.py +0 -1280
- jaclang/vendor/mypy/evalexpr.py +0 -205
- jaclang/vendor/mypy/expandtype.py +0 -524
- jaclang/vendor/mypy/exprtotype.py +0 -209
- jaclang/vendor/mypy/fastparse.py +0 -2147
- jaclang/vendor/mypy/find_sources.py +0 -243
- jaclang/vendor/mypy/fixup.py +0 -428
- jaclang/vendor/mypy/freetree.py +0 -23
- jaclang/vendor/mypy/fscache.py +0 -309
- jaclang/vendor/mypy/fswatcher.py +0 -106
- jaclang/vendor/mypy/gclogger.py +0 -47
- jaclang/vendor/mypy/git.py +0 -34
- jaclang/vendor/mypy/graph_utils.py +0 -112
- jaclang/vendor/mypy/indirection.py +0 -121
- jaclang/vendor/mypy/infer.py +0 -75
- jaclang/vendor/mypy/inspections.py +0 -627
- jaclang/vendor/mypy/ipc.py +0 -310
- jaclang/vendor/mypy/join.py +0 -871
- jaclang/vendor/mypy/literals.py +0 -306
- jaclang/vendor/mypy/lookup.py +0 -61
- jaclang/vendor/mypy/main.py +0 -1574
- jaclang/vendor/mypy/maptype.py +0 -106
- jaclang/vendor/mypy/meet.py +0 -1140
- jaclang/vendor/mypy/memprofile.py +0 -121
- jaclang/vendor/mypy/message_registry.py +0 -329
- jaclang/vendor/mypy/messages.py +0 -3186
- jaclang/vendor/mypy/metastore.py +0 -225
- jaclang/vendor/mypy/mixedtraverser.py +0 -112
- jaclang/vendor/mypy/modulefinder.py +0 -875
- jaclang/vendor/mypy/moduleinspect.py +0 -184
- jaclang/vendor/mypy/mro.py +0 -62
- jaclang/vendor/mypy/nodes.py +0 -4115
- jaclang/vendor/mypy/operators.py +0 -126
- jaclang/vendor/mypy/options.py +0 -556
- jaclang/vendor/mypy/parse.py +0 -30
- jaclang/vendor/mypy/partially_defined.py +0 -675
- jaclang/vendor/mypy/patterns.py +0 -150
- jaclang/vendor/mypy/plugin.py +0 -901
- jaclang/vendor/mypy/plugins/attrs.py +0 -1166
- jaclang/vendor/mypy/plugins/common.py +0 -440
- jaclang/vendor/mypy/plugins/ctypes.py +0 -245
- jaclang/vendor/mypy/plugins/dataclasses.py +0 -1108
- jaclang/vendor/mypy/plugins/default.py +0 -531
- jaclang/vendor/mypy/plugins/enums.py +0 -259
- jaclang/vendor/mypy/plugins/functools.py +0 -104
- jaclang/vendor/mypy/plugins/proper_plugin.py +0 -175
- jaclang/vendor/mypy/plugins/singledispatch.py +0 -224
- jaclang/vendor/mypy/py.typed +0 -1
- jaclang/vendor/mypy/pyinfo.py +0 -78
- jaclang/vendor/mypy/reachability.py +0 -362
- jaclang/vendor/mypy/refinfo.py +0 -92
- jaclang/vendor/mypy/renaming.py +0 -568
- jaclang/vendor/mypy/report.py +0 -924
- jaclang/vendor/mypy/scope.py +0 -125
- jaclang/vendor/mypy/semanal.py +0 -7187
- jaclang/vendor/mypy/semanal_classprop.py +0 -187
- jaclang/vendor/mypy/semanal_enum.py +0 -253
- jaclang/vendor/mypy/semanal_infer.py +0 -128
- jaclang/vendor/mypy/semanal_main.py +0 -511
- jaclang/vendor/mypy/semanal_namedtuple.py +0 -670
- jaclang/vendor/mypy/semanal_newtype.py +0 -273
- jaclang/vendor/mypy/semanal_pass1.py +0 -156
- jaclang/vendor/mypy/semanal_shared.py +0 -490
- jaclang/vendor/mypy/semanal_typeargs.py +0 -265
- jaclang/vendor/mypy/semanal_typeddict.py +0 -575
- jaclang/vendor/mypy/server/astdiff.py +0 -518
- jaclang/vendor/mypy/server/astmerge.py +0 -562
- jaclang/vendor/mypy/server/aststrip.py +0 -281
- jaclang/vendor/mypy/server/deps.py +0 -1137
- jaclang/vendor/mypy/server/mergecheck.py +0 -83
- jaclang/vendor/mypy/server/objgraph.py +0 -101
- jaclang/vendor/mypy/server/subexpr.py +0 -198
- jaclang/vendor/mypy/server/target.py +0 -11
- jaclang/vendor/mypy/server/trigger.py +0 -26
- jaclang/vendor/mypy/server/update.py +0 -1339
- jaclang/vendor/mypy/sharedparse.py +0 -112
- jaclang/vendor/mypy/solve.py +0 -562
- jaclang/vendor/mypy/split_namespace.py +0 -35
- jaclang/vendor/mypy/state.py +0 -28
- jaclang/vendor/mypy/stats.py +0 -489
- jaclang/vendor/mypy/strconv.py +0 -641
- jaclang/vendor/mypy/stubdoc.py +0 -491
- jaclang/vendor/mypy/stubgen.py +0 -1886
- jaclang/vendor/mypy/stubgenc.py +0 -993
- jaclang/vendor/mypy/stubinfo.py +0 -173
- jaclang/vendor/mypy/stubtest.py +0 -2079
- jaclang/vendor/mypy/stubutil.py +0 -834
- jaclang/vendor/mypy/subtypes.py +0 -1980
- jaclang/vendor/mypy/suggestions.py +0 -1046
- jaclang/vendor/mypy/test/config.py +0 -28
- jaclang/vendor/mypy/test/data.py +0 -821
- jaclang/vendor/mypy/test/helpers.py +0 -476
- jaclang/vendor/mypy/test/meta/_pytest.py +0 -72
- jaclang/vendor/mypy/test/meta/test_diff_helper.py +0 -47
- jaclang/vendor/mypy/test/meta/test_parse_data.py +0 -73
- jaclang/vendor/mypy/test/meta/test_update_data.py +0 -135
- jaclang/vendor/mypy/test/test_find_sources.py +0 -376
- jaclang/vendor/mypy/test/test_ref_info.py +0 -45
- jaclang/vendor/mypy/test/testapi.py +0 -45
- jaclang/vendor/mypy/test/testargs.py +0 -77
- jaclang/vendor/mypy/test/testcheck.py +0 -322
- jaclang/vendor/mypy/test/testcmdline.py +0 -152
- jaclang/vendor/mypy/test/testconstraints.py +0 -134
- jaclang/vendor/mypy/test/testdaemon.py +0 -132
- jaclang/vendor/mypy/test/testdeps.py +0 -77
- jaclang/vendor/mypy/test/testdiff.py +0 -67
- jaclang/vendor/mypy/test/testerrorstream.py +0 -46
- jaclang/vendor/mypy/test/testfinegrained.py +0 -438
- jaclang/vendor/mypy/test/testfinegrainedcache.py +0 -18
- jaclang/vendor/mypy/test/testformatter.py +0 -85
- jaclang/vendor/mypy/test/testfscache.py +0 -101
- jaclang/vendor/mypy/test/testgraph.py +0 -83
- jaclang/vendor/mypy/test/testinfer.py +0 -373
- jaclang/vendor/mypy/test/testipc.py +0 -119
- jaclang/vendor/mypy/test/testmerge.py +0 -238
- jaclang/vendor/mypy/test/testmodulefinder.py +0 -278
- jaclang/vendor/mypy/test/testmypyc.py +0 -14
- jaclang/vendor/mypy/test/testparse.py +0 -107
- jaclang/vendor/mypy/test/testpep561.py +0 -211
- jaclang/vendor/mypy/test/testpythoneval.py +0 -117
- jaclang/vendor/mypy/test/testreports.py +0 -55
- jaclang/vendor/mypy/test/testsemanal.py +0 -209
- jaclang/vendor/mypy/test/testsolve.py +0 -285
- jaclang/vendor/mypy/test/teststubgen.py +0 -1412
- jaclang/vendor/mypy/test/teststubinfo.py +0 -12
- jaclang/vendor/mypy/test/teststubtest.py +0 -2492
- jaclang/vendor/mypy/test/testsubtypes.py +0 -303
- jaclang/vendor/mypy/test/testtransform.py +0 -64
- jaclang/vendor/mypy/test/testtypegen.py +0 -83
- jaclang/vendor/mypy/test/testtypes.py +0 -1551
- jaclang/vendor/mypy/test/testutil.py +0 -111
- jaclang/vendor/mypy/test/typefixture.py +0 -415
- jaclang/vendor/mypy/test/update_data.py +0 -87
- jaclang/vendor/mypy/test/visitors.py +0 -63
- jaclang/vendor/mypy/traverser.py +0 -961
- jaclang/vendor/mypy/treetransform.py +0 -800
- jaclang/vendor/mypy/tvar_scope.py +0 -169
- jaclang/vendor/mypy/type_visitor.py +0 -564
- jaclang/vendor/mypy/typeanal.py +0 -2596
- jaclang/vendor/mypy/typeops.py +0 -1082
- jaclang/vendor/mypy/types.py +0 -3708
- jaclang/vendor/mypy/types_utils.py +0 -166
- jaclang/vendor/mypy/typeshed/LICENSE +0 -237
- jaclang/vendor/mypy/typeshed/stdlib/VERSIONS +0 -309
- jaclang/vendor/mypy/typeshed/stdlib/__future__.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/__main__.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/_ast.pyi +0 -591
- jaclang/vendor/mypy/typeshed/stdlib/_bisect.pyi +0 -84
- jaclang/vendor/mypy/typeshed/stdlib/_bootlocale.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/_codecs.pyi +0 -133
- jaclang/vendor/mypy/typeshed/stdlib/_collections_abc.pyi +0 -94
- jaclang/vendor/mypy/typeshed/stdlib/_compat_pickle.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/_compression.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/_csv.pyi +0 -90
- jaclang/vendor/mypy/typeshed/stdlib/_ctypes.pyi +0 -207
- jaclang/vendor/mypy/typeshed/stdlib/_curses.pyi +0 -566
- jaclang/vendor/mypy/typeshed/stdlib/_decimal.pyi +0 -281
- jaclang/vendor/mypy/typeshed/stdlib/_dummy_thread.pyi +0 -33
- jaclang/vendor/mypy/typeshed/stdlib/_dummy_threading.pyi +0 -164
- jaclang/vendor/mypy/typeshed/stdlib/_heapq.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/_imp.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/_json.pyi +0 -49
- jaclang/vendor/mypy/typeshed/stdlib/_locale.pyi +0 -100
- jaclang/vendor/mypy/typeshed/stdlib/_lsprof.pyi +0 -35
- jaclang/vendor/mypy/typeshed/stdlib/_markupbase.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/_msi.pyi +0 -92
- jaclang/vendor/mypy/typeshed/stdlib/_operator.pyi +0 -147
- jaclang/vendor/mypy/typeshed/stdlib/_osx_support.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/_posixsubprocess.pyi +0 -33
- jaclang/vendor/mypy/typeshed/stdlib/_py_abc.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/_pydecimal.pyi +0 -43
- jaclang/vendor/mypy/typeshed/stdlib/_random.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/_sitebuiltins.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/_socket.pyi +0 -803
- jaclang/vendor/mypy/typeshed/stdlib/_stat.pyi +0 -103
- jaclang/vendor/mypy/typeshed/stdlib/_thread.pyi +0 -59
- jaclang/vendor/mypy/typeshed/stdlib/_threading_local.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/_tkinter.pyi +0 -121
- jaclang/vendor/mypy/typeshed/stdlib/_tracemalloc.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/__init__.pyi +0 -347
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/dbapi.pyi +0 -37
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/wsgi.pyi +0 -44
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/xml.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/_warnings.pyi +0 -55
- jaclang/vendor/mypy/typeshed/stdlib/_weakref.pyi +0 -41
- jaclang/vendor/mypy/typeshed/stdlib/_weakrefset.pyi +0 -51
- jaclang/vendor/mypy/typeshed/stdlib/_winapi.pyi +0 -255
- jaclang/vendor/mypy/typeshed/stdlib/abc.pyi +0 -51
- jaclang/vendor/mypy/typeshed/stdlib/aifc.pyi +0 -91
- jaclang/vendor/mypy/typeshed/stdlib/antigravity.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/argparse.pyi +0 -595
- jaclang/vendor/mypy/typeshed/stdlib/array.pyi +0 -92
- jaclang/vendor/mypy/typeshed/stdlib/ast.pyi +0 -277
- jaclang/vendor/mypy/typeshed/stdlib/asynchat.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/__init__.pyi +0 -41
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_events.pyi +0 -440
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_futures.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_subprocess.pyi +0 -63
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_tasks.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/constants.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/coroutines.pyi +0 -26
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/events.pyi +0 -580
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/exceptions.pyi +0 -43
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/format_helpers.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/futures.pyi +0 -57
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/locks.pyi +0 -121
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/log.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/mixins.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/proactor_events.pyi +0 -64
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/protocols.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/queues.pyi +0 -47
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/runners.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/selector_events.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/sslproto.pyi +0 -165
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/staggered.pyi +0 -10
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/streams.pyi +0 -153
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/subprocess.pyi +0 -229
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/taskgroups.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/tasks.pyi +0 -497
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/threads.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/timeouts.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/transports.pyi +0 -47
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/trsock.pyi +0 -94
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/unix_events.pyi +0 -196
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/windows_events.pyi +0 -85
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/windows_utils.pyi +0 -49
- jaclang/vendor/mypy/typeshed/stdlib/asyncore.pyi +0 -90
- jaclang/vendor/mypy/typeshed/stdlib/atexit.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/audioop.pyi +0 -43
- jaclang/vendor/mypy/typeshed/stdlib/base64.pyi +0 -59
- jaclang/vendor/mypy/typeshed/stdlib/bdb.pyi +0 -102
- jaclang/vendor/mypy/typeshed/stdlib/binascii.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/binhex.pyi +0 -45
- jaclang/vendor/mypy/typeshed/stdlib/bisect.pyi +0 -4
- jaclang/vendor/mypy/typeshed/stdlib/builtins.pyi +0 -1936
- jaclang/vendor/mypy/typeshed/stdlib/bz2.pyi +0 -146
- jaclang/vendor/mypy/typeshed/stdlib/cProfile.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/calendar.pyi +0 -208
- jaclang/vendor/mypy/typeshed/stdlib/cgi.pyi +0 -118
- jaclang/vendor/mypy/typeshed/stdlib/cgitb.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/chunk.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/cmath.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/cmd.pyi +0 -45
- jaclang/vendor/mypy/typeshed/stdlib/code.pyi +0 -33
- jaclang/vendor/mypy/typeshed/stdlib/codecs.pyi +0 -285
- jaclang/vendor/mypy/typeshed/stdlib/codeop.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/collections/__init__.pyi +0 -485
- jaclang/vendor/mypy/typeshed/stdlib/collections/abc.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/colorsys.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/compileall.pyi +0 -111
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/__init__.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/_base.pyi +0 -126
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/process.pyi +0 -233
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/thread.pyi +0 -80
- jaclang/vendor/mypy/typeshed/stdlib/configparser.pyi +0 -313
- jaclang/vendor/mypy/typeshed/stdlib/contextlib.pyi +0 -208
- jaclang/vendor/mypy/typeshed/stdlib/contextvars.pyi +0 -63
- jaclang/vendor/mypy/typeshed/stdlib/copy.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/copyreg.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/crypt.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/csv.pyi +0 -147
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/__init__.pyi +0 -187
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/_endian.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/util.pyi +0 -6
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/wintypes.pyi +0 -298
- jaclang/vendor/mypy/typeshed/stdlib/curses/__init__.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/curses/ascii.pyi +0 -62
- jaclang/vendor/mypy/typeshed/stdlib/curses/has_key.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/curses/panel.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/curses/textpad.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/dataclasses.pyi +0 -315
- jaclang/vendor/mypy/typeshed/stdlib/datetime.pyi +0 -295
- jaclang/vendor/mypy/typeshed/stdlib/dbm/__init__.pyi +0 -95
- jaclang/vendor/mypy/typeshed/stdlib/dbm/dumb.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/dbm/gnu.pyi +0 -41
- jaclang/vendor/mypy/typeshed/stdlib/dbm/ndbm.pyi +0 -37
- jaclang/vendor/mypy/typeshed/stdlib/decimal.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/difflib.pyi +0 -140
- jaclang/vendor/mypy/typeshed/stdlib/dis.pyi +0 -144
- jaclang/vendor/mypy/typeshed/stdlib/distutils/__init__.pyi +0 -5
- jaclang/vendor/mypy/typeshed/stdlib/distutils/archive_util.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/distutils/bcppcompiler.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/distutils/ccompiler.pyi +0 -152
- jaclang/vendor/mypy/typeshed/stdlib/distutils/cmd.pyi +0 -66
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_dumb.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_msi.pyi +0 -45
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_rpm.pyi +0 -52
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_wininst.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_clib.pyi +0 -27
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_ext.pyi +0 -50
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_py.pyi +0 -44
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_scripts.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/check.pyi +0 -39
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/clean.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/config.pyi +0 -83
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install.pyi +0 -63
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_data.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_egg_info.pyi +0 -18
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_headers.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_lib.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_scripts.pyi +0 -18
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/register.pyi +0 -18
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/sdist.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/upload.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/distutils/config.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/distutils/core.pyi +0 -57
- jaclang/vendor/mypy/typeshed/stdlib/distutils/cygwinccompiler.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/distutils/debug.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/distutils/dep_util.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/distutils/dir_util.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/distutils/dist.pyi +0 -146
- jaclang/vendor/mypy/typeshed/stdlib/distutils/errors.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/distutils/extension.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/distutils/fancy_getopt.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/distutils/file_util.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/distutils/filelist.pyi +0 -50
- jaclang/vendor/mypy/typeshed/stdlib/distutils/log.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/distutils/msvccompiler.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/distutils/spawn.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/distutils/sysconfig.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/distutils/text_file.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/distutils/unixccompiler.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/distutils/util.pyi +0 -46
- jaclang/vendor/mypy/typeshed/stdlib/distutils/version.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/doctest.pyi +0 -248
- jaclang/vendor/mypy/typeshed/stdlib/dummy_threading.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/email/__init__.pyi +0 -29
- jaclang/vendor/mypy/typeshed/stdlib/email/_header_value_parser.pyi +0 -392
- jaclang/vendor/mypy/typeshed/stdlib/email/_policybase.pyi +0 -51
- jaclang/vendor/mypy/typeshed/stdlib/email/base64mime.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/email/charset.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/email/contentmanager.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/email/encoders.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/email/errors.pyi +0 -39
- jaclang/vendor/mypy/typeshed/stdlib/email/feedparser.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/email/generator.pyi +0 -40
- jaclang/vendor/mypy/typeshed/stdlib/email/header.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/email/headerregistry.pyi +0 -178
- jaclang/vendor/mypy/typeshed/stdlib/email/iterators.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/email/message.pyi +0 -165
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/application.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/audio.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/base.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/image.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/message.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/multipart.pyi +0 -18
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/nonmultipart.pyi +0 -5
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/text.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/email/parser.pyi +0 -26
- jaclang/vendor/mypy/typeshed/stdlib/email/policy.pyi +0 -38
- jaclang/vendor/mypy/typeshed/stdlib/email/quoprimime.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/email/utils.pyi +0 -70
- jaclang/vendor/mypy/typeshed/stdlib/encodings/__init__.pyi +0 -10
- jaclang/vendor/mypy/typeshed/stdlib/encodings/utf_8.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/encodings/utf_8_sig.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/ensurepip/__init__.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/enum.pyi +0 -320
- jaclang/vendor/mypy/typeshed/stdlib/errno.pyi +0 -222
- jaclang/vendor/mypy/typeshed/stdlib/faulthandler.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/fcntl.pyi +0 -127
- jaclang/vendor/mypy/typeshed/stdlib/filecmp.pyi +0 -57
- jaclang/vendor/mypy/typeshed/stdlib/fileinput.pyi +0 -213
- jaclang/vendor/mypy/typeshed/stdlib/fnmatch.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/formatter.pyi +0 -88
- jaclang/vendor/mypy/typeshed/stdlib/fractions.pyi +0 -150
- jaclang/vendor/mypy/typeshed/stdlib/ftplib.pyi +0 -178
- jaclang/vendor/mypy/typeshed/stdlib/functools.pyi +0 -213
- jaclang/vendor/mypy/typeshed/stdlib/gc.pyi +0 -37
- jaclang/vendor/mypy/typeshed/stdlib/genericpath.pyi +0 -52
- jaclang/vendor/mypy/typeshed/stdlib/getopt.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/getpass.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/gettext.pyi +0 -169
- jaclang/vendor/mypy/typeshed/stdlib/glob.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/graphlib.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/grp.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/gzip.pyi +0 -160
- jaclang/vendor/mypy/typeshed/stdlib/hashlib.pyi +0 -167
- jaclang/vendor/mypy/typeshed/stdlib/heapq.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/hmac.pyi +0 -38
- jaclang/vendor/mypy/typeshed/stdlib/html/__init__.pyi +0 -6
- jaclang/vendor/mypy/typeshed/stdlib/html/entities.pyi +0 -6
- jaclang/vendor/mypy/typeshed/stdlib/html/parser.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/http/__init__.pyi +0 -105
- jaclang/vendor/mypy/typeshed/stdlib/http/client.pyi +0 -259
- jaclang/vendor/mypy/typeshed/stdlib/http/cookiejar.pyi +0 -159
- jaclang/vendor/mypy/typeshed/stdlib/http/cookies.pyi +0 -60
- jaclang/vendor/mypy/typeshed/stdlib/http/server.pyi +0 -83
- jaclang/vendor/mypy/typeshed/stdlib/imaplib.pyi +0 -168
- jaclang/vendor/mypy/typeshed/stdlib/imghdr.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/imp.pyi +0 -62
- jaclang/vendor/mypy/typeshed/stdlib/importlib/__init__.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/importlib/_abc.pyi +0 -15
- jaclang/vendor/mypy/typeshed/stdlib/importlib/abc.pyi +0 -172
- jaclang/vendor/mypy/typeshed/stdlib/importlib/machinery.pyi +0 -179
- jaclang/vendor/mypy/typeshed/stdlib/importlib/metadata/__init__.pyi +0 -285
- jaclang/vendor/mypy/typeshed/stdlib/importlib/metadata/_meta.pyi +0 -49
- jaclang/vendor/mypy/typeshed/stdlib/importlib/readers.pyi +0 -68
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/__init__.pyi +0 -46
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/abc.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/readers.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/simple.pyi +0 -56
- jaclang/vendor/mypy/typeshed/stdlib/importlib/simple.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/importlib/util.pyi +0 -43
- jaclang/vendor/mypy/typeshed/stdlib/inspect.pyi +0 -632
- jaclang/vendor/mypy/typeshed/stdlib/io.pyi +0 -238
- jaclang/vendor/mypy/typeshed/stdlib/ipaddress.pyi +0 -208
- jaclang/vendor/mypy/typeshed/stdlib/itertools.pyi +0 -273
- jaclang/vendor/mypy/typeshed/stdlib/json/__init__.pyi +0 -61
- jaclang/vendor/mypy/typeshed/stdlib/json/decoder.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/json/encoder.pyi +0 -40
- jaclang/vendor/mypy/typeshed/stdlib/json/tool.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/keyword.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/btm_matcher.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixer_base.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_apply.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_asserts.pyi +0 -10
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_basestring.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_buffer.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_dict.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_except.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_exec.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_execfile.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_exitfunc.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_filter.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_funcattrs.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_future.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_getcwdu.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_has_key.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_idioms.pyi +0 -15
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_import.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports2.pyi +0 -6
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_input.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_intern.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_isinstance.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools_imports.pyi +0 -7
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_long.pyi +0 -7
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_map.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_metaclass.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_methodattrs.pyi +0 -10
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_ne.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_next.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_nonzero.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_numliterals.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_operator.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_paren.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_print.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_raise.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_raw_input.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_reduce.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_reload.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_renames.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_repr.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_set_literal.pyi +0 -7
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_standarderror.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_sys_exc.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_throw.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_tuple_params.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_types.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_unicode.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_urllib.pyi +0 -15
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_ws_comma.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_xrange.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_xreadlines.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_zip.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/main.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/__init__.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/driver.pyi +0 -27
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/grammar.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/literals.pyi +0 -7
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/parse.pyi +0 -30
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/pgen.pyi +0 -50
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/token.pyi +0 -67
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi +0 -96
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pygram.pyi +0 -114
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pytree.pyi +0 -117
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/refactor.pyi +0 -82
- jaclang/vendor/mypy/typeshed/stdlib/linecache.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/locale.pyi +0 -152
- jaclang/vendor/mypy/typeshed/stdlib/logging/__init__.pyi +0 -658
- jaclang/vendor/mypy/typeshed/stdlib/logging/config.pyi +0 -134
- jaclang/vendor/mypy/typeshed/stdlib/logging/handlers.pyi +0 -275
- jaclang/vendor/mypy/typeshed/stdlib/lzma.pyi +0 -197
- jaclang/vendor/mypy/typeshed/stdlib/mailbox.pyi +0 -256
- jaclang/vendor/mypy/typeshed/stdlib/mailcap.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/marshal.pyi +0 -33
- jaclang/vendor/mypy/typeshed/stdlib/math.pyi +0 -125
- jaclang/vendor/mypy/typeshed/stdlib/mimetypes.pyi +0 -46
- jaclang/vendor/mypy/typeshed/stdlib/mmap.pyi +0 -113
- jaclang/vendor/mypy/typeshed/stdlib/modulefinder.pyi +0 -66
- jaclang/vendor/mypy/typeshed/stdlib/msilib/__init__.pyi +0 -177
- jaclang/vendor/mypy/typeshed/stdlib/msilib/schema.pyi +0 -94
- jaclang/vendor/mypy/typeshed/stdlib/msilib/sequence.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/msilib/text.pyi +0 -7
- jaclang/vendor/mypy/typeshed/stdlib/msvcrt.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/__init__.pyi +0 -90
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/connection.pyi +0 -75
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/context.pyi +0 -189
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/dummy/__init__.pyi +0 -77
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/dummy/connection.pyi +0 -39
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/forkserver.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/heap.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/managers.pyi +0 -212
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/pool.pyi +0 -103
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_fork.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_forkserver.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_spawn_posix.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi +0 -30
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/process.pyi +0 -39
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/queues.pyi +0 -41
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/reduction.pyi +0 -90
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/resource_sharer.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/resource_tracker.pyi +0 -18
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/shared_memory.pyi +0 -40
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/sharedctypes.pyi +0 -107
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/spawn.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/synchronize.pyi +0 -54
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/util.pyi +0 -98
- jaclang/vendor/mypy/typeshed/stdlib/netrc.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/nis.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/nntplib.pyi +0 -125
- jaclang/vendor/mypy/typeshed/stdlib/nt.pyi +0 -111
- jaclang/vendor/mypy/typeshed/stdlib/ntpath.pyi +0 -119
- jaclang/vendor/mypy/typeshed/stdlib/nturl2path.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/numbers.pyi +0 -209
- jaclang/vendor/mypy/typeshed/stdlib/opcode.pyi +0 -59
- jaclang/vendor/mypy/typeshed/stdlib/operator.pyi +0 -110
- jaclang/vendor/mypy/typeshed/stdlib/optparse.pyi +0 -255
- jaclang/vendor/mypy/typeshed/stdlib/os/__init__.pyi +0 -1157
- jaclang/vendor/mypy/typeshed/stdlib/os/path.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/ossaudiodev.pyi +0 -131
- jaclang/vendor/mypy/typeshed/stdlib/parser.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/pathlib.pyi +0 -232
- jaclang/vendor/mypy/typeshed/stdlib/pdb.pyi +0 -181
- jaclang/vendor/mypy/typeshed/stdlib/pickle.pyi +0 -271
- jaclang/vendor/mypy/typeshed/stdlib/pickletools.pyi +0 -167
- jaclang/vendor/mypy/typeshed/stdlib/pipes.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/pkgutil.pyi +0 -53
- jaclang/vendor/mypy/typeshed/stdlib/platform.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/plistlib.pyi +0 -113
- jaclang/vendor/mypy/typeshed/stdlib/poplib.pyi +0 -71
- jaclang/vendor/mypy/typeshed/stdlib/posix.pyi +0 -361
- jaclang/vendor/mypy/typeshed/stdlib/posixpath.pyi +0 -161
- jaclang/vendor/mypy/typeshed/stdlib/pprint.pyi +0 -112
- jaclang/vendor/mypy/typeshed/stdlib/profile.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/pstats.pyi +0 -80
- jaclang/vendor/mypy/typeshed/stdlib/pty.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/pwd.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/py_compile.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/pyclbr.pyi +0 -74
- jaclang/vendor/mypy/typeshed/stdlib/pydoc.pyi +0 -261
- jaclang/vendor/mypy/typeshed/stdlib/pydoc_data/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/pydoc_data/topics.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/pyexpat/__init__.pyi +0 -85
- jaclang/vendor/mypy/typeshed/stdlib/pyexpat/errors.pyi +0 -49
- jaclang/vendor/mypy/typeshed/stdlib/pyexpat/model.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/queue.pyi +0 -66
- jaclang/vendor/mypy/typeshed/stdlib/quopri.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/random.pyi +0 -138
- jaclang/vendor/mypy/typeshed/stdlib/re.pyi +0 -290
- jaclang/vendor/mypy/typeshed/stdlib/readline.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/reprlib.pyi +0 -65
- jaclang/vendor/mypy/typeshed/stdlib/resource.pyi +0 -94
- jaclang/vendor/mypy/typeshed/stdlib/rlcompleter.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/runpy.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/sched.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/secrets.pyi +0 -15
- jaclang/vendor/mypy/typeshed/stdlib/select.pyi +0 -155
- jaclang/vendor/mypy/typeshed/stdlib/selectors.pyi +0 -67
- jaclang/vendor/mypy/typeshed/stdlib/shelve.pyi +0 -46
- jaclang/vendor/mypy/typeshed/stdlib/shlex.pyi +0 -63
- jaclang/vendor/mypy/typeshed/stdlib/shutil.pyi +0 -185
- jaclang/vendor/mypy/typeshed/stdlib/signal.pyi +0 -188
- jaclang/vendor/mypy/typeshed/stdlib/site.pyi +0 -27
- jaclang/vendor/mypy/typeshed/stdlib/smtpd.pyi +0 -91
- jaclang/vendor/mypy/typeshed/stdlib/smtplib.pyi +0 -204
- jaclang/vendor/mypy/typeshed/stdlib/sndhdr.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/socket.pyi +0 -825
- jaclang/vendor/mypy/typeshed/stdlib/socketserver.pyi +0 -168
- jaclang/vendor/mypy/typeshed/stdlib/spwd.pyi +0 -41
- jaclang/vendor/mypy/typeshed/stdlib/sqlite3/__init__.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/sqlite3/dbapi2.pyi +0 -551
- jaclang/vendor/mypy/typeshed/stdlib/sre_compile.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/sre_constants.pyi +0 -130
- jaclang/vendor/mypy/typeshed/stdlib/sre_parse.pyi +0 -104
- jaclang/vendor/mypy/typeshed/stdlib/ssl.pyi +0 -537
- jaclang/vendor/mypy/typeshed/stdlib/stat.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/statistics.pyi +0 -132
- jaclang/vendor/mypy/typeshed/stdlib/string.pyi +0 -83
- jaclang/vendor/mypy/typeshed/stdlib/stringprep.pyi +0 -27
- jaclang/vendor/mypy/typeshed/stdlib/struct.pyi +0 -26
- jaclang/vendor/mypy/typeshed/stdlib/subprocess.pyi +0 -2615
- jaclang/vendor/mypy/typeshed/stdlib/sunau.pyi +0 -86
- jaclang/vendor/mypy/typeshed/stdlib/symbol.pyi +0 -93
- jaclang/vendor/mypy/typeshed/stdlib/symtable.pyi +0 -58
- jaclang/vendor/mypy/typeshed/stdlib/sys/__init__.pyi +0 -373
- jaclang/vendor/mypy/typeshed/stdlib/sys/_monitoring.pyi +0 -52
- jaclang/vendor/mypy/typeshed/stdlib/sysconfig.pyi +0 -48
- jaclang/vendor/mypy/typeshed/stdlib/syslog.pyi +0 -46
- jaclang/vendor/mypy/typeshed/stdlib/tabnanny.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/tarfile.pyi +0 -441
- jaclang/vendor/mypy/typeshed/stdlib/telnetlib.pyi +0 -122
- jaclang/vendor/mypy/typeshed/stdlib/tempfile.pyi +0 -477
- jaclang/vendor/mypy/typeshed/stdlib/termios.pyi +0 -267
- jaclang/vendor/mypy/typeshed/stdlib/textwrap.pyi +0 -103
- jaclang/vendor/mypy/typeshed/stdlib/this.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/threading.pyi +0 -187
- jaclang/vendor/mypy/typeshed/stdlib/time.pyi +0 -108
- jaclang/vendor/mypy/typeshed/stdlib/timeit.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/__init__.pyi +0 -3654
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/colorchooser.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/commondialog.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/constants.pyi +0 -80
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/dialog.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/dnd.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/filedialog.pyi +0 -151
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/font.pyi +0 -116
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/messagebox.pyi +0 -44
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/scrolledtext.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/simpledialog.pyi +0 -54
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/tix.pyi +0 -299
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/ttk.pyi +0 -1204
- jaclang/vendor/mypy/typeshed/stdlib/token.pyi +0 -159
- jaclang/vendor/mypy/typeshed/stdlib/tokenize.pyi +0 -177
- jaclang/vendor/mypy/typeshed/stdlib/tomllib.pyi +0 -10
- jaclang/vendor/mypy/typeshed/stdlib/trace.pyi +0 -79
- jaclang/vendor/mypy/typeshed/stdlib/traceback.pyi +0 -262
- jaclang/vendor/mypy/typeshed/stdlib/tracemalloc.pyi +0 -124
- jaclang/vendor/mypy/typeshed/stdlib/tty.pyi +0 -30
- jaclang/vendor/mypy/typeshed/stdlib/turtle.pyi +0 -713
- jaclang/vendor/mypy/typeshed/stdlib/types.pyi +0 -614
- jaclang/vendor/mypy/typeshed/stdlib/typing.pyi +0 -976
- jaclang/vendor/mypy/typeshed/stdlib/typing_extensions.pyi +0 -509
- jaclang/vendor/mypy/typeshed/stdlib/unicodedata.pyi +0 -73
- jaclang/vendor/mypy/typeshed/stdlib/unittest/__init__.pyi +0 -67
- jaclang/vendor/mypy/typeshed/stdlib/unittest/_log.pyi +0 -27
- jaclang/vendor/mypy/typeshed/stdlib/unittest/async_case.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/unittest/case.pyi +0 -342
- jaclang/vendor/mypy/typeshed/stdlib/unittest/loader.pyi +0 -51
- jaclang/vendor/mypy/typeshed/stdlib/unittest/main.pyi +0 -69
- jaclang/vendor/mypy/typeshed/stdlib/unittest/mock.pyi +0 -430
- jaclang/vendor/mypy/typeshed/stdlib/unittest/result.pyi +0 -47
- jaclang/vendor/mypy/typeshed/stdlib/unittest/runner.pyi +0 -72
- jaclang/vendor/mypy/typeshed/stdlib/unittest/signals.pyi +0 -15
- jaclang/vendor/mypy/typeshed/stdlib/unittest/suite.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/unittest/util.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/urllib/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/urllib/error.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/urllib/parse.pyi +0 -210
- jaclang/vendor/mypy/typeshed/stdlib/urllib/request.pyi +0 -400
- jaclang/vendor/mypy/typeshed/stdlib/urllib/response.pyi +0 -43
- jaclang/vendor/mypy/typeshed/stdlib/urllib/robotparser.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/uu.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/uuid.pyi +0 -100
- jaclang/vendor/mypy/typeshed/stdlib/warnings.pyi +0 -112
- jaclang/vendor/mypy/typeshed/stdlib/wave.pyi +0 -85
- jaclang/vendor/mypy/typeshed/stdlib/weakref.pyi +0 -149
- jaclang/vendor/mypy/typeshed/stdlib/webbrowser.pyi +0 -74
- jaclang/vendor/mypy/typeshed/stdlib/winreg.pyi +0 -132
- jaclang/vendor/mypy/typeshed/stdlib/winsound.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/handlers.pyi +0 -91
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/headers.pyi +0 -26
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/simple_server.pyi +0 -37
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/types.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/util.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/validate.pyi +0 -50
- jaclang/vendor/mypy/typeshed/stdlib/xdrlib.pyi +0 -57
- jaclang/vendor/mypy/typeshed/stdlib/xml/__init__.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/NodeFilter.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/__init__.pyi +0 -69
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/domreg.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/expatbuilder.pyi +0 -100
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/minicompat.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/minidom.pyi +0 -404
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/pulldom.pyi +0 -94
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/xmlbuilder.pyi +0 -108
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementInclude.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementPath.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementTree.pyi +0 -327
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/cElementTree.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/__init__.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/__init__.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/errors.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/model.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/__init__.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/_exceptions.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/handler.pyi +0 -55
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/saxutils.pyi +0 -60
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/xmlreader.pyi +0 -87
- jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/client.pyi +0 -296
- jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/server.pyi +0 -143
- jaclang/vendor/mypy/typeshed/stdlib/xxlimited.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/zipapp.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/zipfile/__init__.pyi +0 -306
- jaclang/vendor/mypy/typeshed/stdlib/zipfile/_path.pyi +0 -95
- jaclang/vendor/mypy/typeshed/stdlib/zipimport.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/zlib.pyi +0 -56
- jaclang/vendor/mypy/typeshed/stdlib/zoneinfo/__init__.pyi +0 -38
- jaclang/vendor/mypy/typeshed/stubs/mypy-extensions/mypy_extensions.pyi +0 -218
- jaclang/vendor/mypy/typestate.py +0 -323
- jaclang/vendor/mypy/typetraverser.py +0 -148
- jaclang/vendor/mypy/typevars.py +0 -93
- jaclang/vendor/mypy/typevartuples.py +0 -32
- jaclang/vendor/mypy/util.py +0 -869
- jaclang/vendor/mypy/version.py +0 -1
- jaclang/vendor/mypy/visitor.py +0 -621
- jaclang/vendor/mypy/xml/mypy-html.css +0 -104
- jaclang/vendor/mypy/xml/mypy-html.xslt +0 -81
- jaclang/vendor/mypy/xml/mypy-txt.xslt +0 -100
- jaclang/vendor/mypy/xml/mypy.xsd +0 -50
- jaclang/vendor/mypy-1.10.0.dist-info/LICENSE +0 -229
- jaclang/vendor/mypy-1.10.0.dist-info/METADATA +0 -48
- jaclang/vendor/mypy-1.10.0.dist-info/RECORD +0 -1241
- jaclang/vendor/mypy-1.10.0.dist-info/WHEEL +0 -6
- jaclang/vendor/mypy-1.10.0.dist-info/entry_points.txt +0 -6
- jaclang/vendor/mypy-1.10.0.dist-info/top_level.txt +0 -3
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/LICENSE +0 -27
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/METADATA +0 -29
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/RECORD +0 -6
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/top_level.txt +0 -1
- jaclang/vendor/mypy_extensions.py +0 -213
- jaclang/vendor/mypyc/README.md +0 -133
- jaclang/vendor/mypyc/__init__.py +0 -0
- jaclang/vendor/mypyc/__main__.py +0 -57
- jaclang/vendor/mypyc/analysis/__init__.py +0 -0
- jaclang/vendor/mypyc/analysis/attrdefined.py +0 -436
- jaclang/vendor/mypyc/analysis/blockfreq.py +0 -32
- jaclang/vendor/mypyc/analysis/dataflow.py +0 -628
- jaclang/vendor/mypyc/analysis/ircheck.py +0 -433
- jaclang/vendor/mypyc/analysis/selfleaks.py +0 -211
- jaclang/vendor/mypyc/build.py +0 -616
- jaclang/vendor/mypyc/codegen/__init__.py +0 -0
- jaclang/vendor/mypyc/codegen/cstring.py +0 -54
- jaclang/vendor/mypyc/codegen/emit.py +0 -1193
- jaclang/vendor/mypyc/codegen/emitclass.py +0 -1060
- jaclang/vendor/mypyc/codegen/emitfunc.py +0 -852
- jaclang/vendor/mypyc/codegen/emitmodule.py +0 -1136
- jaclang/vendor/mypyc/codegen/emitwrapper.py +0 -979
- jaclang/vendor/mypyc/codegen/literals.py +0 -302
- jaclang/vendor/mypyc/common.py +0 -136
- jaclang/vendor/mypyc/crash.py +0 -31
- jaclang/vendor/mypyc/doc/Makefile +0 -20
- jaclang/vendor/mypyc/doc/bool_operations.rst +0 -27
- jaclang/vendor/mypyc/doc/compilation_units.rst +0 -20
- jaclang/vendor/mypyc/doc/conf.py +0 -59
- jaclang/vendor/mypyc/doc/cpython-timings.md +0 -25
- jaclang/vendor/mypyc/doc/dev-intro.md +0 -548
- jaclang/vendor/mypyc/doc/dict_operations.rst +0 -59
- jaclang/vendor/mypyc/doc/differences_from_python.rst +0 -332
- jaclang/vendor/mypyc/doc/float_operations.rst +0 -50
- jaclang/vendor/mypyc/doc/future.md +0 -42
- jaclang/vendor/mypyc/doc/getting_started.rst +0 -240
- jaclang/vendor/mypyc/doc/index.rst +0 -61
- jaclang/vendor/mypyc/doc/int_operations.rst +0 -162
- jaclang/vendor/mypyc/doc/introduction.rst +0 -150
- jaclang/vendor/mypyc/doc/list_operations.rst +0 -65
- jaclang/vendor/mypyc/doc/make.bat +0 -35
- jaclang/vendor/mypyc/doc/native_classes.rst +0 -206
- jaclang/vendor/mypyc/doc/native_operations.rst +0 -55
- jaclang/vendor/mypyc/doc/performance_tips_and_tricks.rst +0 -244
- jaclang/vendor/mypyc/doc/set_operations.rst +0 -47
- jaclang/vendor/mypyc/doc/str_operations.rst +0 -35
- jaclang/vendor/mypyc/doc/tuple_operations.rst +0 -33
- jaclang/vendor/mypyc/doc/using_type_annotations.rst +0 -398
- jaclang/vendor/mypyc/errors.py +0 -29
- jaclang/vendor/mypyc/external/googletest/LICENSE +0 -28
- jaclang/vendor/mypyc/external/googletest/README.md +0 -280
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-death-test.h +0 -294
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-message.h +0 -250
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-param-test.h +0 -1444
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-param-test.h.pump +0 -510
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-printers.h +0 -993
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-spi.h +0 -232
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-test-part.h +0 -179
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-typed-test.h +0 -263
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest.h +0 -2236
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest_pred_impl.h +0 -358
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest_prod.h +0 -58
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest-port.h +0 -69
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest-printers.h +0 -42
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest.h +0 -41
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-death-test-internal.h +0 -319
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-filepath.h +0 -206
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-internal.h +0 -1238
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-linked_ptr.h +0 -243
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h +0 -5146
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -286
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util.h +0 -731
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-port-arch.h +0 -93
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-port.h +0 -2560
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-string.h +0 -167
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-tuple.h +0 -1020
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-tuple.h.pump +0 -347
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-type-util.h +0 -3331
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-type-util.h.pump +0 -297
- jaclang/vendor/mypyc/external/googletest/make/Makefile +0 -61
- jaclang/vendor/mypyc/external/googletest/src/gtest-all.cc +0 -48
- jaclang/vendor/mypyc/external/googletest/src/gtest-death-test.cc +0 -1342
- jaclang/vendor/mypyc/external/googletest/src/gtest-filepath.cc +0 -387
- jaclang/vendor/mypyc/external/googletest/src/gtest-internal-inl.h +0 -1183
- jaclang/vendor/mypyc/external/googletest/src/gtest-port.cc +0 -1259
- jaclang/vendor/mypyc/external/googletest/src/gtest-printers.cc +0 -373
- jaclang/vendor/mypyc/external/googletest/src/gtest-test-part.cc +0 -110
- jaclang/vendor/mypyc/external/googletest/src/gtest-typed-test.cc +0 -118
- jaclang/vendor/mypyc/external/googletest/src/gtest.cc +0 -5388
- jaclang/vendor/mypyc/external/googletest/src/gtest_main.cc +0 -38
- jaclang/vendor/mypyc/ir/__init__.py +0 -0
- jaclang/vendor/mypyc/ir/class_ir.py +0 -499
- jaclang/vendor/mypyc/ir/func_ir.py +0 -370
- jaclang/vendor/mypyc/ir/module_ir.py +0 -88
- jaclang/vendor/mypyc/ir/ops.py +0 -1727
- jaclang/vendor/mypyc/ir/pprint.py +0 -516
- jaclang/vendor/mypyc/ir/rtypes.py +0 -1038
- jaclang/vendor/mypyc/irbuild/__init__.py +0 -0
- jaclang/vendor/mypyc/irbuild/ast_helpers.py +0 -123
- jaclang/vendor/mypyc/irbuild/builder.py +0 -1394
- jaclang/vendor/mypyc/irbuild/callable_class.py +0 -173
- jaclang/vendor/mypyc/irbuild/classdef.py +0 -850
- jaclang/vendor/mypyc/irbuild/constant_fold.py +0 -95
- jaclang/vendor/mypyc/irbuild/context.py +0 -186
- jaclang/vendor/mypyc/irbuild/env_class.py +0 -223
- jaclang/vendor/mypyc/irbuild/expression.py +0 -1070
- jaclang/vendor/mypyc/irbuild/for_helpers.py +0 -1075
- jaclang/vendor/mypyc/irbuild/format_str_tokenizer.py +0 -250
- jaclang/vendor/mypyc/irbuild/function.py +0 -1088
- jaclang/vendor/mypyc/irbuild/generator.py +0 -346
- jaclang/vendor/mypyc/irbuild/ll_builder.py +0 -2389
- jaclang/vendor/mypyc/irbuild/main.py +0 -153
- jaclang/vendor/mypyc/irbuild/mapper.py +0 -221
- jaclang/vendor/mypyc/irbuild/match.py +0 -355
- jaclang/vendor/mypyc/irbuild/nonlocalcontrol.py +0 -197
- jaclang/vendor/mypyc/irbuild/prebuildvisitor.py +0 -203
- jaclang/vendor/mypyc/irbuild/prepare.py +0 -609
- jaclang/vendor/mypyc/irbuild/specialize.py +0 -822
- jaclang/vendor/mypyc/irbuild/statement.py +0 -1017
- jaclang/vendor/mypyc/irbuild/targets.py +0 -57
- jaclang/vendor/mypyc/irbuild/util.py +0 -189
- jaclang/vendor/mypyc/irbuild/visitor.py +0 -401
- jaclang/vendor/mypyc/irbuild/vtable.py +0 -82
- jaclang/vendor/mypyc/lib-rt/CPy.h +0 -638
- jaclang/vendor/mypyc/lib-rt/bytes_ops.c +0 -143
- jaclang/vendor/mypyc/lib-rt/dict_ops.c +0 -446
- jaclang/vendor/mypyc/lib-rt/exc_ops.c +0 -259
- jaclang/vendor/mypyc/lib-rt/float_ops.c +0 -192
- jaclang/vendor/mypyc/lib-rt/generic_ops.c +0 -64
- jaclang/vendor/mypyc/lib-rt/getargs.c +0 -450
- jaclang/vendor/mypyc/lib-rt/getargsfast.c +0 -569
- jaclang/vendor/mypyc/lib-rt/init.c +0 -13
- jaclang/vendor/mypyc/lib-rt/int_ops.c +0 -803
- jaclang/vendor/mypyc/lib-rt/list_ops.c +0 -335
- jaclang/vendor/mypyc/lib-rt/misc_ops.c +0 -942
- jaclang/vendor/mypyc/lib-rt/module_shim.tmpl +0 -18
- jaclang/vendor/mypyc/lib-rt/mypyc_util.h +0 -118
- jaclang/vendor/mypyc/lib-rt/pythoncapi_compat.h +0 -497
- jaclang/vendor/mypyc/lib-rt/pythonsupport.h +0 -533
- jaclang/vendor/mypyc/lib-rt/set_ops.c +0 -17
- jaclang/vendor/mypyc/lib-rt/setup.py +0 -70
- jaclang/vendor/mypyc/lib-rt/str_ops.c +0 -241
- jaclang/vendor/mypyc/lib-rt/test_capi.cc +0 -585
- jaclang/vendor/mypyc/lib-rt/tuple_ops.c +0 -61
- jaclang/vendor/mypyc/lower/__init__.py +0 -0
- jaclang/vendor/mypyc/lower/int_ops.py +0 -113
- jaclang/vendor/mypyc/lower/list_ops.py +0 -45
- jaclang/vendor/mypyc/lower/misc_ops.py +0 -12
- jaclang/vendor/mypyc/lower/registry.py +0 -26
- jaclang/vendor/mypyc/namegen.py +0 -115
- jaclang/vendor/mypyc/options.py +0 -32
- jaclang/vendor/mypyc/primitives/__init__.py +0 -0
- jaclang/vendor/mypyc/primitives/bytes_ops.py +0 -101
- jaclang/vendor/mypyc/primitives/dict_ops.py +0 -325
- jaclang/vendor/mypyc/primitives/exc_ops.py +0 -101
- jaclang/vendor/mypyc/primitives/float_ops.py +0 -168
- jaclang/vendor/mypyc/primitives/generic_ops.py +0 -384
- jaclang/vendor/mypyc/primitives/int_ops.py +0 -303
- jaclang/vendor/mypyc/primitives/list_ops.py +0 -310
- jaclang/vendor/mypyc/primitives/misc_ops.py +0 -267
- jaclang/vendor/mypyc/primitives/registry.py +0 -360
- jaclang/vendor/mypyc/primitives/set_ops.py +0 -121
- jaclang/vendor/mypyc/primitives/str_ops.py +0 -229
- jaclang/vendor/mypyc/primitives/tuple_ops.py +0 -83
- jaclang/vendor/mypyc/rt_subtype.py +0 -77
- jaclang/vendor/mypyc/sametype.py +0 -83
- jaclang/vendor/mypyc/subtype.py +0 -88
- jaclang/vendor/mypyc/test/__init__.py +0 -0
- jaclang/vendor/mypyc/test/config.py +0 -13
- jaclang/vendor/mypyc/test/test_alwaysdefined.py +0 -46
- jaclang/vendor/mypyc/test/test_analysis.py +0 -77
- jaclang/vendor/mypyc/test/test_cheader.py +0 -53
- jaclang/vendor/mypyc/test/test_commandline.py +0 -82
- jaclang/vendor/mypyc/test/test_emit.py +0 -69
- jaclang/vendor/mypyc/test/test_emitclass.py +0 -35
- jaclang/vendor/mypyc/test/test_emitfunc.py +0 -928
- jaclang/vendor/mypyc/test/test_emitwrapper.py +0 -60
- jaclang/vendor/mypyc/test/test_exceptions.py +0 -56
- jaclang/vendor/mypyc/test/test_external.py +0 -49
- jaclang/vendor/mypyc/test/test_irbuild.py +0 -87
- jaclang/vendor/mypyc/test/test_ircheck.py +0 -199
- jaclang/vendor/mypyc/test/test_literals.py +0 -90
- jaclang/vendor/mypyc/test/test_lowering.py +0 -56
- jaclang/vendor/mypyc/test/test_namegen.py +0 -48
- jaclang/vendor/mypyc/test/test_optimizations.py +0 -68
- jaclang/vendor/mypyc/test/test_pprint.py +0 -42
- jaclang/vendor/mypyc/test/test_rarray.py +0 -48
- jaclang/vendor/mypyc/test/test_refcount.py +0 -59
- jaclang/vendor/mypyc/test/test_run.py +0 -426
- jaclang/vendor/mypyc/test/test_serialization.py +0 -108
- jaclang/vendor/mypyc/test/test_struct.py +0 -112
- jaclang/vendor/mypyc/test/test_tuplename.py +0 -33
- jaclang/vendor/mypyc/test/test_typeops.py +0 -97
- jaclang/vendor/mypyc/test/testutil.py +0 -283
- jaclang/vendor/mypyc/test-data/alwaysdefined.test +0 -732
- jaclang/vendor/mypyc/test-data/analysis.test +0 -470
- jaclang/vendor/mypyc/test-data/commandline.test +0 -245
- jaclang/vendor/mypyc/test-data/driver/driver.py +0 -48
- jaclang/vendor/mypyc/test-data/exceptions-freq.test +0 -125
- jaclang/vendor/mypyc/test-data/exceptions.test +0 -699
- jaclang/vendor/mypyc/test-data/fixtures/ir.py +0 -373
- jaclang/vendor/mypyc/test-data/fixtures/testutil.py +0 -103
- jaclang/vendor/mypyc/test-data/fixtures/typing-full.pyi +0 -169
- jaclang/vendor/mypyc/test-data/irbuild-any.test +0 -236
- jaclang/vendor/mypyc/test-data/irbuild-basic.test +0 -3399
- jaclang/vendor/mypyc/test-data/irbuild-bool.test +0 -424
- jaclang/vendor/mypyc/test-data/irbuild-bytes.test +0 -181
- jaclang/vendor/mypyc/test-data/irbuild-classes.test +0 -1302
- jaclang/vendor/mypyc/test-data/irbuild-constant-fold.test +0 -480
- jaclang/vendor/mypyc/test-data/irbuild-dict.test +0 -584
- jaclang/vendor/mypyc/test-data/irbuild-dunders.test +0 -215
- jaclang/vendor/mypyc/test-data/irbuild-float.test +0 -497
- jaclang/vendor/mypyc/test-data/irbuild-generics.test +0 -150
- jaclang/vendor/mypyc/test-data/irbuild-glue-methods.test +0 -437
- jaclang/vendor/mypyc/test-data/irbuild-i16.test +0 -526
- jaclang/vendor/mypyc/test-data/irbuild-i32.test +0 -598
- jaclang/vendor/mypyc/test-data/irbuild-i64.test +0 -2144
- jaclang/vendor/mypyc/test-data/irbuild-int.test +0 -194
- jaclang/vendor/mypyc/test-data/irbuild-isinstance.test +0 -109
- jaclang/vendor/mypyc/test-data/irbuild-lists.test +0 -513
- jaclang/vendor/mypyc/test-data/irbuild-match.test +0 -1717
- jaclang/vendor/mypyc/test-data/irbuild-math.test +0 -64
- jaclang/vendor/mypyc/test-data/irbuild-nested.test +0 -807
- jaclang/vendor/mypyc/test-data/irbuild-optional.test +0 -536
- jaclang/vendor/mypyc/test-data/irbuild-set.test +0 -806
- jaclang/vendor/mypyc/test-data/irbuild-singledispatch.test +0 -257
- jaclang/vendor/mypyc/test-data/irbuild-statements.test +0 -1060
- jaclang/vendor/mypyc/test-data/irbuild-str.test +0 -312
- jaclang/vendor/mypyc/test-data/irbuild-strip-asserts.test +0 -12
- jaclang/vendor/mypyc/test-data/irbuild-try.test +0 -523
- jaclang/vendor/mypyc/test-data/irbuild-tuple.test +0 -386
- jaclang/vendor/mypyc/test-data/irbuild-u8.test +0 -543
- jaclang/vendor/mypyc/test-data/irbuild-unreachable.test +0 -241
- jaclang/vendor/mypyc/test-data/irbuild-vectorcall.test +0 -153
- jaclang/vendor/mypyc/test-data/lowering-int.test +0 -377
- jaclang/vendor/mypyc/test-data/lowering-list.test +0 -33
- jaclang/vendor/mypyc/test-data/opt-copy-propagation.test +0 -400
- jaclang/vendor/mypyc/test-data/opt-flag-elimination.test +0 -296
- jaclang/vendor/mypyc/test-data/refcount.test +0 -1482
- jaclang/vendor/mypyc/test-data/run-async.test +0 -173
- jaclang/vendor/mypyc/test-data/run-attrs.test +0 -318
- jaclang/vendor/mypyc/test-data/run-bench.test +0 -196
- jaclang/vendor/mypyc/test-data/run-bools.test +0 -229
- jaclang/vendor/mypyc/test-data/run-bytes.test +0 -302
- jaclang/vendor/mypyc/test-data/run-classes.test +0 -2505
- jaclang/vendor/mypyc/test-data/run-dicts.test +0 -334
- jaclang/vendor/mypyc/test-data/run-dunders.test +0 -945
- jaclang/vendor/mypyc/test-data/run-exceptions.test +0 -448
- jaclang/vendor/mypyc/test-data/run-floats.test +0 -516
- jaclang/vendor/mypyc/test-data/run-functions.test +0 -1310
- jaclang/vendor/mypyc/test-data/run-generators.test +0 -682
- jaclang/vendor/mypyc/test-data/run-i16.test +0 -338
- jaclang/vendor/mypyc/test-data/run-i32.test +0 -336
- jaclang/vendor/mypyc/test-data/run-i64.test +0 -1519
- jaclang/vendor/mypyc/test-data/run-imports.test +0 -265
- jaclang/vendor/mypyc/test-data/run-integers.test +0 -540
- jaclang/vendor/mypyc/test-data/run-lists.test +0 -411
- jaclang/vendor/mypyc/test-data/run-loops.test +0 -485
- jaclang/vendor/mypyc/test-data/run-match.test +0 -283
- jaclang/vendor/mypyc/test-data/run-math.test +0 -106
- jaclang/vendor/mypyc/test-data/run-misc.test +0 -1170
- jaclang/vendor/mypyc/test-data/run-multimodule.test +0 -887
- jaclang/vendor/mypyc/test-data/run-mypy-sim.test +0 -138
- jaclang/vendor/mypyc/test-data/run-primitives.test +0 -375
- jaclang/vendor/mypyc/test-data/run-python37.test +0 -159
- jaclang/vendor/mypyc/test-data/run-python38.test +0 -88
- jaclang/vendor/mypyc/test-data/run-sets.test +0 -150
- jaclang/vendor/mypyc/test-data/run-singledispatch.test +0 -698
- jaclang/vendor/mypyc/test-data/run-strings.test +0 -641
- jaclang/vendor/mypyc/test-data/run-traits.test +0 -411
- jaclang/vendor/mypyc/test-data/run-tuples.test +0 -258
- jaclang/vendor/mypyc/test-data/run-u8.test +0 -303
- jaclang/vendor/mypyc/transform/__init__.py +0 -0
- jaclang/vendor/mypyc/transform/copy_propagation.py +0 -94
- jaclang/vendor/mypyc/transform/exceptions.py +0 -182
- jaclang/vendor/mypyc/transform/flag_elimination.py +0 -108
- jaclang/vendor/mypyc/transform/ir_transform.py +0 -368
- jaclang/vendor/mypyc/transform/lower.py +0 -33
- jaclang/vendor/mypyc/transform/refcount.py +0 -294
- jaclang/vendor/mypyc/transform/uninit.py +0 -190
- jaclang/vendor/typing_extensions-4.12.2.dist-info/LICENSE +0 -279
- jaclang/vendor/typing_extensions-4.12.2.dist-info/METADATA +0 -67
- jaclang/vendor/typing_extensions-4.12.2.dist-info/RECORD +0 -5
- jaclang/vendor/typing_extensions-4.12.2.dist-info/WHEEL +0 -4
- jaclang/vendor/typing_extensions.py +0 -3641
- jaclang-0.7.33.dist-info/RECORD +0 -1562
- /jaclang/{vendor/mypy/dmypy → compiler/larkparse}/__init__.py +0 -0
- /jaclang/{tests → compiler/passes/main/tests}/fixtures/access_checker.jac +0 -0
- /jaclang/{vendor/mypy/plugins/__init__.py → langserve/tests/fixtures/deep_check_crash.jac} +0 -0
- /jaclang/{vendor/mypy/server/__init__.py → langserve/tests/server_test/code_test.py} +0 -0
- /jaclang/{plugin → runtimelib}/tests/__init__.py +0 -0
- /jaclang/{plugin → runtimelib}/tests/fixtures/traversing_save.jac +0 -0
- /jaclang/{vendor/mypy/test → tests}/__init__.py +0 -0
- /jaclang/{vendor/mypy/test/meta → tests/fixtures}/__init__.py +0 -0
- /jaclang/tests/fixtures/{architype_def_bug.jac → archetype_def_bug.jac} +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/concurrent/__init__.pyi → attrs-25.3.0.dist-info/REQUESTED} +0 -0
- /jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/licenses/LICENSE +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/distutils/command/__init__.pyi → cattrs-24.1.3.dist-info/REQUESTED} +0 -0
- /jaclang/vendor/{cattrs-23.2.3.dist-info → cattrs-24.1.3.dist-info}/licenses/LICENSE +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/distutils/command/bdist_packager.pyi → lark-1.2.2.dist-info/REQUESTED} +0 -0
- /jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/entry_points.txt +0 -0
- /jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/top_level.txt +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/email/mime/__init__.pyi → lsprotocol-2023.0.1.dist-info/REQUESTED} +0 -0
- /jaclang/vendor/lsprotocol-2023.0.1.dist-info/{LICENSE → licenses/LICENSE} +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/lib2to3/__init__.pyi → pluggy-1.5.0.dist-info/REQUESTED} +0 -0
- /jaclang/vendor/pluggy-1.5.0.dist-info/{LICENSE → licenses/LICENSE} +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/lib2to3/fixes/__init__.pyi → pygls-1.3.1.dist-info/REQUESTED} +0 -0
- {jaclang-0.7.33.dist-info → jaclang-0.8.0.dist-info}/entry_points.txt +0 -0
jaclang/vendor/attr/_make.py
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import abc
|
|
3
6
|
import contextlib
|
|
4
7
|
import copy
|
|
5
8
|
import enum
|
|
6
|
-
import functools
|
|
7
9
|
import inspect
|
|
8
10
|
import itertools
|
|
9
11
|
import linecache
|
|
10
12
|
import sys
|
|
11
13
|
import types
|
|
12
|
-
import
|
|
14
|
+
import unicodedata
|
|
13
15
|
|
|
14
|
-
from
|
|
16
|
+
from collections.abc import Callable, Mapping
|
|
17
|
+
from functools import cached_property
|
|
18
|
+
from typing import Any, NamedTuple, TypeVar
|
|
15
19
|
|
|
16
20
|
# We need to import _compat itself in addition to the _compat members to avoid
|
|
17
21
|
# having the thread-local in the globals here.
|
|
18
22
|
from . import _compat, _config, setters
|
|
19
23
|
from ._compat import (
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
PY_3_10_PLUS,
|
|
25
|
+
PY_3_11_PLUS,
|
|
26
|
+
PY_3_13_PLUS,
|
|
22
27
|
_AnnotationExtractor,
|
|
28
|
+
_get_annotations,
|
|
23
29
|
get_generic_base,
|
|
24
30
|
)
|
|
25
31
|
from .exceptions import (
|
|
@@ -31,10 +37,9 @@ from .exceptions import (
|
|
|
31
37
|
|
|
32
38
|
|
|
33
39
|
# This is used at least twice, so cache it here.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
_classvar_prefixes = (
|
|
40
|
+
_OBJ_SETATTR = object.__setattr__
|
|
41
|
+
_INIT_FACTORY_PAT = "__attr_factory_%s"
|
|
42
|
+
_CLASSVAR_PREFIXES = (
|
|
38
43
|
"typing.ClassVar",
|
|
39
44
|
"t.ClassVar",
|
|
40
45
|
"ClassVar",
|
|
@@ -43,19 +48,19 @@ _classvar_prefixes = (
|
|
|
43
48
|
# we don't use a double-underscore prefix because that triggers
|
|
44
49
|
# name mangling when trying to create a slot for the field
|
|
45
50
|
# (when slots=True)
|
|
46
|
-
|
|
51
|
+
_HASH_CACHE_FIELD = "_attrs_cached_hash"
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
_EMPTY_METADATA_SINGLETON = types.MappingProxyType({})
|
|
49
54
|
|
|
50
55
|
# Unique object for unequivocal getattr() defaults.
|
|
51
|
-
|
|
56
|
+
_SENTINEL = object()
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
_DEFAULT_ON_SETATTR = setters.pipe(setters.convert, setters.validate)
|
|
54
59
|
|
|
55
60
|
|
|
56
61
|
class _Nothing(enum.Enum):
|
|
57
62
|
"""
|
|
58
|
-
Sentinel to indicate the lack of a value when
|
|
63
|
+
Sentinel to indicate the lack of a value when `None` is ambiguous.
|
|
59
64
|
|
|
60
65
|
If extending attrs, you can use ``typing.Literal[NOTHING]`` to show
|
|
61
66
|
that a value may be ``NOTHING``.
|
|
@@ -75,7 +80,9 @@ class _Nothing(enum.Enum):
|
|
|
75
80
|
|
|
76
81
|
NOTHING = _Nothing.NOTHING
|
|
77
82
|
"""
|
|
78
|
-
Sentinel to indicate the lack of a value when
|
|
83
|
+
Sentinel to indicate the lack of a value when `None` is ambiguous.
|
|
84
|
+
|
|
85
|
+
When using in 3rd party code, use `attrs.NothingType` for type annotations.
|
|
79
86
|
"""
|
|
80
87
|
|
|
81
88
|
|
|
@@ -84,7 +91,7 @@ class _CacheHashWrapper(int):
|
|
|
84
91
|
An integer subclass that pickles / copies as None
|
|
85
92
|
|
|
86
93
|
This is used for non-slots classes with ``cache_hash=True``, to avoid
|
|
87
|
-
serializing a potentially (even likely) invalid hash value. Since
|
|
94
|
+
serializing a potentially (even likely) invalid hash value. Since `None`
|
|
88
95
|
is the default value for uncalculated hashes, whenever this is copied,
|
|
89
96
|
the copy's value for the hash should automatically reset.
|
|
90
97
|
|
|
@@ -113,137 +120,29 @@ def attrib(
|
|
|
113
120
|
alias=None,
|
|
114
121
|
):
|
|
115
122
|
"""
|
|
116
|
-
Create a new attribute on a class.
|
|
117
|
-
|
|
118
|
-
.. warning::
|
|
119
|
-
|
|
120
|
-
Does *not* do anything unless the class is also decorated with `attr.s`
|
|
121
|
-
/ `attrs.define` / and so on!
|
|
122
|
-
|
|
123
|
-
Please consider using `attrs.field` in new code (``attr.ib`` will *never*
|
|
124
|
-
go away, though).
|
|
125
|
-
|
|
126
|
-
:param default: A value that is used if an *attrs*-generated ``__init__``
|
|
127
|
-
is used and no value is passed while instantiating or the attribute is
|
|
128
|
-
excluded using ``init=False``.
|
|
129
|
-
|
|
130
|
-
If the value is an instance of `attrs.Factory`, its callable will be
|
|
131
|
-
used to construct a new value (useful for mutable data types like lists
|
|
132
|
-
or dicts).
|
|
133
|
-
|
|
134
|
-
If a default is not set (or set manually to `attrs.NOTHING`), a value
|
|
135
|
-
*must* be supplied when instantiating; otherwise a `TypeError` will be
|
|
136
|
-
raised.
|
|
137
|
-
|
|
138
|
-
The default can also be set using decorator notation as shown below.
|
|
139
|
-
|
|
140
|
-
.. seealso:: `defaults`
|
|
141
|
-
|
|
142
|
-
:param callable factory: Syntactic sugar for
|
|
143
|
-
``default=attr.Factory(factory)``.
|
|
144
|
-
|
|
145
|
-
:param validator: `callable` that is called by *attrs*-generated
|
|
146
|
-
``__init__`` methods after the instance has been initialized. They
|
|
147
|
-
receive the initialized instance, the :func:`~attrs.Attribute`, and the
|
|
148
|
-
passed value.
|
|
149
|
-
|
|
150
|
-
The return value is *not* inspected so the validator has to throw an
|
|
151
|
-
exception itself.
|
|
152
|
-
|
|
153
|
-
If a `list` is passed, its items are treated as validators and must all
|
|
154
|
-
pass.
|
|
155
|
-
|
|
156
|
-
Validators can be globally disabled and re-enabled using
|
|
157
|
-
`attrs.validators.get_disabled` / `attrs.validators.set_disabled`.
|
|
158
|
-
|
|
159
|
-
The validator can also be set using decorator notation as shown below.
|
|
160
|
-
|
|
161
|
-
.. seealso:: :ref:`validators`
|
|
162
|
-
|
|
163
|
-
:type validator: `callable` or a `list` of `callable`\\ s.
|
|
164
|
-
|
|
165
|
-
:param repr: Include this attribute in the generated ``__repr__`` method.
|
|
166
|
-
If ``True``, include the attribute; if ``False``, omit it. By default,
|
|
167
|
-
the built-in ``repr()`` function is used. To override how the attribute
|
|
168
|
-
value is formatted, pass a ``callable`` that takes a single value and
|
|
169
|
-
returns a string. Note that the resulting string is used as-is, i.e. it
|
|
170
|
-
will be used directly *instead* of calling ``repr()`` (the default).
|
|
171
|
-
:type repr: a `bool` or a `callable` to use a custom function.
|
|
172
|
-
|
|
173
|
-
:param eq: If ``True`` (default), include this attribute in the generated
|
|
174
|
-
``__eq__`` and ``__ne__`` methods that check two instances for
|
|
175
|
-
equality. To override how the attribute value is compared, pass a
|
|
176
|
-
``callable`` that takes a single value and returns the value to be
|
|
177
|
-
compared.
|
|
123
|
+
Create a new field / attribute on a class.
|
|
178
124
|
|
|
179
|
-
|
|
180
|
-
:type eq: a `bool` or a `callable`.
|
|
125
|
+
Identical to `attrs.field`, except it's not keyword-only.
|
|
181
126
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
override how the attribute value is ordered, pass a ``callable`` that
|
|
185
|
-
takes a single value and returns the value to be ordered.
|
|
127
|
+
Consider using `attrs.field` in new code (``attr.ib`` will *never* go away,
|
|
128
|
+
though).
|
|
186
129
|
|
|
187
|
-
|
|
188
|
-
:type order: a `bool` or a `callable`.
|
|
189
|
-
|
|
190
|
-
:param cmp: Setting *cmp* is equivalent to setting *eq* and *order* to the
|
|
191
|
-
same value. Must not be mixed with *eq* or *order*.
|
|
192
|
-
|
|
193
|
-
.. seealso:: `comparison`
|
|
194
|
-
:type cmp: a `bool` or a `callable`.
|
|
195
|
-
|
|
196
|
-
:param bool | None hash: Include this attribute in the generated
|
|
197
|
-
``__hash__`` method. If ``None`` (default), mirror *eq*'s value. This
|
|
198
|
-
is the correct behavior according the Python spec. Setting this value
|
|
199
|
-
to anything else than ``None`` is *discouraged*.
|
|
200
|
-
|
|
201
|
-
.. seealso:: `hashing`
|
|
202
|
-
:param bool init: Include this attribute in the generated ``__init__``
|
|
203
|
-
method. It is possible to set this to ``False`` and set a default
|
|
204
|
-
value. In that case this attributed is unconditionally initialized
|
|
205
|
-
with the specified default value or factory.
|
|
206
|
-
|
|
207
|
-
.. seealso:: `init`
|
|
208
|
-
:param callable converter: `callable` that is called by *attrs*-generated
|
|
209
|
-
``__init__`` methods to convert attribute's value to the desired
|
|
210
|
-
format. It is given the passed-in value, and the returned value will
|
|
211
|
-
be used as the new value of the attribute. The value is converted
|
|
212
|
-
before being passed to the validator, if any.
|
|
130
|
+
.. warning::
|
|
213
131
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
third-party components. See `extending-metadata`.
|
|
132
|
+
Does **nothing** unless the class is also decorated with
|
|
133
|
+
`attr.s` (or similar)!
|
|
217
134
|
|
|
218
|
-
:param type: The type of the attribute. Nowadays, the preferred method to
|
|
219
|
-
specify the type is using a variable annotation (see :pep:`526`). This
|
|
220
|
-
argument is provided for backward compatibility. Regardless of the
|
|
221
|
-
approach used, the type will be stored on ``Attribute.type``.
|
|
222
|
-
|
|
223
|
-
Please note that *attrs* doesn't do anything with this metadata by
|
|
224
|
-
itself. You can use it as part of your own code or for `static type
|
|
225
|
-
checking <types>`.
|
|
226
|
-
:param bool kw_only: Make this attribute keyword-only in the generated
|
|
227
|
-
``__init__`` (if ``init`` is ``False``, this parameter is ignored).
|
|
228
|
-
:param on_setattr: Allows to overwrite the *on_setattr* setting from
|
|
229
|
-
`attr.s`. If left `None`, the *on_setattr* value from `attr.s` is used.
|
|
230
|
-
Set to `attrs.setters.NO_OP` to run **no** `setattr` hooks for this
|
|
231
|
-
attribute -- regardless of the setting in `attr.s`.
|
|
232
|
-
:type on_setattr: `callable`, or a list of callables, or `None`, or
|
|
233
|
-
`attrs.setters.NO_OP`
|
|
234
|
-
:param str | None alias: Override this attribute's parameter name in the
|
|
235
|
-
generated ``__init__`` method. If left `None`, default to ``name``
|
|
236
|
-
stripped of leading underscores. See `private-attributes`.
|
|
237
135
|
|
|
238
136
|
.. versionadded:: 15.2.0 *convert*
|
|
239
137
|
.. versionadded:: 16.3.0 *metadata*
|
|
240
138
|
.. versionchanged:: 17.1.0 *validator* can be a ``list`` now.
|
|
241
139
|
.. versionchanged:: 17.1.0
|
|
242
|
-
*hash* is
|
|
140
|
+
*hash* is `None` and therefore mirrors *eq* by default.
|
|
243
141
|
.. versionadded:: 17.3.0 *type*
|
|
244
142
|
.. deprecated:: 17.4.0 *convert*
|
|
245
|
-
.. versionadded:: 17.4.0
|
|
246
|
-
*
|
|
143
|
+
.. versionadded:: 17.4.0
|
|
144
|
+
*converter* as a replacement for the deprecated *convert* to achieve
|
|
145
|
+
consistency with other noun-based arguments.
|
|
247
146
|
.. versionadded:: 18.1.0
|
|
248
147
|
``factory=f`` is syntactic sugar for ``default=attr.Factory(f)``.
|
|
249
148
|
.. versionadded:: 18.2.0 *kw_only*
|
|
@@ -310,19 +209,31 @@ def attrib(
|
|
|
310
209
|
)
|
|
311
210
|
|
|
312
211
|
|
|
313
|
-
def _compile_and_eval(
|
|
212
|
+
def _compile_and_eval(
|
|
213
|
+
script: str,
|
|
214
|
+
globs: dict[str, Any] | None,
|
|
215
|
+
locs: Mapping[str, object] | None = None,
|
|
216
|
+
filename: str = "",
|
|
217
|
+
) -> None:
|
|
314
218
|
"""
|
|
315
|
-
|
|
219
|
+
Evaluate the script with the given global (globs) and local (locs)
|
|
220
|
+
variables.
|
|
316
221
|
"""
|
|
317
222
|
bytecode = compile(script, filename, "exec")
|
|
318
223
|
eval(bytecode, globs, locs)
|
|
319
224
|
|
|
320
225
|
|
|
321
|
-
def
|
|
226
|
+
def _linecache_and_compile(
|
|
227
|
+
script: str,
|
|
228
|
+
filename: str,
|
|
229
|
+
globs: dict[str, Any] | None,
|
|
230
|
+
locals: Mapping[str, object] | None = None,
|
|
231
|
+
) -> dict[str, Any]:
|
|
322
232
|
"""
|
|
323
|
-
|
|
233
|
+
Cache the script with _linecache_, compile it and return the _locals_.
|
|
324
234
|
"""
|
|
325
|
-
|
|
235
|
+
|
|
236
|
+
locs = {} if locals is None else locals
|
|
326
237
|
|
|
327
238
|
# In order of debuggers like PDB being able to step through the code,
|
|
328
239
|
# we add a fake linecache entry.
|
|
@@ -344,10 +255,10 @@ def _make_method(name, script, filename, globs):
|
|
|
344
255
|
|
|
345
256
|
_compile_and_eval(script, globs, locs, filename)
|
|
346
257
|
|
|
347
|
-
return locs
|
|
258
|
+
return locs
|
|
348
259
|
|
|
349
260
|
|
|
350
|
-
def _make_attr_tuple_class(cls_name, attr_names):
|
|
261
|
+
def _make_attr_tuple_class(cls_name: str, attr_names: list[str]) -> type:
|
|
351
262
|
"""
|
|
352
263
|
Create a tuple subclass to hold `Attribute`s for an `attrs` class.
|
|
353
264
|
|
|
@@ -358,35 +269,22 @@ def _make_attr_tuple_class(cls_name, attr_names):
|
|
|
358
269
|
x = property(itemgetter(0))
|
|
359
270
|
"""
|
|
360
271
|
attr_class_name = f"{cls_name}Attributes"
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
)
|
|
370
|
-
else:
|
|
371
|
-
attr_class_template.append(" pass")
|
|
372
|
-
globs = {"_attrs_itemgetter": itemgetter, "_attrs_property": property}
|
|
373
|
-
_compile_and_eval("\n".join(attr_class_template), globs)
|
|
374
|
-
return globs[attr_class_name]
|
|
272
|
+
body = {}
|
|
273
|
+
for i, attr_name in enumerate(attr_names):
|
|
274
|
+
|
|
275
|
+
def getter(self, i=i):
|
|
276
|
+
return self[i]
|
|
277
|
+
|
|
278
|
+
body[attr_name] = property(getter)
|
|
279
|
+
return type(attr_class_name, (tuple,), body)
|
|
375
280
|
|
|
376
281
|
|
|
377
282
|
# Tuple class for extracted attributes from a class definition.
|
|
378
283
|
# `base_attrs` is a subset of `attrs`.
|
|
379
|
-
_Attributes
|
|
380
|
-
|
|
381
|
-
[
|
|
382
|
-
|
|
383
|
-
"attrs",
|
|
384
|
-
# attributes that have been inherited
|
|
385
|
-
"base_attrs",
|
|
386
|
-
# map inherited attributes to their originating classes
|
|
387
|
-
"base_attrs_map",
|
|
388
|
-
],
|
|
389
|
-
)
|
|
284
|
+
class _Attributes(NamedTuple):
|
|
285
|
+
attrs: type
|
|
286
|
+
base_attrs: list[Attribute]
|
|
287
|
+
base_attrs_map: dict[str, type]
|
|
390
288
|
|
|
391
289
|
|
|
392
290
|
def _is_class_var(annot):
|
|
@@ -403,36 +301,19 @@ def _is_class_var(annot):
|
|
|
403
301
|
if annot.startswith(("'", '"')) and annot.endswith(("'", '"')):
|
|
404
302
|
annot = annot[1:-1]
|
|
405
303
|
|
|
406
|
-
return annot.startswith(
|
|
304
|
+
return annot.startswith(_CLASSVAR_PREFIXES)
|
|
407
305
|
|
|
408
306
|
|
|
409
307
|
def _has_own_attribute(cls, attrib_name):
|
|
410
308
|
"""
|
|
411
309
|
Check whether *cls* defines *attrib_name* (and doesn't just inherit it).
|
|
412
310
|
"""
|
|
413
|
-
|
|
414
|
-
if attr is _sentinel:
|
|
415
|
-
return False
|
|
416
|
-
|
|
417
|
-
for base_cls in cls.__mro__[1:]:
|
|
418
|
-
a = getattr(base_cls, attrib_name, None)
|
|
419
|
-
if attr is a:
|
|
420
|
-
return False
|
|
421
|
-
|
|
422
|
-
return True
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
def _get_annotations(cls):
|
|
426
|
-
"""
|
|
427
|
-
Get annotations for *cls*.
|
|
428
|
-
"""
|
|
429
|
-
if _has_own_attribute(cls, "__annotations__"):
|
|
430
|
-
return cls.__annotations__
|
|
431
|
-
|
|
432
|
-
return {}
|
|
311
|
+
return attrib_name in cls.__dict__
|
|
433
312
|
|
|
434
313
|
|
|
435
|
-
def _collect_base_attrs(
|
|
314
|
+
def _collect_base_attrs(
|
|
315
|
+
cls, taken_attr_names
|
|
316
|
+
) -> tuple[list[Attribute], dict[str, type]]:
|
|
436
317
|
"""
|
|
437
318
|
Collect attr.ibs from base classes of *cls*, except *taken_attr_names*.
|
|
438
319
|
"""
|
|
@@ -493,14 +374,14 @@ def _collect_base_attrs_broken(cls, taken_attr_names):
|
|
|
493
374
|
|
|
494
375
|
def _transform_attrs(
|
|
495
376
|
cls, these, auto_attribs, kw_only, collect_by_mro, field_transformer
|
|
496
|
-
):
|
|
377
|
+
) -> _Attributes:
|
|
497
378
|
"""
|
|
498
379
|
Transform all `_CountingAttr`s on a class into `Attribute`s.
|
|
499
380
|
|
|
500
381
|
If *these* is passed, use that and don't look for them on the class.
|
|
501
382
|
|
|
502
|
-
*collect_by_mro* is True, collect them in the correct MRO order,
|
|
503
|
-
use the old -- incorrect -- order. See #428.
|
|
383
|
+
If *collect_by_mro* is True, collect them in the correct MRO order,
|
|
384
|
+
otherwise use the old -- incorrect -- order. See #428.
|
|
504
385
|
|
|
505
386
|
Return an `_Attributes`.
|
|
506
387
|
"""
|
|
@@ -513,7 +394,7 @@ def _transform_attrs(
|
|
|
513
394
|
ca_names = {
|
|
514
395
|
name
|
|
515
396
|
for name, attr in cd.items()
|
|
516
|
-
if
|
|
397
|
+
if attr.__class__ is _CountingAttr
|
|
517
398
|
}
|
|
518
399
|
ca_list = []
|
|
519
400
|
annot_names = set()
|
|
@@ -523,12 +404,12 @@ def _transform_attrs(
|
|
|
523
404
|
annot_names.add(attr_name)
|
|
524
405
|
a = cd.get(attr_name, NOTHING)
|
|
525
406
|
|
|
526
|
-
if not
|
|
527
|
-
a = attrib(
|
|
407
|
+
if a.__class__ is not _CountingAttr:
|
|
408
|
+
a = attrib(a)
|
|
528
409
|
ca_list.append((attr_name, a))
|
|
529
410
|
|
|
530
411
|
unannotated = ca_names - annot_names
|
|
531
|
-
if
|
|
412
|
+
if unannotated:
|
|
532
413
|
raise UnannotatedAttributeError(
|
|
533
414
|
"The following `attr.ib`s lack a type annotation: "
|
|
534
415
|
+ ", ".join(
|
|
@@ -541,16 +422,14 @@ def _transform_attrs(
|
|
|
541
422
|
(
|
|
542
423
|
(name, attr)
|
|
543
424
|
for name, attr in cd.items()
|
|
544
|
-
if
|
|
425
|
+
if attr.__class__ is _CountingAttr
|
|
545
426
|
),
|
|
546
427
|
key=lambda e: e[1].counter,
|
|
547
428
|
)
|
|
548
429
|
|
|
430
|
+
fca = Attribute.from_counting_attr
|
|
549
431
|
own_attrs = [
|
|
550
|
-
|
|
551
|
-
name=attr_name, ca=ca, type=anns.get(attr_name)
|
|
552
|
-
)
|
|
553
|
-
for attr_name, ca in ca_list
|
|
432
|
+
fca(attr_name, ca, anns.get(attr_name)) for attr_name, ca in ca_list
|
|
554
433
|
]
|
|
555
434
|
|
|
556
435
|
if collect_by_mro:
|
|
@@ -568,6 +447,10 @@ def _transform_attrs(
|
|
|
568
447
|
|
|
569
448
|
attrs = base_attrs + own_attrs
|
|
570
449
|
|
|
450
|
+
if field_transformer is not None:
|
|
451
|
+
attrs = tuple(field_transformer(cls, attrs))
|
|
452
|
+
|
|
453
|
+
# Check attr order after executing the field_transformer.
|
|
571
454
|
# Mandatory vs non-mandatory attr order only matters when they are part of
|
|
572
455
|
# the __init__ signature and when they aren't kw_only (which are moved to
|
|
573
456
|
# the end and can be mandatory or non-mandatory in any order, as they will
|
|
@@ -581,34 +464,27 @@ def _transform_attrs(
|
|
|
581
464
|
if had_default is False and a.default is not NOTHING:
|
|
582
465
|
had_default = True
|
|
583
466
|
|
|
584
|
-
if field_transformer is not None:
|
|
585
|
-
attrs = field_transformer(cls, attrs)
|
|
586
|
-
|
|
587
467
|
# Resolve default field alias after executing field_transformer.
|
|
588
468
|
# This allows field_transformer to differentiate between explicit vs
|
|
589
469
|
# default aliases and supply their own defaults.
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
470
|
+
for a in attrs:
|
|
471
|
+
if not a.alias:
|
|
472
|
+
# Evolve is very slow, so we hold our nose and do it dirty.
|
|
473
|
+
_OBJ_SETATTR.__get__(a)("alias", _default_init_alias_for(a.name))
|
|
594
474
|
|
|
595
475
|
# Create AttrsClass *after* applying the field_transformer since it may
|
|
596
476
|
# add or remove attributes!
|
|
597
477
|
attr_names = [a.name for a in attrs]
|
|
598
478
|
AttrsClass = _make_attr_tuple_class(cls.__name__, attr_names)
|
|
599
479
|
|
|
600
|
-
return _Attributes(
|
|
480
|
+
return _Attributes(AttrsClass(attrs), base_attrs, base_attr_map)
|
|
601
481
|
|
|
602
482
|
|
|
603
|
-
def _make_cached_property_getattr(
|
|
604
|
-
cached_properties,
|
|
605
|
-
original_getattr,
|
|
606
|
-
cls,
|
|
607
|
-
):
|
|
483
|
+
def _make_cached_property_getattr(cached_properties, original_getattr, cls):
|
|
608
484
|
lines = [
|
|
609
485
|
# Wrapped to get `__class__` into closure cell for super()
|
|
610
486
|
# (It will be replaced with the newly constructed class after construction).
|
|
611
|
-
"def wrapper():",
|
|
487
|
+
"def wrapper(_cls):",
|
|
612
488
|
" __class__ = _cls",
|
|
613
489
|
" def __getattr__(self, item, cached_properties=cached_properties, original_getattr=original_getattr, _cached_setattr_get=_cached_setattr_get):",
|
|
614
490
|
" func = cached_properties.get(item)",
|
|
@@ -625,8 +501,12 @@ def _make_cached_property_getattr(
|
|
|
625
501
|
else:
|
|
626
502
|
lines.extend(
|
|
627
503
|
[
|
|
628
|
-
"
|
|
629
|
-
"
|
|
504
|
+
" try:",
|
|
505
|
+
" return super().__getattribute__(item)",
|
|
506
|
+
" except AttributeError:",
|
|
507
|
+
" if not hasattr(super(), '__getattr__'):",
|
|
508
|
+
" raise",
|
|
509
|
+
" return super().__getattr__(item)",
|
|
630
510
|
" original_error = f\"'{self.__class__.__name__}' object has no attribute '{item}'\"",
|
|
631
511
|
" raise AttributeError(original_error)",
|
|
632
512
|
]
|
|
@@ -635,7 +515,7 @@ def _make_cached_property_getattr(
|
|
|
635
515
|
lines.extend(
|
|
636
516
|
[
|
|
637
517
|
" return __getattr__",
|
|
638
|
-
"__getattr__ = wrapper()",
|
|
518
|
+
"__getattr__ = wrapper(_cls)",
|
|
639
519
|
]
|
|
640
520
|
)
|
|
641
521
|
|
|
@@ -643,17 +523,13 @@ def _make_cached_property_getattr(
|
|
|
643
523
|
|
|
644
524
|
glob = {
|
|
645
525
|
"cached_properties": cached_properties,
|
|
646
|
-
"_cached_setattr_get":
|
|
647
|
-
"_cls": cls,
|
|
526
|
+
"_cached_setattr_get": _OBJ_SETATTR.__get__,
|
|
648
527
|
"original_getattr": original_getattr,
|
|
649
528
|
}
|
|
650
529
|
|
|
651
|
-
return
|
|
652
|
-
"
|
|
653
|
-
|
|
654
|
-
unique_filename,
|
|
655
|
-
glob,
|
|
656
|
-
)
|
|
530
|
+
return _linecache_and_compile(
|
|
531
|
+
"\n".join(lines), unique_filename, glob, locals={"_cls": cls}
|
|
532
|
+
)["__getattr__"]
|
|
657
533
|
|
|
658
534
|
|
|
659
535
|
def _frozen_setattrs(self, name, value):
|
|
@@ -664,18 +540,82 @@ def _frozen_setattrs(self, name, value):
|
|
|
664
540
|
"__cause__",
|
|
665
541
|
"__context__",
|
|
666
542
|
"__traceback__",
|
|
543
|
+
"__suppress_context__",
|
|
544
|
+
"__notes__",
|
|
667
545
|
):
|
|
668
546
|
BaseException.__setattr__(self, name, value)
|
|
669
547
|
return
|
|
670
548
|
|
|
671
|
-
raise FrozenInstanceError
|
|
549
|
+
raise FrozenInstanceError
|
|
672
550
|
|
|
673
551
|
|
|
674
552
|
def _frozen_delattrs(self, name):
|
|
675
553
|
"""
|
|
676
554
|
Attached to frozen classes as __delattr__.
|
|
677
555
|
"""
|
|
678
|
-
|
|
556
|
+
if isinstance(self, BaseException) and name in ("__notes__",):
|
|
557
|
+
BaseException.__delattr__(self, name)
|
|
558
|
+
return
|
|
559
|
+
|
|
560
|
+
raise FrozenInstanceError
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
def evolve(*args, **changes):
|
|
564
|
+
"""
|
|
565
|
+
Create a new instance, based on the first positional argument with
|
|
566
|
+
*changes* applied.
|
|
567
|
+
|
|
568
|
+
.. tip::
|
|
569
|
+
|
|
570
|
+
On Python 3.13 and later, you can also use `copy.replace` instead.
|
|
571
|
+
|
|
572
|
+
Args:
|
|
573
|
+
|
|
574
|
+
inst:
|
|
575
|
+
Instance of a class with *attrs* attributes. *inst* must be passed
|
|
576
|
+
as a positional argument.
|
|
577
|
+
|
|
578
|
+
changes:
|
|
579
|
+
Keyword changes in the new copy.
|
|
580
|
+
|
|
581
|
+
Returns:
|
|
582
|
+
A copy of inst with *changes* incorporated.
|
|
583
|
+
|
|
584
|
+
Raises:
|
|
585
|
+
TypeError:
|
|
586
|
+
If *attr_name* couldn't be found in the class ``__init__``.
|
|
587
|
+
|
|
588
|
+
attrs.exceptions.NotAnAttrsClassError:
|
|
589
|
+
If *cls* is not an *attrs* class.
|
|
590
|
+
|
|
591
|
+
.. versionadded:: 17.1.0
|
|
592
|
+
.. deprecated:: 23.1.0
|
|
593
|
+
It is now deprecated to pass the instance using the keyword argument
|
|
594
|
+
*inst*. It will raise a warning until at least April 2024, after which
|
|
595
|
+
it will become an error. Always pass the instance as a positional
|
|
596
|
+
argument.
|
|
597
|
+
.. versionchanged:: 24.1.0
|
|
598
|
+
*inst* can't be passed as a keyword argument anymore.
|
|
599
|
+
"""
|
|
600
|
+
try:
|
|
601
|
+
(inst,) = args
|
|
602
|
+
except ValueError:
|
|
603
|
+
msg = (
|
|
604
|
+
f"evolve() takes 1 positional argument, but {len(args)} were given"
|
|
605
|
+
)
|
|
606
|
+
raise TypeError(msg) from None
|
|
607
|
+
|
|
608
|
+
cls = inst.__class__
|
|
609
|
+
attrs = fields(cls)
|
|
610
|
+
for a in attrs:
|
|
611
|
+
if not a.init:
|
|
612
|
+
continue
|
|
613
|
+
attr_name = a.name # To deal with private attributes.
|
|
614
|
+
init_name = a.alias
|
|
615
|
+
if init_name not in changes:
|
|
616
|
+
changes[init_name] = getattr(inst, attr_name)
|
|
617
|
+
|
|
618
|
+
return cls(**changes)
|
|
679
619
|
|
|
680
620
|
|
|
681
621
|
class _ClassBuilder:
|
|
@@ -684,6 +624,7 @@ class _ClassBuilder:
|
|
|
684
624
|
"""
|
|
685
625
|
|
|
686
626
|
__slots__ = (
|
|
627
|
+
"_add_method_dunders",
|
|
687
628
|
"_attr_names",
|
|
688
629
|
"_attrs",
|
|
689
630
|
"_base_attr_map",
|
|
@@ -693,20 +634,22 @@ class _ClassBuilder:
|
|
|
693
634
|
"_cls_dict",
|
|
694
635
|
"_delete_attribs",
|
|
695
636
|
"_frozen",
|
|
696
|
-
"
|
|
697
|
-
"_pre_init_has_args",
|
|
637
|
+
"_has_custom_setattr",
|
|
698
638
|
"_has_post_init",
|
|
639
|
+
"_has_pre_init",
|
|
699
640
|
"_is_exc",
|
|
700
641
|
"_on_setattr",
|
|
642
|
+
"_pre_init_has_args",
|
|
643
|
+
"_repr_added",
|
|
644
|
+
"_script_snippets",
|
|
701
645
|
"_slots",
|
|
702
646
|
"_weakref_slot",
|
|
703
647
|
"_wrote_own_setattr",
|
|
704
|
-
"_has_custom_setattr",
|
|
705
648
|
)
|
|
706
649
|
|
|
707
650
|
def __init__(
|
|
708
651
|
self,
|
|
709
|
-
cls,
|
|
652
|
+
cls: type,
|
|
710
653
|
these,
|
|
711
654
|
slots,
|
|
712
655
|
frozen,
|
|
@@ -764,7 +707,7 @@ class _ClassBuilder:
|
|
|
764
707
|
|
|
765
708
|
self._wrote_own_setattr = True
|
|
766
709
|
elif on_setattr in (
|
|
767
|
-
|
|
710
|
+
_DEFAULT_ON_SETATTR,
|
|
768
711
|
setters.validate,
|
|
769
712
|
setters.convert,
|
|
770
713
|
):
|
|
@@ -779,7 +722,7 @@ class _ClassBuilder:
|
|
|
779
722
|
break
|
|
780
723
|
if (
|
|
781
724
|
(
|
|
782
|
-
on_setattr ==
|
|
725
|
+
on_setattr == _DEFAULT_ON_SETATTR
|
|
783
726
|
and not (has_validator or has_converter)
|
|
784
727
|
)
|
|
785
728
|
or (on_setattr == setters.validate and not has_validator)
|
|
@@ -796,37 +739,65 @@ class _ClassBuilder:
|
|
|
796
739
|
self._cls_dict["__setstate__"],
|
|
797
740
|
) = self._make_getstate_setstate()
|
|
798
741
|
|
|
742
|
+
# tuples of script, globs, hook
|
|
743
|
+
self._script_snippets: list[
|
|
744
|
+
tuple[str, dict, Callable[[dict, dict], Any]]
|
|
745
|
+
] = []
|
|
746
|
+
self._repr_added = False
|
|
747
|
+
|
|
748
|
+
# We want to only do this check once; in 99.9% of cases these
|
|
749
|
+
# exist.
|
|
750
|
+
if not hasattr(self._cls, "__module__") or not hasattr(
|
|
751
|
+
self._cls, "__qualname__"
|
|
752
|
+
):
|
|
753
|
+
self._add_method_dunders = self._add_method_dunders_safe
|
|
754
|
+
else:
|
|
755
|
+
self._add_method_dunders = self._add_method_dunders_unsafe
|
|
756
|
+
|
|
799
757
|
def __repr__(self):
|
|
800
758
|
return f"<_ClassBuilder(cls={self._cls.__name__})>"
|
|
801
759
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
760
|
+
def _eval_snippets(self) -> None:
|
|
761
|
+
"""
|
|
762
|
+
Evaluate any registered snippets in one go.
|
|
763
|
+
"""
|
|
764
|
+
script = "\n".join([snippet[0] for snippet in self._script_snippets])
|
|
765
|
+
globs = {}
|
|
766
|
+
for _, snippet_globs, _ in self._script_snippets:
|
|
767
|
+
globs.update(snippet_globs)
|
|
768
|
+
|
|
769
|
+
locs = _linecache_and_compile(
|
|
770
|
+
script,
|
|
771
|
+
_generate_unique_filename(self._cls, "methods"),
|
|
772
|
+
globs,
|
|
773
|
+
)
|
|
808
774
|
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
if self._slots is True:
|
|
812
|
-
return self._create_slots_class()
|
|
775
|
+
for _, _, hook in self._script_snippets:
|
|
776
|
+
hook(self._cls_dict, locs)
|
|
813
777
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
else:
|
|
778
|
+
def build_class(self):
|
|
779
|
+
"""
|
|
780
|
+
Finalize class based on the accumulated configuration.
|
|
819
781
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
782
|
+
Builder cannot be used after calling this method.
|
|
783
|
+
"""
|
|
784
|
+
self._eval_snippets()
|
|
785
|
+
if self._slots is True:
|
|
786
|
+
cls = self._create_slots_class()
|
|
787
|
+
else:
|
|
788
|
+
cls = self._patch_original_class()
|
|
789
|
+
if PY_3_10_PLUS:
|
|
790
|
+
cls = abc.update_abstractmethods(cls)
|
|
823
791
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
792
|
+
# The method gets only called if it's not inherited from a base class.
|
|
793
|
+
# _has_own_attribute does NOT work properly for classmethods.
|
|
794
|
+
if (
|
|
795
|
+
getattr(cls, "__attrs_init_subclass__", None)
|
|
796
|
+
and "__attrs_init_subclass__" not in cls.__dict__
|
|
797
|
+
):
|
|
798
|
+
cls.__attrs_init_subclass__()
|
|
828
799
|
|
|
829
|
-
|
|
800
|
+
return cls
|
|
830
801
|
|
|
831
802
|
def _patch_original_class(self):
|
|
832
803
|
"""
|
|
@@ -840,7 +811,7 @@ class _ClassBuilder:
|
|
|
840
811
|
for name in self._attr_names:
|
|
841
812
|
if (
|
|
842
813
|
name not in base_names
|
|
843
|
-
and getattr(cls, name,
|
|
814
|
+
and getattr(cls, name, _SENTINEL) is not _SENTINEL
|
|
844
815
|
):
|
|
845
816
|
# An AttributeError can happen if a base class defines a
|
|
846
817
|
# class variable and we want to set an attribute with the
|
|
@@ -860,7 +831,7 @@ class _ClassBuilder:
|
|
|
860
831
|
cls.__attrs_own_setattr__ = False
|
|
861
832
|
|
|
862
833
|
if not self._has_custom_setattr:
|
|
863
|
-
cls.__setattr__ =
|
|
834
|
+
cls.__setattr__ = _OBJ_SETATTR
|
|
864
835
|
|
|
865
836
|
return cls
|
|
866
837
|
|
|
@@ -888,7 +859,7 @@ class _ClassBuilder:
|
|
|
888
859
|
if not self._has_custom_setattr:
|
|
889
860
|
for base_cls in self._cls.__bases__:
|
|
890
861
|
if base_cls.__dict__.get("__attrs_own_setattr__", False):
|
|
891
|
-
cd["__setattr__"] =
|
|
862
|
+
cd["__setattr__"] = _OBJ_SETATTR
|
|
892
863
|
break
|
|
893
864
|
|
|
894
865
|
# Traverse the MRO to collect existing slots
|
|
@@ -916,30 +887,23 @@ class _ClassBuilder:
|
|
|
916
887
|
):
|
|
917
888
|
names += ("__weakref__",)
|
|
918
889
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
}
|
|
925
|
-
else:
|
|
926
|
-
# `functools.cached_property` was introduced in 3.8.
|
|
927
|
-
# So can't be used before this.
|
|
928
|
-
cached_properties = {}
|
|
890
|
+
cached_properties = {
|
|
891
|
+
name: cached_prop.func
|
|
892
|
+
for name, cached_prop in cd.items()
|
|
893
|
+
if isinstance(cached_prop, cached_property)
|
|
894
|
+
}
|
|
929
895
|
|
|
930
896
|
# Collect methods with a `__class__` reference that are shadowed in the new class.
|
|
931
897
|
# To know to update them.
|
|
932
898
|
additional_closure_functions_to_update = []
|
|
933
899
|
if cached_properties:
|
|
934
|
-
# Add cached properties to names for slotting.
|
|
935
|
-
names += tuple(cached_properties.keys())
|
|
936
|
-
|
|
937
|
-
for name in cached_properties:
|
|
938
|
-
# Clear out function from class to avoid clashing.
|
|
939
|
-
del cd[name]
|
|
940
|
-
|
|
941
900
|
class_annotations = _get_annotations(self._cls)
|
|
942
901
|
for name, func in cached_properties.items():
|
|
902
|
+
# Add cached properties to names for slotting.
|
|
903
|
+
names += (name,)
|
|
904
|
+
# Clear out function from class to avoid clashing.
|
|
905
|
+
del cd[name]
|
|
906
|
+
additional_closure_functions_to_update.append(func)
|
|
943
907
|
annotation = inspect.signature(func).return_annotation
|
|
944
908
|
if annotation is not inspect.Parameter.empty:
|
|
945
909
|
class_annotations[name] = annotation
|
|
@@ -968,7 +932,7 @@ class _ClassBuilder:
|
|
|
968
932
|
slot_names = [name for name in slot_names if name not in reused_slots]
|
|
969
933
|
cd.update(reused_slots)
|
|
970
934
|
if self._cache_hash:
|
|
971
|
-
slot_names.append(
|
|
935
|
+
slot_names.append(_HASH_CACHE_FIELD)
|
|
972
936
|
|
|
973
937
|
cd["__slots__"] = tuple(slot_names)
|
|
974
938
|
|
|
@@ -1011,14 +975,17 @@ class _ClassBuilder:
|
|
|
1011
975
|
return cls
|
|
1012
976
|
|
|
1013
977
|
def add_repr(self, ns):
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
)
|
|
978
|
+
script, globs = _make_repr_script(self._attrs, ns)
|
|
979
|
+
|
|
980
|
+
def _attach_repr(cls_dict, globs):
|
|
981
|
+
cls_dict["__repr__"] = self._add_method_dunders(globs["__repr__"])
|
|
982
|
+
|
|
983
|
+
self._script_snippets.append((script, globs, _attach_repr))
|
|
984
|
+
self._repr_added = True
|
|
1017
985
|
return self
|
|
1018
986
|
|
|
1019
987
|
def add_str(self):
|
|
1020
|
-
|
|
1021
|
-
if repr is None:
|
|
988
|
+
if not self._repr_added:
|
|
1022
989
|
msg = "__str__ can only be generated if a __repr__ exists."
|
|
1023
990
|
raise ValueError(msg)
|
|
1024
991
|
|
|
@@ -1049,7 +1016,7 @@ class _ClassBuilder:
|
|
|
1049
1016
|
"""
|
|
1050
1017
|
Automatically created by attrs.
|
|
1051
1018
|
"""
|
|
1052
|
-
__bound_setattr =
|
|
1019
|
+
__bound_setattr = _OBJ_SETATTR.__get__(self)
|
|
1053
1020
|
if isinstance(state, tuple):
|
|
1054
1021
|
# Backward compatibility with attrs instances pickled with
|
|
1055
1022
|
# attrs versions before v22.2.0 which stored tuples.
|
|
@@ -1065,7 +1032,7 @@ class _ClassBuilder:
|
|
|
1065
1032
|
# indicate that the first call to __hash__ should be a cache
|
|
1066
1033
|
# miss.
|
|
1067
1034
|
if hash_caching_enabled:
|
|
1068
|
-
__bound_setattr(
|
|
1035
|
+
__bound_setattr(_HASH_CACHE_FIELD, None)
|
|
1069
1036
|
|
|
1070
1037
|
return slots_getstate, slots_setstate
|
|
1071
1038
|
|
|
@@ -1074,35 +1041,49 @@ class _ClassBuilder:
|
|
|
1074
1041
|
return self
|
|
1075
1042
|
|
|
1076
1043
|
def add_hash(self):
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
cache_hash=self._cache_hash,
|
|
1083
|
-
)
|
|
1044
|
+
script, globs = _make_hash_script(
|
|
1045
|
+
self._cls,
|
|
1046
|
+
self._attrs,
|
|
1047
|
+
frozen=self._frozen,
|
|
1048
|
+
cache_hash=self._cache_hash,
|
|
1084
1049
|
)
|
|
1085
1050
|
|
|
1051
|
+
def attach_hash(cls_dict: dict, locs: dict) -> None:
|
|
1052
|
+
cls_dict["__hash__"] = self._add_method_dunders(locs["__hash__"])
|
|
1053
|
+
|
|
1054
|
+
self._script_snippets.append((script, globs, attach_hash))
|
|
1055
|
+
|
|
1086
1056
|
return self
|
|
1087
1057
|
|
|
1088
1058
|
def add_init(self):
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
attrs_init=False,
|
|
1103
|
-
)
|
|
1059
|
+
script, globs, annotations = _make_init_script(
|
|
1060
|
+
self._cls,
|
|
1061
|
+
self._attrs,
|
|
1062
|
+
self._has_pre_init,
|
|
1063
|
+
self._pre_init_has_args,
|
|
1064
|
+
self._has_post_init,
|
|
1065
|
+
self._frozen,
|
|
1066
|
+
self._slots,
|
|
1067
|
+
self._cache_hash,
|
|
1068
|
+
self._base_attr_map,
|
|
1069
|
+
self._is_exc,
|
|
1070
|
+
self._on_setattr,
|
|
1071
|
+
attrs_init=False,
|
|
1104
1072
|
)
|
|
1105
1073
|
|
|
1074
|
+
def _attach_init(cls_dict, globs):
|
|
1075
|
+
init = globs["__init__"]
|
|
1076
|
+
init.__annotations__ = annotations
|
|
1077
|
+
cls_dict["__init__"] = self._add_method_dunders(init)
|
|
1078
|
+
|
|
1079
|
+
self._script_snippets.append((script, globs, _attach_init))
|
|
1080
|
+
|
|
1081
|
+
return self
|
|
1082
|
+
|
|
1083
|
+
def add_replace(self):
|
|
1084
|
+
self._cls_dict["__replace__"] = self._add_method_dunders(
|
|
1085
|
+
lambda self, **changes: evolve(self, **changes)
|
|
1086
|
+
)
|
|
1106
1087
|
return self
|
|
1107
1088
|
|
|
1108
1089
|
def add_match_args(self):
|
|
@@ -1113,32 +1094,41 @@ class _ClassBuilder:
|
|
|
1113
1094
|
)
|
|
1114
1095
|
|
|
1115
1096
|
def add_attrs_init(self):
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
attrs_init=True,
|
|
1130
|
-
)
|
|
1097
|
+
script, globs, annotations = _make_init_script(
|
|
1098
|
+
self._cls,
|
|
1099
|
+
self._attrs,
|
|
1100
|
+
self._has_pre_init,
|
|
1101
|
+
self._pre_init_has_args,
|
|
1102
|
+
self._has_post_init,
|
|
1103
|
+
self._frozen,
|
|
1104
|
+
self._slots,
|
|
1105
|
+
self._cache_hash,
|
|
1106
|
+
self._base_attr_map,
|
|
1107
|
+
self._is_exc,
|
|
1108
|
+
self._on_setattr,
|
|
1109
|
+
attrs_init=True,
|
|
1131
1110
|
)
|
|
1132
1111
|
|
|
1112
|
+
def _attach_attrs_init(cls_dict, globs):
|
|
1113
|
+
init = globs["__attrs_init__"]
|
|
1114
|
+
init.__annotations__ = annotations
|
|
1115
|
+
cls_dict["__attrs_init__"] = self._add_method_dunders(init)
|
|
1116
|
+
|
|
1117
|
+
self._script_snippets.append((script, globs, _attach_attrs_init))
|
|
1118
|
+
|
|
1133
1119
|
return self
|
|
1134
1120
|
|
|
1135
1121
|
def add_eq(self):
|
|
1136
1122
|
cd = self._cls_dict
|
|
1137
1123
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
)
|
|
1141
|
-
|
|
1124
|
+
script, globs = _make_eq_script(self._attrs)
|
|
1125
|
+
|
|
1126
|
+
def _attach_eq(cls_dict, globs):
|
|
1127
|
+
cls_dict["__eq__"] = self._add_method_dunders(globs["__eq__"])
|
|
1128
|
+
|
|
1129
|
+
self._script_snippets.append((script, globs, _attach_eq))
|
|
1130
|
+
|
|
1131
|
+
cd["__ne__"] = __ne__
|
|
1142
1132
|
|
|
1143
1133
|
return self
|
|
1144
1134
|
|
|
@@ -1153,9 +1143,6 @@ class _ClassBuilder:
|
|
|
1153
1143
|
return self
|
|
1154
1144
|
|
|
1155
1145
|
def add_setattr(self):
|
|
1156
|
-
if self._frozen:
|
|
1157
|
-
return self
|
|
1158
|
-
|
|
1159
1146
|
sa_attrs = {}
|
|
1160
1147
|
for a in self._attrs:
|
|
1161
1148
|
on_setattr = a.on_setattr or self._on_setattr
|
|
@@ -1179,7 +1166,7 @@ class _ClassBuilder:
|
|
|
1179
1166
|
else:
|
|
1180
1167
|
nval = hook(self, a, val)
|
|
1181
1168
|
|
|
1182
|
-
|
|
1169
|
+
_OBJ_SETATTR(self, name, nval)
|
|
1183
1170
|
|
|
1184
1171
|
self._cls_dict["__attrs_own_setattr__"] = True
|
|
1185
1172
|
self._cls_dict["__setattr__"] = self._add_method_dunders(__setattr__)
|
|
@@ -1187,7 +1174,21 @@ class _ClassBuilder:
|
|
|
1187
1174
|
|
|
1188
1175
|
return self
|
|
1189
1176
|
|
|
1190
|
-
def
|
|
1177
|
+
def _add_method_dunders_unsafe(self, method: Callable) -> Callable:
|
|
1178
|
+
"""
|
|
1179
|
+
Add __module__ and __qualname__ to a *method*.
|
|
1180
|
+
"""
|
|
1181
|
+
method.__module__ = self._cls.__module__
|
|
1182
|
+
|
|
1183
|
+
method.__qualname__ = f"{self._cls.__qualname__}.{method.__name__}"
|
|
1184
|
+
|
|
1185
|
+
method.__doc__ = (
|
|
1186
|
+
f"Method generated by attrs for class {self._cls.__qualname__}."
|
|
1187
|
+
)
|
|
1188
|
+
|
|
1189
|
+
return method
|
|
1190
|
+
|
|
1191
|
+
def _add_method_dunders_safe(self, method: Callable) -> Callable:
|
|
1191
1192
|
"""
|
|
1192
1193
|
Add __module__ and __qualname__ to a *method* if possible.
|
|
1193
1194
|
"""
|
|
@@ -1198,10 +1199,7 @@ class _ClassBuilder:
|
|
|
1198
1199
|
method.__qualname__ = f"{self._cls.__qualname__}.{method.__name__}"
|
|
1199
1200
|
|
|
1200
1201
|
with contextlib.suppress(AttributeError):
|
|
1201
|
-
method.__doc__ =
|
|
1202
|
-
"Method generated by attrs for class "
|
|
1203
|
-
f"{self._cls.__qualname__}."
|
|
1204
|
-
)
|
|
1202
|
+
method.__doc__ = f"Method generated by attrs for class {self._cls.__qualname__}."
|
|
1205
1203
|
|
|
1206
1204
|
return method
|
|
1207
1205
|
|
|
@@ -1333,238 +1331,28 @@ def attrs(
|
|
|
1333
1331
|
A class decorator that adds :term:`dunder methods` according to the
|
|
1334
1332
|
specified attributes using `attr.ib` or the *these* argument.
|
|
1335
1333
|
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
:
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
:param str repr_ns: When using nested classes, there's no way in Python 2
|
|
1352
|
-
to automatically detect that. Therefore it's possible to set the
|
|
1353
|
-
namespace explicitly for a more meaningful ``repr`` output.
|
|
1354
|
-
:param bool auto_detect: Instead of setting the *init*, *repr*, *eq*,
|
|
1355
|
-
*order*, and *hash* arguments explicitly, assume they are set to
|
|
1356
|
-
``True`` **unless any** of the involved methods for one of the
|
|
1357
|
-
arguments is implemented in the *current* class (i.e. it is *not*
|
|
1358
|
-
inherited from some base class).
|
|
1359
|
-
|
|
1360
|
-
So for example by implementing ``__eq__`` on a class yourself, *attrs*
|
|
1361
|
-
will deduce ``eq=False`` and will create *neither* ``__eq__`` *nor*
|
|
1362
|
-
``__ne__`` (but Python classes come with a sensible ``__ne__`` by
|
|
1363
|
-
default, so it *should* be enough to only implement ``__eq__`` in most
|
|
1364
|
-
cases).
|
|
1365
|
-
|
|
1366
|
-
.. warning::
|
|
1367
|
-
|
|
1368
|
-
If you prevent *attrs* from creating the ordering methods for you
|
|
1369
|
-
(``order=False``, e.g. by implementing ``__le__``), it becomes
|
|
1370
|
-
*your* responsibility to make sure its ordering is sound. The best
|
|
1371
|
-
way is to use the `functools.total_ordering` decorator.
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
Passing ``True`` or ``False`` to *init*, *repr*, *eq*, *order*, *cmp*,
|
|
1375
|
-
or *hash* overrides whatever *auto_detect* would determine.
|
|
1376
|
-
|
|
1377
|
-
:param bool repr: Create a ``__repr__`` method with a human readable
|
|
1378
|
-
representation of *attrs* attributes..
|
|
1379
|
-
:param bool str: Create a ``__str__`` method that is identical to
|
|
1380
|
-
``__repr__``. This is usually not necessary except for `Exception`\ s.
|
|
1381
|
-
:param bool | None eq: If ``True`` or ``None`` (default), add ``__eq__``
|
|
1382
|
-
and ``__ne__`` methods that check two instances for equality.
|
|
1383
|
-
|
|
1384
|
-
They compare the instances as if they were tuples of their *attrs*
|
|
1385
|
-
attributes if and only if the types of both classes are *identical*!
|
|
1386
|
-
|
|
1387
|
-
.. seealso:: `comparison`
|
|
1388
|
-
:param bool | None order: If ``True``, add ``__lt__``, ``__le__``,
|
|
1389
|
-
``__gt__``, and ``__ge__`` methods that behave like *eq* above and
|
|
1390
|
-
allow instances to be ordered. If ``None`` (default) mirror value of
|
|
1391
|
-
*eq*.
|
|
1392
|
-
|
|
1393
|
-
.. seealso:: `comparison`
|
|
1394
|
-
:param bool | None cmp: Setting *cmp* is equivalent to setting *eq* and
|
|
1395
|
-
*order* to the same value. Must not be mixed with *eq* or *order*.
|
|
1396
|
-
|
|
1397
|
-
.. seealso:: `comparison`
|
|
1398
|
-
:param bool | None unsafe_hash: If ``None`` (default), the ``__hash__``
|
|
1399
|
-
method is generated according how *eq* and *frozen* are set.
|
|
1400
|
-
|
|
1401
|
-
1. If *both* are True, *attrs* will generate a ``__hash__`` for you.
|
|
1402
|
-
2. If *eq* is True and *frozen* is False, ``__hash__`` will be set to
|
|
1403
|
-
None, marking it unhashable (which it is).
|
|
1404
|
-
3. If *eq* is False, ``__hash__`` will be left untouched meaning the
|
|
1405
|
-
``__hash__`` method of the base class will be used (if base class is
|
|
1406
|
-
``object``, this means it will fall back to id-based hashing.).
|
|
1407
|
-
|
|
1408
|
-
Although not recommended, you can decide for yourself and force *attrs*
|
|
1409
|
-
to create one (e.g. if the class is immutable even though you didn't
|
|
1410
|
-
freeze it programmatically) by passing ``True`` or not. Both of these
|
|
1411
|
-
cases are rather special and should be used carefully.
|
|
1412
|
-
|
|
1413
|
-
.. seealso::
|
|
1414
|
-
|
|
1415
|
-
- Our documentation on `hashing`,
|
|
1416
|
-
- Python's documentation on `object.__hash__`,
|
|
1417
|
-
- and the `GitHub issue that led to the default \
|
|
1418
|
-
behavior <https://github.com/python-attrs/attrs/issues/136>`_ for
|
|
1419
|
-
more details.
|
|
1420
|
-
|
|
1421
|
-
:param bool | None hash: Alias for *unsafe_hash*. *unsafe_hash* takes
|
|
1422
|
-
precedence.
|
|
1423
|
-
:param bool init: Create a ``__init__`` method that initializes the *attrs*
|
|
1424
|
-
attributes. Leading underscores are stripped for the argument name. If
|
|
1425
|
-
a ``__attrs_pre_init__`` method exists on the class, it will be called
|
|
1426
|
-
before the class is initialized. If a ``__attrs_post_init__`` method
|
|
1427
|
-
exists on the class, it will be called after the class is fully
|
|
1428
|
-
initialized.
|
|
1429
|
-
|
|
1430
|
-
If ``init`` is ``False``, an ``__attrs_init__`` method will be injected
|
|
1431
|
-
instead. This allows you to define a custom ``__init__`` method that
|
|
1432
|
-
can do pre-init work such as ``super().__init__()``, and then call
|
|
1433
|
-
``__attrs_init__()`` and ``__attrs_post_init__()``.
|
|
1434
|
-
|
|
1435
|
-
.. seealso:: `init`
|
|
1436
|
-
:param bool slots: Create a :term:`slotted class <slotted classes>` that's
|
|
1437
|
-
more memory-efficient. Slotted classes are generally superior to the
|
|
1438
|
-
default dict classes, but have some gotchas you should know about, so
|
|
1439
|
-
we encourage you to read the :term:`glossary entry <slotted classes>`.
|
|
1440
|
-
:param bool frozen: Make instances immutable after initialization. If
|
|
1441
|
-
someone attempts to modify a frozen instance,
|
|
1442
|
-
`attrs.exceptions.FrozenInstanceError` is raised.
|
|
1443
|
-
|
|
1444
|
-
.. note::
|
|
1445
|
-
|
|
1446
|
-
1. This is achieved by installing a custom ``__setattr__`` method
|
|
1447
|
-
on your class, so you can't implement your own.
|
|
1448
|
-
|
|
1449
|
-
2. True immutability is impossible in Python.
|
|
1450
|
-
|
|
1451
|
-
3. This *does* have a minor a runtime performance `impact
|
|
1452
|
-
<how-frozen>` when initializing new instances. In other words:
|
|
1453
|
-
``__init__`` is slightly slower with ``frozen=True``.
|
|
1454
|
-
|
|
1455
|
-
4. If a class is frozen, you cannot modify ``self`` in
|
|
1456
|
-
``__attrs_post_init__`` or a self-written ``__init__``. You can
|
|
1457
|
-
circumvent that limitation by using ``object.__setattr__(self,
|
|
1458
|
-
"attribute_name", value)``.
|
|
1459
|
-
|
|
1460
|
-
5. Subclasses of a frozen class are frozen too.
|
|
1461
|
-
|
|
1462
|
-
:param bool weakref_slot: Make instances weak-referenceable. This has no
|
|
1463
|
-
effect unless ``slots`` is also enabled.
|
|
1464
|
-
:param bool auto_attribs: If ``True``, collect :pep:`526`-annotated
|
|
1465
|
-
attributes from the class body.
|
|
1466
|
-
|
|
1467
|
-
In this case, you **must** annotate every field. If *attrs* encounters
|
|
1468
|
-
a field that is set to an `attr.ib` but lacks a type annotation, an
|
|
1469
|
-
`attr.exceptions.UnannotatedAttributeError` is raised. Use
|
|
1470
|
-
``field_name: typing.Any = attr.ib(...)`` if you don't want to set a
|
|
1471
|
-
type.
|
|
1472
|
-
|
|
1473
|
-
If you assign a value to those attributes (e.g. ``x: int = 42``), that
|
|
1474
|
-
value becomes the default value like if it were passed using
|
|
1475
|
-
``attr.ib(default=42)``. Passing an instance of `attrs.Factory` also
|
|
1476
|
-
works as expected in most cases (see warning below).
|
|
1477
|
-
|
|
1478
|
-
Attributes annotated as `typing.ClassVar`, and attributes that are
|
|
1479
|
-
neither annotated nor set to an `attr.ib` are **ignored**.
|
|
1480
|
-
|
|
1481
|
-
.. warning::
|
|
1482
|
-
For features that use the attribute name to create decorators (e.g.
|
|
1483
|
-
:ref:`validators <validators>`), you still *must* assign `attr.ib`
|
|
1484
|
-
to them. Otherwise Python will either not find the name or try to
|
|
1485
|
-
use the default value to call e.g. ``validator`` on it.
|
|
1486
|
-
|
|
1487
|
-
These errors can be quite confusing and probably the most common bug
|
|
1488
|
-
report on our bug tracker.
|
|
1489
|
-
|
|
1490
|
-
:param bool kw_only: Make all attributes keyword-only in the generated
|
|
1491
|
-
``__init__`` (if ``init`` is ``False``, this parameter is ignored).
|
|
1492
|
-
:param bool cache_hash: Ensure that the object's hash code is computed only
|
|
1493
|
-
once and stored on the object. If this is set to ``True``, hashing
|
|
1494
|
-
must be either explicitly or implicitly enabled for this class. If the
|
|
1495
|
-
hash code is cached, avoid any reassignments of fields involved in hash
|
|
1496
|
-
code computation or mutations of the objects those fields point to
|
|
1497
|
-
after object creation. If such changes occur, the behavior of the
|
|
1498
|
-
object's hash code is undefined.
|
|
1499
|
-
:param bool auto_exc: If the class subclasses `BaseException` (which
|
|
1500
|
-
implicitly includes any subclass of any exception), the following
|
|
1501
|
-
happens to behave like a well-behaved Python exceptions class:
|
|
1502
|
-
|
|
1503
|
-
- the values for *eq*, *order*, and *hash* are ignored and the
|
|
1504
|
-
instances compare and hash by the instance's ids (N.B. *attrs* will
|
|
1505
|
-
*not* remove existing implementations of ``__hash__`` or the equality
|
|
1506
|
-
methods. It just won't add own ones.),
|
|
1507
|
-
- all attributes that are either passed into ``__init__`` or have a
|
|
1508
|
-
default value are additionally available as a tuple in the ``args``
|
|
1509
|
-
attribute,
|
|
1510
|
-
- the value of *str* is ignored leaving ``__str__`` to base classes.
|
|
1511
|
-
:param bool collect_by_mro: Setting this to `True` fixes the way *attrs*
|
|
1512
|
-
collects attributes from base classes. The default behavior is
|
|
1513
|
-
incorrect in certain cases of multiple inheritance. It should be on by
|
|
1514
|
-
default but is kept off for backward-compatibility.
|
|
1515
|
-
|
|
1516
|
-
.. seealso::
|
|
1517
|
-
Issue `#428 <https://github.com/python-attrs/attrs/issues/428>`_
|
|
1518
|
-
|
|
1519
|
-
:param bool | None getstate_setstate:
|
|
1520
|
-
.. note::
|
|
1521
|
-
This is usually only interesting for slotted classes and you should
|
|
1522
|
-
probably just set *auto_detect* to `True`.
|
|
1523
|
-
|
|
1524
|
-
If `True`, ``__getstate__`` and ``__setstate__`` are generated and
|
|
1525
|
-
attached to the class. This is necessary for slotted classes to be
|
|
1526
|
-
pickleable. If left `None`, it's `True` by default for slotted classes
|
|
1527
|
-
and ``False`` for dict classes.
|
|
1528
|
-
|
|
1529
|
-
If *auto_detect* is `True`, and *getstate_setstate* is left `None`, and
|
|
1530
|
-
**either** ``__getstate__`` or ``__setstate__`` is detected directly on
|
|
1531
|
-
the class (i.e. not inherited), it is set to `False` (this is usually
|
|
1532
|
-
what you want).
|
|
1533
|
-
|
|
1534
|
-
:param on_setattr: A callable that is run whenever the user attempts to set
|
|
1535
|
-
an attribute (either by assignment like ``i.x = 42`` or by using
|
|
1536
|
-
`setattr` like ``setattr(i, "x", 42)``). It receives the same arguments
|
|
1537
|
-
as validators: the instance, the attribute that is being modified, and
|
|
1538
|
-
the new value.
|
|
1539
|
-
|
|
1540
|
-
If no exception is raised, the attribute is set to the return value of
|
|
1541
|
-
the callable.
|
|
1542
|
-
|
|
1543
|
-
If a list of callables is passed, they're automatically wrapped in an
|
|
1544
|
-
`attrs.setters.pipe`.
|
|
1545
|
-
:type on_setattr: `callable`, or a list of callables, or `None`, or
|
|
1546
|
-
`attrs.setters.NO_OP`
|
|
1547
|
-
|
|
1548
|
-
:param callable | None field_transformer:
|
|
1549
|
-
A function that is called with the original class object and all fields
|
|
1550
|
-
right before *attrs* finalizes the class. You can use this, e.g., to
|
|
1551
|
-
automatically add converters or validators to fields based on their
|
|
1552
|
-
types.
|
|
1553
|
-
|
|
1554
|
-
.. seealso:: `transform-fields`
|
|
1555
|
-
|
|
1556
|
-
:param bool match_args:
|
|
1557
|
-
If `True` (default), set ``__match_args__`` on the class to support
|
|
1558
|
-
:pep:`634` (Structural Pattern Matching). It is a tuple of all
|
|
1559
|
-
non-keyword-only ``__init__`` parameter names on Python 3.10 and later.
|
|
1560
|
-
Ignored on older Python versions.
|
|
1334
|
+
Consider using `attrs.define` / `attrs.frozen` in new code (``attr.s`` will
|
|
1335
|
+
*never* go away, though).
|
|
1336
|
+
|
|
1337
|
+
Args:
|
|
1338
|
+
repr_ns (str):
|
|
1339
|
+
When using nested classes, there was no way in Python 2 to
|
|
1340
|
+
automatically detect that. This argument allows to set a custom
|
|
1341
|
+
name for a more meaningful ``repr`` output. This argument is
|
|
1342
|
+
pointless in Python 3 and is therefore deprecated.
|
|
1343
|
+
|
|
1344
|
+
.. caution::
|
|
1345
|
+
Refer to `attrs.define` for the rest of the parameters, but note that they
|
|
1346
|
+
can have different defaults.
|
|
1347
|
+
|
|
1348
|
+
Notably, leaving *on_setattr* as `None` will **not** add any hooks.
|
|
1561
1349
|
|
|
1562
1350
|
.. versionadded:: 16.0.0 *slots*
|
|
1563
1351
|
.. versionadded:: 16.1.0 *frozen*
|
|
1564
1352
|
.. versionadded:: 16.3.0 *str*
|
|
1565
1353
|
.. versionadded:: 16.3.0 Support for ``__attrs_post_init__``.
|
|
1566
1354
|
.. versionchanged:: 17.1.0
|
|
1567
|
-
*hash* supports
|
|
1355
|
+
*hash* supports `None` as value which is also the default now.
|
|
1568
1356
|
.. versionadded:: 17.3.0 *auto_attribs*
|
|
1569
1357
|
.. versionchanged:: 18.1.0
|
|
1570
1358
|
If *these* is passed, no attributes are deleted from the class body.
|
|
@@ -1595,10 +1383,29 @@ def attrs(
|
|
|
1595
1383
|
.. versionadded:: 21.3.0 *match_args*
|
|
1596
1384
|
.. versionadded:: 22.2.0
|
|
1597
1385
|
*unsafe_hash* as an alias for *hash* (for :pep:`681` compliance).
|
|
1598
|
-
|
|
1386
|
+
.. deprecated:: 24.1.0 *repr_ns*
|
|
1387
|
+
.. versionchanged:: 24.1.0
|
|
1388
|
+
Instances are not compared as tuples of attributes anymore, but using a
|
|
1389
|
+
big ``and`` condition. This is faster and has more correct behavior for
|
|
1390
|
+
uncomparable values like `math.nan`.
|
|
1391
|
+
.. versionadded:: 24.1.0
|
|
1392
|
+
If a class has an *inherited* classmethod called
|
|
1393
|
+
``__attrs_init_subclass__``, it is executed after the class is created.
|
|
1394
|
+
.. deprecated:: 24.1.0 *hash* is deprecated in favor of *unsafe_hash*.
|
|
1395
|
+
"""
|
|
1396
|
+
if repr_ns is not None:
|
|
1397
|
+
import warnings
|
|
1398
|
+
|
|
1399
|
+
warnings.warn(
|
|
1400
|
+
DeprecationWarning(
|
|
1401
|
+
"The `repr_ns` argument is deprecated and will be removed in or after August 2025."
|
|
1402
|
+
),
|
|
1403
|
+
stacklevel=2,
|
|
1404
|
+
)
|
|
1405
|
+
|
|
1599
1406
|
eq_, order_ = _determine_attrs_eq_order(cmp, eq, order, None)
|
|
1600
1407
|
|
|
1601
|
-
#
|
|
1408
|
+
# unsafe_hash takes precedence due to PEP 681.
|
|
1602
1409
|
if unsafe_hash is not None:
|
|
1603
1410
|
hash = unsafe_hash
|
|
1604
1411
|
|
|
@@ -1638,10 +1445,12 @@ def attrs(
|
|
|
1638
1445
|
has_own_setattr,
|
|
1639
1446
|
field_transformer,
|
|
1640
1447
|
)
|
|
1448
|
+
|
|
1641
1449
|
if _determine_whether_to_implement(
|
|
1642
1450
|
cls, repr, auto_detect, ("__repr__",)
|
|
1643
1451
|
):
|
|
1644
1452
|
builder.add_repr(repr_ns)
|
|
1453
|
+
|
|
1645
1454
|
if str is True:
|
|
1646
1455
|
builder.add_str()
|
|
1647
1456
|
|
|
@@ -1655,7 +1464,8 @@ def attrs(
|
|
|
1655
1464
|
):
|
|
1656
1465
|
builder.add_order()
|
|
1657
1466
|
|
|
1658
|
-
|
|
1467
|
+
if not frozen:
|
|
1468
|
+
builder.add_setattr()
|
|
1659
1469
|
|
|
1660
1470
|
nonlocal hash
|
|
1661
1471
|
if (
|
|
@@ -1698,8 +1508,11 @@ def attrs(
|
|
|
1698
1508
|
msg = "Invalid value for cache_hash. To use hash caching, init must be True."
|
|
1699
1509
|
raise TypeError(msg)
|
|
1700
1510
|
|
|
1511
|
+
if PY_3_13_PLUS and not _has_own_attribute(cls, "__replace__"):
|
|
1512
|
+
builder.add_replace()
|
|
1513
|
+
|
|
1701
1514
|
if (
|
|
1702
|
-
|
|
1515
|
+
PY_3_10_PLUS
|
|
1703
1516
|
and match_args
|
|
1704
1517
|
and not _has_own_attribute(cls, "__match_args__")
|
|
1705
1518
|
):
|
|
@@ -1708,7 +1521,7 @@ def attrs(
|
|
|
1708
1521
|
return builder.build_class()
|
|
1709
1522
|
|
|
1710
1523
|
# maybe_cls's type depends on the usage of the decorator. It's a class
|
|
1711
|
-
# if it's used as `@attrs` but
|
|
1524
|
+
# if it's used as `@attrs` but `None` if used as `@attrs()`.
|
|
1712
1525
|
if maybe_cls is None:
|
|
1713
1526
|
return wrap
|
|
1714
1527
|
|
|
@@ -1730,7 +1543,7 @@ def _has_frozen_base_class(cls):
|
|
|
1730
1543
|
return cls.__setattr__ is _frozen_setattrs
|
|
1731
1544
|
|
|
1732
1545
|
|
|
1733
|
-
def _generate_unique_filename(cls, func_name):
|
|
1546
|
+
def _generate_unique_filename(cls: type, func_name: str) -> str:
|
|
1734
1547
|
"""
|
|
1735
1548
|
Create a "filename" suitable for a function being generated.
|
|
1736
1549
|
"""
|
|
@@ -1740,15 +1553,16 @@ def _generate_unique_filename(cls, func_name):
|
|
|
1740
1553
|
)
|
|
1741
1554
|
|
|
1742
1555
|
|
|
1743
|
-
def
|
|
1556
|
+
def _make_hash_script(
|
|
1557
|
+
cls: type, attrs: list[Attribute], frozen: bool, cache_hash: bool
|
|
1558
|
+
) -> tuple[str, dict]:
|
|
1744
1559
|
attrs = tuple(
|
|
1745
1560
|
a for a in attrs if a.hash is True or (a.hash is None and a.eq is True)
|
|
1746
1561
|
)
|
|
1747
1562
|
|
|
1748
1563
|
tab = " "
|
|
1749
1564
|
|
|
1750
|
-
|
|
1751
|
-
type_hash = hash(unique_filename)
|
|
1565
|
+
type_hash = hash(_generate_unique_filename(cls, "hash"))
|
|
1752
1566
|
# If eq is custom generated, we need to include the functions in globs
|
|
1753
1567
|
globs = {}
|
|
1754
1568
|
|
|
@@ -1793,89 +1607,85 @@ def _make_hash(cls, attrs, frozen, cache_hash):
|
|
|
1793
1607
|
method_lines.append(indent + " " + closing_braces)
|
|
1794
1608
|
|
|
1795
1609
|
if cache_hash:
|
|
1796
|
-
method_lines.append(tab + f"if self.{
|
|
1610
|
+
method_lines.append(tab + f"if self.{_HASH_CACHE_FIELD} is None:")
|
|
1797
1611
|
if frozen:
|
|
1798
1612
|
append_hash_computation_lines(
|
|
1799
|
-
f"object.__setattr__(self, '{
|
|
1613
|
+
f"object.__setattr__(self, '{_HASH_CACHE_FIELD}', ", tab * 2
|
|
1800
1614
|
)
|
|
1801
1615
|
method_lines.append(tab * 2 + ")") # close __setattr__
|
|
1802
1616
|
else:
|
|
1803
1617
|
append_hash_computation_lines(
|
|
1804
|
-
f"self.{
|
|
1618
|
+
f"self.{_HASH_CACHE_FIELD} = ", tab * 2
|
|
1805
1619
|
)
|
|
1806
|
-
method_lines.append(tab + f"return self.{
|
|
1620
|
+
method_lines.append(tab + f"return self.{_HASH_CACHE_FIELD}")
|
|
1807
1621
|
else:
|
|
1808
1622
|
append_hash_computation_lines("return ", tab)
|
|
1809
1623
|
|
|
1810
1624
|
script = "\n".join(method_lines)
|
|
1811
|
-
return
|
|
1625
|
+
return script, globs
|
|
1812
1626
|
|
|
1813
1627
|
|
|
1814
|
-
def _add_hash(cls, attrs):
|
|
1628
|
+
def _add_hash(cls: type, attrs: list[Attribute]):
|
|
1815
1629
|
"""
|
|
1816
1630
|
Add a hash method to *cls*.
|
|
1817
1631
|
"""
|
|
1818
|
-
|
|
1632
|
+
script, globs = _make_hash_script(
|
|
1633
|
+
cls, attrs, frozen=False, cache_hash=False
|
|
1634
|
+
)
|
|
1635
|
+
_compile_and_eval(
|
|
1636
|
+
script, globs, filename=_generate_unique_filename(cls, "__hash__")
|
|
1637
|
+
)
|
|
1638
|
+
cls.__hash__ = globs["__hash__"]
|
|
1819
1639
|
return cls
|
|
1820
1640
|
|
|
1821
1641
|
|
|
1822
|
-
def
|
|
1642
|
+
def __ne__(self, other):
|
|
1823
1643
|
"""
|
|
1824
|
-
|
|
1644
|
+
Check equality and either forward a NotImplemented or
|
|
1645
|
+
return the result negated.
|
|
1825
1646
|
"""
|
|
1647
|
+
result = self.__eq__(other)
|
|
1648
|
+
if result is NotImplemented:
|
|
1649
|
+
return NotImplemented
|
|
1826
1650
|
|
|
1827
|
-
|
|
1828
|
-
"""
|
|
1829
|
-
Check equality and either forward a NotImplemented or
|
|
1830
|
-
return the result negated.
|
|
1831
|
-
"""
|
|
1832
|
-
result = self.__eq__(other)
|
|
1833
|
-
if result is NotImplemented:
|
|
1834
|
-
return NotImplemented
|
|
1835
|
-
|
|
1836
|
-
return not result
|
|
1837
|
-
|
|
1838
|
-
return __ne__
|
|
1651
|
+
return not result
|
|
1839
1652
|
|
|
1840
1653
|
|
|
1841
|
-
def
|
|
1654
|
+
def _make_eq_script(attrs: list) -> tuple[str, dict]:
|
|
1842
1655
|
"""
|
|
1843
1656
|
Create __eq__ method for *cls* with *attrs*.
|
|
1844
1657
|
"""
|
|
1845
1658
|
attrs = [a for a in attrs if a.eq]
|
|
1846
1659
|
|
|
1847
|
-
unique_filename = _generate_unique_filename(cls, "eq")
|
|
1848
1660
|
lines = [
|
|
1849
1661
|
"def __eq__(self, other):",
|
|
1850
1662
|
" if other.__class__ is not self.__class__:",
|
|
1851
1663
|
" return NotImplemented",
|
|
1852
1664
|
]
|
|
1853
1665
|
|
|
1854
|
-
# We can't just do a big self.x = other.x and... clause due to
|
|
1855
|
-
# irregularities like nan == nan is false but (nan,) == (nan,) is true.
|
|
1856
1666
|
globs = {}
|
|
1857
1667
|
if attrs:
|
|
1858
1668
|
lines.append(" return (")
|
|
1859
|
-
others = [" ) == ("]
|
|
1860
1669
|
for a in attrs:
|
|
1861
1670
|
if a.eq_key:
|
|
1862
1671
|
cmp_name = f"_{a.name}_key"
|
|
1863
1672
|
# Add the key function to the global namespace
|
|
1864
1673
|
# of the evaluated function.
|
|
1865
1674
|
globs[cmp_name] = a.eq_key
|
|
1866
|
-
lines.append(
|
|
1867
|
-
|
|
1675
|
+
lines.append(
|
|
1676
|
+
f" {cmp_name}(self.{a.name}) == {cmp_name}(other.{a.name})"
|
|
1677
|
+
)
|
|
1868
1678
|
else:
|
|
1869
|
-
lines.append(f" self.{a.name}
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
lines
|
|
1679
|
+
lines.append(f" self.{a.name} == other.{a.name}")
|
|
1680
|
+
if a is not attrs[-1]:
|
|
1681
|
+
lines[-1] = f"{lines[-1]} and"
|
|
1682
|
+
lines.append(" )")
|
|
1873
1683
|
else:
|
|
1874
1684
|
lines.append(" return True")
|
|
1875
1685
|
|
|
1876
1686
|
script = "\n".join(lines)
|
|
1877
1687
|
|
|
1878
|
-
return
|
|
1688
|
+
return script, globs
|
|
1879
1689
|
|
|
1880
1690
|
|
|
1881
1691
|
def _make_order(cls, attrs):
|
|
@@ -1941,14 +1751,20 @@ def _add_eq(cls, attrs=None):
|
|
|
1941
1751
|
if attrs is None:
|
|
1942
1752
|
attrs = cls.__attrs_attrs__
|
|
1943
1753
|
|
|
1944
|
-
|
|
1945
|
-
|
|
1754
|
+
script, globs = _make_eq_script(attrs)
|
|
1755
|
+
_compile_and_eval(
|
|
1756
|
+
script, globs, filename=_generate_unique_filename(cls, "__eq__")
|
|
1757
|
+
)
|
|
1758
|
+
cls.__eq__ = globs["__eq__"]
|
|
1759
|
+
cls.__ne__ = __ne__
|
|
1946
1760
|
|
|
1947
1761
|
return cls
|
|
1948
1762
|
|
|
1949
1763
|
|
|
1950
|
-
def
|
|
1951
|
-
|
|
1764
|
+
def _make_repr_script(attrs, ns) -> tuple[str, dict]:
|
|
1765
|
+
"""
|
|
1766
|
+
Create the source and globs for a __repr__ and return it.
|
|
1767
|
+
"""
|
|
1952
1768
|
# Figure out which attributes to include, and which function to use to
|
|
1953
1769
|
# format them. The a.repr value can be either bool or a custom
|
|
1954
1770
|
# callable.
|
|
@@ -1999,9 +1815,7 @@ def _make_repr(attrs, ns, cls):
|
|
|
1999
1815
|
" already_repring.remove(id(self))",
|
|
2000
1816
|
]
|
|
2001
1817
|
|
|
2002
|
-
return
|
|
2003
|
-
"__repr__", "\n".join(lines), unique_filename, globs=globs
|
|
2004
|
-
)
|
|
1818
|
+
return "\n".join(lines), globs
|
|
2005
1819
|
|
|
2006
1820
|
|
|
2007
1821
|
def _add_repr(cls, ns=None, attrs=None):
|
|
@@ -2011,7 +1825,11 @@ def _add_repr(cls, ns=None, attrs=None):
|
|
|
2011
1825
|
if attrs is None:
|
|
2012
1826
|
attrs = cls.__attrs_attrs__
|
|
2013
1827
|
|
|
2014
|
-
|
|
1828
|
+
script, globs = _make_repr_script(attrs, ns)
|
|
1829
|
+
_compile_and_eval(
|
|
1830
|
+
script, globs, filename=_generate_unique_filename(cls, "__repr__")
|
|
1831
|
+
)
|
|
1832
|
+
cls.__repr__ = globs["__repr__"]
|
|
2015
1833
|
return cls
|
|
2016
1834
|
|
|
2017
1835
|
|
|
@@ -2022,13 +1840,17 @@ def fields(cls):
|
|
|
2022
1840
|
The tuple also allows accessing the fields by their names (see below for
|
|
2023
1841
|
examples).
|
|
2024
1842
|
|
|
2025
|
-
:
|
|
1843
|
+
Args:
|
|
1844
|
+
cls (type): Class to introspect.
|
|
2026
1845
|
|
|
2027
|
-
:
|
|
2028
|
-
|
|
2029
|
-
class.
|
|
1846
|
+
Raises:
|
|
1847
|
+
TypeError: If *cls* is not a class.
|
|
2030
1848
|
|
|
2031
|
-
|
|
1849
|
+
attrs.exceptions.NotAnAttrsClassError:
|
|
1850
|
+
If *cls* is not an *attrs* class.
|
|
1851
|
+
|
|
1852
|
+
Returns:
|
|
1853
|
+
tuple (with name accessors) of `attrs.Attribute`
|
|
2032
1854
|
|
|
2033
1855
|
.. versionchanged:: 16.2.0 Returned tuple allows accessing the fields
|
|
2034
1856
|
by name.
|
|
@@ -2059,16 +1881,20 @@ def fields(cls):
|
|
|
2059
1881
|
|
|
2060
1882
|
def fields_dict(cls):
|
|
2061
1883
|
"""
|
|
2062
|
-
Return an ordered dictionary of *attrs* attributes for a class, whose
|
|
2063
|
-
|
|
1884
|
+
Return an ordered dictionary of *attrs* attributes for a class, whose keys
|
|
1885
|
+
are the attribute names.
|
|
1886
|
+
|
|
1887
|
+
Args:
|
|
1888
|
+
cls (type): Class to introspect.
|
|
2064
1889
|
|
|
2065
|
-
:
|
|
1890
|
+
Raises:
|
|
1891
|
+
TypeError: If *cls* is not a class.
|
|
2066
1892
|
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
class.
|
|
1893
|
+
attrs.exceptions.NotAnAttrsClassError:
|
|
1894
|
+
If *cls* is not an *attrs* class.
|
|
2070
1895
|
|
|
2071
|
-
:
|
|
1896
|
+
Returns:
|
|
1897
|
+
dict[str, attrs.Attribute]: Dict of attribute name to definition
|
|
2072
1898
|
|
|
2073
1899
|
.. versionadded:: 18.1.0
|
|
2074
1900
|
"""
|
|
@@ -2088,7 +1914,8 @@ def validate(inst):
|
|
|
2088
1914
|
|
|
2089
1915
|
Leaves all exceptions through.
|
|
2090
1916
|
|
|
2091
|
-
:
|
|
1917
|
+
Args:
|
|
1918
|
+
inst: Instance of a class with *attrs* attributes.
|
|
2092
1919
|
"""
|
|
2093
1920
|
if _config._run_validators is False:
|
|
2094
1921
|
return
|
|
@@ -2099,18 +1926,15 @@ def validate(inst):
|
|
|
2099
1926
|
v(inst, a, getattr(inst, a.name))
|
|
2100
1927
|
|
|
2101
1928
|
|
|
2102
|
-
def _is_slot_cls(cls):
|
|
2103
|
-
return "__slots__" in cls.__dict__
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
1929
|
def _is_slot_attr(a_name, base_attr_map):
|
|
2107
1930
|
"""
|
|
2108
1931
|
Check if the attribute name comes from a slot class.
|
|
2109
1932
|
"""
|
|
2110
|
-
|
|
1933
|
+
cls = base_attr_map.get(a_name)
|
|
1934
|
+
return cls and "__slots__" in cls.__dict__
|
|
2111
1935
|
|
|
2112
1936
|
|
|
2113
|
-
def
|
|
1937
|
+
def _make_init_script(
|
|
2114
1938
|
cls,
|
|
2115
1939
|
attrs,
|
|
2116
1940
|
pre_init,
|
|
@@ -2123,7 +1947,7 @@ def _make_init(
|
|
|
2123
1947
|
is_exc,
|
|
2124
1948
|
cls_on_setattr,
|
|
2125
1949
|
attrs_init,
|
|
2126
|
-
):
|
|
1950
|
+
) -> tuple[str, dict, dict]:
|
|
2127
1951
|
has_cls_on_setattr = (
|
|
2128
1952
|
cls_on_setattr is not None and cls_on_setattr is not setters.NO_OP
|
|
2129
1953
|
)
|
|
@@ -2151,8 +1975,6 @@ def _make_init(
|
|
|
2151
1975
|
elif has_cls_on_setattr and a.on_setattr is not setters.NO_OP:
|
|
2152
1976
|
needs_cached_setattr = True
|
|
2153
1977
|
|
|
2154
|
-
unique_filename = _generate_unique_filename(cls, "init")
|
|
2155
|
-
|
|
2156
1978
|
script, globs, annotations = _attrs_to_init_script(
|
|
2157
1979
|
filtered_attrs,
|
|
2158
1980
|
frozen,
|
|
@@ -2165,7 +1987,7 @@ def _make_init(
|
|
|
2165
1987
|
is_exc,
|
|
2166
1988
|
needs_cached_setattr,
|
|
2167
1989
|
has_cls_on_setattr,
|
|
2168
|
-
attrs_init,
|
|
1990
|
+
"__attrs_init__" if attrs_init else "__init__",
|
|
2169
1991
|
)
|
|
2170
1992
|
if cls.__module__ in sys.modules:
|
|
2171
1993
|
# This makes typing.get_type_hints(CLS.__init__) resolve string types.
|
|
@@ -2176,39 +1998,29 @@ def _make_init(
|
|
|
2176
1998
|
if needs_cached_setattr:
|
|
2177
1999
|
# Save the lookup overhead in __init__ if we need to circumvent
|
|
2178
2000
|
# setattr hooks.
|
|
2179
|
-
globs["_cached_setattr_get"] =
|
|
2001
|
+
globs["_cached_setattr_get"] = _OBJ_SETATTR.__get__
|
|
2180
2002
|
|
|
2181
|
-
|
|
2182
|
-
"__attrs_init__" if attrs_init else "__init__",
|
|
2183
|
-
script,
|
|
2184
|
-
unique_filename,
|
|
2185
|
-
globs,
|
|
2186
|
-
)
|
|
2187
|
-
init.__annotations__ = annotations
|
|
2188
|
-
|
|
2189
|
-
return init
|
|
2003
|
+
return script, globs, annotations
|
|
2190
2004
|
|
|
2191
2005
|
|
|
2192
|
-
def _setattr(attr_name, value_var, has_on_setattr):
|
|
2006
|
+
def _setattr(attr_name: str, value_var: str, has_on_setattr: bool) -> str:
|
|
2193
2007
|
"""
|
|
2194
2008
|
Use the cached object.setattr to set *attr_name* to *value_var*.
|
|
2195
2009
|
"""
|
|
2196
2010
|
return f"_setattr('{attr_name}', {value_var})"
|
|
2197
2011
|
|
|
2198
2012
|
|
|
2199
|
-
def _setattr_with_converter(
|
|
2013
|
+
def _setattr_with_converter(
|
|
2014
|
+
attr_name: str, value_var: str, has_on_setattr: bool, converter: Converter
|
|
2015
|
+
) -> str:
|
|
2200
2016
|
"""
|
|
2201
2017
|
Use the cached object.setattr to set *attr_name* to *value_var*, but run
|
|
2202
2018
|
its converter first.
|
|
2203
2019
|
"""
|
|
2204
|
-
return "_setattr('
|
|
2205
|
-
attr_name,
|
|
2206
|
-
_init_converter_pat % (attr_name,),
|
|
2207
|
-
value_var,
|
|
2208
|
-
)
|
|
2020
|
+
return f"_setattr('{attr_name}', {converter._fmt_converter_call(attr_name, value_var)})"
|
|
2209
2021
|
|
|
2210
2022
|
|
|
2211
|
-
def _assign(attr_name, value, has_on_setattr):
|
|
2023
|
+
def _assign(attr_name: str, value: str, has_on_setattr: bool) -> str:
|
|
2212
2024
|
"""
|
|
2213
2025
|
Unless *attr_name* has an on_setattr hook, use normal assignment. Otherwise
|
|
2214
2026
|
relegate to _setattr.
|
|
@@ -2219,90 +2031,100 @@ def _assign(attr_name, value, has_on_setattr):
|
|
|
2219
2031
|
return f"self.{attr_name} = {value}"
|
|
2220
2032
|
|
|
2221
2033
|
|
|
2222
|
-
def _assign_with_converter(
|
|
2034
|
+
def _assign_with_converter(
|
|
2035
|
+
attr_name: str, value_var: str, has_on_setattr: bool, converter: Converter
|
|
2036
|
+
) -> str:
|
|
2223
2037
|
"""
|
|
2224
2038
|
Unless *attr_name* has an on_setattr hook, use normal assignment after
|
|
2225
2039
|
conversion. Otherwise relegate to _setattr_with_converter.
|
|
2226
2040
|
"""
|
|
2227
2041
|
if has_on_setattr:
|
|
2228
|
-
return _setattr_with_converter(attr_name, value_var, True)
|
|
2042
|
+
return _setattr_with_converter(attr_name, value_var, True, converter)
|
|
2229
2043
|
|
|
2230
|
-
return "self
|
|
2231
|
-
attr_name,
|
|
2232
|
-
_init_converter_pat % (attr_name,),
|
|
2233
|
-
value_var,
|
|
2234
|
-
)
|
|
2044
|
+
return f"self.{attr_name} = {converter._fmt_converter_call(attr_name, value_var)}"
|
|
2235
2045
|
|
|
2236
2046
|
|
|
2237
|
-
def
|
|
2238
|
-
|
|
2239
|
-
frozen,
|
|
2240
|
-
slots,
|
|
2241
|
-
pre_init,
|
|
2242
|
-
pre_init_has_args,
|
|
2243
|
-
post_init,
|
|
2244
|
-
cache_hash,
|
|
2245
|
-
base_attr_map,
|
|
2246
|
-
is_exc,
|
|
2247
|
-
needs_cached_setattr,
|
|
2248
|
-
has_cls_on_setattr,
|
|
2249
|
-
attrs_init,
|
|
2047
|
+
def _determine_setters(
|
|
2048
|
+
frozen: bool, slots: bool, base_attr_map: dict[str, type]
|
|
2250
2049
|
):
|
|
2251
2050
|
"""
|
|
2252
|
-
|
|
2051
|
+
Determine the correct setter functions based on whether a class is frozen
|
|
2052
|
+
and/or slotted.
|
|
2053
|
+
"""
|
|
2054
|
+
if frozen is True:
|
|
2055
|
+
if slots is True:
|
|
2056
|
+
return (), _setattr, _setattr_with_converter
|
|
2057
|
+
|
|
2058
|
+
# Dict frozen classes assign directly to __dict__.
|
|
2059
|
+
# But only if the attribute doesn't come from an ancestor slot
|
|
2060
|
+
# class.
|
|
2061
|
+
# Note _inst_dict will be used again below if cache_hash is True
|
|
2062
|
+
|
|
2063
|
+
def fmt_setter(
|
|
2064
|
+
attr_name: str, value_var: str, has_on_setattr: bool
|
|
2065
|
+
) -> str:
|
|
2066
|
+
if _is_slot_attr(attr_name, base_attr_map):
|
|
2067
|
+
return _setattr(attr_name, value_var, has_on_setattr)
|
|
2068
|
+
|
|
2069
|
+
return f"_inst_dict['{attr_name}'] = {value_var}"
|
|
2070
|
+
|
|
2071
|
+
def fmt_setter_with_converter(
|
|
2072
|
+
attr_name: str,
|
|
2073
|
+
value_var: str,
|
|
2074
|
+
has_on_setattr: bool,
|
|
2075
|
+
converter: Converter,
|
|
2076
|
+
) -> str:
|
|
2077
|
+
if has_on_setattr or _is_slot_attr(attr_name, base_attr_map):
|
|
2078
|
+
return _setattr_with_converter(
|
|
2079
|
+
attr_name, value_var, has_on_setattr, converter
|
|
2080
|
+
)
|
|
2253
2081
|
|
|
2254
|
-
|
|
2082
|
+
return f"_inst_dict['{attr_name}'] = {converter._fmt_converter_call(attr_name, value_var)}"
|
|
2255
2083
|
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2084
|
+
return (
|
|
2085
|
+
("_inst_dict = self.__dict__",),
|
|
2086
|
+
fmt_setter,
|
|
2087
|
+
fmt_setter_with_converter,
|
|
2088
|
+
)
|
|
2089
|
+
|
|
2090
|
+
# Not frozen -- we can just assign directly.
|
|
2091
|
+
return (), _assign, _assign_with_converter
|
|
2092
|
+
|
|
2093
|
+
|
|
2094
|
+
def _attrs_to_init_script(
|
|
2095
|
+
attrs: list[Attribute],
|
|
2096
|
+
is_frozen: bool,
|
|
2097
|
+
is_slotted: bool,
|
|
2098
|
+
call_pre_init: bool,
|
|
2099
|
+
pre_init_has_args: bool,
|
|
2100
|
+
call_post_init: bool,
|
|
2101
|
+
does_cache_hash: bool,
|
|
2102
|
+
base_attr_map: dict[str, type],
|
|
2103
|
+
is_exc: bool,
|
|
2104
|
+
needs_cached_setattr: bool,
|
|
2105
|
+
has_cls_on_setattr: bool,
|
|
2106
|
+
method_name: str,
|
|
2107
|
+
) -> tuple[str, dict, dict]:
|
|
2108
|
+
"""
|
|
2109
|
+
Return a script of an initializer for *attrs*, a dict of globals, and
|
|
2110
|
+
annotations for the initializer.
|
|
2111
|
+
|
|
2112
|
+
The globals are required by the generated script.
|
|
2113
|
+
"""
|
|
2114
|
+
lines = ["self.__attrs_pre_init__()"] if call_pre_init else []
|
|
2262
2115
|
|
|
2263
2116
|
if needs_cached_setattr:
|
|
2264
2117
|
lines.append(
|
|
2265
2118
|
# Circumvent the __setattr__ descriptor to save one lookup per
|
|
2266
|
-
# assignment.
|
|
2267
|
-
#
|
|
2119
|
+
# assignment. Note _setattr will be used again below if
|
|
2120
|
+
# does_cache_hash is True.
|
|
2268
2121
|
"_setattr = _cached_setattr_get(self)"
|
|
2269
2122
|
)
|
|
2270
2123
|
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
else:
|
|
2276
|
-
# Dict frozen classes assign directly to __dict__.
|
|
2277
|
-
# But only if the attribute doesn't come from an ancestor slot
|
|
2278
|
-
# class.
|
|
2279
|
-
# Note _inst_dict will be used again below if cache_hash is True
|
|
2280
|
-
lines.append("_inst_dict = self.__dict__")
|
|
2281
|
-
|
|
2282
|
-
def fmt_setter(attr_name, value_var, has_on_setattr):
|
|
2283
|
-
if _is_slot_attr(attr_name, base_attr_map):
|
|
2284
|
-
return _setattr(attr_name, value_var, has_on_setattr)
|
|
2285
|
-
|
|
2286
|
-
return f"_inst_dict['{attr_name}'] = {value_var}"
|
|
2287
|
-
|
|
2288
|
-
def fmt_setter_with_converter(
|
|
2289
|
-
attr_name, value_var, has_on_setattr
|
|
2290
|
-
):
|
|
2291
|
-
if has_on_setattr or _is_slot_attr(attr_name, base_attr_map):
|
|
2292
|
-
return _setattr_with_converter(
|
|
2293
|
-
attr_name, value_var, has_on_setattr
|
|
2294
|
-
)
|
|
2295
|
-
|
|
2296
|
-
return "_inst_dict['%s'] = %s(%s)" % (
|
|
2297
|
-
attr_name,
|
|
2298
|
-
_init_converter_pat % (attr_name,),
|
|
2299
|
-
value_var,
|
|
2300
|
-
)
|
|
2301
|
-
|
|
2302
|
-
else:
|
|
2303
|
-
# Not frozen.
|
|
2304
|
-
fmt_setter = _assign
|
|
2305
|
-
fmt_setter_with_converter = _assign_with_converter
|
|
2124
|
+
extra_lines, fmt_setter, fmt_setter_with_converter = _determine_setters(
|
|
2125
|
+
is_frozen, is_slotted, base_attr_map
|
|
2126
|
+
)
|
|
2127
|
+
lines.extend(extra_lines)
|
|
2306
2128
|
|
|
2307
2129
|
args = []
|
|
2308
2130
|
kw_only_args = []
|
|
@@ -2328,19 +2150,26 @@ def _attrs_to_init_script(
|
|
|
2328
2150
|
has_factory = isinstance(a.default, Factory)
|
|
2329
2151
|
maybe_self = "self" if has_factory and a.default.takes_self else ""
|
|
2330
2152
|
|
|
2153
|
+
if a.converter is not None and not isinstance(a.converter, Converter):
|
|
2154
|
+
converter = Converter(a.converter)
|
|
2155
|
+
else:
|
|
2156
|
+
converter = a.converter
|
|
2157
|
+
|
|
2331
2158
|
if a.init is False:
|
|
2332
2159
|
if has_factory:
|
|
2333
|
-
init_factory_name =
|
|
2334
|
-
if
|
|
2160
|
+
init_factory_name = _INIT_FACTORY_PAT % (a.name,)
|
|
2161
|
+
if converter is not None:
|
|
2335
2162
|
lines.append(
|
|
2336
2163
|
fmt_setter_with_converter(
|
|
2337
2164
|
attr_name,
|
|
2338
2165
|
init_factory_name + f"({maybe_self})",
|
|
2339
2166
|
has_on_setattr,
|
|
2167
|
+
converter,
|
|
2340
2168
|
)
|
|
2341
2169
|
)
|
|
2342
|
-
|
|
2343
|
-
|
|
2170
|
+
names_for_globals[converter._get_global_name(a.name)] = (
|
|
2171
|
+
converter.converter
|
|
2172
|
+
)
|
|
2344
2173
|
else:
|
|
2345
2174
|
lines.append(
|
|
2346
2175
|
fmt_setter(
|
|
@@ -2350,16 +2179,18 @@ def _attrs_to_init_script(
|
|
|
2350
2179
|
)
|
|
2351
2180
|
)
|
|
2352
2181
|
names_for_globals[init_factory_name] = a.default.factory
|
|
2353
|
-
elif
|
|
2182
|
+
elif converter is not None:
|
|
2354
2183
|
lines.append(
|
|
2355
2184
|
fmt_setter_with_converter(
|
|
2356
2185
|
attr_name,
|
|
2357
2186
|
f"attr_dict['{attr_name}'].default",
|
|
2358
2187
|
has_on_setattr,
|
|
2188
|
+
converter,
|
|
2359
2189
|
)
|
|
2360
2190
|
)
|
|
2361
|
-
|
|
2362
|
-
|
|
2191
|
+
names_for_globals[converter._get_global_name(a.name)] = (
|
|
2192
|
+
converter.converter
|
|
2193
|
+
)
|
|
2363
2194
|
else:
|
|
2364
2195
|
lines.append(
|
|
2365
2196
|
fmt_setter(
|
|
@@ -2375,15 +2206,15 @@ def _attrs_to_init_script(
|
|
|
2375
2206
|
else:
|
|
2376
2207
|
args.append(arg)
|
|
2377
2208
|
|
|
2378
|
-
if
|
|
2209
|
+
if converter is not None:
|
|
2379
2210
|
lines.append(
|
|
2380
2211
|
fmt_setter_with_converter(
|
|
2381
|
-
attr_name, arg_name, has_on_setattr
|
|
2212
|
+
attr_name, arg_name, has_on_setattr, converter
|
|
2382
2213
|
)
|
|
2383
2214
|
)
|
|
2384
|
-
names_for_globals[
|
|
2385
|
-
|
|
2386
|
-
|
|
2215
|
+
names_for_globals[converter._get_global_name(a.name)] = (
|
|
2216
|
+
converter.converter
|
|
2217
|
+
)
|
|
2387
2218
|
else:
|
|
2388
2219
|
lines.append(fmt_setter(attr_name, arg_name, has_on_setattr))
|
|
2389
2220
|
|
|
@@ -2395,12 +2226,12 @@ def _attrs_to_init_script(
|
|
|
2395
2226
|
args.append(arg)
|
|
2396
2227
|
lines.append(f"if {arg_name} is not NOTHING:")
|
|
2397
2228
|
|
|
2398
|
-
init_factory_name =
|
|
2399
|
-
if
|
|
2229
|
+
init_factory_name = _INIT_FACTORY_PAT % (a.name,)
|
|
2230
|
+
if converter is not None:
|
|
2400
2231
|
lines.append(
|
|
2401
2232
|
" "
|
|
2402
2233
|
+ fmt_setter_with_converter(
|
|
2403
|
-
attr_name, arg_name, has_on_setattr
|
|
2234
|
+
attr_name, arg_name, has_on_setattr, converter
|
|
2404
2235
|
)
|
|
2405
2236
|
)
|
|
2406
2237
|
lines.append("else:")
|
|
@@ -2410,11 +2241,12 @@ def _attrs_to_init_script(
|
|
|
2410
2241
|
attr_name,
|
|
2411
2242
|
init_factory_name + "(" + maybe_self + ")",
|
|
2412
2243
|
has_on_setattr,
|
|
2244
|
+
converter,
|
|
2413
2245
|
)
|
|
2414
2246
|
)
|
|
2415
|
-
names_for_globals[
|
|
2416
|
-
|
|
2417
|
-
|
|
2247
|
+
names_for_globals[converter._get_global_name(a.name)] = (
|
|
2248
|
+
converter.converter
|
|
2249
|
+
)
|
|
2418
2250
|
else:
|
|
2419
2251
|
lines.append(
|
|
2420
2252
|
" " + fmt_setter(attr_name, arg_name, has_on_setattr)
|
|
@@ -2435,26 +2267,24 @@ def _attrs_to_init_script(
|
|
|
2435
2267
|
else:
|
|
2436
2268
|
args.append(arg_name)
|
|
2437
2269
|
|
|
2438
|
-
if
|
|
2270
|
+
if converter is not None:
|
|
2439
2271
|
lines.append(
|
|
2440
2272
|
fmt_setter_with_converter(
|
|
2441
|
-
attr_name, arg_name, has_on_setattr
|
|
2273
|
+
attr_name, arg_name, has_on_setattr, converter
|
|
2442
2274
|
)
|
|
2443
2275
|
)
|
|
2444
|
-
names_for_globals[
|
|
2445
|
-
|
|
2446
|
-
|
|
2276
|
+
names_for_globals[converter._get_global_name(a.name)] = (
|
|
2277
|
+
converter.converter
|
|
2278
|
+
)
|
|
2447
2279
|
else:
|
|
2448
2280
|
lines.append(fmt_setter(attr_name, arg_name, has_on_setattr))
|
|
2449
2281
|
|
|
2450
2282
|
if a.init is True:
|
|
2451
|
-
if a.type is not None and
|
|
2283
|
+
if a.type is not None and converter is None:
|
|
2452
2284
|
annotations[arg_name] = a.type
|
|
2453
|
-
elif
|
|
2454
|
-
#
|
|
2455
|
-
|
|
2456
|
-
if t:
|
|
2457
|
-
annotations[arg_name] = t
|
|
2285
|
+
elif converter is not None and converter._first_param_type:
|
|
2286
|
+
# Use the type from the converter if present.
|
|
2287
|
+
annotations[arg_name] = converter._first_param_type
|
|
2458
2288
|
|
|
2459
2289
|
if attrs_to_validate: # we can skip this if there are no validators.
|
|
2460
2290
|
names_for_globals["_config"] = _config
|
|
@@ -2466,25 +2296,23 @@ def _attrs_to_init_script(
|
|
|
2466
2296
|
names_for_globals[val_name] = a.validator
|
|
2467
2297
|
names_for_globals[attr_name] = a
|
|
2468
2298
|
|
|
2469
|
-
if
|
|
2299
|
+
if call_post_init:
|
|
2470
2300
|
lines.append("self.__attrs_post_init__()")
|
|
2471
2301
|
|
|
2472
|
-
#
|
|
2302
|
+
# Because this is set only after __attrs_post_init__ is called, a crash
|
|
2473
2303
|
# will result if post-init tries to access the hash code. This seemed
|
|
2474
|
-
# preferable to setting this beforehand, in which case alteration to
|
|
2475
|
-
#
|
|
2476
|
-
#
|
|
2477
|
-
if
|
|
2478
|
-
if
|
|
2479
|
-
if
|
|
2480
|
-
|
|
2481
|
-
init_hash_cache = "_setattr('%s', %s)"
|
|
2304
|
+
# preferable to setting this beforehand, in which case alteration to field
|
|
2305
|
+
# values during post-init combined with post-init accessing the hash code
|
|
2306
|
+
# would result in silent bugs.
|
|
2307
|
+
if does_cache_hash:
|
|
2308
|
+
if is_frozen:
|
|
2309
|
+
if is_slotted:
|
|
2310
|
+
init_hash_cache = f"_setattr('{_HASH_CACHE_FIELD}', None)"
|
|
2482
2311
|
else:
|
|
2483
|
-
|
|
2484
|
-
init_hash_cache = "_inst_dict['%s'] = %s"
|
|
2312
|
+
init_hash_cache = f"_inst_dict['{_HASH_CACHE_FIELD}'] = None"
|
|
2485
2313
|
else:
|
|
2486
|
-
init_hash_cache = "self
|
|
2487
|
-
lines.append(init_hash_cache
|
|
2314
|
+
init_hash_cache = f"self.{_HASH_CACHE_FIELD} = None"
|
|
2315
|
+
lines.append(init_hash_cache)
|
|
2488
2316
|
|
|
2489
2317
|
# For exceptions we rely on BaseException.__init__ for proper
|
|
2490
2318
|
# initialization.
|
|
@@ -2496,29 +2324,28 @@ def _attrs_to_init_script(
|
|
|
2496
2324
|
args = ", ".join(args)
|
|
2497
2325
|
pre_init_args = args
|
|
2498
2326
|
if kw_only_args:
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
", ".join(kw_only_args), # kw_only args
|
|
2502
|
-
)
|
|
2327
|
+
# leading comma & kw_only args
|
|
2328
|
+
args += f"{', ' if args else ''}*, {', '.join(kw_only_args)}"
|
|
2503
2329
|
pre_init_kw_only_args = ", ".join(
|
|
2504
|
-
[
|
|
2330
|
+
[
|
|
2331
|
+
f"{kw_arg_name}={kw_arg_name}"
|
|
2332
|
+
# We need to remove the defaults from the kw_only_args.
|
|
2333
|
+
for kw_arg_name in (kwa.split("=")[0] for kwa in kw_only_args)
|
|
2334
|
+
]
|
|
2505
2335
|
)
|
|
2506
|
-
pre_init_args +=
|
|
2507
|
-
", " if pre_init_args else ""
|
|
2508
|
-
) # handle only kwargs and no regular args
|
|
2336
|
+
pre_init_args += ", " if pre_init_args else ""
|
|
2509
2337
|
pre_init_args += pre_init_kw_only_args
|
|
2510
2338
|
|
|
2511
|
-
if
|
|
2512
|
-
# If pre init method has arguments, pass same arguments as `__init__
|
|
2513
|
-
lines[0] = "self.__attrs_pre_init__(
|
|
2339
|
+
if call_pre_init and pre_init_has_args:
|
|
2340
|
+
# If pre init method has arguments, pass same arguments as `__init__`.
|
|
2341
|
+
lines[0] = f"self.__attrs_pre_init__({pre_init_args})"
|
|
2514
2342
|
|
|
2343
|
+
# Python <3.12 doesn't allow backslashes in f-strings.
|
|
2344
|
+
NL = "\n "
|
|
2515
2345
|
return (
|
|
2516
|
-
"def
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
args,
|
|
2520
|
-
"\n ".join(lines) if lines else "pass",
|
|
2521
|
-
),
|
|
2346
|
+
f"""def {method_name}(self, {args}):
|
|
2347
|
+
{NL.join(lines) if lines else "pass"}
|
|
2348
|
+
""",
|
|
2522
2349
|
names_for_globals,
|
|
2523
2350
|
annotations,
|
|
2524
2351
|
)
|
|
@@ -2543,20 +2370,19 @@ class Attribute:
|
|
|
2543
2370
|
|
|
2544
2371
|
You should never instantiate this class yourself.
|
|
2545
2372
|
|
|
2546
|
-
The class has *all* arguments of `attr.ib` (except for ``factory``
|
|
2547
|
-
|
|
2548
|
-
following:
|
|
2373
|
+
The class has *all* arguments of `attr.ib` (except for ``factory`` which is
|
|
2374
|
+
only syntactic sugar for ``default=Factory(...)`` plus the following:
|
|
2549
2375
|
|
|
2550
2376
|
- ``name`` (`str`): The name of the attribute.
|
|
2551
2377
|
- ``alias`` (`str`): The __init__ parameter name of the attribute, after
|
|
2552
2378
|
any explicit overrides and default private-attribute-name handling.
|
|
2553
2379
|
- ``inherited`` (`bool`): Whether or not that attribute has been inherited
|
|
2554
2380
|
from a base class.
|
|
2555
|
-
- ``eq_key`` and ``order_key`` (`typing.Callable` or `None`): The
|
|
2556
|
-
that are used for comparing and ordering objects by this
|
|
2557
|
-
respectively. These are set by passing a callable to
|
|
2558
|
-
``order``, or ``cmp`` arguments. See also
|
|
2559
|
-
<custom-comparison>`.
|
|
2381
|
+
- ``eq_key`` and ``order_key`` (`typing.Callable` or `None`): The
|
|
2382
|
+
callables that are used for comparing and ordering objects by this
|
|
2383
|
+
attribute, respectively. These are set by passing a callable to
|
|
2384
|
+
`attr.ib`'s ``eq``, ``order``, or ``cmp`` arguments. See also
|
|
2385
|
+
:ref:`comparison customization <custom-comparison>`.
|
|
2560
2386
|
|
|
2561
2387
|
Instances of this class are frequently used for introspection purposes
|
|
2562
2388
|
like:
|
|
@@ -2579,7 +2405,9 @@ class Attribute:
|
|
|
2579
2405
|
For the full version history of the fields, see `attr.ib`.
|
|
2580
2406
|
"""
|
|
2581
2407
|
|
|
2582
|
-
|
|
2408
|
+
# These slots must NOT be reordered because we use them later for
|
|
2409
|
+
# instantiation.
|
|
2410
|
+
__slots__ = ( # noqa: RUF023
|
|
2583
2411
|
"name",
|
|
2584
2412
|
"default",
|
|
2585
2413
|
"validator",
|
|
@@ -2625,7 +2453,7 @@ class Attribute:
|
|
|
2625
2453
|
)
|
|
2626
2454
|
|
|
2627
2455
|
# Cache this descriptor here to speed things up later.
|
|
2628
|
-
bound_setattr =
|
|
2456
|
+
bound_setattr = _OBJ_SETATTR.__get__(self)
|
|
2629
2457
|
|
|
2630
2458
|
# Despite the big red warning, people *do* instantiate `Attribute`
|
|
2631
2459
|
# themselves.
|
|
@@ -2645,7 +2473,7 @@ class Attribute:
|
|
|
2645
2473
|
(
|
|
2646
2474
|
types.MappingProxyType(dict(metadata)) # Shallow copy
|
|
2647
2475
|
if metadata
|
|
2648
|
-
else
|
|
2476
|
+
else _EMPTY_METADATA_SINGLETON
|
|
2649
2477
|
),
|
|
2650
2478
|
)
|
|
2651
2479
|
bound_setattr("type", type)
|
|
@@ -2655,36 +2483,35 @@ class Attribute:
|
|
|
2655
2483
|
bound_setattr("alias", alias)
|
|
2656
2484
|
|
|
2657
2485
|
def __setattr__(self, name, value):
|
|
2658
|
-
raise FrozenInstanceError
|
|
2486
|
+
raise FrozenInstanceError
|
|
2659
2487
|
|
|
2660
2488
|
@classmethod
|
|
2661
|
-
def from_counting_attr(cls, name, ca, type=None):
|
|
2489
|
+
def from_counting_attr(cls, name: str, ca: _CountingAttr, type=None):
|
|
2662
2490
|
# type holds the annotated value. deal with conflicts:
|
|
2663
2491
|
if type is None:
|
|
2664
2492
|
type = ca.type
|
|
2665
2493
|
elif ca.type is not None:
|
|
2666
|
-
msg = "Type annotation and type argument cannot both be present"
|
|
2494
|
+
msg = f"Type annotation and type argument cannot both be present for '{name}'."
|
|
2667
2495
|
raise ValueError(msg)
|
|
2668
|
-
inst_dict = {
|
|
2669
|
-
k: getattr(ca, k)
|
|
2670
|
-
for k in Attribute.__slots__
|
|
2671
|
-
if k
|
|
2672
|
-
not in (
|
|
2673
|
-
"name",
|
|
2674
|
-
"validator",
|
|
2675
|
-
"default",
|
|
2676
|
-
"type",
|
|
2677
|
-
"inherited",
|
|
2678
|
-
) # exclude methods and deprecated alias
|
|
2679
|
-
}
|
|
2680
2496
|
return cls(
|
|
2681
|
-
name
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2497
|
+
name,
|
|
2498
|
+
ca._default,
|
|
2499
|
+
ca._validator,
|
|
2500
|
+
ca.repr,
|
|
2501
|
+
None,
|
|
2502
|
+
ca.hash,
|
|
2503
|
+
ca.init,
|
|
2504
|
+
False,
|
|
2505
|
+
ca.metadata,
|
|
2506
|
+
type,
|
|
2507
|
+
ca.converter,
|
|
2508
|
+
ca.kw_only,
|
|
2509
|
+
ca.eq,
|
|
2510
|
+
ca.eq_key,
|
|
2511
|
+
ca.order,
|
|
2512
|
+
ca.order_key,
|
|
2513
|
+
ca.on_setattr,
|
|
2514
|
+
ca.alias,
|
|
2688
2515
|
)
|
|
2689
2516
|
|
|
2690
2517
|
# Don't use attrs.evolve since fields(Attribute) doesn't work
|
|
@@ -2693,7 +2520,7 @@ class Attribute:
|
|
|
2693
2520
|
Copy *self* and apply *changes*.
|
|
2694
2521
|
|
|
2695
2522
|
This works similarly to `attrs.evolve` but that function does not work
|
|
2696
|
-
with
|
|
2523
|
+
with :class:`attrs.Attribute`.
|
|
2697
2524
|
|
|
2698
2525
|
It is mainly meant to be used for `transform-fields`.
|
|
2699
2526
|
|
|
@@ -2722,16 +2549,18 @@ class Attribute:
|
|
|
2722
2549
|
self._setattrs(zip(self.__slots__, state))
|
|
2723
2550
|
|
|
2724
2551
|
def _setattrs(self, name_values_pairs):
|
|
2725
|
-
bound_setattr =
|
|
2552
|
+
bound_setattr = _OBJ_SETATTR.__get__(self)
|
|
2726
2553
|
for name, value in name_values_pairs:
|
|
2727
2554
|
if name != "metadata":
|
|
2728
2555
|
bound_setattr(name, value)
|
|
2729
2556
|
else:
|
|
2730
2557
|
bound_setattr(
|
|
2731
2558
|
name,
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2559
|
+
(
|
|
2560
|
+
types.MappingProxyType(dict(value))
|
|
2561
|
+
if value
|
|
2562
|
+
else _EMPTY_METADATA_SINGLETON
|
|
2563
|
+
),
|
|
2735
2564
|
)
|
|
2736
2565
|
|
|
2737
2566
|
|
|
@@ -2771,22 +2600,22 @@ class _CountingAttr:
|
|
|
2771
2600
|
"""
|
|
2772
2601
|
|
|
2773
2602
|
__slots__ = (
|
|
2774
|
-
"counter",
|
|
2775
2603
|
"_default",
|
|
2776
|
-
"
|
|
2604
|
+
"_validator",
|
|
2605
|
+
"alias",
|
|
2606
|
+
"converter",
|
|
2607
|
+
"counter",
|
|
2777
2608
|
"eq",
|
|
2778
2609
|
"eq_key",
|
|
2779
|
-
"order",
|
|
2780
|
-
"order_key",
|
|
2781
2610
|
"hash",
|
|
2782
2611
|
"init",
|
|
2783
|
-
"metadata",
|
|
2784
|
-
"_validator",
|
|
2785
|
-
"converter",
|
|
2786
|
-
"type",
|
|
2787
2612
|
"kw_only",
|
|
2613
|
+
"metadata",
|
|
2788
2614
|
"on_setattr",
|
|
2789
|
-
"
|
|
2615
|
+
"order",
|
|
2616
|
+
"order_key",
|
|
2617
|
+
"repr",
|
|
2618
|
+
"type",
|
|
2790
2619
|
)
|
|
2791
2620
|
__attrs_attrs__ = (
|
|
2792
2621
|
*tuple(
|
|
@@ -2896,12 +2725,13 @@ class _CountingAttr:
|
|
|
2896
2725
|
|
|
2897
2726
|
Returns *meth* unchanged.
|
|
2898
2727
|
|
|
2899
|
-
:
|
|
2728
|
+
Raises:
|
|
2729
|
+
DefaultAlreadySetError: If default has been set before.
|
|
2900
2730
|
|
|
2901
2731
|
.. versionadded:: 17.1.0
|
|
2902
2732
|
"""
|
|
2903
2733
|
if self._default is not NOTHING:
|
|
2904
|
-
raise DefaultAlreadySetError
|
|
2734
|
+
raise DefaultAlreadySetError
|
|
2905
2735
|
|
|
2906
2736
|
self._default = Factory(meth, takes_self=True)
|
|
2907
2737
|
|
|
@@ -2918,10 +2748,14 @@ class Factory:
|
|
|
2918
2748
|
If passed as the default value to `attrs.field`, the factory is used to
|
|
2919
2749
|
generate a new value.
|
|
2920
2750
|
|
|
2921
|
-
:
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2751
|
+
Args:
|
|
2752
|
+
factory (typing.Callable):
|
|
2753
|
+
A callable that takes either none or exactly one mandatory
|
|
2754
|
+
positional argument depending on *takes_self*.
|
|
2755
|
+
|
|
2756
|
+
takes_self (bool):
|
|
2757
|
+
Pass the partially initialized instance that is being initialized
|
|
2758
|
+
as a positional argument.
|
|
2925
2759
|
|
|
2926
2760
|
.. versionadded:: 17.1.0 *takes_self*
|
|
2927
2761
|
"""
|
|
@@ -2965,35 +2799,177 @@ _f = [
|
|
|
2965
2799
|
Factory = _add_hash(_add_eq(_add_repr(Factory, attrs=_f), attrs=_f), attrs=_f)
|
|
2966
2800
|
|
|
2967
2801
|
|
|
2802
|
+
class Converter:
|
|
2803
|
+
"""
|
|
2804
|
+
Stores a converter callable.
|
|
2805
|
+
|
|
2806
|
+
Allows for the wrapped converter to take additional arguments. The
|
|
2807
|
+
arguments are passed in the order they are documented.
|
|
2808
|
+
|
|
2809
|
+
Args:
|
|
2810
|
+
converter (Callable): A callable that converts the passed value.
|
|
2811
|
+
|
|
2812
|
+
takes_self (bool):
|
|
2813
|
+
Pass the partially initialized instance that is being initialized
|
|
2814
|
+
as a positional argument. (default: `False`)
|
|
2815
|
+
|
|
2816
|
+
takes_field (bool):
|
|
2817
|
+
Pass the field definition (an :class:`Attribute`) into the
|
|
2818
|
+
converter as a positional argument. (default: `False`)
|
|
2819
|
+
|
|
2820
|
+
.. versionadded:: 24.1.0
|
|
2821
|
+
"""
|
|
2822
|
+
|
|
2823
|
+
__slots__ = (
|
|
2824
|
+
"__call__",
|
|
2825
|
+
"_first_param_type",
|
|
2826
|
+
"_global_name",
|
|
2827
|
+
"converter",
|
|
2828
|
+
"takes_field",
|
|
2829
|
+
"takes_self",
|
|
2830
|
+
)
|
|
2831
|
+
|
|
2832
|
+
def __init__(self, converter, *, takes_self=False, takes_field=False):
|
|
2833
|
+
self.converter = converter
|
|
2834
|
+
self.takes_self = takes_self
|
|
2835
|
+
self.takes_field = takes_field
|
|
2836
|
+
|
|
2837
|
+
ex = _AnnotationExtractor(converter)
|
|
2838
|
+
self._first_param_type = ex.get_first_param_type()
|
|
2839
|
+
|
|
2840
|
+
if not (self.takes_self or self.takes_field):
|
|
2841
|
+
self.__call__ = lambda value, _, __: self.converter(value)
|
|
2842
|
+
elif self.takes_self and not self.takes_field:
|
|
2843
|
+
self.__call__ = lambda value, instance, __: self.converter(
|
|
2844
|
+
value, instance
|
|
2845
|
+
)
|
|
2846
|
+
elif not self.takes_self and self.takes_field:
|
|
2847
|
+
self.__call__ = lambda value, __, field: self.converter(
|
|
2848
|
+
value, field
|
|
2849
|
+
)
|
|
2850
|
+
else:
|
|
2851
|
+
self.__call__ = lambda value, instance, field: self.converter(
|
|
2852
|
+
value, instance, field
|
|
2853
|
+
)
|
|
2854
|
+
|
|
2855
|
+
rt = ex.get_return_type()
|
|
2856
|
+
if rt is not None:
|
|
2857
|
+
self.__call__.__annotations__["return"] = rt
|
|
2858
|
+
|
|
2859
|
+
@staticmethod
|
|
2860
|
+
def _get_global_name(attr_name: str) -> str:
|
|
2861
|
+
"""
|
|
2862
|
+
Return the name that a converter for an attribute name *attr_name*
|
|
2863
|
+
would have.
|
|
2864
|
+
"""
|
|
2865
|
+
return f"__attr_converter_{attr_name}"
|
|
2866
|
+
|
|
2867
|
+
def _fmt_converter_call(self, attr_name: str, value_var: str) -> str:
|
|
2868
|
+
"""
|
|
2869
|
+
Return a string that calls the converter for an attribute name
|
|
2870
|
+
*attr_name* and the value in variable named *value_var* according to
|
|
2871
|
+
`self.takes_self` and `self.takes_field`.
|
|
2872
|
+
"""
|
|
2873
|
+
if not (self.takes_self or self.takes_field):
|
|
2874
|
+
return f"{self._get_global_name(attr_name)}({value_var})"
|
|
2875
|
+
|
|
2876
|
+
if self.takes_self and self.takes_field:
|
|
2877
|
+
return f"{self._get_global_name(attr_name)}({value_var}, self, attr_dict['{attr_name}'])"
|
|
2878
|
+
|
|
2879
|
+
if self.takes_self:
|
|
2880
|
+
return f"{self._get_global_name(attr_name)}({value_var}, self)"
|
|
2881
|
+
|
|
2882
|
+
return f"{self._get_global_name(attr_name)}({value_var}, attr_dict['{attr_name}'])"
|
|
2883
|
+
|
|
2884
|
+
def __getstate__(self):
|
|
2885
|
+
"""
|
|
2886
|
+
Return a dict containing only converter and takes_self -- the rest gets
|
|
2887
|
+
computed when loading.
|
|
2888
|
+
"""
|
|
2889
|
+
return {
|
|
2890
|
+
"converter": self.converter,
|
|
2891
|
+
"takes_self": self.takes_self,
|
|
2892
|
+
"takes_field": self.takes_field,
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
def __setstate__(self, state):
|
|
2896
|
+
"""
|
|
2897
|
+
Load instance from state.
|
|
2898
|
+
"""
|
|
2899
|
+
self.__init__(**state)
|
|
2900
|
+
|
|
2901
|
+
|
|
2902
|
+
_f = [
|
|
2903
|
+
Attribute(
|
|
2904
|
+
name=name,
|
|
2905
|
+
default=NOTHING,
|
|
2906
|
+
validator=None,
|
|
2907
|
+
repr=True,
|
|
2908
|
+
cmp=None,
|
|
2909
|
+
eq=True,
|
|
2910
|
+
order=False,
|
|
2911
|
+
hash=True,
|
|
2912
|
+
init=True,
|
|
2913
|
+
inherited=False,
|
|
2914
|
+
)
|
|
2915
|
+
for name in ("converter", "takes_self", "takes_field")
|
|
2916
|
+
]
|
|
2917
|
+
|
|
2918
|
+
Converter = _add_hash(
|
|
2919
|
+
_add_eq(_add_repr(Converter, attrs=_f), attrs=_f), attrs=_f
|
|
2920
|
+
)
|
|
2921
|
+
|
|
2922
|
+
|
|
2968
2923
|
def make_class(
|
|
2969
2924
|
name, attrs, bases=(object,), class_body=None, **attributes_arguments
|
|
2970
2925
|
):
|
|
2971
2926
|
r"""
|
|
2972
2927
|
A quick way to create a new class called *name* with *attrs*.
|
|
2973
2928
|
|
|
2974
|
-
|
|
2929
|
+
.. note::
|
|
2930
|
+
|
|
2931
|
+
``make_class()`` is a thin wrapper around `attr.s`, not `attrs.define`
|
|
2932
|
+
which means that it doesn't come with some of the improved defaults.
|
|
2933
|
+
|
|
2934
|
+
For example, if you want the same ``on_setattr`` behavior as in
|
|
2935
|
+
`attrs.define`, you have to pass the hooks yourself: ``make_class(...,
|
|
2936
|
+
on_setattr=setters.pipe(setters.convert, setters.validate)``
|
|
2975
2937
|
|
|
2976
|
-
|
|
2977
|
-
|
|
2938
|
+
.. warning::
|
|
2939
|
+
|
|
2940
|
+
It is *your* duty to ensure that the class name and the attribute names
|
|
2941
|
+
are valid identifiers. ``make_class()`` will *not* validate them for
|
|
2942
|
+
you.
|
|
2943
|
+
|
|
2944
|
+
Args:
|
|
2945
|
+
name (str): The name for the new class.
|
|
2978
2946
|
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
:type attrs: `list` or `dict`
|
|
2947
|
+
attrs (list | dict):
|
|
2948
|
+
A list of names or a dictionary of mappings of names to `attr.ib`\
|
|
2949
|
+
s / `attrs.field`\ s.
|
|
2983
2950
|
|
|
2984
|
-
|
|
2951
|
+
The order is deduced from the order of the names or attributes
|
|
2952
|
+
inside *attrs*. Otherwise the order of the definition of the
|
|
2953
|
+
attributes is used.
|
|
2985
2954
|
|
|
2986
|
-
|
|
2955
|
+
bases (tuple[type, ...]): Classes that the new class will subclass.
|
|
2987
2956
|
|
|
2988
|
-
|
|
2957
|
+
class_body (dict):
|
|
2958
|
+
An optional dictionary of class attributes for the new class.
|
|
2989
2959
|
|
|
2990
|
-
|
|
2991
|
-
|
|
2960
|
+
attributes_arguments: Passed unmodified to `attr.s`.
|
|
2961
|
+
|
|
2962
|
+
Returns:
|
|
2963
|
+
type: A new class with *attrs*.
|
|
2992
2964
|
|
|
2993
2965
|
.. versionadded:: 17.1.0 *bases*
|
|
2994
2966
|
.. versionchanged:: 18.1.0 If *attrs* is ordered, the order is retained.
|
|
2995
2967
|
.. versionchanged:: 23.2.0 *class_body*
|
|
2968
|
+
.. versionchanged:: 25.2.0 Class names can now be unicode.
|
|
2996
2969
|
"""
|
|
2970
|
+
# Class identifiers are converted into the normal form NFKC while parsing
|
|
2971
|
+
name = unicodedata.normalize("NFKC", name)
|
|
2972
|
+
|
|
2997
2973
|
if isinstance(attrs, dict):
|
|
2998
2974
|
cls_dict = attrs
|
|
2999
2975
|
elif isinstance(attrs, (list, tuple)):
|
|
@@ -3039,14 +3015,19 @@ def make_class(
|
|
|
3039
3015
|
True,
|
|
3040
3016
|
)
|
|
3041
3017
|
|
|
3042
|
-
|
|
3018
|
+
cls = _attrs(these=cls_dict, **attributes_arguments)(type_)
|
|
3019
|
+
# Only add type annotations now or "_attrs()" will complain:
|
|
3020
|
+
cls.__annotations__ = {
|
|
3021
|
+
k: v.type for k, v in cls_dict.items() if v.type is not None
|
|
3022
|
+
}
|
|
3023
|
+
return cls
|
|
3043
3024
|
|
|
3044
3025
|
|
|
3045
3026
|
# These are required by within this module so we define them here and merely
|
|
3046
3027
|
# import into .validators / .converters.
|
|
3047
3028
|
|
|
3048
3029
|
|
|
3049
|
-
@attrs(slots=True,
|
|
3030
|
+
@attrs(slots=True, unsafe_hash=True)
|
|
3050
3031
|
class _AndValidator:
|
|
3051
3032
|
"""
|
|
3052
3033
|
Compose many validators to a single one.
|
|
@@ -3065,7 +3046,9 @@ def and_(*validators):
|
|
|
3065
3046
|
|
|
3066
3047
|
When called on a value, it runs all wrapped validators.
|
|
3067
3048
|
|
|
3068
|
-
:
|
|
3049
|
+
Args:
|
|
3050
|
+
validators (~collections.abc.Iterable[typing.Callable]):
|
|
3051
|
+
Arbitrary number of validators.
|
|
3069
3052
|
|
|
3070
3053
|
.. versionadded:: 17.1.0
|
|
3071
3054
|
"""
|
|
@@ -3087,33 +3070,54 @@ def pipe(*converters):
|
|
|
3087
3070
|
When called on a value, it runs all wrapped converters, returning the
|
|
3088
3071
|
*last* value.
|
|
3089
3072
|
|
|
3090
|
-
Type annotations will be inferred from the wrapped converters', if
|
|
3091
|
-
|
|
3073
|
+
Type annotations will be inferred from the wrapped converters', if they
|
|
3074
|
+
have any.
|
|
3092
3075
|
|
|
3093
|
-
|
|
3076
|
+
converters (~collections.abc.Iterable[typing.Callable]):
|
|
3077
|
+
Arbitrary number of converters.
|
|
3094
3078
|
|
|
3095
3079
|
.. versionadded:: 20.1.0
|
|
3096
3080
|
"""
|
|
3097
3081
|
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3082
|
+
return_instance = any(isinstance(c, Converter) for c in converters)
|
|
3083
|
+
|
|
3084
|
+
if return_instance:
|
|
3085
|
+
|
|
3086
|
+
def pipe_converter(val, inst, field):
|
|
3087
|
+
for c in converters:
|
|
3088
|
+
val = (
|
|
3089
|
+
c(val, inst, field) if isinstance(c, Converter) else c(val)
|
|
3090
|
+
)
|
|
3091
|
+
|
|
3092
|
+
return val
|
|
3093
|
+
|
|
3094
|
+
else:
|
|
3101
3095
|
|
|
3102
|
-
|
|
3096
|
+
def pipe_converter(val):
|
|
3097
|
+
for c in converters:
|
|
3098
|
+
val = c(val)
|
|
3099
|
+
|
|
3100
|
+
return val
|
|
3103
3101
|
|
|
3104
3102
|
if not converters:
|
|
3105
3103
|
# If the converter list is empty, pipe_converter is the identity.
|
|
3106
|
-
A =
|
|
3107
|
-
pipe_converter.__annotations__
|
|
3104
|
+
A = TypeVar("A")
|
|
3105
|
+
pipe_converter.__annotations__.update({"val": A, "return": A})
|
|
3108
3106
|
else:
|
|
3109
3107
|
# Get parameter type from first converter.
|
|
3110
3108
|
t = _AnnotationExtractor(converters[0]).get_first_param_type()
|
|
3111
3109
|
if t:
|
|
3112
3110
|
pipe_converter.__annotations__["val"] = t
|
|
3113
3111
|
|
|
3112
|
+
last = converters[-1]
|
|
3113
|
+
if not PY_3_11_PLUS and isinstance(last, Converter):
|
|
3114
|
+
last = last.__call__
|
|
3115
|
+
|
|
3114
3116
|
# Get return type from last converter.
|
|
3115
|
-
rt = _AnnotationExtractor(
|
|
3117
|
+
rt = _AnnotationExtractor(last).get_return_type()
|
|
3116
3118
|
if rt:
|
|
3117
3119
|
pipe_converter.__annotations__["return"] = rt
|
|
3118
3120
|
|
|
3121
|
+
if return_instance:
|
|
3122
|
+
return Converter(pipe_converter, takes_self=True, takes_field=True)
|
|
3119
3123
|
return pipe_converter
|