worktoy 1.1.0.dev2__tar.gz → 1.1.0.dev4__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.
Files changed (200) hide show
  1. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/PKG-INFO +2 -2
  2. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/README.md +1 -1
  3. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/pyproject.toml +1 -1
  4. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/__init__.py +1 -1
  5. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/_object.py +127 -47
  6. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/desc/_base_descriptor.py +3 -5
  7. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/space_hooks/_abstract_space_hook.py +1 -4
  8. worktoy-1.1.0.dev4/src/worktoy/mcls/space_hooks/_space_desc.py +90 -0
  9. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy.egg-info/PKG-INFO +2 -2
  10. worktoy-1.1.0.dev2/src/worktoy/mcls/space_hooks/_space_desc.py +0 -46
  11. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/LICENSE +0 -0
  12. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/setup.cfg +0 -0
  13. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/__init__.py +0 -0
  14. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/_instance_owner.py +0 -0
  15. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/_meta_type.py +0 -0
  16. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/control_flow/__init__.py +0 -0
  17. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/control_flow/_control_flow.py +0 -0
  18. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/control_flow/_control_space.py +0 -0
  19. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/control_flow/_meta_flow.py +0 -0
  20. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/control_flow/_skip_set.py +0 -0
  21. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/sentinels/__init__.py +0 -0
  22. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/sentinels/_args.py +0 -0
  23. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/sentinels/_deleted.py +0 -0
  24. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/sentinels/_desc.py +0 -0
  25. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/sentinels/_meta_call.py +0 -0
  26. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/sentinels/_owner.py +0 -0
  27. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/sentinels/_sentinel.py +0 -0
  28. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/core/sentinels/_this.py +0 -0
  29. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/desc/__init__.py +0 -0
  30. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/desc/_alias.py +0 -0
  31. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/desc/_attri_box.py +0 -0
  32. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/desc/_fast_box.py +0 -0
  33. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/desc/_field.py +0 -0
  34. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/desc/_fix_box.py +0 -0
  35. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/desc/_root_alias.py +0 -0
  36. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/desc/_symbolic_name.py +0 -0
  37. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/dispatch/__init__.py +0 -0
  38. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/dispatch/_call_me_maybe.py +0 -0
  39. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/dispatch/_dispatcher.py +0 -0
  40. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/dispatch/_flex_call.py +0 -0
  41. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/dispatch/_overload.py +0 -0
  42. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/dispatch/_permuter.py +0 -0
  43. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/dispatch/_permuter_method.py +0 -0
  44. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/dispatch/_type_sig.py +0 -0
  45. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/ezdata/__init__.py +0 -0
  46. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/ezdata/_ez_data.py +0 -0
  47. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/ezdata/_ez_field.py +0 -0
  48. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/ezdata/_ez_hook.py +0 -0
  49. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/ezdata/_ez_meta.py +0 -0
  50. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/ezdata/_ez_space.py +0 -0
  51. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/ezdata/_ez_store.py +0 -0
  52. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/ezdata/_fields.py +0 -0
  53. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/__init__.py +0 -0
  54. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_access_num.py +0 -0
  55. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_box.py +0 -0
  56. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_flag.py +0 -0
  57. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_flags.py +0 -0
  58. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_flags_hook.py +0 -0
  59. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_flags_meta.py +0 -0
  60. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_flags_space.py +0 -0
  61. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_member.py +0 -0
  62. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_meta.py +0 -0
  63. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_meta_meta.py +0 -0
  64. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_num.py +0 -0
  65. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_space.py +0 -0
  66. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/keenum/_kee_space_hook.py +0 -0
  67. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/lorem_ipsum/__init__.py +0 -0
  68. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/lorem_ipsum/_base_generator.py +0 -0
  69. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/lorem_ipsum/_clause.py +0 -0
  70. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/lorem_ipsum/_gaussian_lengths.py +0 -0
  71. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/lorem_ipsum/_paragraph.py +0 -0
  72. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/lorem_ipsum/_sentence.py +0 -0
  73. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/lorem_ipsum/_stochastic_variable.py +0 -0
  74. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/lorem_ipsum/_stochastic_word.py +0 -0
  75. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/lorem_ipsum/_words.py +0 -0
  76. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/__init__.py +0 -0
  77. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/_abstract_metaclass.py +0 -0
  78. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/_abstract_namespace.py +0 -0
  79. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/_base_meta.py +0 -0
  80. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/_base_object.py +0 -0
  81. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/_base_space.py +0 -0
  82. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/space_hooks/__init__.py +0 -0
  83. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/space_hooks/_flex_call_hook.py +0 -0
  84. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/space_hooks/_load_space_hook.py +0 -0
  85. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/space_hooks/_name_hook.py +0 -0
  86. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/space_hooks/_reserved_names.py +0 -0
  87. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/mcls/space_hooks/_reserved_namespace_hook.py +0 -0
  88. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/py.typed +0 -0
  89. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/__init__.py +0 -0
  90. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_args_count.py +0 -0
  91. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_bipartite_matching.py +0 -0
  92. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_class_body_template.py +0 -0
  93. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_directory.py +0 -0
  94. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_exception_info.py +0 -0
  95. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_join_words.py +0 -0
  96. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_maybe.py +0 -0
  97. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_quick_desc.py +0 -0
  98. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_replace_flex.py +0 -0
  99. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_resolve_mro.py +0 -0
  100. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_slice_len.py +0 -0
  101. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_string_list.py +0 -0
  102. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_text_fmt.py +0 -0
  103. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_type_cast.py +0 -0
  104. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_unpack.py +0 -0
  105. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_valid_slice.py +0 -0
  106. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/_word_wrap.py +0 -0
  107. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/combinatorics/__init__.py +0 -0
  108. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/combinatorics/_arrangement.py +0 -0
  109. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/combinatorics/_arrangements.py +0 -0
  110. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/utilities/combinatorics/_index_permutations.py +0 -0
  111. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/__init__.py +0 -0
  112. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/_missing_variable.py +0 -0
  113. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/_subclass_exception.py +0 -0
  114. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/_type_exception.py +0 -0
  115. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/_uncheckable_type.py +0 -0
  116. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/_unpack_exception.py +0 -0
  117. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/_variable_not_none.py +0 -0
  118. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/_work_toy_exception.py +0 -0
  119. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/control_flow/__init__.py +0 -0
  120. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/__init__.py +0 -0
  121. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_access_error.py +0 -0
  122. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_dangling_alias.py +0 -0
  123. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_descriptor_exception.py +0 -0
  124. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_missing_instance_dict.py +0 -0
  125. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_nameless_callback.py +0 -0
  126. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_not_a_descriptor.py +0 -0
  127. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_overload_reference.py +0 -0
  128. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_phantom_box_error.py +0 -0
  129. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_protected_error.py +0 -0
  130. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_read_only_error.py +0 -0
  131. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_recursive_read.py +0 -0
  132. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_reference_conflict.py +0 -0
  133. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_shared_descriptor.py +0 -0
  134. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_without_exception.py +0 -0
  135. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/desc/_write_once_error.py +0 -0
  136. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/dispatch/__init__.py +0 -0
  137. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/dispatch/_bare_overload.py +0 -0
  138. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/dispatch/_dispatch_exception.py +0 -0
  139. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/dispatch/_duplicate_signature.py +0 -0
  140. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/dispatch/_type_cast_exception.py +0 -0
  141. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/dispatch/_unbound_cast_hook.py +0 -0
  142. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/__init__.py +0 -0
  143. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/_class_field_error.py +0 -0
  144. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/_duplicate_error.py +0 -0
  145. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/_extra_keyword_exception.py +0 -0
  146. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/_extra_positional_exception.py +0 -0
  147. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/_incomplete_field_exception.py +0 -0
  148. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/_kw_only_exception.py +0 -0
  149. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/_repeated_field_exception.py +0 -0
  150. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/_reserved_attribute_error.py +0 -0
  151. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/_reserved_field_error.py +0 -0
  152. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/ezdata/_reserved_method_error.py +0 -0
  153. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/__init__.py +0 -0
  154. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_box_exception.py +0 -0
  155. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_box_type_error.py +0 -0
  156. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_box_value_error.py +0 -0
  157. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_case_exception.py +0 -0
  158. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_duplicate.py +0 -0
  159. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_flag_duplicate.py +0 -0
  160. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_flag_name_error.py +0 -0
  161. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_member_name_error.py +0 -0
  162. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_name_conflict.py +0 -0
  163. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_resolve_error.py +0 -0
  164. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_type_exception.py +0 -0
  165. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/keenum/_kee_write_once_error.py +0 -0
  166. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/__init__.py +0 -0
  167. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_claimed_name.py +0 -0
  168. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_control_class_error.py +0 -0
  169. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_del_exception.py +0 -0
  170. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_duplicate_hook.py +0 -0
  171. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_duplicate_sentinel.py +0 -0
  172. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_hook_exception.py +0 -0
  173. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_illegal_instantiation.py +0 -0
  174. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_mixed_method_kind.py +0 -0
  175. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_overload_conflict.py +0 -0
  176. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_questionable_syntax.py +0 -0
  177. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_rebound_overload.py +0 -0
  178. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_reserved_name.py +0 -0
  179. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_shadowed_class_hook.py +0 -0
  180. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_slots_refused.py +0 -0
  181. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/waitaminute/meta/_unbound_class_hook.py +0 -0
  182. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/__init__.py +0 -0
  183. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/_base_test.py +0 -0
  184. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/_complex_mixin.py +0 -0
  185. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/_complex_test.py +0 -0
  186. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/_sub_test.py +0 -0
  187. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/samplers/__init__.py +0 -0
  188. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/samplers/_base_sampler.py +0 -0
  189. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/samplers/_float_sampler.py +0 -0
  190. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/samplers/_gaussian_sampler.py +0 -0
  191. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/samplers/_int_sampler.py +0 -0
  192. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/samplers/_lorem_sampler.py +0 -0
  193. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/samplers/_lorem_text.py +0 -0
  194. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/samplers/_sampler_meta.py +0 -0
  195. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/samplers/_symbolic_sampler.py +0 -0
  196. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy/work_test/samplers/_word_sampler.py +0 -0
  197. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy.egg-info/SOURCES.txt +0 -0
  198. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy.egg-info/dependency_links.txt +0 -0
  199. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/src/worktoy.egg-info/top_level.txt +0 -0
  200. {worktoy-1.1.0.dev2 → worktoy-1.1.0.dev4}/tests/test_smoke.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: worktoy
3
- Version: 1.1.0.dev2
3
+ Version: 1.1.0.dev4
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: Apache-2.0
@@ -33,7 +33,7 @@ Dynamic: license-file
33
33
  [![PyPI version](https://img.shields.io/pypi/v/worktoy)](https://pypi.org/project/worktoy/)
34
34
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
35
35
 
36
- # worktoy v1.1.0-dev2 (development build)
36
+ # worktoy v1.1.0-dev4 (development build)
37
37
 
38
38
  **worktoy** provides utilities for Python development focused on
39
39
  reducing boilerplate while improving type safety and readability. Each
@@ -4,7 +4,7 @@
4
4
  [![PyPI version](https://img.shields.io/pypi/v/worktoy)](https://pypi.org/project/worktoy/)
5
5
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6
6
 
7
- # worktoy v1.1.0-dev2 (development build)
7
+ # worktoy v1.1.0-dev4 (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
@@ -5,7 +5,7 @@ build-backend = 'setuptools.build_meta'
5
5
 
6
6
  [project]
7
7
  name = "worktoy"
8
- version = "1.1.0-dev2"
8
+ version = "1.1.0-dev4"
9
9
  authors = [
10
10
  { name = "Asger Jon Vistisen", email = "asgerjon2@gmail.com" },
11
11
  ]
@@ -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.1.0-dev2'
51
+ __version__ = '1.1.0-dev4'
52
52
 
53
53
  from . import utilities
54
54
  from . import waitaminute
@@ -6,6 +6,7 @@ Object is the most primitive base class in the 'worktoy' library.
6
6
  from __future__ import annotations
7
7
 
8
8
  import re
9
+ from threading import local
9
10
  from typing import TYPE_CHECKING
10
11
 
11
12
  from ..utilities import Directory, maybe
@@ -25,6 +26,61 @@ if TYPE_CHECKING: # pragma: no cover, no mutate
25
26
  # call.
26
27
  _PRIVATE_KEY_PATTERN = re.compile(r'(?<!^)(?=[A-Z])')
27
28
 
29
+ class _ThreadRecords(local):
30
+ """
31
+ The frames and the read-hook records of every descriptor, kept per
32
+ thread. Each mapping takes 'id(desc)' to '(desc, list)', the list being
33
+ changed in place, since no other thread ever reads it. A record is
34
+ dropped when its list empties. Every thread starts without records, on
35
+ every build and whatever the flag 'thread_inherit_context' says, and a
36
+ frame never outlives the call that pushed it, so an asyncio task
37
+ cannot see the frames of another.
38
+
39
+ Implementation
40
+ --------------
41
+
42
+ The key is 'id(desc)', and an 'id' is unique only among objects alive
43
+ at the same time: once a descriptor is gone, Python may hand its 'id'
44
+ to a new object. A record found under the 'id' of a new descriptor
45
+ would then be the frames of a dead one. That cannot happen here, and
46
+ the reason is the first element of the record. The record holds the
47
+ descriptor itself, so for as long as a record exists its descriptor is
48
+ alive and its 'id' is taken; the record is dropped the moment its
49
+ list empties, and with it the hold. A descriptor dropped by its owner
50
+ while a frame is still open keeps its 'id' until that frame is popped,
51
+ which the pairing of 'createContext' with 'exitContext' guarantees.
52
+ The held descriptor is read by nothing. An identity check against it
53
+ was carried at first and removed, since no input reaches it: the four
54
+ mutants turning it into an equality check all survived the sweep of
55
+ 2026-11-07, which is what an unreachable branch looks like.
56
+ """
57
+
58
+ def __init__(self) -> None:
59
+ """Give the thread empty mappings on its first use"""
60
+ self.chains: dict[int, tuple[Any, list]] = {}
61
+ self.locks: dict[int, tuple[Any, list]] = {}
62
+
63
+
64
+ _THREAD = _ThreadRecords()
65
+
66
+
67
+ def _record(records: dict[int, tuple[Any, list]], desc: Any) -> list:
68
+ """Return the list of 'desc' in 'records', or an empty one"""
69
+ entry: Optional[tuple[Any, list]] = records.get(id(desc))
70
+ if entry is None:
71
+ return []
72
+ return entry[1]
73
+
74
+
75
+ def _readCallChain(self: Any) -> list[tuple[Any, type]]:
76
+ """Return a copy of the frames of 'self' in the current thread"""
77
+ return [*_record(_THREAD.chains, self)]
78
+
79
+
80
+ def _readGetLock(self: Any) -> list[tuple[Any, str]]:
81
+ """Return a copy of the read-hook records of 'self' in this thread"""
82
+ return [*_record(_THREAD.locks, self)]
83
+
28
84
 
29
85
  class Object(metaclass=MetaType):
30
86
  """
@@ -62,9 +118,10 @@ class Object(metaclass=MetaType):
62
118
  left to the metaclass, as for 'type'. A deletion stores 'DELETED',
63
119
  which a read turns into 'MissingVariable'. A read made while a read
64
120
  hook of the same descriptor runs for the same instance is refused with
65
- 'RecursiveRead', since it would run that hook again. The frames live on
66
- the descriptor and are shared by every instance of the owning class, so
67
- the protocol is meant for single-threaded, synchronous code.
121
+ 'RecursiveRead', since it would run that hook again. The frames and the
122
+ read-hook records live in thread-local storage, not on the descriptor,
123
+ so each thread keeps its own, and accesses through the same descriptor
124
+ from several threads do not see each other.
68
125
 
69
126
  Attributes
70
127
  ----------
@@ -90,12 +147,13 @@ class Object(metaclass=MetaType):
90
147
  __key_args__ : dict or None
91
148
  The keyword arguments of the constructor.
92
149
 
93
- __call_chain__ : list or None
94
- The stack of '(instance, owner)' frames.
150
+ __call_chain__ : list
151
+ A copy of the stack of '(instance, owner)' frames in the current
152
+ thread.
95
153
 
96
- __get_lock__ : list or None
97
- The instances whose read hooks are running, each with the name of
98
- the hook, 'preGet' or 'onGet'.
154
+ __get_lock__ : list
155
+ A copy of the instances whose read hooks are running in the current
156
+ thread, each with the name of the hook, 'preGet' or 'onGet'.
99
157
 
100
158
  Examples
101
159
  --------
@@ -124,14 +182,16 @@ class Object(metaclass=MetaType):
124
182
  __private_name__: Optional[str] = None # cached result of 'getPrivateName'
125
183
  __pos_args__: Optional[tuple[Any, ...]] = None
126
184
  __key_args__: Optional[dict[str, Any]] = None
127
- __call_chain__: Optional[list[tuple[Any, type]]] = None
128
- __get_lock__: Optional[list[tuple[Any, str]]] = None
129
185
 
130
186
  # Public Variables
131
187
  directory = Directory()
132
188
  instance = ContextInstance()
133
189
  owner = ContextOwner()
134
190
 
191
+ # Virtual Variables
192
+ __call_chain__ = property(_readCallChain)
193
+ __get_lock__ = property(_readGetLock)
194
+
135
195
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
136
196
  # GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
137
197
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -160,8 +220,9 @@ class Object(metaclass=MetaType):
160
220
  dict[type[Sentinel], Any]
161
221
  The mapping from each placeholder to its value.
162
222
  """
163
- if self.__call_chain__:
164
- instance, owner = self.__call_chain__[-1]
223
+ chain: list = _record(_THREAD.chains, self)
224
+ if chain:
225
+ instance, owner = chain[-1]
165
226
  else:
166
227
  instance, owner = None, None
167
228
  return {
@@ -281,9 +342,10 @@ class Object(metaclass=MetaType):
281
342
  of its box.
282
343
  """
283
344
  if self.hasContext():
284
- if self.__call_chain__ is None:
345
+ chain: list = _record(_THREAD.chains, self)
346
+ if not chain:
285
347
  raise MissingVariable(self, '__call_chain__', list)
286
- return self.__call_chain__[-1][0]
348
+ return chain[-1][0]
287
349
  if self.__field_name__ is None:
288
350
  infoSpec: str = """'%s' object has no attribute 'instance'"""
289
351
  info: str = infoSpec % type(self).__name__
@@ -331,9 +393,10 @@ class Object(metaclass=MetaType):
331
393
  of its box.
332
394
  """
333
395
  if self.hasContext():
334
- if self.__call_chain__ is None:
396
+ chain: list = _record(_THREAD.chains, self)
397
+ if not chain:
335
398
  raise MissingVariable(self, '__call_chain__', list)
336
- return self.__call_chain__[-1][1]
399
+ return chain[-1][1]
337
400
  if self.__field_name__ is None:
338
401
  infoSpec: str = """'%s' object has no attribute 'owner'"""
339
402
  info: str = infoSpec % type(self).__name__
@@ -372,7 +435,7 @@ class Object(metaclass=MetaType):
372
435
  bool
373
436
  Whether a frame is on the stack.
374
437
  """
375
- return bool(self.__call_chain__)
438
+ return bool(_record(_THREAD.chains, self))
376
439
 
377
440
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
378
441
  # CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -388,16 +451,14 @@ class Object(metaclass=MetaType):
388
451
  Implementation
389
452
  --------------
390
453
 
391
- The arguments and an empty stack are written with
392
- 'object.__setattr__', and the next '__init__' along the resolution
393
- order is called without arguments. A subclass taking arguments of its
394
- own passes on to this method the ones meant for 'getPosArgs' and
395
- 'getKeyArgs'.
454
+ The arguments are written with 'object.__setattr__', and the next
455
+ '__init__' along the resolution order is called without arguments. A
456
+ subclass taking arguments of its own passes on to this method the ones
457
+ meant for 'getPosArgs' and 'getKeyArgs'.
396
458
  """
397
459
  # The bookkeeping bypasses any '__setattr__' of a subclass.
398
460
  object.__setattr__(self, '__pos_args__', args)
399
461
  object.__setattr__(self, '__key_args__', kwargs)
400
- object.__setattr__(self, '__call_chain__', [])
401
462
  # The arguments belong to this class, which recorded them above. A
402
463
  # base after it in the resolution order, such as 'threading.Thread',
403
464
  # is initialized without them, as in a plain class.
@@ -505,13 +566,14 @@ class Object(metaclass=MetaType):
505
566
  Implementation
506
567
  --------------
507
568
 
508
- The instances whose read hooks are running are kept in '__get_lock__',
509
- each with the name of its hook. An instance found there is refused
510
- with 'RecursiveRead', naming the hook that runs. Otherwise the instance
511
- is added, the hook called, and the instance removed in a 'finally'
512
- block, so a hook raising leaves later reads as they were. The record
513
- is written with 'object.__setattr__', past any '__setattr__' of a
514
- subclass.
569
+ The instances whose read hooks are running in the current thread are
570
+ kept in the thread-local records, each with the name of its hook. An
571
+ instance found there is refused with 'RecursiveRead', naming the hook
572
+ that runs. Otherwise the instance is added, the hook called, and the
573
+ instance removed in a 'finally' block, so a hook raising leaves later
574
+ reads as they were. Hooks of one thread nest, so the instance removed
575
+ is always the last one added. A read of the same instance from another
576
+ thread has records of its own, and is not refused.
515
577
 
516
578
  Parameters
517
579
  ----------
@@ -534,17 +596,24 @@ class Object(metaclass=MetaType):
534
596
  RecursiveRead
535
597
  A read hook of this descriptor runs for the instance already.
536
598
  """
537
- locked = maybe(self.__get_lock__, [])
538
- for held, runningPhase in locked:
539
- if held is instance:
540
- raise RecursiveRead(self, instance, runningPhase)
541
- object.__setattr__(self, '__get_lock__', [*locked, (instance, phase)])
599
+ records: dict[int, tuple[Any, list]] = _THREAD.locks
600
+ key: int = id(self)
601
+ entry: Optional[tuple[Any, list]] = records.get(key)
602
+ if entry is None:
603
+ entry = (self, [])
604
+ records[key] = entry
605
+ else:
606
+ for held, runningPhase in entry[1]:
607
+ if held is instance:
608
+ raise RecursiveRead(self, instance, runningPhase)
609
+ locked: list[tuple[Any, str]] = entry[1]
610
+ locked.append((instance, phase))
542
611
  try:
543
612
  hook(instance, *args)
544
613
  finally:
545
- locked = maybe(self.__get_lock__, [])
546
- remaining = [pair for pair in locked if pair[0] is not instance]
547
- object.__setattr__(self, '__get_lock__', remaining)
614
+ locked.pop()
615
+ if not locked:
616
+ del records[key]
548
617
 
549
618
  def __set__(self, instance: Any, newValue: Any, **kwargs) -> None:
550
619
  """
@@ -766,8 +835,9 @@ class Object(metaclass=MetaType):
766
835
  Implementation
767
836
  --------------
768
837
 
769
- The frame is appended to a new copy of the stack. Every call is paired
770
- with one call of 'exitContext', in a 'finally' block.
838
+ The frame is appended to the stack of the current thread, which is
839
+ made when the descriptor has none. Every call is paired with one call
840
+ of 'exitContext', in a 'finally' block.
771
841
 
772
842
  Parameters
773
843
  ----------
@@ -784,9 +854,13 @@ class Object(metaclass=MetaType):
784
854
  Object
785
855
  The descriptor itself.
786
856
  """
787
- existing: list[tuple[Any, type]] = maybe(self.__call_chain__, [])
788
- updated: list[tuple[Any, type]] = [*existing, (instance, owner), ]
789
- object.__setattr__(self, '__call_chain__', updated)
857
+ records: dict[int, tuple[Any, list]] = _THREAD.chains
858
+ key: int = id(self)
859
+ entry: Optional[tuple[Any, list]] = records.get(key)
860
+ if entry is None:
861
+ records[key] = (self, [(instance, owner)])
862
+ else:
863
+ entry[1].append((instance, owner))
790
864
  return self
791
865
 
792
866
  def exitContext(self) -> Self:
@@ -798,7 +872,8 @@ class Object(metaclass=MetaType):
798
872
  Implementation
799
873
  --------------
800
874
 
801
- The stack is replaced by a copy without its top frame.
875
+ The top frame of the stack of the current thread is removed, and the
876
+ stack is dropped when it empties.
802
877
 
803
878
  Returns
804
879
  -------
@@ -812,10 +887,15 @@ class Object(metaclass=MetaType):
812
887
  WithoutException
813
888
  The stack is empty.
814
889
  """
815
- if not self.__call_chain__:
890
+ records: dict[int, tuple[Any, list]] = _THREAD.chains
891
+ key: int = id(self)
892
+ entry: Optional[tuple[Any, list]] = records.get(key)
893
+ if entry is None:
816
894
  raise WithoutException(self)
817
- updated: list[tuple[Any, type]] = self.__call_chain__[:-1]
818
- object.__setattr__(self, '__call_chain__', updated)
895
+ frames: list[tuple[Any, type]] = entry[1]
896
+ frames.pop()
897
+ if not frames:
898
+ del records[key]
819
899
  return self
820
900
 
821
901
  def _deletedGuard(self, instance: Any, value: Any, ) -> Any:
@@ -359,8 +359,9 @@ class BaseDescriptor(Object, Generic[T]):
359
359
  --------------
360
360
 
361
361
  The instance dictionary is copied field by field, except the owner,
362
- the field name, '__private_name__', the stack of frames, which starts
363
- empty, and the record of the read hooks running. A subclass keeping a
362
+ the field name and '__private_name__'. The stack of frames and the
363
+ record of the read hooks running are kept per context outside the
364
+ descriptor, so the copy starts with neither. A subclass keeping a
364
365
  cache built from the field name clears it when the copy is placed.
365
366
 
366
367
  Returns
@@ -375,14 +376,11 @@ class BaseDescriptor(Object, Generic[T]):
375
376
  '__field_owner__',
376
377
  '__field_name__',
377
378
  '__private_name__',
378
- '__call_chain__',
379
- '__get_lock__',
380
379
  )
381
380
  for key, value in vars(self).items():
382
381
  if key in skipped:
383
382
  continue
384
383
  object.__setattr__(new, key, value)
385
- object.__setattr__(new, '__call_chain__', [])
386
384
  return new
387
385
 
388
386
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -70,9 +70,6 @@ class AbstractSpaceHook(Object):
70
70
  # NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
71
71
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
72
72
 
73
- # Private variables
74
- __space_object__: Optional[AbstractNamespace] = None
75
-
76
73
  # Public variables
77
74
  space: SpaceDesc[AbstractNamespace] = SpaceDesc()
78
75
 
@@ -279,5 +276,5 @@ class AbstractSpaceHook(Object):
279
276
  """
280
277
  if instance is None:
281
278
  return self
282
- self.__space_object__ = instance
279
+ self.space = instance
283
280
  return self
@@ -0,0 +1,90 @@
1
+ """
2
+ SpaceDesc is the descriptor exposing the namespace to an
3
+ 'AbstractSpaceHook'.
4
+ """
5
+ # Apache-2.0 license
6
+ # Copyright (c) 2025-2026 Asger Jon Vistisen
7
+ from __future__ import annotations
8
+
9
+ import threading
10
+ from typing import TYPE_CHECKING, overload, Generic, TypeVar
11
+
12
+ if TYPE_CHECKING: # pragma: no cover, no mutate
13
+ from typing import Any, Optional, Union, Self
14
+
15
+ from . import AbstractSpaceHook as Hook
16
+
17
+ NamespaceT = TypeVar('NamespaceT')
18
+
19
+
20
+ class _ThreadSpaces(threading.local):
21
+ """
22
+ The namespace each hook is bound to, kept per thread. A hook is one
23
+ object on its namespace class, shared by every class statement that
24
+ runs under that class, and the namespace reads it anew before every
25
+ phase, binding it to itself. Two threads running class statements at
26
+ once would otherwise bind the same hook in turn, and a phase of one
27
+ thread would read the namespace of the other, finding names it never
28
+ bound and registering overloads in a body not its own. Kept per
29
+ thread, a binding is seen only by the thread that made it.
30
+
31
+ Implementation
32
+ --------------
33
+
34
+ 'bound' maps 'id(hook)' to '(hook, namespace)'. The hook is held in the
35
+ entry so that its 'id' stays taken for as long as the entry exists,
36
+ and a new hook can never find the namespace of a dead one under a
37
+ reused 'id'; nothing reads the held hook. Entries are replaced at every
38
+ binding and never dropped, as the binding on the hook itself was never
39
+ cleared before: a hook keeps the last namespace it worked for, per
40
+ thread now rather than once for all threads.
41
+ """
42
+
43
+ def __init__(self) -> None:
44
+ """Give the thread an empty mapping on its first use"""
45
+ self.bound: dict[int, tuple[Any, Any]] = {}
46
+
47
+
48
+ _THREAD = _ThreadSpaces()
49
+
50
+
51
+ class SpaceDesc(Generic[NamespaceT]):
52
+ """
53
+ A hook method must reach the namespace whose class body it is working
54
+ on, and one hook object serves every namespace of its class, from
55
+ whichever thread a class statement runs in.
56
+
57
+ Implementation
58
+ --------------
59
+
60
+ Through a hook, the descriptor returns the namespace the hook was last
61
+ bound to in the current thread, or 'None' before any binding; through
62
+ the class, itself. A write through a hook binds it, in the current
63
+ thread alone.
64
+ """
65
+
66
+ # @formatter:off
67
+ @overload
68
+ def __get__(self, instance: None, owner: type) -> Self: ...
69
+ @overload
70
+ def __get__(self, instance: Hook, owner: type) -> NamespaceT: ...
71
+ # @formatter:on
72
+
73
+ def __get__(self, instance: Any, owner: type) -> Union[Self, NamespaceT]:
74
+ """
75
+ Accessed on a hook instance, '__get__' returns the namespace bound to
76
+ that hook in the current thread; accessed on the class, it returns
77
+ the descriptor itself.
78
+ """
79
+ if instance is None:
80
+ return self
81
+ entry: Optional[tuple[Any, Any]] = _THREAD.bound.get(id(instance))
82
+ if entry is None:
83
+ return None
84
+ return entry[1]
85
+
86
+ def __set__(self, instance: Hook, value: NamespaceT) -> None:
87
+ """
88
+ A write binds the hook to the namespace, in the current thread.
89
+ """
90
+ _THREAD.bound[id(instance)] = (instance, value)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: worktoy
3
- Version: 1.1.0.dev2
3
+ Version: 1.1.0.dev4
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: Apache-2.0
@@ -33,7 +33,7 @@ Dynamic: license-file
33
33
  [![PyPI version](https://img.shields.io/pypi/v/worktoy)](https://pypi.org/project/worktoy/)
34
34
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
35
35
 
36
- # worktoy v1.1.0-dev2 (development build)
36
+ # worktoy v1.1.0-dev4 (development build)
37
37
 
38
38
  **worktoy** provides utilities for Python development focused on
39
39
  reducing boilerplate while improving type safety and readability. Each
@@ -1,46 +0,0 @@
1
- """
2
- SpaceDesc is the descriptor exposing the namespace to an
3
- 'AbstractSpaceHook'.
4
- """
5
- # Apache-2.0 license
6
- # Copyright (c) 2025-2026 Asger Jon Vistisen
7
- from __future__ import annotations
8
-
9
- from typing import TYPE_CHECKING, overload, Generic, TypeVar
10
-
11
- if TYPE_CHECKING: # pragma: no cover, no mutate
12
- from typing import Any, Union, Self
13
-
14
- from . import AbstractSpaceHook as Hook
15
-
16
- NamespaceT = TypeVar('NamespaceT')
17
-
18
-
19
- class SpaceDesc(Generic[NamespaceT]):
20
- """
21
- A hook method must reach the namespace whose class body it is working
22
- on, and one hook object serves every namespace of its class.
23
-
24
- Implementation
25
- --------------
26
-
27
- Through a hook, the descriptor returns '__space_object__', the
28
- namespace that last read the hook; through the class, itself.
29
- """
30
-
31
- # @formatter:off
32
- @overload
33
- def __get__(self, instance: None, owner: type) -> Self: ...
34
- @overload
35
- def __get__(self, instance: Hook, owner: type) -> NamespaceT: ...
36
- # @formatter:on
37
-
38
- def __get__(self, instance: Any, owner: type) -> Union[Self, NamespaceT]:
39
- """
40
- Accessed on a hook instance, '__get__' returns the namespace object
41
- bound to that hook; accessed on the class, it returns the descriptor
42
- itself.
43
- """
44
- if instance is None:
45
- return self
46
- return object.__getattribute__(instance, '__space_object__')
File without changes
File without changes