worktoy 1.3.0.dev0__tar.gz → 1.3.0.dev2__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.3.0.dev0 → worktoy-1.3.0.dev2}/PKG-INFO +138 -2
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/README.md +137 -1
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/pyproject.toml +1 -1
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/__init__.py +1 -1
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_num.py +71 -14
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/__init__.py +5 -1
- worktoy-1.3.0.dev2/src/worktoy/mcls/_abc_object.py +32 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy.egg-info/PKG-INFO +138 -2
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy.egg-info/SOURCES.txt +1 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/LICENSE +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/setup.cfg +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/_instance_owner.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/_meta_type.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/_object.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/control_flow/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/control_flow/_control_flow.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/control_flow/_control_space.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/control_flow/_meta_flow.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/control_flow/_skip_set.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/sentinels/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/sentinels/_args.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/sentinels/_deleted.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/sentinels/_desc.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/sentinels/_meta_call.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/sentinels/_owner.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/sentinels/_sentinel.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/core/sentinels/_this.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/desc/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/desc/_alias.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/desc/_attri_box.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/desc/_base_descriptor.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/desc/_fast_box.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/desc/_field.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/desc/_fix_box.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/desc/_root_alias.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/desc/_symbolic_name.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/dispatch/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/dispatch/_abstract.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/dispatch/_call_me_maybe.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/dispatch/_dispatcher.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/dispatch/_flex_call.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/dispatch/_overload.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/dispatch/_permuter.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/dispatch/_permuter_method.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/dispatch/_type_sig.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/ezdata/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/ezdata/_ez_data.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/ezdata/_ez_field.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/ezdata/_ez_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/ezdata/_ez_meta.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/ezdata/_ez_space.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/ezdata/_ez_store.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/ezdata/_fields.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_access_num.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_box.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_flag.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_flags.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_flags_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_flags_meta.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_flags_space.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_member.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_meta.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_meta_meta.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_space.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/keenum/_kee_space_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/lorem_ipsum/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/lorem_ipsum/_base_generator.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/lorem_ipsum/_clause.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/lorem_ipsum/_gaussian_lengths.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/lorem_ipsum/_paragraph.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/lorem_ipsum/_sentence.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/lorem_ipsum/_stochastic_variable.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/lorem_ipsum/_stochastic_word.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/lorem_ipsum/_words.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/_abc_meta.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/_abc_space.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/_abstract_metaclass.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/_abstract_namespace.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/_base_meta.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/_base_object.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/_base_space.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/space_hooks/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/space_hooks/_abc_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/space_hooks/_abstract_space_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/space_hooks/_flex_call_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/space_hooks/_load_space_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/space_hooks/_name_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/space_hooks/_reserved_names.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/space_hooks/_reserved_namespace_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/mcls/space_hooks/_space_desc.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/py.typed +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_args_count.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_bipartite_matching.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_class_body_template.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_directory.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_exception_info.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_join_words.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_maybe.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_quick_desc.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_replace_flex.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_resolve_mro.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_slice_len.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_string_list.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_text_fmt.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_type_cast.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_unpack.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_valid_slice.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/_word_wrap.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/combinatorics/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/combinatorics/_arrangement.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/combinatorics/_arrangements.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/utilities/combinatorics/_index_permutations.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_alternative_warning.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_deprecated_promise.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_missing_variable.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_redundant_keyword.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_risk_warning.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_subclass_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_type_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_uncheckable_type.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_unpack_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_variable_not_none.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_work_toy_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/_work_toy_warning.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/control_flow/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_access_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_dangling_alias.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_descriptor_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_missing_instance_dict.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_nameless_callback.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_not_a_descriptor.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_overload_reference.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_phantom_box_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_protected_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_read_only_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_recursive_read.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_reference_conflict.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_shared_descriptor.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_without_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/desc/_write_once_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/dispatch/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/dispatch/_bare_overload.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/dispatch/_dispatch_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/dispatch/_duplicate_signature.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/dispatch/_type_cast_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/dispatch/_unbound_cast_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/_class_field_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/_duplicate_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/_extra_keyword_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/_extra_positional_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/_incomplete_field_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/_kw_only_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/_repeated_field_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/_reserved_attribute_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/_reserved_field_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/ezdata/_reserved_method_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_box_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_box_type_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_box_value_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_case_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_duplicate.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_flag_duplicate.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_flag_name_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_member_name_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_name_conflict.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_resolve_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_type_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/keenum/_kee_write_once_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_claimed_name.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_control_class_error.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_del_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_duplicate_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_duplicate_sentinel.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_hook_exception.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_illegal_instantiation.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_missing_implementation.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_mixed_method_kind.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_overload_conflict.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_questionable_syntax.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_rebound_overload.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_reserved_name.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_shadowed_class_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_slots_refused.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_unbound_class_hook.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/waitaminute/meta/_wrong_implementation.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/_base_test.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/_complex_mixin.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/_complex_test.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/_sub_test.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/_test_meta.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/_test_space.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/samplers/__init__.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/samplers/_base_sampler.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/samplers/_float_sampler.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/samplers/_gaussian_sampler.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/samplers/_int_sampler.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/samplers/_lorem_sampler.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/samplers/_lorem_text.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/samplers/_sampler_meta.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/samplers/_symbolic_sampler.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy/work_test/samplers/_word_sampler.py +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy.egg-info/dependency_links.txt +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/src/worktoy.egg-info/top_level.txt +0 -0
- {worktoy-1.3.0.dev0 → worktoy-1.3.0.dev2}/tests/test_smoke.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: worktoy
|
|
3
|
-
Version: 1.3.0.
|
|
3
|
+
Version: 1.3.0.dev2
|
|
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.3.0-
|
|
35
|
+
# worktoy v1.3.0-dev2 (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
|
|
@@ -48,6 +48,7 @@ to 3.15.
|
|
|
48
48
|
- ['Trust-Me-Bro'-Typing](#trust-me-bro-typing)
|
|
49
49
|
- [The Python Parsing Situation Is Crazy](#the-python-parsing-situation-is-crazy)
|
|
50
50
|
- ["Show Don't Tell" Is for Stories, not for Code!](#show-dont-tell-is-for-stories-not-for-code)
|
|
51
|
+
- [Abstract Classes That Check the Homework](#abstract-classes-that-check-the-homework)
|
|
51
52
|
- [Static Discipline](#static-discipline)
|
|
52
53
|
- [Contributing](#contributing)
|
|
53
54
|
- [License](#license)
|
|
@@ -285,6 +286,141 @@ The `r` attribute is declared first. Next, the `@r.GET` declares that the
|
|
|
285
286
|
method implementing the get operation comes next. The structure is
|
|
286
287
|
visible separately from the behaviour.
|
|
287
288
|
|
|
289
|
+
## Abstract Classes That Check the Homework
|
|
290
|
+
|
|
291
|
+
Python's `abc` lets a class leave methods for its subclasses to write:
|
|
292
|
+
|
|
293
|
+
```python
|
|
294
|
+
from abc import ABC, abstractmethod
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
class Model(ABC):
|
|
298
|
+
@abstractmethod
|
|
299
|
+
def rowCount(self) -> int:
|
|
300
|
+
pass
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
class Names(Model):
|
|
304
|
+
def rowCount(self, parent) -> int: # one argument too many
|
|
305
|
+
return 3
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
`abc` checks names, nothing else. `Names` has something called
|
|
309
|
+
`rowCount`, so `Names()` is created without a word, and the mistake waits
|
|
310
|
+
for the first call: `rowCount() missing 1 required positional argument`,
|
|
311
|
+
far from the class that made it. And `abc` has never heard of overloads,
|
|
312
|
+
so it cannot ask a subclass for one particular signature.
|
|
313
|
+
|
|
314
|
+
With **worktoy**, the base is `ABCObject` and the decorator is
|
|
315
|
+
`@abstract`:
|
|
316
|
+
|
|
317
|
+
```python
|
|
318
|
+
from worktoy.mcls import ABCObject
|
|
319
|
+
from worktoy.dispatch import abstract
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
class Model(ABCObject):
|
|
323
|
+
@abstract
|
|
324
|
+
def rowCount(self) -> int: ...
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
class Names(Model): # WrongImplementation, right here
|
|
328
|
+
def rowCount(self, parent) -> int:
|
|
329
|
+
return 3
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
What a subclass writes is held to what was declared, as the class is
|
|
333
|
+
created: the same kind of method, taking what the abstract one takes.
|
|
334
|
+
`Names` fails at its class statement with `WrongImplementation`. Until
|
|
335
|
+
every abstract method is written, making an object is refused with
|
|
336
|
+
`MissingImplementation`, naming what is left to write. A subclass may
|
|
337
|
+
write some of them, all or none, and may declare abstract methods of its
|
|
338
|
+
own.
|
|
339
|
+
|
|
340
|
+
A base class can also demand particular type signatures of an
|
|
341
|
+
overloaded name, two or more of them, and a subclass has to write every
|
|
342
|
+
one:
|
|
343
|
+
|
|
344
|
+
```python
|
|
345
|
+
from worktoy.dispatch import overload
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
class Source(ABCObject):
|
|
349
|
+
@overload(str, int)
|
|
350
|
+
@abstract
|
|
351
|
+
def data(self, index: str, role: int) -> object: ...
|
|
352
|
+
|
|
353
|
+
@overload(bytes)
|
|
354
|
+
@abstract
|
|
355
|
+
def data(self, index: bytes) -> object: ...
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
class Text(Source):
|
|
359
|
+
@overload(str, int)
|
|
360
|
+
def data(self, index: str, role: int) -> object:
|
|
361
|
+
return index * role
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
`Text` writes `data(str, int)` but not `data(bytes)`, so it is still
|
|
365
|
+
abstract: `Text()` is refused, and a subclass writing `data(bytes)`
|
|
366
|
+
completes it. One plain function at `data` taking `*args` would write
|
|
367
|
+
both signatures at once.
|
|
368
|
+
|
|
369
|
+
Where this pays off is a family of classes sharing one job. Take the
|
|
370
|
+
`Point` from above. Every transform must accept a `Point`, a pair of
|
|
371
|
+
floats or a complex number:
|
|
372
|
+
|
|
373
|
+
```python
|
|
374
|
+
class Transform(ABCObject):
|
|
375
|
+
@overload(Point)
|
|
376
|
+
@abstract
|
|
377
|
+
def apply(self, point: Point) -> Point: ...
|
|
378
|
+
|
|
379
|
+
@overload(float, float)
|
|
380
|
+
@abstract
|
|
381
|
+
def apply(self, x: float, y: float) -> Point: ...
|
|
382
|
+
|
|
383
|
+
@abstract # above '@overload' or below it, either works
|
|
384
|
+
@overload(complex)
|
|
385
|
+
def apply(self, z: complex) -> Point: ...
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
class PointTransform(Transform):
|
|
389
|
+
@overload(float, float)
|
|
390
|
+
def apply(self, x: float, y: float) -> Point:
|
|
391
|
+
return self.apply(Point(x, y))
|
|
392
|
+
|
|
393
|
+
@overload(complex)
|
|
394
|
+
def apply(self, z: complex) -> Point:
|
|
395
|
+
return self.apply(Point(z))
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
class Shift(PointTransform):
|
|
399
|
+
dx = AttriBox[float](0.0)
|
|
400
|
+
dy = AttriBox[float](0.0)
|
|
401
|
+
|
|
402
|
+
@overload(Point)
|
|
403
|
+
def apply(self, point: Point) -> Point:
|
|
404
|
+
return Point(point.x + self.dx, point.y + self.dy)
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
`Transform` demands three signatures. `PointTransform` writes two of
|
|
408
|
+
them in terms of the third, once and for all, and is still abstract:
|
|
409
|
+
`PointTransform()` is refused, since `apply(Point)` is not implemented.
|
|
410
|
+
A concrete transform then has a single thing left to say, how it moves
|
|
411
|
+
a `Point`, and gets the other two for free:
|
|
412
|
+
|
|
413
|
+
```python
|
|
414
|
+
shift = Shift()
|
|
415
|
+
shift.dx, shift.dy = 1.0, 2.0
|
|
416
|
+
shift.apply(Point(0.0, 0.0)).y == 2.0
|
|
417
|
+
shift.apply(3.0, 4.0).x == 4.0
|
|
418
|
+
shift.apply(3 + 4j).y == 6.0
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
`ABCObject` is `BaseObject` built by worktoy's own `ABCMeta`, which is no
|
|
422
|
+
relative of the one in `abc`.
|
|
423
|
+
|
|
288
424
|
## Static Discipline
|
|
289
425
|
|
|
290
426
|
In plain Python, attributes assigned in `__init__` are closer to
|
|
@@ -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.3.0-
|
|
7
|
+
# worktoy v1.3.0-dev2 (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
|
|
@@ -20,6 +20,7 @@ to 3.15.
|
|
|
20
20
|
- ['Trust-Me-Bro'-Typing](#trust-me-bro-typing)
|
|
21
21
|
- [The Python Parsing Situation Is Crazy](#the-python-parsing-situation-is-crazy)
|
|
22
22
|
- ["Show Don't Tell" Is for Stories, not for Code!](#show-dont-tell-is-for-stories-not-for-code)
|
|
23
|
+
- [Abstract Classes That Check the Homework](#abstract-classes-that-check-the-homework)
|
|
23
24
|
- [Static Discipline](#static-discipline)
|
|
24
25
|
- [Contributing](#contributing)
|
|
25
26
|
- [License](#license)
|
|
@@ -257,6 +258,141 @@ The `r` attribute is declared first. Next, the `@r.GET` declares that the
|
|
|
257
258
|
method implementing the get operation comes next. The structure is
|
|
258
259
|
visible separately from the behaviour.
|
|
259
260
|
|
|
261
|
+
## Abstract Classes That Check the Homework
|
|
262
|
+
|
|
263
|
+
Python's `abc` lets a class leave methods for its subclasses to write:
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
from abc import ABC, abstractmethod
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
class Model(ABC):
|
|
270
|
+
@abstractmethod
|
|
271
|
+
def rowCount(self) -> int:
|
|
272
|
+
pass
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class Names(Model):
|
|
276
|
+
def rowCount(self, parent) -> int: # one argument too many
|
|
277
|
+
return 3
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
`abc` checks names, nothing else. `Names` has something called
|
|
281
|
+
`rowCount`, so `Names()` is created without a word, and the mistake waits
|
|
282
|
+
for the first call: `rowCount() missing 1 required positional argument`,
|
|
283
|
+
far from the class that made it. And `abc` has never heard of overloads,
|
|
284
|
+
so it cannot ask a subclass for one particular signature.
|
|
285
|
+
|
|
286
|
+
With **worktoy**, the base is `ABCObject` and the decorator is
|
|
287
|
+
`@abstract`:
|
|
288
|
+
|
|
289
|
+
```python
|
|
290
|
+
from worktoy.mcls import ABCObject
|
|
291
|
+
from worktoy.dispatch import abstract
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
class Model(ABCObject):
|
|
295
|
+
@abstract
|
|
296
|
+
def rowCount(self) -> int: ...
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
class Names(Model): # WrongImplementation, right here
|
|
300
|
+
def rowCount(self, parent) -> int:
|
|
301
|
+
return 3
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
What a subclass writes is held to what was declared, as the class is
|
|
305
|
+
created: the same kind of method, taking what the abstract one takes.
|
|
306
|
+
`Names` fails at its class statement with `WrongImplementation`. Until
|
|
307
|
+
every abstract method is written, making an object is refused with
|
|
308
|
+
`MissingImplementation`, naming what is left to write. A subclass may
|
|
309
|
+
write some of them, all or none, and may declare abstract methods of its
|
|
310
|
+
own.
|
|
311
|
+
|
|
312
|
+
A base class can also demand particular type signatures of an
|
|
313
|
+
overloaded name, two or more of them, and a subclass has to write every
|
|
314
|
+
one:
|
|
315
|
+
|
|
316
|
+
```python
|
|
317
|
+
from worktoy.dispatch import overload
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
class Source(ABCObject):
|
|
321
|
+
@overload(str, int)
|
|
322
|
+
@abstract
|
|
323
|
+
def data(self, index: str, role: int) -> object: ...
|
|
324
|
+
|
|
325
|
+
@overload(bytes)
|
|
326
|
+
@abstract
|
|
327
|
+
def data(self, index: bytes) -> object: ...
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
class Text(Source):
|
|
331
|
+
@overload(str, int)
|
|
332
|
+
def data(self, index: str, role: int) -> object:
|
|
333
|
+
return index * role
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
`Text` writes `data(str, int)` but not `data(bytes)`, so it is still
|
|
337
|
+
abstract: `Text()` is refused, and a subclass writing `data(bytes)`
|
|
338
|
+
completes it. One plain function at `data` taking `*args` would write
|
|
339
|
+
both signatures at once.
|
|
340
|
+
|
|
341
|
+
Where this pays off is a family of classes sharing one job. Take the
|
|
342
|
+
`Point` from above. Every transform must accept a `Point`, a pair of
|
|
343
|
+
floats or a complex number:
|
|
344
|
+
|
|
345
|
+
```python
|
|
346
|
+
class Transform(ABCObject):
|
|
347
|
+
@overload(Point)
|
|
348
|
+
@abstract
|
|
349
|
+
def apply(self, point: Point) -> Point: ...
|
|
350
|
+
|
|
351
|
+
@overload(float, float)
|
|
352
|
+
@abstract
|
|
353
|
+
def apply(self, x: float, y: float) -> Point: ...
|
|
354
|
+
|
|
355
|
+
@abstract # above '@overload' or below it, either works
|
|
356
|
+
@overload(complex)
|
|
357
|
+
def apply(self, z: complex) -> Point: ...
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
class PointTransform(Transform):
|
|
361
|
+
@overload(float, float)
|
|
362
|
+
def apply(self, x: float, y: float) -> Point:
|
|
363
|
+
return self.apply(Point(x, y))
|
|
364
|
+
|
|
365
|
+
@overload(complex)
|
|
366
|
+
def apply(self, z: complex) -> Point:
|
|
367
|
+
return self.apply(Point(z))
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
class Shift(PointTransform):
|
|
371
|
+
dx = AttriBox[float](0.0)
|
|
372
|
+
dy = AttriBox[float](0.0)
|
|
373
|
+
|
|
374
|
+
@overload(Point)
|
|
375
|
+
def apply(self, point: Point) -> Point:
|
|
376
|
+
return Point(point.x + self.dx, point.y + self.dy)
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
`Transform` demands three signatures. `PointTransform` writes two of
|
|
380
|
+
them in terms of the third, once and for all, and is still abstract:
|
|
381
|
+
`PointTransform()` is refused, since `apply(Point)` is not implemented.
|
|
382
|
+
A concrete transform then has a single thing left to say, how it moves
|
|
383
|
+
a `Point`, and gets the other two for free:
|
|
384
|
+
|
|
385
|
+
```python
|
|
386
|
+
shift = Shift()
|
|
387
|
+
shift.dx, shift.dy = 1.0, 2.0
|
|
388
|
+
shift.apply(Point(0.0, 0.0)).y == 2.0
|
|
389
|
+
shift.apply(3.0, 4.0).x == 4.0
|
|
390
|
+
shift.apply(3 + 4j).y == 6.0
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
`ABCObject` is `BaseObject` built by worktoy's own `ABCMeta`, which is no
|
|
394
|
+
relative of the one in `abc`.
|
|
395
|
+
|
|
260
396
|
## Static Discipline
|
|
261
397
|
|
|
262
398
|
In plain Python, attributes assigned in `__init__` are closer to
|
|
@@ -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.3.0-
|
|
51
|
+
__version__ = '1.3.0-dev2'
|
|
52
52
|
|
|
53
53
|
from . import utilities
|
|
54
54
|
from . import waitaminute
|
|
@@ -8,8 +8,9 @@ from __future__ import annotations
|
|
|
8
8
|
from typing import TYPE_CHECKING, overload
|
|
9
9
|
|
|
10
10
|
from ..core import MetaType
|
|
11
|
-
from ..utilities import textFmt
|
|
11
|
+
from ..utilities import textFmt, typeCast
|
|
12
12
|
from ..waitaminute import DeprecatedPromise
|
|
13
|
+
from ..waitaminute.dispatch import TypeCastException
|
|
13
14
|
from ..waitaminute.keenum import KeeResolveError, KeeWriteOnceError
|
|
14
15
|
from . import Kee
|
|
15
16
|
|
|
@@ -77,9 +78,10 @@ class KeeBase(metaclass=MetaType):
|
|
|
77
78
|
|
|
78
79
|
index : int
|
|
79
80
|
Deprecated: the position of the member among those of the class that
|
|
80
|
-
declared it. Reading it
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
declared it. Reading it gives a 'DeprecatedPromise', since the
|
|
82
|
+
position belongs to the enumeration: 'Day[x]' gives the member at a
|
|
83
|
+
position. 'int(member)', and the member used as an index, go by the
|
|
84
|
+
value and not by the position; see '__int__' and '__index__'.
|
|
83
85
|
|
|
84
86
|
value : Any
|
|
85
87
|
The value the 'Kee' built.
|
|
@@ -218,21 +220,76 @@ class KeeBase(metaclass=MetaType):
|
|
|
218
220
|
|
|
219
221
|
def __int__(self) -> int:
|
|
220
222
|
"""
|
|
221
|
-
'int(member)'
|
|
222
|
-
|
|
223
|
+
A member stands for its value, so 'int(member)' must give the value
|
|
224
|
+
as an integer wherever the value is a whole number, as
|
|
225
|
+
'int(Size.LARGE)' gives 3 for a member holding 3. Where the member
|
|
226
|
+
stands in its class plays no part. A value that is no whole number
|
|
227
|
+
has no integer to give, and the conversion must then fail as Python
|
|
228
|
+
fails 'int' of an object that is no number, without truncating a
|
|
229
|
+
fraction or parsing a text on the way.
|
|
230
|
+
|
|
231
|
+
Implementation
|
|
232
|
+
--------------
|
|
233
|
+
|
|
234
|
+
'typeCast' decides, as for every conversion in the library: an
|
|
235
|
+
'int', a whole 'float' and a real, whole 'complex' convert, and
|
|
236
|
+
nothing else does. Its refusal is raised again as a 'TypeError'
|
|
237
|
+
naming the member. The result is made a plain 'int', which Python
|
|
238
|
+
asks of '__int__'.
|
|
239
|
+
|
|
240
|
+
Returns
|
|
241
|
+
-------
|
|
242
|
+
|
|
243
|
+
int
|
|
244
|
+
The value of the member as an integer.
|
|
245
|
+
|
|
246
|
+
Raises
|
|
247
|
+
------
|
|
248
|
+
|
|
249
|
+
TypeError
|
|
250
|
+
The value is no whole number.
|
|
223
251
|
"""
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
252
|
+
try:
|
|
253
|
+
return int(typeCast(int, self.value))
|
|
254
|
+
except TypeCastException as typeCastException:
|
|
255
|
+
infoSpec = """Enumeration member '%s' converts to no 'int': its
|
|
256
|
+
value of type '%s' is no whole number!"""
|
|
257
|
+
info = infoSpec % (self, type(self.value).__name__)
|
|
258
|
+
raise TypeError(textFmt(info)) from typeCastException
|
|
227
259
|
|
|
228
260
|
def __index__(self) -> int:
|
|
229
261
|
"""
|
|
230
|
-
A member
|
|
231
|
-
|
|
262
|
+
A member whose value is an integer must serve wherever Python takes
|
|
263
|
+
an integer without loss, as an index in 'items[member]' or a count
|
|
264
|
+
in 'range(member)', by that value. Python asks more of an index
|
|
265
|
+
than of 'int': a whole 'float' converts with 'int' and is still no
|
|
266
|
+
index, and the same must hold for a member holding one.
|
|
267
|
+
|
|
268
|
+
Implementation
|
|
269
|
+
--------------
|
|
270
|
+
|
|
271
|
+
A value that is an 'int' is returned as a plain 'int', which Python
|
|
272
|
+
asks of '__index__'; any other value raises 'TypeError'.
|
|
273
|
+
|
|
274
|
+
Returns
|
|
275
|
+
-------
|
|
276
|
+
|
|
277
|
+
int
|
|
278
|
+
The value of the member.
|
|
279
|
+
|
|
280
|
+
Raises
|
|
281
|
+
------
|
|
282
|
+
|
|
283
|
+
TypeError
|
|
284
|
+
The value is no 'int'.
|
|
232
285
|
"""
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
286
|
+
value = self.value
|
|
287
|
+
if isinstance(value, int):
|
|
288
|
+
return int(value)
|
|
289
|
+
infoSpec = """Enumeration member '%s' serves as no index: its value
|
|
290
|
+
of type '%s' is no 'int'!"""
|
|
291
|
+
info = infoSpec % (self, type(value).__name__)
|
|
292
|
+
raise TypeError(textFmt(info))
|
|
236
293
|
|
|
237
294
|
def __hash__(self) -> int:
|
|
238
295
|
"""
|
|
@@ -30,7 +30,8 @@ The 'ABCMeta' of this package is worktoy's own, and no relative of that
|
|
|
30
30
|
one. It builds the classes that declare methods with '@abstract' of
|
|
31
31
|
'worktoy.dispatch', holds each subclass to what is declared, one
|
|
32
32
|
signature of an overloaded name at a time, and refuses to make an
|
|
33
|
-
object of a class that still lacks an implementation.
|
|
33
|
+
object of a class that still lacks an implementation. 'ABCObject' is
|
|
34
|
+
the base of such classes, as 'BaseObject' is of the others.
|
|
34
35
|
|
|
35
36
|
- space_hooks
|
|
36
37
|
- AbstractNamespace
|
|
@@ -40,6 +41,7 @@ object of a class that still lacks an implementation.
|
|
|
40
41
|
- BaseObject
|
|
41
42
|
- ABCSpace
|
|
42
43
|
- ABCMeta
|
|
44
|
+
- ABCObject
|
|
43
45
|
"""
|
|
44
46
|
# Apache-2.0 license
|
|
45
47
|
# Copyright (c) 2024-2026 Asger Jon Vistisen
|
|
@@ -53,6 +55,7 @@ from ._base_meta import BaseMeta
|
|
|
53
55
|
from ._base_object import BaseObject
|
|
54
56
|
from ._abc_space import ABCSpace
|
|
55
57
|
from ._abc_meta import ABCMeta
|
|
58
|
+
from ._abc_object import ABCObject
|
|
56
59
|
|
|
57
60
|
__all__ = [
|
|
58
61
|
'space_hooks',
|
|
@@ -63,4 +66,5 @@ __all__ = [
|
|
|
63
66
|
'BaseObject',
|
|
64
67
|
'ABCSpace',
|
|
65
68
|
'ABCMeta',
|
|
69
|
+
'ABCObject',
|
|
66
70
|
]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ABCObject is the base of the classes that declare abstract methods.
|
|
3
|
+
"""
|
|
4
|
+
# Apache-2.0 license
|
|
5
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from . import BaseObject, ABCMeta
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ABCObject(BaseObject, metaclass=ABCMeta):
|
|
12
|
+
"""
|
|
13
|
+
A class that declares methods with '@abstract' is built by 'ABCMeta',
|
|
14
|
+
and would otherwise name that metaclass in its class statement, each
|
|
15
|
+
time. It needs a base to be based on instead, as a worktoy class is
|
|
16
|
+
based on 'BaseObject' and names no metaclass:
|
|
17
|
+
|
|
18
|
+
class Model(ABCObject):
|
|
19
|
+
|
|
20
|
+
@abstract
|
|
21
|
+
def rowCount(self) -> int: ...
|
|
22
|
+
|
|
23
|
+
Implementation
|
|
24
|
+
--------------
|
|
25
|
+
|
|
26
|
+
'ABCObject' is 'BaseObject' built by 'ABCMeta', with a body of its
|
|
27
|
+
own that holds nothing: it is to 'ABCMeta' what 'BaseObject' is to
|
|
28
|
+
'BaseMeta'. A class based on it is built by 'ABCMeta' in turn, and
|
|
29
|
+
keeps everything a 'BaseObject' gives. It declares nothing abstract
|
|
30
|
+
itself, so it is no abstract class, and an object may be made of it,
|
|
31
|
+
as of 'BaseObject'.
|
|
32
|
+
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: worktoy
|
|
3
|
-
Version: 1.3.0.
|
|
3
|
+
Version: 1.3.0.dev2
|
|
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.3.0-
|
|
35
|
+
# worktoy v1.3.0-dev2 (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
|
|
@@ -48,6 +48,7 @@ to 3.15.
|
|
|
48
48
|
- ['Trust-Me-Bro'-Typing](#trust-me-bro-typing)
|
|
49
49
|
- [The Python Parsing Situation Is Crazy](#the-python-parsing-situation-is-crazy)
|
|
50
50
|
- ["Show Don't Tell" Is for Stories, not for Code!](#show-dont-tell-is-for-stories-not-for-code)
|
|
51
|
+
- [Abstract Classes That Check the Homework](#abstract-classes-that-check-the-homework)
|
|
51
52
|
- [Static Discipline](#static-discipline)
|
|
52
53
|
- [Contributing](#contributing)
|
|
53
54
|
- [License](#license)
|
|
@@ -285,6 +286,141 @@ The `r` attribute is declared first. Next, the `@r.GET` declares that the
|
|
|
285
286
|
method implementing the get operation comes next. The structure is
|
|
286
287
|
visible separately from the behaviour.
|
|
287
288
|
|
|
289
|
+
## Abstract Classes That Check the Homework
|
|
290
|
+
|
|
291
|
+
Python's `abc` lets a class leave methods for its subclasses to write:
|
|
292
|
+
|
|
293
|
+
```python
|
|
294
|
+
from abc import ABC, abstractmethod
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
class Model(ABC):
|
|
298
|
+
@abstractmethod
|
|
299
|
+
def rowCount(self) -> int:
|
|
300
|
+
pass
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
class Names(Model):
|
|
304
|
+
def rowCount(self, parent) -> int: # one argument too many
|
|
305
|
+
return 3
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
`abc` checks names, nothing else. `Names` has something called
|
|
309
|
+
`rowCount`, so `Names()` is created without a word, and the mistake waits
|
|
310
|
+
for the first call: `rowCount() missing 1 required positional argument`,
|
|
311
|
+
far from the class that made it. And `abc` has never heard of overloads,
|
|
312
|
+
so it cannot ask a subclass for one particular signature.
|
|
313
|
+
|
|
314
|
+
With **worktoy**, the base is `ABCObject` and the decorator is
|
|
315
|
+
`@abstract`:
|
|
316
|
+
|
|
317
|
+
```python
|
|
318
|
+
from worktoy.mcls import ABCObject
|
|
319
|
+
from worktoy.dispatch import abstract
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
class Model(ABCObject):
|
|
323
|
+
@abstract
|
|
324
|
+
def rowCount(self) -> int: ...
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
class Names(Model): # WrongImplementation, right here
|
|
328
|
+
def rowCount(self, parent) -> int:
|
|
329
|
+
return 3
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
What a subclass writes is held to what was declared, as the class is
|
|
333
|
+
created: the same kind of method, taking what the abstract one takes.
|
|
334
|
+
`Names` fails at its class statement with `WrongImplementation`. Until
|
|
335
|
+
every abstract method is written, making an object is refused with
|
|
336
|
+
`MissingImplementation`, naming what is left to write. A subclass may
|
|
337
|
+
write some of them, all or none, and may declare abstract methods of its
|
|
338
|
+
own.
|
|
339
|
+
|
|
340
|
+
A base class can also demand particular type signatures of an
|
|
341
|
+
overloaded name, two or more of them, and a subclass has to write every
|
|
342
|
+
one:
|
|
343
|
+
|
|
344
|
+
```python
|
|
345
|
+
from worktoy.dispatch import overload
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
class Source(ABCObject):
|
|
349
|
+
@overload(str, int)
|
|
350
|
+
@abstract
|
|
351
|
+
def data(self, index: str, role: int) -> object: ...
|
|
352
|
+
|
|
353
|
+
@overload(bytes)
|
|
354
|
+
@abstract
|
|
355
|
+
def data(self, index: bytes) -> object: ...
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
class Text(Source):
|
|
359
|
+
@overload(str, int)
|
|
360
|
+
def data(self, index: str, role: int) -> object:
|
|
361
|
+
return index * role
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
`Text` writes `data(str, int)` but not `data(bytes)`, so it is still
|
|
365
|
+
abstract: `Text()` is refused, and a subclass writing `data(bytes)`
|
|
366
|
+
completes it. One plain function at `data` taking `*args` would write
|
|
367
|
+
both signatures at once.
|
|
368
|
+
|
|
369
|
+
Where this pays off is a family of classes sharing one job. Take the
|
|
370
|
+
`Point` from above. Every transform must accept a `Point`, a pair of
|
|
371
|
+
floats or a complex number:
|
|
372
|
+
|
|
373
|
+
```python
|
|
374
|
+
class Transform(ABCObject):
|
|
375
|
+
@overload(Point)
|
|
376
|
+
@abstract
|
|
377
|
+
def apply(self, point: Point) -> Point: ...
|
|
378
|
+
|
|
379
|
+
@overload(float, float)
|
|
380
|
+
@abstract
|
|
381
|
+
def apply(self, x: float, y: float) -> Point: ...
|
|
382
|
+
|
|
383
|
+
@abstract # above '@overload' or below it, either works
|
|
384
|
+
@overload(complex)
|
|
385
|
+
def apply(self, z: complex) -> Point: ...
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
class PointTransform(Transform):
|
|
389
|
+
@overload(float, float)
|
|
390
|
+
def apply(self, x: float, y: float) -> Point:
|
|
391
|
+
return self.apply(Point(x, y))
|
|
392
|
+
|
|
393
|
+
@overload(complex)
|
|
394
|
+
def apply(self, z: complex) -> Point:
|
|
395
|
+
return self.apply(Point(z))
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
class Shift(PointTransform):
|
|
399
|
+
dx = AttriBox[float](0.0)
|
|
400
|
+
dy = AttriBox[float](0.0)
|
|
401
|
+
|
|
402
|
+
@overload(Point)
|
|
403
|
+
def apply(self, point: Point) -> Point:
|
|
404
|
+
return Point(point.x + self.dx, point.y + self.dy)
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
`Transform` demands three signatures. `PointTransform` writes two of
|
|
408
|
+
them in terms of the third, once and for all, and is still abstract:
|
|
409
|
+
`PointTransform()` is refused, since `apply(Point)` is not implemented.
|
|
410
|
+
A concrete transform then has a single thing left to say, how it moves
|
|
411
|
+
a `Point`, and gets the other two for free:
|
|
412
|
+
|
|
413
|
+
```python
|
|
414
|
+
shift = Shift()
|
|
415
|
+
shift.dx, shift.dy = 1.0, 2.0
|
|
416
|
+
shift.apply(Point(0.0, 0.0)).y == 2.0
|
|
417
|
+
shift.apply(3.0, 4.0).x == 4.0
|
|
418
|
+
shift.apply(3 + 4j).y == 6.0
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
`ABCObject` is `BaseObject` built by worktoy's own `ABCMeta`, which is no
|
|
422
|
+
relative of the one in `abc`.
|
|
423
|
+
|
|
288
424
|
## Static Discipline
|
|
289
425
|
|
|
290
426
|
In plain Python, attributes assigned in `__init__` are closer to
|
|
@@ -75,6 +75,7 @@ src/worktoy/lorem_ipsum/_stochastic_word.py
|
|
|
75
75
|
src/worktoy/lorem_ipsum/_words.py
|
|
76
76
|
src/worktoy/mcls/__init__.py
|
|
77
77
|
src/worktoy/mcls/_abc_meta.py
|
|
78
|
+
src/worktoy/mcls/_abc_object.py
|
|
78
79
|
src/worktoy/mcls/_abc_space.py
|
|
79
80
|
src/worktoy/mcls/_abstract_metaclass.py
|
|
80
81
|
src/worktoy/mcls/_abstract_namespace.py
|
|
File without changes
|