worktoy 1.1.0.dev4__tar.gz → 1.2.0__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.1.0.dev4 → worktoy-1.2.0}/PKG-INFO +4 -5
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/README.md +2 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/pyproject.toml +4 -4
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/__init__.py +1 -1
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/_object.py +9 -7
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/control_flow/__init__.py +3 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/control_flow/_control_space.py +9 -4
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/desc/__init__.py +6 -3
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/desc/_attri_box.py +58 -6
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/desc/_base_descriptor.py +12 -14
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/desc/_field.py +0 -9
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/dispatch/_dispatcher.py +16 -10
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/dispatch/_overload.py +0 -1
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/ezdata/_ez_field.py +8 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/ezdata/_ez_hook.py +20 -11
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/ezdata/_ez_meta.py +4 -4
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/ezdata/_ez_space.py +1 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/keenum/__init__.py +6 -4
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/keenum/_kee_box.py +69 -44
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/keenum/_kee_flag.py +44 -37
- worktoy-1.2.0/src/worktoy/keenum/_kee_flags.py +368 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/keenum/_kee_flags_hook.py +11 -10
- worktoy-1.2.0/src/worktoy/keenum/_kee_flags_meta.py +475 -0
- worktoy-1.2.0/src/worktoy/keenum/_kee_flags_space.py +163 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/keenum/_kee_member.py +64 -11
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/keenum/_kee_meta.py +214 -183
- worktoy-1.2.0/src/worktoy/keenum/_kee_num.py +274 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/keenum/_kee_space.py +37 -17
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/keenum/_kee_space_hook.py +1 -5
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/_abstract_metaclass.py +6 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/_abstract_namespace.py +3 -3
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/space_hooks/_abstract_space_hook.py +1 -5
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_bipartite_matching.py +0 -8
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_class_body_template.py +16 -9
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_join_words.py +11 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_resolve_mro.py +13 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_string_list.py +11 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_text_fmt.py +23 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_type_cast.py +47 -12
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_unpack.py +11 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_word_wrap.py +18 -4
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/combinatorics/_arrangement.py +0 -1
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/combinatorics/_arrangements.py +0 -3
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/__init__.py +23 -1
- worktoy-1.2.0/src/worktoy/waitaminute/_alternative_warning.py +61 -0
- worktoy-1.2.0/src/worktoy/waitaminute/_deprecated_promise.py +64 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/_missing_variable.py +2 -1
- worktoy-1.2.0/src/worktoy/waitaminute/_redundant_keyword.py +64 -0
- worktoy-1.2.0/src/worktoy/waitaminute/_risk_warning.py +63 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/_subclass_exception.py +2 -1
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/_type_exception.py +5 -7
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/_unpack_exception.py +1 -1
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/_variable_not_none.py +2 -2
- worktoy-1.2.0/src/worktoy/waitaminute/_work_toy_exception.py +51 -0
- worktoy-1.2.0/src/worktoy/waitaminute/_work_toy_warning.py +164 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/control_flow/__init__.py +18 -5
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_not_a_descriptor.py +2 -4
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_phantom_box_error.py +2 -1
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_protected_error.py +12 -3
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_read_only_error.py +2 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_without_exception.py +5 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_write_once_error.py +3 -3
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/dispatch/_dispatch_exception.py +1 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/dispatch/_type_cast_exception.py +2 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/_reserved_field_error.py +3 -1
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_box_exception.py +1 -1
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_box_type_error.py +1 -1
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_box_value_error.py +2 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_flag_duplicate.py +10 -9
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_resolve_error.py +2 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_type_exception.py +13 -8
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_write_once_error.py +11 -9
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_hook_exception.py +11 -8
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/__init__.py +10 -1
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/_base_test.py +52 -28
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/_sub_test.py +4 -3
- worktoy-1.2.0/src/worktoy/work_test/_test_meta.py +115 -0
- worktoy-1.2.0/src/worktoy/work_test/_test_space.py +64 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/samplers/_base_sampler.py +4 -2
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy.egg-info/PKG-INFO +4 -5
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy.egg-info/SOURCES.txt +7 -0
- worktoy-1.1.0.dev4/src/worktoy/keenum/_kee_flags.py +0 -352
- worktoy-1.1.0.dev4/src/worktoy/keenum/_kee_flags_meta.py +0 -337
- worktoy-1.1.0.dev4/src/worktoy/keenum/_kee_flags_space.py +0 -195
- worktoy-1.1.0.dev4/src/worktoy/keenum/_kee_num.py +0 -249
- worktoy-1.1.0.dev4/src/worktoy/waitaminute/_work_toy_exception.py +0 -25
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/LICENSE +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/setup.cfg +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/_instance_owner.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/_meta_type.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/control_flow/_control_flow.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/control_flow/_meta_flow.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/control_flow/_skip_set.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/sentinels/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/sentinels/_args.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/sentinels/_deleted.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/sentinels/_desc.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/sentinels/_meta_call.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/sentinels/_owner.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/sentinels/_sentinel.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/core/sentinels/_this.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/desc/_alias.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/desc/_fast_box.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/desc/_fix_box.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/desc/_root_alias.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/desc/_symbolic_name.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/dispatch/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/dispatch/_call_me_maybe.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/dispatch/_flex_call.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/dispatch/_permuter.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/dispatch/_permuter_method.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/dispatch/_type_sig.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/ezdata/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/ezdata/_ez_data.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/ezdata/_ez_store.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/ezdata/_fields.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/keenum/_access_num.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/keenum/_kee_meta_meta.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/lorem_ipsum/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/lorem_ipsum/_base_generator.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/lorem_ipsum/_clause.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/lorem_ipsum/_gaussian_lengths.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/lorem_ipsum/_paragraph.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/lorem_ipsum/_sentence.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/lorem_ipsum/_stochastic_variable.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/lorem_ipsum/_stochastic_word.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/lorem_ipsum/_words.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/_base_meta.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/_base_object.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/_base_space.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/space_hooks/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/space_hooks/_flex_call_hook.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/space_hooks/_load_space_hook.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/space_hooks/_name_hook.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/space_hooks/_reserved_names.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/space_hooks/_reserved_namespace_hook.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/mcls/space_hooks/_space_desc.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/py.typed +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_args_count.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_directory.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_exception_info.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_maybe.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_quick_desc.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_replace_flex.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_slice_len.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/_valid_slice.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/combinatorics/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/utilities/combinatorics/_index_permutations.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/_uncheckable_type.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_access_error.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_dangling_alias.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_descriptor_exception.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_missing_instance_dict.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_nameless_callback.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_overload_reference.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_recursive_read.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_reference_conflict.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/desc/_shared_descriptor.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/dispatch/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/dispatch/_bare_overload.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/dispatch/_duplicate_signature.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/dispatch/_unbound_cast_hook.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/_class_field_error.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/_duplicate_error.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/_extra_keyword_exception.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/_extra_positional_exception.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/_incomplete_field_exception.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/_kw_only_exception.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/_repeated_field_exception.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/_reserved_attribute_error.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/ezdata/_reserved_method_error.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_case_exception.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_duplicate.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_flag_name_error.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_member_name_error.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/keenum/_kee_name_conflict.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_claimed_name.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_control_class_error.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_del_exception.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_duplicate_hook.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_duplicate_sentinel.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_illegal_instantiation.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_mixed_method_kind.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_overload_conflict.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_questionable_syntax.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_rebound_overload.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_reserved_name.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_shadowed_class_hook.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_slots_refused.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/waitaminute/meta/_unbound_class_hook.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/_complex_mixin.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/_complex_test.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/samplers/__init__.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/samplers/_float_sampler.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/samplers/_gaussian_sampler.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/samplers/_int_sampler.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/samplers/_lorem_sampler.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/samplers/_lorem_text.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/samplers/_sampler_meta.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/samplers/_symbolic_sampler.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy/work_test/samplers/_word_sampler.py +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy.egg-info/dependency_links.txt +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/src/worktoy.egg-info/top_level.txt +0 -0
- {worktoy-1.1.0.dev4 → worktoy-1.2.0}/tests/test_smoke.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: worktoy
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
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
|
-
License: Apache-2.0
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://github.com/AsgerJon/WorkToy
|
|
8
8
|
Project-URL: Bug Tracker, https://github.com/AsgerJon/WorkToy/issues
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.7
|
|
@@ -16,7 +16,6 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.15
|
|
18
18
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
20
19
|
Classifier: Operating System :: OS Independent
|
|
21
20
|
Classifier: Development Status :: 5 - Production/Stable
|
|
22
21
|
Classifier: Intended Audience :: Developers
|
|
@@ -28,12 +27,12 @@ License-File: LICENSE
|
|
|
28
27
|
Dynamic: license-file
|
|
29
28
|
|
|
30
29
|
[](https://wakatime.com/badge/github/AsgerJon/WorkToy)
|
|
31
|
-
[](https://claude.com/claude-code)
|
|
32
31
|
[](https://codecov.io/gh/AsgerJon/WorkToy)
|
|
33
32
|
[](https://pypi.org/project/worktoy/)
|
|
34
33
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
35
34
|
|
|
36
|
-
# worktoy v1.
|
|
35
|
+
# worktoy v1.2.0
|
|
37
36
|
|
|
38
37
|
**worktoy** provides utilities for Python development focused on
|
|
39
38
|
reducing boilerplate while improving type safety and readability. Each
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[](https://wakatime.com/badge/github/AsgerJon/WorkToy)
|
|
2
|
-
[](https://claude.com/claude-code)
|
|
3
3
|
[](https://codecov.io/gh/AsgerJon/WorkToy)
|
|
4
4
|
[](https://pypi.org/project/worktoy/)
|
|
5
5
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
6
6
|
|
|
7
|
-
# worktoy v1.
|
|
7
|
+
# worktoy v1.2.0
|
|
8
8
|
|
|
9
9
|
**worktoy** provides utilities for Python development focused on
|
|
10
10
|
reducing boilerplate while improving type safety and readability. Each
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ['setuptools>=
|
|
2
|
+
requires = ['setuptools>=77.0.0'] # PEP 639 licence metadata
|
|
3
3
|
build-backend = 'setuptools.build_meta'
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "worktoy"
|
|
8
|
-
version = "1.
|
|
8
|
+
version = "1.2.0"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Asger Jon Vistisen", email = "asgerjon2@gmail.com" },
|
|
11
11
|
]
|
|
12
12
|
description = "Declarative structure for Python that enforces types at runtime and enables true function overloading"
|
|
13
13
|
readme = "README.md"
|
|
14
|
-
license =
|
|
14
|
+
license = "Apache-2.0"
|
|
15
|
+
license-files = ["LICENSE"]
|
|
15
16
|
requires-python = ">=3.7"
|
|
16
17
|
classifiers = [
|
|
17
18
|
'Programming Language :: Python :: 3.7',
|
|
@@ -24,7 +25,6 @@ classifiers = [
|
|
|
24
25
|
'Programming Language :: Python :: 3.14',
|
|
25
26
|
'Programming Language :: Python :: 3.15',
|
|
26
27
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
27
|
-
"License :: OSI Approved :: Apache Software License",
|
|
28
28
|
"Operating System :: OS Independent",
|
|
29
29
|
"Development Status :: 5 - Production/Stable",
|
|
30
30
|
"Intended Audience :: Developers",
|
|
@@ -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()
|
|
@@ -246,8 +251,8 @@ class AttriBox(BaseDescriptor[T]):
|
|
|
246
251
|
arguments of the '%s' constructor instead: '%s[%s](...)'."""
|
|
247
252
|
typeName = fieldType.__name__
|
|
248
253
|
info = infoSpec % (
|
|
249
|
-
|
|
250
|
-
|
|
254
|
+
self.getFieldOwner().__name__, self.getFieldName(), typeName,
|
|
255
|
+
typeName, type(self).__name__, typeName,
|
|
251
256
|
)
|
|
252
257
|
raise TypeError(textFmt(info)) from exception
|
|
253
258
|
else:
|
|
@@ -445,6 +450,7 @@ class AttriBox(BaseDescriptor[T]):
|
|
|
445
450
|
cast = self._cast(value)
|
|
446
451
|
return self.__instance_set__(
|
|
447
452
|
instance, cast, _recursion=True) # pragma: no mutate
|
|
453
|
+
|
|
448
454
|
def __instance_delete__(self, instance: Any, *_, **kwargs) -> None:
|
|
449
455
|
"""
|
|
450
456
|
After a deletion the next read must fail, and must not build the
|
|
@@ -469,10 +475,41 @@ class AttriBox(BaseDescriptor[T]):
|
|
|
469
475
|
def __get__(self, instance: Any, owner: type) -> T: ...
|
|
470
476
|
# @formatter:on
|
|
471
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
|
+
|
|
472
493
|
def __get__(self, instance: Any, owner: type) -> Union[Self, T]:
|
|
473
494
|
"""
|
|
474
495
|
Read through the class, the box must give itself, for inspection or
|
|
475
|
-
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.
|
|
476
513
|
|
|
477
514
|
Raises
|
|
478
515
|
------
|
|
@@ -481,9 +518,24 @@ class AttriBox(BaseDescriptor[T]):
|
|
|
481
518
|
The box has no field type or no name, as a box installed with
|
|
482
519
|
'setattr' after the class was created.
|
|
483
520
|
"""
|
|
484
|
-
if instance is
|
|
485
|
-
|
|
486
|
-
|
|
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
|
|
487
539
|
return super().__get__(instance, owner)
|
|
488
540
|
|
|
489
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]):
|
|
@@ -38,8 +36,8 @@ class BaseDescriptor(Object, Generic[T]):
|
|
|
38
36
|
--------------
|
|
39
37
|
|
|
40
38
|
Seven decorators register a method of the owning class: 'preGet' and
|
|
41
|
-
'onGet' around a read, 'preSet' and 'onSet' around a write,
|
|
42
|
-
'preDelete' and 'onDelete' around a deletion, and 'setName' when the
|
|
39
|
+
'onGet' around a 'read', 'preSet' and 'onSet' around a 'write',
|
|
40
|
+
'preDelete' and 'onDelete' around a 'deletion', and 'setName' when the
|
|
43
41
|
descriptor is placed, for which the method is a classmethod receiving
|
|
44
42
|
the class and the descriptor:
|
|
45
43
|
|
|
@@ -173,12 +171,12 @@ class BaseDescriptor(Object, Generic[T]):
|
|
|
173
171
|
if isinstance(func, Func):
|
|
174
172
|
return kind, func
|
|
175
173
|
raise TypeException(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
174
|
+
'callback',
|
|
175
|
+
callback,
|
|
176
|
+
Func,
|
|
177
|
+
classmethod,
|
|
178
|
+
staticmethod
|
|
179
|
+
)
|
|
182
180
|
|
|
183
181
|
@classmethod
|
|
184
182
|
def _wrapCallback(cls, callback: Any) -> Any:
|
|
@@ -373,9 +371,9 @@ class BaseDescriptor(Object, Generic[T]):
|
|
|
373
371
|
cls = type(self)
|
|
374
372
|
new = object.__new__(cls)
|
|
375
373
|
skipped = (
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
374
|
+
'__field_owner__',
|
|
375
|
+
'__field_name__',
|
|
376
|
+
'__private_name__',
|
|
379
377
|
)
|
|
380
378
|
for key, value in vars(self).items():
|
|
381
379
|
if key in skipped:
|
|
@@ -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
|
|