worktoy 1.2.0.dev0__tar.gz → 1.2.0.dev1__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.0.dev1}/PKG-INFO +2 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/README.md +1 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/pyproject.toml +1 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/__init__.py +1 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/dispatch/_dispatcher.py +16 -9
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/__init__.py +6 -4
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_kee_box.py +13 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_kee_flag.py +19 -12
- worktoy-1.2.0.dev1/src/worktoy/keenum/_kee_flags.py +368 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_kee_flags_hook.py +11 -10
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_kee_flags_meta.py +203 -115
- worktoy-1.2.0.dev1/src/worktoy/keenum/_kee_flags_space.py +163 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_kee_member.py +44 -5
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_kee_meta.py +52 -46
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_kee_num.py +73 -5
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_kee_space.py +37 -16
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_class_body_template.py +16 -9
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_resolve_mro.py +2 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_text_fmt.py +3 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_word_wrap.py +7 -4
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/__init__.py +19 -1
- worktoy-1.2.0.dev1/src/worktoy/waitaminute/_alternative_warning.py +61 -0
- worktoy-1.2.0.dev1/src/worktoy/waitaminute/_deprecated_promise.py +64 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/_missing_variable.py +2 -1
- worktoy-1.2.0.dev1/src/worktoy/waitaminute/_risk_warning.py +63 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/_subclass_exception.py +2 -1
- worktoy-1.2.0.dev1/src/worktoy/waitaminute/_work_toy_warning.py +164 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/control_flow/__init__.py +18 -5
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_flag_duplicate.py +10 -9
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_type_exception.py +12 -7
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/_base_test.py +31 -1
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy.egg-info/PKG-INFO +2 -2
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy.egg-info/SOURCES.txt +4 -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 → worktoy-1.2.0.dev1}/LICENSE +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/setup.cfg +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/_instance_owner.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/_meta_type.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/_object.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/control_flow/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/control_flow/_control_flow.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/control_flow/_control_space.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/control_flow/_meta_flow.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/control_flow/_skip_set.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/sentinels/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/sentinels/_args.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/sentinels/_deleted.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/sentinels/_desc.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/sentinels/_meta_call.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/sentinels/_owner.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/sentinels/_sentinel.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/core/sentinels/_this.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/desc/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/desc/_alias.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/desc/_attri_box.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/desc/_base_descriptor.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/desc/_fast_box.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/desc/_field.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/desc/_fix_box.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/desc/_root_alias.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/desc/_symbolic_name.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/dispatch/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/dispatch/_call_me_maybe.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/dispatch/_flex_call.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/dispatch/_overload.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/dispatch/_permuter.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/dispatch/_permuter_method.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/dispatch/_type_sig.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/ezdata/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/ezdata/_ez_data.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/ezdata/_ez_field.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/ezdata/_ez_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/ezdata/_ez_meta.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/ezdata/_ez_space.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/ezdata/_ez_store.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/ezdata/_fields.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_access_num.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_kee_meta_meta.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/keenum/_kee_space_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/lorem_ipsum/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/lorem_ipsum/_base_generator.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/lorem_ipsum/_clause.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/lorem_ipsum/_gaussian_lengths.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/lorem_ipsum/_paragraph.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/lorem_ipsum/_sentence.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/lorem_ipsum/_stochastic_variable.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/lorem_ipsum/_stochastic_word.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/lorem_ipsum/_words.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/_abstract_metaclass.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/_abstract_namespace.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/_base_meta.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/_base_object.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/_base_space.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/space_hooks/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/space_hooks/_abstract_space_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/space_hooks/_flex_call_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/space_hooks/_load_space_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/space_hooks/_name_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/space_hooks/_reserved_names.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/space_hooks/_reserved_namespace_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/mcls/space_hooks/_space_desc.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/py.typed +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_args_count.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_bipartite_matching.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_directory.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_exception_info.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_join_words.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_maybe.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_quick_desc.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_replace_flex.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_slice_len.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_string_list.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_type_cast.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_unpack.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/_valid_slice.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/combinatorics/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/combinatorics/_arrangement.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/combinatorics/_arrangements.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/utilities/combinatorics/_index_permutations.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/_type_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/_uncheckable_type.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/_unpack_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/_variable_not_none.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/_work_toy_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_access_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_dangling_alias.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_descriptor_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_missing_instance_dict.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_nameless_callback.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_not_a_descriptor.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_overload_reference.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_phantom_box_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_protected_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_read_only_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_recursive_read.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_reference_conflict.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_shared_descriptor.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_without_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/desc/_write_once_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/dispatch/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/dispatch/_bare_overload.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/dispatch/_dispatch_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/dispatch/_duplicate_signature.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/dispatch/_type_cast_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/dispatch/_unbound_cast_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/_class_field_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/_duplicate_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/_extra_keyword_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/_extra_positional_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/_incomplete_field_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/_kw_only_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/_repeated_field_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/_reserved_attribute_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/_reserved_field_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/ezdata/_reserved_method_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_box_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_box_type_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_box_value_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_case_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_duplicate.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_flag_name_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_member_name_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_name_conflict.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_resolve_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/keenum/_kee_write_once_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_claimed_name.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_control_class_error.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_del_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_duplicate_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_duplicate_sentinel.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_hook_exception.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_illegal_instantiation.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_mixed_method_kind.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_overload_conflict.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_questionable_syntax.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_rebound_overload.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_reserved_name.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_shadowed_class_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_slots_refused.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/waitaminute/meta/_unbound_class_hook.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/_complex_mixin.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/_complex_test.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/_sub_test.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/samplers/__init__.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/samplers/_base_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/samplers/_float_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/samplers/_gaussian_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/samplers/_int_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/samplers/_lorem_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/samplers/_lorem_text.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/samplers/_sampler_meta.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/samplers/_symbolic_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy/work_test/samplers/_word_sampler.py +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy.egg-info/dependency_links.txt +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/src/worktoy.egg-info/top_level.txt +0 -0
- {worktoy-1.2.0.dev0 → worktoy-1.2.0.dev1}/tests/test_smoke.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: worktoy
|
|
3
|
-
Version: 1.2.0.
|
|
3
|
+
Version: 1.2.0.dev1
|
|
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-dev1 (development build)
|
|
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-dev1 (development build)
|
|
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-dev1'
|
|
52
52
|
|
|
53
53
|
from . import utilities
|
|
54
54
|
from . import waitaminute
|
|
@@ -223,10 +223,13 @@ class Dispatcher(Object):
|
|
|
223
223
|
signatures, most recent first.
|
|
224
224
|
3. A cast of each argument that is not an instance, where a number
|
|
225
225
|
class takes only a narrower number, 'int' to 'float' to 'complex',
|
|
226
|
-
and every other class casts as 'typeCast' allows
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
226
|
+
and every other class casts as 'typeCast' allows: the concrete
|
|
227
|
+
signatures, then the flexible declarations, then the variadic
|
|
228
|
+
signatures, each kind farthest class first. A subclass therefore
|
|
229
|
+
never redirects a call its parent handled through a cast to a
|
|
230
|
+
signature of the same kind, but a concrete signature of a subclass
|
|
231
|
+
takes a call its parent handled through a cast to a flexible or a
|
|
232
|
+
variadic one.
|
|
230
233
|
4. The same with every cast 'typeCast' allows, narrowing included, as
|
|
231
234
|
'2.0' to the 'int' '2'.
|
|
232
235
|
5. The fallback, if any, else 'DispatchException'.
|
|
@@ -444,7 +447,10 @@ class Dispatcher(Object):
|
|
|
444
447
|
) -> SigFuncList:
|
|
445
448
|
"""
|
|
446
449
|
Adding a signature in a subclass must never redirect a call its parent
|
|
447
|
-
already handled through a cast of the same tier
|
|
450
|
+
already handled through a cast of the same tier to a signature of the
|
|
451
|
+
same kind. The cast pass tries the concrete signatures before the
|
|
452
|
+
flexible and the variadic ones, so this order holds within one kind
|
|
453
|
+
of signature only.
|
|
448
454
|
|
|
449
455
|
Implementation
|
|
450
456
|
--------------
|
|
@@ -715,10 +721,11 @@ class Dispatcher(Object):
|
|
|
715
721
|
def matchCasts(args: tuple, cast: Callable) -> Any:
|
|
716
722
|
"""The function, and the arguments in the order it takes them, of
|
|
717
723
|
the registration accepting 'args' when 'cast' is applied to each
|
|
718
|
-
argument that is not an instance
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
724
|
+
argument that is not an instance: the concrete signatures, then the
|
|
725
|
+
flexible declarations, then the variadic ones, each kind farthest
|
|
726
|
+
class first, and within a class the concrete and flexible ones in
|
|
727
|
+
registration order, the variadic ones most recent first. None when
|
|
728
|
+
none accepts the call."""
|
|
722
729
|
for sig, func in castFuncs:
|
|
723
730
|
if len(args) != len(sig):
|
|
724
731
|
continue
|
|
@@ -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,13 +19,16 @@ 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
34
|
'KeeFlag' requires the owning 'KeeFlags' class to specify the type of the
|
|
@@ -178,6 +181,9 @@ class KeeFlag:
|
|
|
178
181
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
179
182
|
|
|
180
183
|
def __init__(self, *args, **kwargs) -> None:
|
|
184
|
+
info = """Declare the flag with 'Kee' instead, as 'READ =
|
|
185
|
+
Kee[str]()'."""
|
|
186
|
+
DeprecatedPromise(KeeFlag, textFmt(info)).warn()
|
|
181
187
|
self.__pos_args__ = args
|
|
182
188
|
self.__key_args__ = kwargs
|
|
183
189
|
|
|
@@ -187,8 +193,9 @@ class KeeFlag:
|
|
|
187
193
|
carrying over its constructor arguments, name, and index (the index
|
|
188
194
|
overridable via the argument).
|
|
189
195
|
"""
|
|
190
|
-
|
|
191
|
-
cloned =
|
|
196
|
+
cloned = object.__new__(type(self))
|
|
197
|
+
cloned.__pos_args__ = self.__pos_args__
|
|
198
|
+
cloned.__key_args__ = self.__key_args__
|
|
192
199
|
cloned.__field_owner__ = owner
|
|
193
200
|
cloned.__field_name__ = self.__field_name__
|
|
194
201
|
cloned.__member_index__ = maybe(index, self.__member_index__)
|
|
@@ -200,14 +207,14 @@ class KeeFlag:
|
|
|
200
207
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
201
208
|
|
|
202
209
|
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
203
|
-
@typing.overload
|
|
210
|
+
@typing.overload # pragma: no mutate
|
|
204
211
|
def __or__(self, other: Self) -> Self: ...
|
|
205
212
|
|
|
206
|
-
@typing.overload
|
|
213
|
+
@typing.overload # pragma: no mutate
|
|
207
214
|
def __and__(self, other: Self) -> Self: ...
|
|
208
215
|
|
|
209
|
-
@typing.overload
|
|
216
|
+
@typing.overload # pragma: no mutate
|
|
210
217
|
def __xor__(self, other: Self) -> Self: ...
|
|
211
218
|
|
|
212
|
-
@typing.overload
|
|
219
|
+
@typing.overload # pragma: no mutate
|
|
213
220
|
def __invert__(self) -> Self: ...
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
"""
|
|
2
|
+
KeeFlags enumerates every combination of a set of single-bit flags.
|
|
3
|
+
"""
|
|
4
|
+
# Apache-2.0 license
|
|
5
|
+
# Copyright (c) 2025-2026 Asger Jon Vistisen
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
from ..utilities import textFmt
|
|
11
|
+
from ..waitaminute import DeprecatedPromise
|
|
12
|
+
from ..waitaminute.keenum import KeeWriteOnceError, KeeResolveError
|
|
13
|
+
from . import Kee, KeeFlagsMeta
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
16
|
+
from typing import Any, Callable, Iterator, Never, Optional, Self
|
|
17
|
+
|
|
18
|
+
# The description of the deprecation of the bit mask of a member.
|
|
19
|
+
_MASK = """The bit mask belongs to the class, not to the member: 'Flags[x]'
|
|
20
|
+
gives the member of mask 'x', and iterating 'Flags' gives its members in
|
|
21
|
+
the order of their masks."""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class KeeFlags(metaclass=KeeFlagsMeta, _root=True):
|
|
25
|
+
"""
|
|
26
|
+
Base class for bitmask-flag enumerations. A subclass declares its
|
|
27
|
+
flags in its body with 'Kee', as 'READ = Kee[str]()', and the
|
|
28
|
+
metaclass gives the class one member per combination of its flags.
|
|
29
|
+
|
|
30
|
+
class UserPermission(KeeFlags):
|
|
31
|
+
READ = Kee[str]()
|
|
32
|
+
EXEC = Kee[str]()
|
|
33
|
+
|
|
34
|
+
class AdminPermission(KeeFlags):
|
|
35
|
+
WRITE = Kee[str]()
|
|
36
|
+
DEL = Kee[str]()
|
|
37
|
+
|
|
38
|
+
class Permission(UserPermission, AdminPermission):
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
Every member is a combination of flags. A flag is the combination of
|
|
42
|
+
itself, and 'NULL', which this root builds, is the one member that
|
|
43
|
+
combines none, inherited by every flags class.
|
|
44
|
+
|
|
45
|
+
Cost (read before declaring a large enum)
|
|
46
|
+
-----------------------------------------
|
|
47
|
+
|
|
48
|
+
A flags class with N flags holds 2 ** N members and builds those no
|
|
49
|
+
other class built for the same flags, each with its name, the names of
|
|
50
|
+
its flags and its hash worked out once. Measured on one desktop
|
|
51
|
+
machine under Python 3.15, the class statement of a class of fresh
|
|
52
|
+
flags took:
|
|
53
|
+
|
|
54
|
+
N = 8 -> 256 members about a millisecond
|
|
55
|
+
N = 12 -> 4096 members about 15 milliseconds
|
|
56
|
+
N = 16 -> 65,536 members about 0.3 seconds, and 72 MB
|
|
57
|
+
|
|
58
|
+
The cost is paid once, at import, and grows four times for every two
|
|
59
|
+
flags added. Every lookup is one step whatever N is: by mask, by name
|
|
60
|
+
in any case and order, by value when every value hashes, and through
|
|
61
|
+
the operators.
|
|
62
|
+
|
|
63
|
+
Members shared along the lineage
|
|
64
|
+
--------------------------------
|
|
65
|
+
|
|
66
|
+
A flags class holds the flags of its bases first, in the order of the
|
|
67
|
+
bases, and its own after them. One member stands for each set of flags
|
|
68
|
+
in the whole process, so a class holds the very members of its bases,
|
|
69
|
+
'Extended.READ is Permission.READ', and a combination of flags of two
|
|
70
|
+
bases is built by the first class combining them and bound by every
|
|
71
|
+
later one. A member belongs to the class that built it: its 'flags'
|
|
72
|
+
are those of that class, its 'lows' the flags of that class that are
|
|
73
|
+
low in it, and its value comes from the '_getValue' of that class.
|
|
74
|
+
|
|
75
|
+
Member attributes
|
|
76
|
+
-----------------
|
|
77
|
+
|
|
78
|
+
- 'name': the flag names joined by '_' in the order of the class that
|
|
79
|
+
built it, or 'NULL'. A class binds each member at the name joining
|
|
80
|
+
its flags in its own order.
|
|
81
|
+
- 'names': a frozenset of the names of the high flags.
|
|
82
|
+
- 'highs': the flags that are high in the member, the flag members
|
|
83
|
+
themselves; iterating a member gives them.
|
|
84
|
+
- 'lows': the flags of the class that built the member that are low.
|
|
85
|
+
- 'flags': the flags of the class that built the member.
|
|
86
|
+
- 'value': the value of a flag declared with a 'Kee' is that of the
|
|
87
|
+
'Kee', so 'Kee[str]()' gives the name; every other member is valued
|
|
88
|
+
by its name. A subclass reimplements '_getValue' to give the members
|
|
89
|
+
it builds other values; it is read once per member, after the class
|
|
90
|
+
has its flags. 'valueType' is the type of the value of the first
|
|
91
|
+
flag of the class, and no combination may contain a member whose
|
|
92
|
+
value is not an instance of it: every flag of a class shares the
|
|
93
|
+
type, while the value of a combination is free, and 'NULL' is
|
|
94
|
+
exempt, since it contains no member.
|
|
95
|
+
- 'kee': the declaration of a flag, or None for any other member.
|
|
96
|
+
- 'owners': the flags classes holding the member, in order of
|
|
97
|
+
creation.
|
|
98
|
+
- 'index': deprecated, the bit mask of the member in the class that
|
|
99
|
+
built it.
|
|
100
|
+
|
|
101
|
+
Equality is identity, and a member hashes by the names of its flags.
|
|
102
|
+
'|', '&' and '^' give the member of the resulting set of flags, and
|
|
103
|
+
refuse with 'TypeError' when no class holds that set. '~member' is the
|
|
104
|
+
member whose flags are the lows of 'member'; '~NULL' raises
|
|
105
|
+
'ZeroDivisionError', since there is no universal combination to invert
|
|
106
|
+
to. 'NULL' is falsy and every other member truthy.
|
|
107
|
+
|
|
108
|
+
Like 'KeeNum' members, the members are write-once constants: any
|
|
109
|
+
attempt to set or delete an attribute on a member raises
|
|
110
|
+
'KeeWriteOnceError', as does rebinding or deleting the member name on
|
|
111
|
+
the owning class. The constructor writes past that with
|
|
112
|
+
'object.__setattr__'. A copy of a member is the member, and a member
|
|
113
|
+
pickles as a lookup of its name on the class that built it. The text
|
|
114
|
+
of a member is no promise: it currently names its one owner,
|
|
115
|
+
'<Permission>.READ', or the root once several classes hold it,
|
|
116
|
+
'<KeeFlags>.READ'.
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
120
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
121
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
122
|
+
|
|
123
|
+
# Class Variables (type hints)
|
|
124
|
+
__member_list__: list[Self]
|
|
125
|
+
__member_dict__: dict[frozenset[str], Self]
|
|
126
|
+
__flag_order__: tuple[Self, ...]
|
|
127
|
+
|
|
128
|
+
# Private Variables
|
|
129
|
+
__field_owner__ = None
|
|
130
|
+
__field_name__ = None
|
|
131
|
+
__member_hash__: Optional[int] = None
|
|
132
|
+
__member_flags__: tuple = ()
|
|
133
|
+
__member_index__: Optional[int] = None
|
|
134
|
+
__member_owners__: Optional[list] = None
|
|
135
|
+
|
|
136
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
137
|
+
# GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
138
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
139
|
+
|
|
140
|
+
def _getFlagsFromType(self, ) -> list[Self]:
|
|
141
|
+
"""
|
|
142
|
+
The 'flags' of a member are those of the class that built it, which
|
|
143
|
+
the metaclass gives the class as 'flags'.
|
|
144
|
+
"""
|
|
145
|
+
return type(self).flags
|
|
146
|
+
|
|
147
|
+
def _getValue(self) -> Any:
|
|
148
|
+
"""
|
|
149
|
+
The value of a member is what a project reads off it, and what the
|
|
150
|
+
class resolves a member from. A flag declared with a 'Kee' is valued
|
|
151
|
+
as the 'Kee' is, so 'Kee[str]()' gives the name, and every other
|
|
152
|
+
member is valued by its name. A subclass reimplements this method to
|
|
153
|
+
give the members it builds any other object; it is read once per
|
|
154
|
+
member, after the class has its flags. Several members may share one
|
|
155
|
+
value, in which case the lowest-indexed member answers for it.
|
|
156
|
+
"""
|
|
157
|
+
if isinstance(self.kee, Kee):
|
|
158
|
+
return self.kee.getValue()
|
|
159
|
+
return self.name
|
|
160
|
+
|
|
161
|
+
def _getHighs(self) -> Iterator[Self]:
|
|
162
|
+
yield from self.__member_flags__
|
|
163
|
+
|
|
164
|
+
def _getLows(self) -> Iterator[Self]:
|
|
165
|
+
highs = self.__member_flags__
|
|
166
|
+
for flag in type(self).__flag_order__:
|
|
167
|
+
if not any(flag is high for high in highs):
|
|
168
|
+
yield flag
|
|
169
|
+
|
|
170
|
+
def _readIndex(self) -> int:
|
|
171
|
+
"""
|
|
172
|
+
The 'index' of a member is deprecated: the bit mask belongs to the
|
|
173
|
+
class, which answers 'Flags[x]', not to the member. A read still
|
|
174
|
+
gives the mask in the class that built the member, with a
|
|
175
|
+
'DeprecatedPromise' at the line that read it.
|
|
176
|
+
"""
|
|
177
|
+
DeprecatedPromise('worktoy.keenum.KeeFlags.index', textFmt(_MASK)).warn()
|
|
178
|
+
return self.__member_index__
|
|
179
|
+
|
|
180
|
+
def _getOwners(self) -> tuple[type, ...]:
|
|
181
|
+
return (*self.__member_owners__,)
|
|
182
|
+
|
|
183
|
+
flags = property(_getFlagsFromType)
|
|
184
|
+
lows = property(_getLows)
|
|
185
|
+
highs = property(_getHighs)
|
|
186
|
+
index = property(_readIndex)
|
|
187
|
+
owners = property(_getOwners)
|
|
188
|
+
|
|
189
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
190
|
+
# Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
191
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
192
|
+
|
|
193
|
+
@classmethod
|
|
194
|
+
def __cast_as__(cls, value: Any) -> Any:
|
|
195
|
+
"""
|
|
196
|
+
The '__cast_as__' hook lets 'typeCast' resolve a value to the member
|
|
197
|
+
it identifies, as calling the class does: a member passes, a name in
|
|
198
|
+
any case and order, a tuple of names, a mask or a value resolves,
|
|
199
|
+
and one the class cannot resolve is declined with 'NotImplemented',
|
|
200
|
+
so 'typeCast' raises its own refusal and an 'AttriBox' over the
|
|
201
|
+
class, or an overload naming it, refuses it as any value it cannot
|
|
202
|
+
convert. While the metaclass still builds the members, nothing is
|
|
203
|
+
resolved.
|
|
204
|
+
"""
|
|
205
|
+
if cls.__allow_instantiation__:
|
|
206
|
+
return NotImplemented
|
|
207
|
+
try:
|
|
208
|
+
return cls(value)
|
|
209
|
+
except KeeResolveError:
|
|
210
|
+
return NotImplemented
|
|
211
|
+
|
|
212
|
+
def __setattr__(self, name: str, value: Any) -> Never:
|
|
213
|
+
"""
|
|
214
|
+
A member is frozen once built, so every assignment raises
|
|
215
|
+
'KeeWriteOnceError'; the constructor writes with
|
|
216
|
+
'object.__setattr__'.
|
|
217
|
+
"""
|
|
218
|
+
raise KeeWriteOnceError(self, name)
|
|
219
|
+
|
|
220
|
+
def __delattr__(self, name: str) -> Never:
|
|
221
|
+
"""
|
|
222
|
+
No stage of member construction deletes an attribute, so deletion
|
|
223
|
+
raises 'KeeWriteOnceError' unconditionally.
|
|
224
|
+
"""
|
|
225
|
+
raise KeeWriteOnceError(self, name)
|
|
226
|
+
|
|
227
|
+
def __copy__(self) -> Self:
|
|
228
|
+
"""A member is a singleton, so a copy is the member itself. A fresh
|
|
229
|
+
instance would break identity checks such as 'member is cls.NULL'."""
|
|
230
|
+
return self
|
|
231
|
+
|
|
232
|
+
def __deepcopy__(self, memo: Any) -> Self:
|
|
233
|
+
"""A member is a singleton, so a deep copy is the member itself,
|
|
234
|
+
keeping a member carried inside a deep-copied structure identical to
|
|
235
|
+
the canonical member."""
|
|
236
|
+
return self
|
|
237
|
+
|
|
238
|
+
def __reduce__(self) -> tuple:
|
|
239
|
+
"""
|
|
240
|
+
A member pickles as a lookup of its name on the class that built it,
|
|
241
|
+
so it unpickles as the member itself.
|
|
242
|
+
"""
|
|
243
|
+
return getattr, (type(self), self.name)
|
|
244
|
+
|
|
245
|
+
def __bool__(self) -> bool:
|
|
246
|
+
"""'NULL', which combines no flags, is falsy. Every other member is
|
|
247
|
+
truthy, mirroring the truthiness of the underlying bitmask."""
|
|
248
|
+
return True if self.__member_flags__ else False
|
|
249
|
+
|
|
250
|
+
def __iter__(self) -> Iterator[Self]:
|
|
251
|
+
yield from self.highs
|
|
252
|
+
|
|
253
|
+
def __str__(self, ) -> str:
|
|
254
|
+
"""
|
|
255
|
+
The text names the one class holding the member, or the root once
|
|
256
|
+
several do. It is no promise.
|
|
257
|
+
"""
|
|
258
|
+
owners = self.__member_owners__
|
|
259
|
+
if len(owners) == 1:
|
|
260
|
+
return '<%s>.%s' % (owners[0].__name__, self.name)
|
|
261
|
+
root = type(type(self)).__kee_class__
|
|
262
|
+
return '<%s>.%s' % (root.__name__, self.name)
|
|
263
|
+
|
|
264
|
+
__repr__ = __str__
|
|
265
|
+
|
|
266
|
+
def __hash__(self, ) -> int:
|
|
267
|
+
return self.__member_hash__
|
|
268
|
+
|
|
269
|
+
def _combine(self, other: Any, merge: Callable) -> Any:
|
|
270
|
+
"""
|
|
271
|
+
The operators work on the flags of the two members alone, so neither
|
|
272
|
+
class has a say: the result is the member of the resulting set of
|
|
273
|
+
flags, whichever class built it, or 'NotImplemented' when 'other' is
|
|
274
|
+
no flags member or no class holds that set.
|
|
275
|
+
"""
|
|
276
|
+
if not isinstance(type(other), KeeFlagsMeta):
|
|
277
|
+
return NotImplemented
|
|
278
|
+
mine = frozenset(self.__member_flags__)
|
|
279
|
+
theirs = frozenset(other.__member_flags__)
|
|
280
|
+
return KeeFlagsMeta._findCombination(merge(mine, theirs))
|
|
281
|
+
|
|
282
|
+
def __or__(self, other: Any) -> Any:
|
|
283
|
+
return self._combine(other, frozenset.union)
|
|
284
|
+
|
|
285
|
+
def __and__(self, other: Any) -> Any:
|
|
286
|
+
return self._combine(other, frozenset.intersection)
|
|
287
|
+
|
|
288
|
+
def __xor__(self, other: Any) -> Any:
|
|
289
|
+
return self._combine(other, frozenset.symmetric_difference)
|
|
290
|
+
|
|
291
|
+
# The three operators commute, so the reflected forms are the same.
|
|
292
|
+
__ror__ = __or__
|
|
293
|
+
__rand__ = __and__
|
|
294
|
+
__rxor__ = __xor__
|
|
295
|
+
|
|
296
|
+
def __invert__(self, ) -> Self:
|
|
297
|
+
"""
|
|
298
|
+
The inverse of a member is the member whose flags are its lows, the
|
|
299
|
+
flags of the class that built it that are low in it. 'NULL' combines
|
|
300
|
+
no flags and belongs to no class with flags, so it has no inverse.
|
|
301
|
+
"""
|
|
302
|
+
if not self.__member_flags__:
|
|
303
|
+
info = """'NULL' combines no flags, and there is no universal
|
|
304
|
+
combination for it to invert to."""
|
|
305
|
+
raise ZeroDivisionError(textFmt(info))
|
|
306
|
+
return KeeFlagsMeta._findCombination(frozenset(self.lows))
|
|
307
|
+
|
|
308
|
+
def __int__(self) -> int:
|
|
309
|
+
"""
|
|
310
|
+
'int(member)' gives the deprecated bit mask, with a
|
|
311
|
+
'DeprecatedPromise'; see '_readIndex'.
|
|
312
|
+
"""
|
|
313
|
+
info = textFmt(_MASK)
|
|
314
|
+
DeprecatedPromise('worktoy.keenum.KeeFlags.__int__', info).warn()
|
|
315
|
+
return self.__member_index__
|
|
316
|
+
|
|
317
|
+
def __index__(self) -> int:
|
|
318
|
+
"""
|
|
319
|
+
A member used as an index gives the deprecated bit mask, with a
|
|
320
|
+
'DeprecatedPromise'; see '_readIndex'.
|
|
321
|
+
"""
|
|
322
|
+
info = textFmt(_MASK)
|
|
323
|
+
DeprecatedPromise('worktoy.keenum.KeeFlags.__index__', info).warn()
|
|
324
|
+
return self.__member_index__
|
|
325
|
+
|
|
326
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
327
|
+
# CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
328
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
329
|
+
|
|
330
|
+
def __init__(self, highs: tuple, mask: int, kee: Any = None) -> None:
|
|
331
|
+
"""
|
|
332
|
+
A member stores its high flags, its bit mask in the class building
|
|
333
|
+
it, its canonical name, the names of its flags, its hash and its
|
|
334
|
+
declaration as plain attributes. A flag, given its declaration, is
|
|
335
|
+
the combination of itself and takes the name of the declaration. The
|
|
336
|
+
value is settled by the metaclass through '_settleValue' once the
|
|
337
|
+
class has its flags.
|
|
338
|
+
"""
|
|
339
|
+
if kee is None:
|
|
340
|
+
name = str.join('_', [flag.name for flag in highs]) or 'NULL'
|
|
341
|
+
else:
|
|
342
|
+
name = kee.name
|
|
343
|
+
highs = (self,)
|
|
344
|
+
object.__setattr__(self, 'name', name)
|
|
345
|
+
object.__setattr__(self, 'kee', kee)
|
|
346
|
+
object.__setattr__(self, '__member_flags__', highs)
|
|
347
|
+
object.__setattr__(self, '__member_index__', mask)
|
|
348
|
+
object.__setattr__(self, '__member_owners__', [])
|
|
349
|
+
names = frozenset(flag.name for flag in highs)
|
|
350
|
+
object.__setattr__(self, 'names', names)
|
|
351
|
+
object.__setattr__(self, '__member_hash__', hash(names))
|
|
352
|
+
object.__setattr__(self, '__field_owner__', type(self))
|
|
353
|
+
object.__setattr__(self, '__field_name__', name)
|
|
354
|
+
|
|
355
|
+
def _settleValue(self) -> None:
|
|
356
|
+
"""
|
|
357
|
+
The metaclass reads the value once, after the class building the
|
|
358
|
+
member has all its flags, since a '_getValue' may read the lows.
|
|
359
|
+
"""
|
|
360
|
+
object.__setattr__(self, 'value', self._getValue())
|
|
361
|
+
|
|
362
|
+
def _addOwner(self, cls: type) -> None:
|
|
363
|
+
"""
|
|
364
|
+
The metaclass records each flags class holding the member as it binds
|
|
365
|
+
it. The list is changed in place, which the frozen member allows,
|
|
366
|
+
since nothing is assigned.
|
|
367
|
+
"""
|
|
368
|
+
self.__member_owners__.append(cls)
|
|
@@ -8,7 +8,7 @@ from __future__ import annotations
|
|
|
8
8
|
from typing import TYPE_CHECKING
|
|
9
9
|
|
|
10
10
|
from ..mcls.space_hooks import AbstractSpaceHook
|
|
11
|
-
from . import KeeFlag
|
|
11
|
+
from . import KeeFlag, Kee
|
|
12
12
|
|
|
13
13
|
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
14
14
|
from typing import Any
|
|
@@ -16,18 +16,19 @@ if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
|
16
16
|
|
|
17
17
|
class KeeFlagsHook(AbstractSpaceHook):
|
|
18
18
|
"""
|
|
19
|
-
A flags class body
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
never its dictionary.
|
|
19
|
+
A flags class body declares its flags as ordinary names, 'READ =
|
|
20
|
+
Kee[str]()', yet the class must hold members at those names, the
|
|
21
|
+
flags themselves among them. The declarations must therefore reach the
|
|
22
|
+
namespace's record and never its dictionary.
|
|
23
23
|
|
|
24
24
|
Implementation
|
|
25
25
|
--------------
|
|
26
26
|
|
|
27
|
-
'setItemPhase' hands every '
|
|
28
|
-
and claims the binding; every other
|
|
29
|
-
A body name colliding with a member
|
|
30
|
-
created, since the combined names
|
|
27
|
+
'setItemPhase' hands every 'Kee', and every deprecated 'KeeFlag', to
|
|
28
|
+
'addKeeFlag' of the namespace and claims the binding; every other
|
|
29
|
+
binding is left to the namespace. A body name colliding with a member
|
|
30
|
+
name is refused as the class is created, since the combined names
|
|
31
|
+
exist only then.
|
|
31
32
|
"""
|
|
32
33
|
|
|
33
34
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
@@ -35,7 +36,7 @@ class KeeFlagsHook(AbstractSpaceHook):
|
|
|
35
36
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
36
37
|
|
|
37
38
|
def setItemPhase(self, key: str, val: Any, old: Any = None, ) -> bool:
|
|
38
|
-
if isinstance(val, KeeFlag):
|
|
39
|
+
if isinstance(val, (Kee, KeeFlag)):
|
|
39
40
|
self.space.addKeeFlag(key, val)
|
|
40
41
|
return True
|
|
41
42
|
return False
|