worktoy 1.2.0.dev0__tar.gz → 1.2.0rc0__tar.gz
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.
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/PKG-INFO +2 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/README.md +1 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/pyproject.toml +1 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/__init__.py +1 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/_object.py +9 -7
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/control_flow/__init__.py +3 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/control_flow/_control_space.py +9 -4
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/desc/__init__.py +6 -3
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/desc/_attri_box.py +55 -4
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/desc/_base_descriptor.py +1 -3
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/desc/_field.py +0 -9
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/dispatch/_dispatcher.py +16 -10
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/dispatch/_overload.py +0 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/ezdata/_ez_field.py +8 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/ezdata/_ez_hook.py +20 -11
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/ezdata/_ez_meta.py +4 -4
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/ezdata/_ez_space.py +1 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/__init__.py +6 -4
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_kee_box.py +13 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_kee_flag.py +32 -22
- worktoy-1.2.0rc0/src/worktoy/keenum/_kee_flags.py +368 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_kee_flags_hook.py +11 -10
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_kee_flags_meta.py +203 -115
- worktoy-1.2.0rc0/src/worktoy/keenum/_kee_flags_space.py +163 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_kee_member.py +61 -10
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_kee_meta.py +52 -46
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_kee_num.py +73 -5
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_kee_space.py +37 -17
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_kee_space_hook.py +1 -5
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/_abstract_metaclass.py +6 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/_abstract_namespace.py +3 -3
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/space_hooks/_abstract_space_hook.py +1 -5
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_bipartite_matching.py +0 -8
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_class_body_template.py +16 -9
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_join_words.py +11 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_resolve_mro.py +13 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_string_list.py +11 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_text_fmt.py +23 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_type_cast.py +47 -12
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_unpack.py +11 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_word_wrap.py +18 -4
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/combinatorics/_arrangement.py +0 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/combinatorics/_arrangements.py +0 -3
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/__init__.py +23 -1
- worktoy-1.2.0rc0/src/worktoy/waitaminute/_alternative_warning.py +61 -0
- worktoy-1.2.0rc0/src/worktoy/waitaminute/_deprecated_promise.py +64 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/_missing_variable.py +2 -1
- worktoy-1.2.0rc0/src/worktoy/waitaminute/_redundant_keyword.py +64 -0
- worktoy-1.2.0rc0/src/worktoy/waitaminute/_risk_warning.py +63 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/_subclass_exception.py +2 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/_type_exception.py +5 -7
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/_unpack_exception.py +1 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/_variable_not_none.py +2 -2
- worktoy-1.2.0rc0/src/worktoy/waitaminute/_work_toy_exception.py +51 -0
- worktoy-1.2.0rc0/src/worktoy/waitaminute/_work_toy_warning.py +164 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/control_flow/__init__.py +18 -5
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_not_a_descriptor.py +2 -4
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_phantom_box_error.py +2 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_protected_error.py +12 -3
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_read_only_error.py +2 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_without_exception.py +5 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_write_once_error.py +3 -3
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/dispatch/_dispatch_exception.py +1 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/dispatch/_type_cast_exception.py +2 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/_reserved_field_error.py +3 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_box_exception.py +1 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_box_type_error.py +1 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_box_value_error.py +2 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_flag_duplicate.py +10 -9
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_resolve_error.py +2 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_type_exception.py +13 -8
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_write_once_error.py +11 -9
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_hook_exception.py +11 -8
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/__init__.py +10 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/_base_test.py +52 -28
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/_sub_test.py +4 -3
- worktoy-1.2.0rc0/src/worktoy/work_test/_test_meta.py +115 -0
- worktoy-1.2.0rc0/src/worktoy/work_test/_test_space.py +64 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/samplers/_base_sampler.py +4 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy.egg-info/PKG-INFO +2 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy.egg-info/SOURCES.txt +7 -0
- worktoy-1.2.0.dev0/src/worktoy/keenum/_kee_flags.py +0 -297
- worktoy-1.2.0.dev0/src/worktoy/keenum/_kee_flags_space.py +0 -195
- worktoy-1.2.0.dev0/src/worktoy/waitaminute/_work_toy_exception.py +0 -25
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/LICENSE +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/setup.cfg +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/_instance_owner.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/_meta_type.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/control_flow/_control_flow.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/control_flow/_meta_flow.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/control_flow/_skip_set.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/sentinels/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/sentinels/_args.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/sentinels/_deleted.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/sentinels/_desc.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/sentinels/_meta_call.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/sentinels/_owner.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/sentinels/_sentinel.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/core/sentinels/_this.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/desc/_alias.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/desc/_fast_box.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/desc/_fix_box.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/desc/_root_alias.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/desc/_symbolic_name.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/dispatch/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/dispatch/_call_me_maybe.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/dispatch/_flex_call.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/dispatch/_permuter.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/dispatch/_permuter_method.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/dispatch/_type_sig.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/ezdata/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/ezdata/_ez_data.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/ezdata/_ez_store.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/ezdata/_fields.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_access_num.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/keenum/_kee_meta_meta.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/lorem_ipsum/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/lorem_ipsum/_base_generator.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/lorem_ipsum/_clause.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/lorem_ipsum/_gaussian_lengths.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/lorem_ipsum/_paragraph.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/lorem_ipsum/_sentence.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/lorem_ipsum/_stochastic_variable.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/lorem_ipsum/_stochastic_word.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/lorem_ipsum/_words.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/_base_meta.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/_base_object.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/_base_space.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/space_hooks/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/space_hooks/_flex_call_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/space_hooks/_load_space_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/space_hooks/_name_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/space_hooks/_reserved_names.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/space_hooks/_reserved_namespace_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/mcls/space_hooks/_space_desc.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/py.typed +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_args_count.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_directory.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_exception_info.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_maybe.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_quick_desc.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_replace_flex.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_slice_len.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/_valid_slice.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/combinatorics/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/utilities/combinatorics/_index_permutations.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/_uncheckable_type.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_access_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_dangling_alias.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_descriptor_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_missing_instance_dict.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_nameless_callback.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_overload_reference.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_recursive_read.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_reference_conflict.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/desc/_shared_descriptor.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/dispatch/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/dispatch/_bare_overload.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/dispatch/_duplicate_signature.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/dispatch/_unbound_cast_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/_class_field_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/_duplicate_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/_extra_keyword_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/_extra_positional_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/_incomplete_field_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/_kw_only_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/_repeated_field_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/_reserved_attribute_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/ezdata/_reserved_method_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_case_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_duplicate.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_flag_name_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_member_name_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/keenum/_kee_name_conflict.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_claimed_name.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_control_class_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_del_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_duplicate_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_duplicate_sentinel.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_illegal_instantiation.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_mixed_method_kind.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_overload_conflict.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_questionable_syntax.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_rebound_overload.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_reserved_name.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_shadowed_class_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_slots_refused.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/waitaminute/meta/_unbound_class_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/_complex_mixin.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/_complex_test.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/samplers/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/samplers/_float_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/samplers/_gaussian_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/samplers/_int_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/samplers/_lorem_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/samplers/_lorem_text.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/samplers/_sampler_meta.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/samplers/_symbolic_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy/work_test/samplers/_word_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy.egg-info/dependency_links.txt +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/src/worktoy.egg-info/top_level.txt +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0rc0}/tests/test_smoke.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: worktoy
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.0rc0
|
|
4
4
|
Summary: Declarative structure for Python that enforces types at runtime and enables true function overloading
|
|
5
5
|
Author-email: Asger Jon Vistisen <asgerjon2@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -32,7 +32,7 @@ Dynamic: license-file
|
|
|
32
32
|
[](https://pypi.org/project/worktoy/)
|
|
33
33
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
34
34
|
|
|
35
|
-
# worktoy v1.2.0-
|
|
35
|
+
# worktoy v1.2.0-rc0 (release candidate)
|
|
36
36
|
|
|
37
37
|
**worktoy** provides utilities for Python development focused on
|
|
38
38
|
reducing boilerplate while improving type safety and readability. Each
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://pypi.org/project/worktoy/)
|
|
5
5
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
6
6
|
|
|
7
|
-
# worktoy v1.2.0-
|
|
7
|
+
# worktoy v1.2.0-rc0 (release candidate)
|
|
8
8
|
|
|
9
9
|
**worktoy** provides utilities for Python development focused on
|
|
10
10
|
reducing boilerplate while improving type safety and readability. Each
|
|
@@ -48,7 +48,7 @@ and the enclosing class is left without the decoration.
|
|
|
48
48
|
# Copyright (c) 2025-2026 Asger Jon Vistisen
|
|
49
49
|
from __future__ import annotations
|
|
50
50
|
|
|
51
|
-
__version__ = '1.2.0-
|
|
51
|
+
__version__ = '1.2.0-rc0'
|
|
52
52
|
|
|
53
53
|
from . import utilities
|
|
54
54
|
from . import waitaminute
|
|
@@ -103,12 +103,13 @@ class Object(metaclass=MetaType):
|
|
|
103
103
|
Implementation
|
|
104
104
|
--------------
|
|
105
105
|
|
|
106
|
-
Each 'Object'
|
|
107
|
-
'__call_chain__'. '__get__', '__set__' and
|
|
108
|
-
|
|
109
|
-
'hookPreDelete' or 'hookOnDelete' around
|
|
110
|
-
'__instance_set__' or '__instance_delete__', and
|
|
111
|
-
'finally' block. 'self.instance' and 'self.owner'
|
|
106
|
+
Each 'Object' has a stack of '(instance, owner)' frames in each thread,
|
|
107
|
+
of which '__call_chain__' gives a copy. '__get__', '__set__' and
|
|
108
|
+
'__delete__' push a frame, call 'hookPreGet', 'hookOnGet',
|
|
109
|
+
'hookPreSet', 'hookOnSet', 'hookPreDelete' or 'hookOnDelete' around
|
|
110
|
+
'__instance_get__', '__instance_set__' or '__instance_delete__', and
|
|
111
|
+
pop the frame in a 'finally' block. 'self.instance' and 'self.owner'
|
|
112
|
+
read the top frame.
|
|
112
113
|
The constructor keeps its arguments, which 'getPosArgs' and
|
|
113
114
|
'getKeyArgs' return with 'THIS', 'OWNER' and 'DESC' replaced. The
|
|
114
115
|
defaults of the three '__instance_*__' methods return the descriptor,
|
|
@@ -901,7 +902,8 @@ class Object(metaclass=MetaType):
|
|
|
901
902
|
def _deletedGuard(self, instance: Any, value: Any, ) -> Any:
|
|
902
903
|
if value is DELETED:
|
|
903
904
|
if self.__field_name__ is None:
|
|
904
|
-
|
|
905
|
+
# The descriptor is the one without a name, not the instance.
|
|
906
|
+
raise MissingVariable(self, '__field_name__', str)
|
|
905
907
|
raise MissingVariable(instance, self.__field_name__, object)
|
|
906
908
|
return value
|
|
907
909
|
|
|
@@ -12,8 +12,9 @@ identity, which is why the two families sit side by side in 'core'.
|
|
|
12
12
|
one root class.
|
|
13
13
|
- ControlSpace: the namespace object 'MetaFlow' prepares for a signal.
|
|
14
14
|
- ControlFlow: the root signal every other signal is based on.
|
|
15
|
-
- SkipSet: the one signal the library
|
|
16
|
-
descriptor's 'hookPreSet', telling 'Object.__set__' to skip
|
|
15
|
+
- SkipSet: the one signal the library provides beside the root, for a
|
|
16
|
+
descriptor's 'hookPreSet' to raise, telling 'Object.__set__' to skip
|
|
17
|
+
the write. The library catches it and raises it nowhere itself.
|
|
17
18
|
|
|
18
19
|
The refusal of an attribute in a signal's class body, 'ControlClassError',
|
|
19
20
|
is an error and lives in 'worktoy.waitaminute.meta' with the other
|
|
@@ -34,10 +34,11 @@ class ControlSpace(dict):
|
|
|
34
34
|
|
|
35
35
|
'MetaFlow.__prepare__' creates the namespace. '__setitem__' admits the
|
|
36
36
|
names in '__white_list__' ('__str__', '__repr__' and the names the
|
|
37
|
-
interpreter writes, such as '__classcell__'), and any name
|
|
38
|
-
holds as an attribute that is not callable, such as
|
|
39
|
-
'__qualname__' and '__doc__'. Every other name raises
|
|
40
|
-
'ControlClassError'
|
|
37
|
+
interpreter writes, such as '__classcell__'), and any dunder name
|
|
38
|
+
'Exception' holds as an attribute that is not callable, such as
|
|
39
|
+
'__module__', '__qualname__' and '__doc__'. Every other name raises
|
|
40
|
+
'ControlClassError', 'args' among them, which 'Exception' holds as
|
|
41
|
+
data and which would be state. The body of the root signal, declared with
|
|
41
42
|
'_root=True', is not checked. 'MetaType' writes '__namespace__' into
|
|
42
43
|
the class past '__setitem__', as for every class it builds.
|
|
43
44
|
|
|
@@ -93,4 +94,8 @@ class ControlSpace(dict):
|
|
|
93
94
|
else:
|
|
94
95
|
if callable(existing):
|
|
95
96
|
raise ControlClassError(self, key)
|
|
97
|
+
if not (key.startswith('__') and key.endswith('__')):
|
|
98
|
+
# This branch is reached by the following:
|
|
99
|
+
# - 'args', the one plain name 'Exception' holds as data
|
|
100
|
+
raise ControlClassError(self, key)
|
|
96
101
|
return dict.__setitem__(self, key, value)
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"""
|
|
2
2
|
The 'worktoy.desc' package provides the base descriptor classes. It
|
|
3
3
|
introduces the descriptor-context: during an access the active
|
|
4
|
-
'(instance, owner)' pair is recorded
|
|
5
|
-
hooks can read the current instance and
|
|
6
|
-
them as arguments.
|
|
4
|
+
'(instance, owner)' pair is recorded for the descriptor, in the thread
|
|
5
|
+
making the access, so accessor hooks can read the current instance and
|
|
6
|
+
owner instead of receiving them as arguments. A read that runs no code
|
|
7
|
+
but that of 'AttriBox' makes no record: with no read callback
|
|
8
|
+
registered and none of 'hookPreGet', 'hookOnGet' and '__instance_get__'
|
|
9
|
+
overridden, a value already stored is returned as it is.
|
|
7
10
|
|
|
8
11
|
Accessed through the owning class, a descriptor returns itself.
|
|
9
12
|
Accessed through an instance, it runs the accessor appropriate for
|
|
@@ -98,6 +98,10 @@ class AttriBox(BaseDescriptor[T]):
|
|
|
98
98
|
|
|
99
99
|
__storage_name__ : str or None
|
|
100
100
|
The cached key in the instance dictionary.
|
|
101
|
+
|
|
102
|
+
__reads_plainly__ : bool or None
|
|
103
|
+
Whether the read hooks and the fetch are those of 'AttriBox', settled
|
|
104
|
+
at the first read through an instance and 'None' until then.
|
|
101
105
|
"""
|
|
102
106
|
|
|
103
107
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
@@ -107,6 +111,7 @@ class AttriBox(BaseDescriptor[T]):
|
|
|
107
111
|
# Private Variables
|
|
108
112
|
__field_type__: Optional[type] = None
|
|
109
113
|
__storage_name__: Optional[str] = None # kept by '_getStorageName'
|
|
114
|
+
__reads_plainly__: Optional[bool] = None # kept by '_settleReadsPlainly'
|
|
110
115
|
|
|
111
116
|
# Public Variables
|
|
112
117
|
fieldType: Field[type] = Field()
|
|
@@ -470,10 +475,41 @@ class AttriBox(BaseDescriptor[T]):
|
|
|
470
475
|
def __get__(self, instance: Any, owner: type) -> T: ...
|
|
471
476
|
# @formatter:on
|
|
472
477
|
|
|
478
|
+
def _settleReadsPlainly(self, ) -> None:
|
|
479
|
+
"""
|
|
480
|
+
The '_settleReadsPlainly' method settles, once for the box, whether a
|
|
481
|
+
read through it runs no code but that of 'AttriBox': 'hookPreGet',
|
|
482
|
+
'hookOnGet' and '__instance_get__' are looked up on the class of the
|
|
483
|
+
box, and '__reads_plainly__' is True when all three are those of
|
|
484
|
+
'AttriBox', False when a subclass overrides one.
|
|
485
|
+
"""
|
|
486
|
+
cls = type(self)
|
|
487
|
+
plain = True
|
|
488
|
+
for name in ('hookPreGet', 'hookOnGet', '__instance_get__'):
|
|
489
|
+
if getattr(cls, name) is not getattr(AttriBox, name):
|
|
490
|
+
plain = False
|
|
491
|
+
object.__setattr__(self, '__reads_plainly__', plain)
|
|
492
|
+
|
|
473
493
|
def __get__(self, instance: Any, owner: type) -> Union[Self, T]:
|
|
474
494
|
"""
|
|
475
495
|
Read through the class, the box must give itself, for inspection or
|
|
476
|
-
for registering callbacks; read through an instance, the value.
|
|
496
|
+
for registering callbacks; read through an instance, the value. By
|
|
497
|
+
far the most reads are of a value already stored, through a box with
|
|
498
|
+
no read callback, and such a read runs no code of the builder: it
|
|
499
|
+
has no use for the frame or for the hook phases, which cost many
|
|
500
|
+
times the read itself, and must not pay for them.
|
|
501
|
+
|
|
502
|
+
Implementation
|
|
503
|
+
--------------
|
|
504
|
+
|
|
505
|
+
When no read callback is registered and the hooks and the fetch are
|
|
506
|
+
those of 'AttriBox', the stored value is taken from the instance and
|
|
507
|
+
returned, unless it is 'DELETED'. Every other read is the full read
|
|
508
|
+
of 'Object.__get__': the first read of an instance, which builds the
|
|
509
|
+
value, a deleted value, and a storage name that is no name, each of
|
|
510
|
+
which is refused or handled there as before. The callbacks are
|
|
511
|
+
looked at on every read, since one may be registered after reads
|
|
512
|
+
were made.
|
|
477
513
|
|
|
478
514
|
Raises
|
|
479
515
|
------
|
|
@@ -482,9 +518,24 @@ class AttriBox(BaseDescriptor[T]):
|
|
|
482
518
|
The box has no field type or no name, as a box installed with
|
|
483
519
|
'setattr' after the class was created.
|
|
484
520
|
"""
|
|
485
|
-
if instance is
|
|
486
|
-
|
|
487
|
-
|
|
521
|
+
if instance is None:
|
|
522
|
+
return super().__get__(instance, owner)
|
|
523
|
+
if self.__field_type__ is None:
|
|
524
|
+
raise MissingVariable(self, '__field_type__', type)
|
|
525
|
+
if not (self.__pre_get_keys__ or self.__on_get_keys__):
|
|
526
|
+
if self.__reads_plainly__ is None:
|
|
527
|
+
self._settleReadsPlainly()
|
|
528
|
+
if self.__reads_plainly__:
|
|
529
|
+
try:
|
|
530
|
+
value = object.__getattribute__(instance, self.__storage_name__)
|
|
531
|
+
except (AttributeError, TypeError):
|
|
532
|
+
# This branch is reached by the following:
|
|
533
|
+
# - The first read of an instance, which has no value yet
|
|
534
|
+
# - A storage name not yet made, or one that is no 'str'
|
|
535
|
+
pass
|
|
536
|
+
else:
|
|
537
|
+
if value is not DELETED:
|
|
538
|
+
return value
|
|
488
539
|
return super().__get__(instance, owner)
|
|
489
540
|
|
|
490
541
|
def __copy__(self) -> Self:
|
|
@@ -19,9 +19,7 @@ T = TypeVar('T', )
|
|
|
19
19
|
F = TypeVar('F', bound=Callable[..., Any])
|
|
20
20
|
|
|
21
21
|
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
22
|
-
from typing import
|
|
23
|
-
|
|
24
|
-
Keys: TypeAlias = tuple[str, ...]
|
|
22
|
+
from typing import Self, Union, Optional
|
|
25
23
|
|
|
26
24
|
|
|
27
25
|
class BaseDescriptor(Object, Generic[T]):
|
|
@@ -18,17 +18,8 @@ T = TypeVar('T')
|
|
|
18
18
|
F = TypeVar('F', bound=Callable[..., Any])
|
|
19
19
|
|
|
20
20
|
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
21
|
-
from typing import TypeAlias, Optional
|
|
22
21
|
from typing import Self
|
|
23
22
|
|
|
24
|
-
MaybeStr: TypeAlias = Optional[str]
|
|
25
|
-
|
|
26
|
-
StrTuple: TypeAlias = tuple[str, ...]
|
|
27
|
-
MaybeStrTuple: TypeAlias = Optional[StrTuple]
|
|
28
|
-
|
|
29
|
-
CallMeMaybe: TypeAlias = Callable[..., Any]
|
|
30
|
-
MaybeBool: TypeAlias = Optional[bool]
|
|
31
|
-
|
|
32
23
|
|
|
33
24
|
class Field(BaseDescriptor[T]):
|
|
34
25
|
"""
|
|
@@ -22,7 +22,6 @@ from . import TypeSig, PermuterMethod, CallMeMaybe
|
|
|
22
22
|
|
|
23
23
|
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
24
24
|
from typing import Any, Callable, Never, TypeAlias, Optional, Self
|
|
25
|
-
from . import Dispatcher
|
|
26
25
|
|
|
27
26
|
Method: TypeAlias = Callable[[Any, ...], Any]
|
|
28
27
|
SigFuncList: TypeAlias = list[tuple[TypeSig, Method]]
|
|
@@ -223,10 +222,13 @@ class Dispatcher(Object):
|
|
|
223
222
|
signatures, most recent first.
|
|
224
223
|
3. A cast of each argument that is not an instance, where a number
|
|
225
224
|
class takes only a narrower number, 'int' to 'float' to 'complex',
|
|
226
|
-
and every other class casts as 'typeCast' allows
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
and every other class casts as 'typeCast' allows: the concrete
|
|
226
|
+
signatures, then the flexible declarations, then the variadic
|
|
227
|
+
signatures, each kind farthest class first. A subclass therefore
|
|
228
|
+
never redirects a call its parent handled through a cast to a
|
|
229
|
+
signature of the same kind, but a concrete signature of a subclass
|
|
230
|
+
takes a call its parent handled through a cast to a flexible or a
|
|
231
|
+
variadic one.
|
|
230
232
|
4. The same with every cast 'typeCast' allows, narrowing included, as
|
|
231
233
|
'2.0' to the 'int' '2'.
|
|
232
234
|
5. The fallback, if any, else 'DispatchException'.
|
|
@@ -444,7 +446,10 @@ class Dispatcher(Object):
|
|
|
444
446
|
) -> SigFuncList:
|
|
445
447
|
"""
|
|
446
448
|
Adding a signature in a subclass must never redirect a call its parent
|
|
447
|
-
already handled through a cast of the same tier
|
|
449
|
+
already handled through a cast of the same tier to a signature of the
|
|
450
|
+
same kind. The cast pass tries the concrete signatures before the
|
|
451
|
+
flexible and the variadic ones, so this order holds within one kind
|
|
452
|
+
of signature only.
|
|
448
453
|
|
|
449
454
|
Implementation
|
|
450
455
|
--------------
|
|
@@ -715,10 +720,11 @@ class Dispatcher(Object):
|
|
|
715
720
|
def matchCasts(args: tuple, cast: Callable) -> Any:
|
|
716
721
|
"""The function, and the arguments in the order it takes them, of
|
|
717
722
|
the registration accepting 'args' when 'cast' is applied to each
|
|
718
|
-
argument that is not an instance
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
723
|
+
argument that is not an instance: the concrete signatures, then the
|
|
724
|
+
flexible declarations, then the variadic ones, each kind farthest
|
|
725
|
+
class first, and within a class the concrete and flexible ones in
|
|
726
|
+
registration order, the variadic ones most recent first. None when
|
|
727
|
+
none accepts the call."""
|
|
722
728
|
for sig, func in castFuncs:
|
|
723
729
|
if len(args) != len(sig):
|
|
724
730
|
continue
|
|
@@ -8,7 +8,7 @@ from __future__ import annotations
|
|
|
8
8
|
from copy import deepcopy, Error
|
|
9
9
|
from typing import TYPE_CHECKING, TypeVar, Generic
|
|
10
10
|
|
|
11
|
-
from ..core.sentinels import THIS
|
|
11
|
+
from ..core.sentinels import THIS, SentinelMeta
|
|
12
12
|
from ..desc import Field
|
|
13
13
|
from ..dispatch import TypeSig
|
|
14
14
|
from ..mcls import BaseObject
|
|
@@ -419,7 +419,7 @@ class EZField(BaseObject, Generic[T]):
|
|
|
419
419
|
A new EZField carrying 'type_' as its field type. The
|
|
420
420
|
returned instance must subsequently be called to bind
|
|
421
421
|
construction arguments before it is used as a class-body
|
|
422
|
-
field; otherwise '
|
|
422
|
+
field; otherwise 'EZHook._assertCompleteField' raises
|
|
423
423
|
'IncompleteFieldException' at class-body time.
|
|
424
424
|
|
|
425
425
|
Raises
|
|
@@ -443,6 +443,12 @@ class EZField(BaseObject, Generic[T]):
|
|
|
443
443
|
if not issubclass(type(type_), type):
|
|
444
444
|
raise TypeException('fieldType', type_, type)
|
|
445
445
|
declaration = '%s[%s]' % (cls.__name__, type_.__name__)
|
|
446
|
+
if isinstance(type_, SentinelMeta) and type_ is not THIS:
|
|
447
|
+
infoSpec = """The subscript '%s' names a sentinel as the field
|
|
448
|
+
type. A sentinel stands for a meaning, such as the enclosing class,
|
|
449
|
+
and is no type of value a field could hold; the field type is the
|
|
450
|
+
class of the values the field holds."""
|
|
451
|
+
raise TypeError(textFmt(infoSpec % declaration))
|
|
446
452
|
TypeSig.validateTypes(type_, variadic=False, declaration=declaration)
|
|
447
453
|
if type_ is THIS:
|
|
448
454
|
infoSpec = """The subscript '%s' names 'THIS', the class being
|
|
@@ -30,7 +30,6 @@ if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
|
30
30
|
|
|
31
31
|
INIT: TypeAlias = Callable[..., None]
|
|
32
32
|
ITER: TypeAlias = Callable[..., Iterator]
|
|
33
|
-
BOOL: TypeAlias = Callable[..., bool]
|
|
34
33
|
SETATTR: TypeAlias = Callable[..., None]
|
|
35
34
|
|
|
36
35
|
|
|
@@ -632,8 +631,8 @@ class EZHook(AbstractSpaceHook):
|
|
|
632
631
|
instance '__dict__', where one defining neither yields to it.
|
|
633
632
|
"""
|
|
634
633
|
valueType = type(value)
|
|
635
|
-
hasSet =
|
|
636
|
-
hasDelete =
|
|
634
|
+
hasSet = EZHook._typeDefines(valueType, '__set__')
|
|
635
|
+
hasDelete = EZHook._typeDefines(valueType, '__delete__')
|
|
637
636
|
return True if hasSet or hasDelete else False
|
|
638
637
|
|
|
639
638
|
@classmethod
|
|
@@ -849,17 +848,23 @@ class EZHook(AbstractSpaceHook):
|
|
|
849
848
|
def _assignField(self: Any, key: str, val: Any, type_: type) -> None:
|
|
850
849
|
object.__setattr__(self, key, castField(key, val, type_))
|
|
851
850
|
|
|
852
|
-
|
|
851
|
+
# The helpers take the keywords of the caller as one argument, and
|
|
852
|
+
# the receiver of '__init__' is not named 'self': a field named as
|
|
853
|
+
# a parameter of these functions, 'self' or 'argCount', must be
|
|
854
|
+
# free to arrive as a keyword, as 'dataclasses' arranges for a field
|
|
855
|
+
# named 'self'.
|
|
856
|
+
|
|
857
|
+
def _refuseUnknown(self: Any, kwargs: dict) -> None:
|
|
853
858
|
for key in kwargs:
|
|
854
859
|
if key not in fieldNames:
|
|
855
860
|
raise ExtraKeywordException(type(self), key, *fieldNames)
|
|
856
861
|
|
|
857
|
-
def _refuseRepeated(self: Any, argCount: int,
|
|
862
|
+
def _refuseRepeated(self: Any, argCount: int, kwargs: dict) -> None:
|
|
858
863
|
for key in fieldNames[:argCount]:
|
|
859
864
|
if key in kwargs:
|
|
860
865
|
raise RepeatedFieldException(type(self), key)
|
|
861
866
|
|
|
862
|
-
def _applyKwargs(self: Any,
|
|
867
|
+
def _applyKwargs(self: Any, kwargs: dict) -> None:
|
|
863
868
|
for key, type_, _ in specs:
|
|
864
869
|
if key in kwargs:
|
|
865
870
|
_assignField(self, key, kwargs[key], type_)
|
|
@@ -876,14 +881,15 @@ class EZHook(AbstractSpaceHook):
|
|
|
876
881
|
if key not in values:
|
|
877
882
|
object.__setattr__(self, key, makeDefault())
|
|
878
883
|
|
|
879
|
-
def __init__(
|
|
884
|
+
def __init__(__ez_self__: Any, *args, **kwargs) -> None:
|
|
885
|
+
self = __ez_self__
|
|
880
886
|
if not self.__kw_only__:
|
|
881
887
|
_applyArgs(self, *args)
|
|
882
888
|
elif args:
|
|
883
889
|
raise KwargsOnlyException(type(self), len(args))
|
|
884
|
-
_refuseUnknown(self,
|
|
885
|
-
_refuseRepeated(self, len(args),
|
|
886
|
-
_applyKwargs(self,
|
|
890
|
+
_refuseUnknown(self, kwargs)
|
|
891
|
+
_refuseRepeated(self, len(args), kwargs)
|
|
892
|
+
_applyKwargs(self, kwargs)
|
|
887
893
|
_applyDefaults(self)
|
|
888
894
|
try:
|
|
889
895
|
postInit = type.__getattribute__(type(self), '__post_init__')
|
|
@@ -1002,7 +1008,10 @@ class EZHook(AbstractSpaceHook):
|
|
|
1002
1008
|
construction.
|
|
1003
1009
|
"""
|
|
1004
1010
|
|
|
1005
|
-
|
|
1011
|
+
# The receiver is not named 'self', so a field of that name may be
|
|
1012
|
+
# among the changes.
|
|
1013
|
+
def replace(__ez_self__: Any, **changes) -> Any:
|
|
1014
|
+
self = __ez_self__
|
|
1006
1015
|
return type(self)(**{**self.asDict(), **changes})
|
|
1007
1016
|
|
|
1008
1017
|
return replace
|
|
@@ -5,7 +5,6 @@ EZMeta is the metaclass behind 'EZData'.
|
|
|
5
5
|
# Copyright (c) 2026 Asger Jon Vistisen
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
|
-
from collections.abc import Callable
|
|
9
8
|
from typing import TYPE_CHECKING
|
|
10
9
|
|
|
11
10
|
from ..desc import Field
|
|
@@ -18,7 +17,6 @@ if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
|
18
17
|
|
|
19
18
|
from . import EZMeta
|
|
20
19
|
|
|
21
|
-
AsTypeSig: TypeAlias = Callable[..., TypeSig]
|
|
22
20
|
Bases: TypeAlias = tuple[EZMeta, ...]
|
|
23
21
|
|
|
24
22
|
|
|
@@ -32,8 +30,10 @@ class EZMeta(BaseMeta):
|
|
|
32
30
|
for structural equality between EZData classes that declare
|
|
33
31
|
the same field-type signature.
|
|
34
32
|
|
|
35
|
-
Two classes are 'congruent' when
|
|
36
|
-
compare equal under 'TypeSig.__eq__'
|
|
33
|
+
Two classes are 'congruent' when one is based on the other and
|
|
34
|
+
their field-type tuples compare equal under 'TypeSig.__eq__'; two
|
|
35
|
+
unrelated classes of the same field types are not. The generated
|
|
36
|
+
'__eq__'
|
|
37
37
|
on EZData instances uses 'isCongruent' to admit cross-class
|
|
38
38
|
equality, so a 'FrozenComplex(EZComplex)' instance can
|
|
39
39
|
compare equal to its non-frozen parent's instances.
|
|
@@ -14,10 +14,9 @@ from ..utilities import maybe
|
|
|
14
14
|
from ..waitaminute.ezdata import DuplicateError, ReservedFieldError
|
|
15
15
|
|
|
16
16
|
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
17
|
-
from typing import Optional, TypeAlias
|
|
17
|
+
from typing import Optional, TypeAlias
|
|
18
18
|
from . import EZMeta, EZField
|
|
19
19
|
|
|
20
|
-
Meta: TypeAlias = Type[EZMeta]
|
|
21
20
|
Bases: TypeAlias = tuple[EZMeta, ...]
|
|
22
21
|
|
|
23
22
|
|
|
@@ -3,10 +3,12 @@ The 'worktoy.keenum' package builds two enumeration systems on the
|
|
|
3
3
|
metaclass and descriptor machinery from 'worktoy.mcls' and
|
|
4
4
|
'worktoy.desc'. 'KeeNum' is the value enumeration: 'Kee' members declared
|
|
5
5
|
in the class body are collected by a space hook and frozen into typed
|
|
6
|
-
members by 'KeeMeta'. 'KeeFlags' is the bitmask-flag enumeration:
|
|
7
|
-
'
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
members by 'KeeMeta'. 'KeeFlags' is the bitmask-flag enumeration: its
|
|
7
|
+
flags are declared with 'Kee' as well, each one bit, and 'KeeFlagsMeta'
|
|
8
|
+
gives the class every combination of them as a member. In both systems
|
|
9
|
+
an enumeration may be based on several, and holds the very members of
|
|
10
|
+
its bases. 'KeeBox', deprecated, adapts either system for use as an
|
|
11
|
+
'AttriBox' field type.
|
|
10
12
|
|
|
11
13
|
KeeNum machinery:
|
|
12
14
|
|
|
@@ -10,7 +10,8 @@ from typing import TYPE_CHECKING
|
|
|
10
10
|
|
|
11
11
|
from . import KeeMeta, KeeFlagsMeta
|
|
12
12
|
from ..desc import AttriBox
|
|
13
|
-
from ..
|
|
13
|
+
from ..utilities import textFmt
|
|
14
|
+
from ..waitaminute import TypeException, DeprecatedPromise
|
|
14
15
|
from ..waitaminute.keenum import KeeBoxException, \
|
|
15
16
|
KeeBoxValueError, KeeBoxTypeError
|
|
16
17
|
|
|
@@ -20,6 +21,12 @@ if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
|
20
21
|
|
|
21
22
|
class KeeBox(AttriBox):
|
|
22
23
|
"""
|
|
24
|
+
'KeeBox' is deprecated: it is no longer a promised feature beginning
|
|
25
|
+
with the next major update, and every subscript of it gives a
|
|
26
|
+
'DeprecatedPromise' at the line that wrote the subscript. It works
|
|
27
|
+
as it did. An 'AttriBox' over the enumeration, with the member itself
|
|
28
|
+
as the default, declares the same field.
|
|
29
|
+
|
|
23
30
|
A field typed with an enumeration is declared with the member it
|
|
24
31
|
starts as, and a project wants to write that member the way it
|
|
25
32
|
thinks of it: by name, by the arguments of the value it carries, by
|
|
@@ -171,8 +178,12 @@ class KeeBox(AttriBox):
|
|
|
171
178
|
'TypeException' otherwise, before delegating to
|
|
172
179
|
'AttriBox.__class_getitem__'. The restriction simplifies the
|
|
173
180
|
implementation; plain 'AttriBox' performs no such check and accepts
|
|
174
|
-
every 'type'.
|
|
181
|
+
every 'type'. Every subscript first gives the deprecation notice of
|
|
182
|
+
'KeeBox', at the line that wrote the subscript.
|
|
175
183
|
"""
|
|
184
|
+
info = """Declare the field with 'AttriBox' instead, giving the
|
|
185
|
+
member itself as the default."""
|
|
186
|
+
DeprecatedPromise(KeeBox, textFmt(info)).warn()
|
|
176
187
|
if isinstance(fieldType, KeeMeta) or isinstance(fieldType, KeeFlagsMeta):
|
|
177
188
|
return super().__class_getitem__(fieldType)
|
|
178
189
|
raise TypeException('fieldType', fieldType, KeeMeta, KeeFlagsMeta)
|
|
@@ -9,7 +9,7 @@ import typing
|
|
|
9
9
|
from typing import TYPE_CHECKING
|
|
10
10
|
|
|
11
11
|
from ..utilities import textFmt, maybe
|
|
12
|
-
from ..waitaminute import MissingVariable, TypeException
|
|
12
|
+
from ..waitaminute import MissingVariable, TypeException, DeprecatedPromise
|
|
13
13
|
|
|
14
14
|
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
15
15
|
from typing import Any, Tuple, Self, Iterator, Never
|
|
@@ -19,20 +19,24 @@ if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
|
19
19
|
class KeeFlag:
|
|
20
20
|
"""
|
|
21
21
|
KeeFlag declares one single-bit flag inside a 'KeeFlags' class body.
|
|
22
|
+
It is deprecated: each 'KeeFlag' made gives a 'DeprecatedPromise' at
|
|
23
|
+
the line that made it, and declares its flag as it did. A 'Kee'
|
|
24
|
+
declares a flag instead, as 'READ = Kee[str]()'.
|
|
25
|
+
|
|
22
26
|
Despite the name it is not itself an enumeration; the 'KeeFlags'
|
|
23
27
|
metaclass reads the declared flags and builds the members, one per
|
|
24
|
-
combination of flags
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Then the members are created as wrappers on these instances.
|
|
28
|
+
combination of flags, the flag itself among them. The 'KeeFlag' is the
|
|
29
|
+
declaration of a flag, kept on the member as its 'kee', and receives
|
|
30
|
+
the class that built the flag as its owner and the bit of the flag as
|
|
31
|
+
its index.
|
|
29
32
|
|
|
30
33
|
Where the 'Kee' class allows the novel syntactic sugar of 'Kee[int](1)',
|
|
31
|
-
'KeeFlag'
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
a 'KeeFlag' names neither the type nor the value: its flag is valued by
|
|
35
|
+
its name, and the owning 'KeeFlags' class holds every flag to the type
|
|
36
|
+
of the 'value' of its first flag. While duplicate 'name' attributes
|
|
37
|
+
between members are disallowed, duplicate 'value' attributes are
|
|
38
|
+
allowed. Please note however that when retrieving members by value, the
|
|
39
|
+
member having the lowest index is used.
|
|
36
40
|
|
|
37
41
|
The flags are read for every member as the class is created, so their
|
|
38
42
|
attributes are builtin properties over the private values, not worktoy
|
|
@@ -44,7 +48,8 @@ class KeeFlag:
|
|
|
44
48
|
- name: The flag's name, set from the class-body assignment by
|
|
45
49
|
'KeeFlagsSpace.addKeeFlag'.
|
|
46
50
|
- index: The flag's bit index, the number of flags declared before
|
|
47
|
-
it. Assigned by
|
|
51
|
+
it. Assigned by 'KeeFlagsMeta._createFlags' once the 'KeeFlags'
|
|
52
|
+
class exists.
|
|
48
53
|
- args: Positional arguments passed to the 'KeeFlag()' constructor.
|
|
49
54
|
- kwargs: Keyword arguments passed to the 'KeeFlag()' constructor.
|
|
50
55
|
"""
|
|
@@ -117,9 +122,9 @@ class KeeFlag:
|
|
|
117
122
|
"""
|
|
118
123
|
A 'KeeFlag' in a 'KeeFlags' body is claimed by 'KeeFlagsHook' before
|
|
119
124
|
the namespace stores it, so the interpreter never calls this method
|
|
120
|
-
for it; the flag's owner is written by '
|
|
121
|
-
|
|
122
|
-
'KeeFlag' in the body of a class not built by 'KeeFlagsMeta', which
|
|
125
|
+
for it; the flag's owner is written by 'KeeFlagsMeta._createFlags'
|
|
126
|
+
once the class exists. The interpreter reaches this method only for
|
|
127
|
+
a 'KeeFlag' in the body of a class not built by 'KeeFlagsMeta', which
|
|
123
128
|
is refused with a 'TypeError' saying where a 'KeeFlag' belongs.
|
|
124
129
|
"""
|
|
125
130
|
infoSpec = """A 'KeeFlag' declares a flag of a flags enumeration and
|
|
@@ -171,13 +176,17 @@ class KeeFlag:
|
|
|
171
176
|
def __hash__(self, ) -> int:
|
|
172
177
|
return hash((self.__field_owner__, self.__field_name__, self.index))
|
|
173
178
|
|
|
174
|
-
__index__
|
|
179
|
+
def __index__(self, ) -> int:
|
|
180
|
+
return self._getIndex()
|
|
175
181
|
|
|
176
182
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
177
183
|
# CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
178
184
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
179
185
|
|
|
180
186
|
def __init__(self, *args, **kwargs) -> None:
|
|
187
|
+
info = """Declare the flag with 'Kee' instead, as 'READ =
|
|
188
|
+
Kee[str]()'."""
|
|
189
|
+
DeprecatedPromise(KeeFlag, textFmt(info)).warn()
|
|
181
190
|
self.__pos_args__ = args
|
|
182
191
|
self.__key_args__ = kwargs
|
|
183
192
|
|
|
@@ -187,8 +196,9 @@ class KeeFlag:
|
|
|
187
196
|
carrying over its constructor arguments, name, and index (the index
|
|
188
197
|
overridable via the argument).
|
|
189
198
|
"""
|
|
190
|
-
|
|
191
|
-
cloned =
|
|
199
|
+
cloned = object.__new__(type(self))
|
|
200
|
+
cloned.__pos_args__ = self.__pos_args__
|
|
201
|
+
cloned.__key_args__ = self.__key_args__
|
|
192
202
|
cloned.__field_owner__ = owner
|
|
193
203
|
cloned.__field_name__ = self.__field_name__
|
|
194
204
|
cloned.__member_index__ = maybe(index, self.__member_index__)
|
|
@@ -200,14 +210,14 @@ class KeeFlag:
|
|
|
200
210
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
201
211
|
|
|
202
212
|
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
203
|
-
@typing.overload
|
|
213
|
+
@typing.overload # pragma: no mutate
|
|
204
214
|
def __or__(self, other: Self) -> Self: ...
|
|
205
215
|
|
|
206
|
-
@typing.overload
|
|
216
|
+
@typing.overload # pragma: no mutate
|
|
207
217
|
def __and__(self, other: Self) -> Self: ...
|
|
208
218
|
|
|
209
|
-
@typing.overload
|
|
219
|
+
@typing.overload # pragma: no mutate
|
|
210
220
|
def __xor__(self, other: Self) -> Self: ...
|
|
211
221
|
|
|
212
|
-
@typing.overload
|
|
222
|
+
@typing.overload # pragma: no mutate
|
|
213
223
|
def __invert__(self) -> Self: ...
|