python-constricter 0.4.6__tar.gz → 0.4.7__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 (202) hide show
  1. {python_constricter-0.4.6 → python_constricter-0.4.7}/.gitignore +10 -0
  2. {python_constricter-0.4.6 → python_constricter-0.4.7}/PKG-INFO +2 -1
  3. {python_constricter-0.4.6 → python_constricter-0.4.7}/README.md +1 -0
  4. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/_version.py +1 -1
  5. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/explain.py +15 -1
  6. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/lsp/hints.py +6 -2
  7. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/lsp/protocol.py +7 -3
  8. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/options.py +2 -1
  9. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/rounds.py +6 -4
  10. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/source.json +1 -1
  11. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/doubts.py +94 -2
  12. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/hinted.py +18 -2
  13. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/offences.py +2 -1
  14. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/recording.py +29 -10
  15. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/late.py +2 -2
  16. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/scope.py +12 -4
  17. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/trace.py +1 -1
  18. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/witness.py +183 -24
  19. {python_constricter-0.4.6 → python_constricter-0.4.7}/pyproject.toml +4 -3
  20. {python_constricter-0.4.6 → python_constricter-0.4.7}/LICENSE.md +0 -0
  21. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/__init__.py +0 -0
  22. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/__main__.py +0 -0
  23. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/__init__.py +0 -0
  24. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/baseline.py +0 -0
  25. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/collecting.py +0 -0
  26. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/command.py +0 -0
  27. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/config.py +0 -0
  28. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/lsp/__init__.py +0 -0
  29. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/lsp/connection.py +0 -0
  30. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/lsp/edits.py +0 -0
  31. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/lsp/guard.py +0 -0
  32. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/lsp/remembered.py +0 -0
  33. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/lsp/stored.py +0 -0
  34. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/paths.py +0 -0
  35. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/reading.py +0 -0
  36. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/report.py +0 -0
  37. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/runs.py +0 -0
  38. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/schedule.py +0 -0
  39. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/cli/workers.py +0 -0
  40. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/empty.py +0 -0
  41. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/__init__.py +0 -0
  42. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/core/__init__.py +0 -0
  43. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/core/asked.py +0 -0
  44. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/core/fixes.py +0 -0
  45. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/core/imports.py +0 -0
  46. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/core/inherited.py +0 -0
  47. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/core/known.py +0 -0
  48. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/core/signatures.py +0 -0
  49. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/__init__.py +0 -0
  50. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/across.py +0 -0
  51. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/annotated.py +0 -0
  52. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/awaits.py +0 -0
  53. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/beyond.py +0 -0
  54. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/callers.py +0 -0
  55. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/consistent.py +0 -0
  56. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/crossed.py +0 -0
  57. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/decorated.py +0 -0
  58. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/fixtures.py +0 -0
  59. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/linked.py +0 -0
  60. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/loose.py +0 -0
  61. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/managed.py +0 -0
  62. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/modules.py +0 -0
  63. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/offers.py +0 -0
  64. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/order.py +0 -0
  65. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/origins.py +0 -0
  66. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/own_methods.py +0 -0
  67. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/own_overloads.py +0 -0
  68. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/own_stubs.py +0 -0
  69. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/own_types.py +0 -0
  70. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/params.py +0 -0
  71. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/plain.py +0 -0
  72. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/project.py +0 -0
  73. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/sides.py +0 -0
  74. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/spelling.py +0 -0
  75. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/strings.py +0 -0
  76. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/__init__.py +0 -0
  77. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/atoms.py +0 -0
  78. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/chained.py +0 -0
  79. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/classnames.py +0 -0
  80. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/declared.py +0 -0
  81. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/installed.py +0 -0
  82. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/lone.py +0 -0
  83. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/names.py +0 -0
  84. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/read.py +0 -0
  85. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/signatures.py +0 -0
  86. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/stubs/stubbed.py +0 -0
  87. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/taken.py +0 -0
  88. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/tuples.py +0 -0
  89. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/index/used.py +0 -0
  90. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/libraries/__init__.py +0 -0
  91. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/libraries/generics.py +0 -0
  92. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/libraries/library.py +0 -0
  93. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/libraries/opened.py +0 -0
  94. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/libraries/operators.py +0 -0
  95. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/libraries/overloads.py +0 -0
  96. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/libraries/receivers.py +0 -0
  97. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/libraries/stdlib.py +0 -0
  98. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/libraries/walks.py +0 -0
  99. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/aliases.json +0 -0
  100. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/attributes.json +0 -0
  101. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/awaited.json +0 -0
  102. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/awaited_overloads.json +0 -0
  103. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/bases.json +0 -0
  104. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/classes.json +0 -0
  105. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/elements.json +0 -0
  106. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/functions.json +0 -0
  107. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/generic_attributes.json +0 -0
  108. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/method_overloads.json +0 -0
  109. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/method_signatures.json +0 -0
  110. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/methods.json +0 -0
  111. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/overloads.json +0 -0
  112. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/platform.json +0 -0
  113. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/returns.json +0 -0
  114. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/scalar_members.json +0 -0
  115. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/scalars.json +0 -0
  116. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/subscriptable.json +0 -0
  117. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/type_parameters.json +0 -0
  118. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/tables/variables.json +0 -0
  119. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/__init__.py +0 -0
  120. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/aliased.py +0 -0
  121. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/bodies.py +0 -0
  122. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/callables.py +0 -0
  123. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/called.py +0 -0
  124. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/classvars.py +0 -0
  125. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/decided.py +0 -0
  126. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/displays.py +0 -0
  127. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/documented.py +0 -0
  128. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/echoed.py +0 -0
  129. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/entered.py +0 -0
  130. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/fills.py +0 -0
  131. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/guesses.py +0 -0
  132. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/inference.py +0 -0
  133. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/loops.py +0 -0
  134. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/members.py +0 -0
  135. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/narrowed.py +0 -0
  136. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/operated.py +0 -0
  137. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/ordered.py +0 -0
  138. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/reads.py +0 -0
  139. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/refused.py +0 -0
  140. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/returned.py +0 -0
  141. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/returns.py +0 -0
  142. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/shapes.py +0 -0
  143. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/stored.py +0 -0
  144. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/tables.py +0 -0
  145. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/targets.py +0 -0
  146. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/fix/values/unchecked.py +0 -0
  147. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/jsonc.py +0 -0
  148. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/noqa.py +0 -0
  149. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/notebook.py +0 -0
  150. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/overrides.py +0 -0
  151. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/plugins/__init__.py +0 -0
  152. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/plugins/flake8.py +0 -0
  153. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/plugins/options.py +0 -0
  154. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/plugins/pylint.py +0 -0
  155. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/py.typed +0 -0
  156. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/__init__.py +0 -0
  157. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/attributes.py +0 -0
  158. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/binding.py +0 -0
  159. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/calls.py +0 -0
  160. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/checker.py +0 -0
  161. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/narrowing.py +0 -0
  162. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/parameters.py +0 -0
  163. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/rebinding.py +0 -0
  164. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/rebound.py +0 -0
  165. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/recorded.py +0 -0
  166. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/redundant.py +0 -0
  167. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/returning.py +0 -0
  168. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/scoped.py +0 -0
  169. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/scoping.py +0 -0
  170. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/settings.py +0 -0
  171. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/signatures.py +0 -0
  172. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/rules/widened.py +0 -0
  173. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/__init__.py +0 -0
  174. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/annotations.py +0 -0
  175. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/concrete.py +0 -0
  176. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/declarations.py +0 -0
  177. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/decorators.py +0 -0
  178. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/flow.py +0 -0
  179. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/inert.py +0 -0
  180. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/keys.py +0 -0
  181. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/parsed.py +0 -0
  182. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/quoted.py +0 -0
  183. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/syntax.py +0 -0
  184. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/usable.py +0 -0
  185. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/source/walked.py +0 -0
  186. {python_constricter-0.4.6 → python_constricter-0.4.7}/constricter/traced.py +0 -0
  187. {python_constricter-0.4.6 → python_constricter-0.4.7}/hatch_build.py +0 -0
  188. {python_constricter-0.4.6 → python_constricter-0.4.7}/mypyc.txt +0 -0
  189. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/__init__.py +0 -0
  190. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/__main__.py +0 -0
  191. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/accepting.py +0 -0
  192. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/configured.py +0 -0
  193. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/elements.py +0 -0
  194. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/forms.py +0 -0
  195. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/generate.py +0 -0
  196. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/overloads.py +0 -0
  197. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/partial.json +0 -0
  198. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/reading.py +0 -0
  199. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/shed.py +0 -0
  200. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/stubs.py +0 -0
  201. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/templates.py +0 -0
  202. {python_constricter-0.4.6 → python_constricter-0.4.7}/stdlib_tables/written.py +0 -0
@@ -40,6 +40,7 @@ CLAUDE.local.md
40
40
  # values, so it stays tracked.
41
41
  .env
42
42
  .env.*
43
+ *.env
43
44
  !.env.example
44
45
  .envrc
45
46
  .direnv/
@@ -82,6 +83,15 @@ __pycache__/
82
83
  # A local Jekyll build of the docs site; CI builds the real one.
83
84
  _site/
84
85
  .jekyll-cache/
86
+ # `nix build`'s links to what it built.
87
+ /result
88
+ /result-*
89
+ # OpenTofu and Terraform working state, which can hold addresses, key names
90
+ # and secrets.
91
+ .terraform/
92
+ *.tfstate
93
+ *.tfstate.*
94
+ *.tfvars
85
95
  # Not used in this project; kept out so stray editor or tooling output isn't
86
96
  # committed by accident.
87
97
  *.js
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-constricter
3
- Version: 0.4.6
3
+ Version: 0.4.7
4
4
  Import-Name: constricter
5
5
  Summary: Lint rules: every local variable is typed where it's first bound. A flake8 plugin, a pylint plugin and a standalone CLI.
6
6
  Author: Ivy Duggan
@@ -108,6 +108,7 @@ class bodies too. Statements are read in source order, and only a name's first b
108
108
  | `LVA013` | opt-in: an instance attribute a plain class's method first stores, declared nowhere in it | `self.x: T = ...` |
109
109
  | `LVA014` | opt-in: a plain function that declares no return type | `def f(...) -> T:` |
110
110
  | `LVA015` | opt-in: a parameter with no annotation | `def f(x: T):` |
111
+ | `LVA016` | with `python -m constricter.trace --check`: an annotation a traced value differed from | fix the value, or the annotation |
111
112
 
112
113
  Exempt: comprehensions, `except ... as`, imports, `def`/`class`, `type` aliases, parameters,
113
114
  `global`/`nonlocal`, and `_`; in module and class bodies, dunder names (`__all__`, `__slots__`) and
@@ -81,6 +81,7 @@ class bodies too. Statements are read in source order, and only a name's first b
81
81
  | `LVA013` | opt-in: an instance attribute a plain class's method first stores, declared nowhere in it | `self.x: T = ...` |
82
82
  | `LVA014` | opt-in: a plain function that declares no return type | `def f(...) -> T:` |
83
83
  | `LVA015` | opt-in: a parameter with no annotation | `def f(x: T):` |
84
+ | `LVA016` | with `python -m constricter.trace --check`: an annotation a traced value differed from | fix the value, or the annotation |
84
85
 
85
86
  Exempt: comprehensions, `except ... as`, imports, `def`/`class`, `type` aliases, parameters,
86
87
  `global`/`nonlocal`, and `_`; in module and class bodies, dunder names (`__all__`, `__slots__`) and
@@ -1,3 +1,3 @@
1
1
  """The version this was built as, from its git tag (written by the build, not tracked)."""
2
2
 
3
- __version__ = "0.4.6"
3
+ __version__ = "0.4.7"
@@ -12,6 +12,7 @@ from constricter.offences import (
12
12
  NESTED_TYPE,
13
13
  OPT_IN,
14
14
  REDUNDANT_TYPE,
15
+ TRACED,
15
16
  UNANNOTATED,
16
17
  UNANNOTATED_ATTRIBUTE,
17
18
  UNANNOTATED_MEMBER,
@@ -106,13 +107,26 @@ _WHY: Final = {
106
107
  }
107
108
 
108
109
 
110
+ # What a traced run reports (`python -m constricter.trace --check`), which no check does.
111
+ _TRACED_MESSAGE: Final = "an annotation a traced run's value differed from"
112
+ _TRACED_WHY: Final = (
113
+ "A run of the code (its tests, say) held each annotated parameter, local and return to what\n"
114
+ "it was bound to, and one value wasn't what the annotation says: `count: int` given a `str`.\n"
115
+ "Fix the annotation or the value. A cast narrowing a value on purpose to the part the code uses\n"
116
+ "(a JSON document read as a `TypedDict`) can say so: `# noqa: LVA016` on its line."
117
+ )
118
+ _TRACED_BY: Final = "reported by `python -m constricter.trace --check` alone"
119
+
120
+
109
121
  def explain(code: str) -> str:
110
122
  """Explain `code`.
111
123
 
112
124
  Returns:
113
- Its message, rationale and the levels that report it.
125
+ Its message, rationale and the levels that report it; for `TRACED`, what reports it.
114
126
 
115
127
  """
128
+ if code == TRACED:
129
+ return f"{code}: {_TRACED_MESSAGE}\n\n{_TRACED_WHY}\n\n{_TRACED_BY}\n"
116
130
  offence: Offence = Offence(1, 0, "name", code)
117
131
  levels: list[str] = [
118
132
  f"{level.name.lower()}: {'error' if offence.is_error(level) else 'warning'}"
@@ -1,7 +1,8 @@
1
1
  """`--infer-with`: ask a type checker's language server what type each untyped name has.
2
2
 
3
- Each checker's servers are started once (each round, asked in turn: see `Asking`), over standard
4
- input and output, with the project root as their workspace, and work at once (see `Session`); each
3
+ Each checker's servers are started once (each round, asked in turn, see `Asking`, or a stale
4
+ checker's, see `Server.stale`), over standard input and output, with the project root as their
5
+ workspace, and work at once (see `Session`); each
5
6
  file is opened with the text constricter read, and its inlay hints asked for over the whole file. A
6
7
  variable-type hint (`: int`) sits just after the name it types: that end is its key, as the line
7
8
  (from 1) and the UTF-8 byte column `ast` gives the name's end. What the hint says is
@@ -121,6 +122,9 @@ class Session:
121
122
  turns: list[list[Checker]] = [[checker] for checker in asking] if self.how.in_turn else [asking]
122
123
  turn: list[Checker]
123
124
  for turn in turns:
125
+ for checker in turn:
126
+ if checker.server.stale:
127
+ checker.stop()
124
128
  _asked(files, turn, found)
125
129
  for checker in turn if self.how.in_turn else ():
126
130
  checker.stop()
@@ -35,7 +35,9 @@ class Server(NamedTuple):
35
35
  Its executable, the arguments that start it over stdio, and the most of it to run (up to
36
36
  `MAX_SERVERS`). And the memory its servers take, as measured: `memory` bytes each before the
37
37
  files, and `per_byte` more for each byte of them: each server's again where each holds the
38
- `whole` program, once among them all where each holds what it's asked about.
38
+ `whole` program, once among them all where each holds what it's asked about. A `stale` one goes
39
+ on answering from what it read of a file before its new text was sent: its servers are started
40
+ anew for each round of files after their first.
39
41
  """
40
42
 
41
43
  executable: str
@@ -45,6 +47,7 @@ class Server(NamedTuple):
45
47
  per_byte: int
46
48
  whole: bool = False
47
49
  node: bool = False # it runs on Node, whose heap its share of the memory caps (`--max-old-space-size`)
50
+ stale: bool = False
48
51
 
49
52
  def fitting(self, budget: int, size: int) -> int:
50
53
  """Count the servers that fit in `budget` bytes, for files of `size` bytes together.
@@ -75,8 +78,9 @@ SERVERS: Final = {
75
78
  # with two, 22s with three and 21s with four (1.2 GB with one, 1.7 with two, 2.5 with four).
76
79
  "ty": Server("ty", ("server",), MAX_SERVERS, 420 << 20, 38),
77
80
  # Parallel too: pandas's takes 132s with one, 58s with two and 32s with four (2.8 GB, 3.2, 4.2);
78
- # the standard library's 39 MB, 4.3 GB with one and 5.6 with four.
79
- "pyrefly": Server("pyrefly", ("lsp",), MAX_SERVERS, 480 << 20, 120),
81
+ # the standard library's 39 MB, 4.3 GB with one and 5.6 with four. Stale (1.3.2): a server kept
82
+ # from the round before gave pip 32 fewer fixes, which a second pass then made.
83
+ "pyrefly": Server("pyrefly", ("lsp",), MAX_SERVERS, 480 << 20, 120, stale=True),
80
84
  }
81
85
  _PROBE: Final = "--version" # quick for each; basedpyright-langserver's exits 1 all the same
82
86
  _PROBE_TIMEOUT: Final = 10.0 # seconds it may take
@@ -32,6 +32,7 @@ from constricter.offences import (
32
32
  NESTING,
33
33
  OPT_IN,
34
34
  PLAIN_BASES,
35
+ TRACED,
35
36
  UNANNOTATED_ATTRIBUTE,
36
37
  UNANNOTATED_PARAMETER,
37
38
  UNANNOTATED_RETURN,
@@ -450,7 +451,7 @@ def _parser() -> argparse.ArgumentParser:
450
451
  )
451
452
  _ = parser.add_argument(
452
453
  "--explain",
453
- choices=list(MESSAGES),
454
+ choices=[*MESSAGES, TRACED],
454
455
  metavar="CODE",
455
456
  help="explain a code and exit",
456
457
  )
@@ -42,9 +42,11 @@ def settled(
42
42
  """Check every file, then again each one `--fix` changed in a way a second check would see.
43
43
 
44
44
  Until a round changes nothing, `HINT_ROUNDS` at most: a second pass is then left nothing. With
45
- `--likely` or `--unsafe-fixes` and no type checker's hints, the files a round changed are indexed
46
- again, and the others checked again too where that changes what they know from outside: what
47
- reads a guess another file declares (an attribute LVA013's declares) now knows its type.
45
+ `--likely` or `--unsafe-fixes`, the files a round changed are indexed again, and the others
46
+ checked again too where that changes what they know from outside: what reads a guess another
47
+ file declares (an attribute LVA013's declares) now knows its type. With a type checker's hints,
48
+ every file is asked about again then, and checked again where its hints changed: a checker can
49
+ type a name once another file's fix is written.
48
50
 
49
51
  Returns:
50
52
  What each file found, a file's rounds joined.
@@ -60,7 +62,7 @@ def settled(
60
62
  session,
61
63
  )
62
64
  fixing: bool = options.mode is Mode.FIX
63
- onward: bool = fixing and session is None and options.guesses is not Guesses.NONE
65
+ onward: bool = fixing and options.guesses is not Guesses.NONE
64
66
  # A signature written (LVA014, LVA015) changes what the other files know of the file whatever
65
67
  # the guesses: it's indexed again, and they're checked again where that reaches them.
66
68
  signing: bool = fixing and session is None and (options.checks.returns or options.checks.parameters)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "basedpyright": "1.40.2",
3
- "digest": "7f28d4a8acd3cc27796ea72676d594333f2c974a63eae626649e366d90202ce7",
3
+ "digest": "f944124e346912069bd9426dfe2013307b2c7ef2bf801937825eaa3a487a3c59",
4
4
  "tables": [
5
5
  "aliases",
6
6
  "attributes",
@@ -15,6 +15,7 @@
15
15
 
16
16
  import ast
17
17
  import bisect
18
+ from collections import Counter
18
19
  from collections.abc import Mapping, Sequence
19
20
  from dataclasses import dataclass
20
21
  from functools import lru_cache
@@ -22,7 +23,7 @@ from types import MappingProxyType
22
23
  from typing import Final, NamedTuple, TypeAlias, cast
23
24
 
24
25
  from constricter.fix.core.imports import checking, inner_imports, nested_classes, rebound_names
25
- from constricter.fix.core.known import ImportPlan, Inference, Passed
26
+ from constricter.fix.core.known import ImportPlan, Inference, Known, Passed
26
27
  from constricter.fix.values.narrowed import Regions, regions
27
28
  from constricter.fix.values.shapes import COMPREHENSIONS, Comprehension, is_none
28
29
  from constricter.offences import CONSTRUCTOR
@@ -30,7 +31,7 @@ from constricter.source.annotations import node_name, roots
30
31
  from constricter.source.declarations import generic_classes
31
32
  from constricter.source.flow import members
32
33
  from constricter.source.quoted import parsed
33
- from constricter.source.syntax import FunctionDef, Start, within
34
+ from constricter.source.syntax import FunctionDef, Start, own_nodes, within
34
35
  from constricter.source.walked import classes, of_type, walk
35
36
 
36
37
  # What a copy, an attribute and a subscript of a narrowable union rest on, as guesses.
@@ -56,6 +57,10 @@ _CLASS_OF: Final = "type[{}]" # how `type(self)` is
56
57
  _INSTANCE: Final = "self" # a method's first parameter: any other name is a classmethod's class
57
58
  _EXTENSIONS: Final = "typing_extensions"
58
59
  _TYPING: Final = frozenset({"typing", _EXTENSIONS})
60
+ _ENUM_ENDINGS: Final = ("Enum", "Flag") # how `enum`'s classes' names end (`IntEnum`, `StrEnum`, `IntFlag`)
61
+ _DEFINITIONS: Final = (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)
62
+ FINAL_KIND: Final = "final" # the fix kind of a `Final` (LVA012's, or one that keeps a `Literal`)
63
+ TYPING_FINAL: Final = "typing.Final"
59
64
 
60
65
 
61
66
  @dataclass(frozen=True, eq=False) # hashed by identity: a module's, cached with each function
@@ -104,6 +109,8 @@ class Facts(NamedTuple):
104
109
  # The classes defined in a class's body, and the class naming each (see `imports.nested_classes`).
105
110
  nested: Mapping[str, str] = MappingProxyType({})
106
111
  excused: tuple[int, ...] = () # the lines (from 0) a type-ignore comment is on, sorted (`late.excusing`)
112
+ enums: frozenset[str] = frozenset() # the enums its body defines (see `enums`)
113
+ once: frozenset[str] = frozenset() # what its own scope binds once (see `bound_once`)
107
114
 
108
115
 
109
116
  def facts(
@@ -140,9 +147,94 @@ def facts(
140
147
  rebound=rebound_names(tree),
141
148
  lazy=[(stmt.lineno, stmt.col_offset) for stmt in inner_imports(tree)],
142
149
  nested=nested_classes(tree),
150
+ enums=enums(tree),
151
+ once=bound_once(tree),
143
152
  )
144
153
 
145
154
 
155
+ def enums(tree: ast.Module) -> frozenset[str]:
156
+ """Name the enums a module's body defines: a class with a base named as one, or a call making one.
157
+
158
+ `class State(enum.IntEnum)`, `_SENTINEL = enum.Enum("_SENTINEL", "sentinel")`: a base or a
159
+ factory whose name ends in `Enum` or `Flag`, as `enum`'s do.
160
+
161
+ Returns:
162
+ Their names.
163
+
164
+ """
165
+ found: set[str] = set()
166
+ stmt: ast.stmt
167
+ for stmt in tree.body:
168
+ if isinstance(stmt, ast.ClassDef) and any(_enum_named(base) for base in stmt.bases):
169
+ found.add(stmt.name)
170
+ elif (
171
+ isinstance(stmt, ast.Assign) and isinstance(stmt.value, ast.Call) and _enum_named(stmt.value.func)
172
+ ):
173
+ found.update(target.id for target in stmt.targets if isinstance(target, ast.Name))
174
+ return frozenset(found)
175
+
176
+
177
+ def _enum_named(node: ast.expr) -> bool: # `Enum`, `enum.IntFlag`, ...
178
+ return node_name(node).endswith(_ENUM_ENDINGS)
179
+
180
+
181
+ def sentinel(name: str, value: ast.expr, hint: Inference, module: Facts, known: Known) -> Inference | None:
182
+ """Declare a module's constant `Final`, not the enum a hint says, where it's bound to the enum's member.
183
+
184
+ `NO_DEFAULT = _NoDefault.no_default`, hinted `_NoDefault`: declared so, the constant loses its
185
+ member's `Literal` type, and pyright no longer narrows `x is NO_DEFAULT`; `Final` keeps it, to
186
+ pyright and mypy. Only for a member of an enum the `module` defines (`enums`), bound once
187
+ (`bound_once`), and where it can name `Final`; a guess resting on the hint still.
188
+
189
+ Returns:
190
+ The `Final` inference, or `None`.
191
+
192
+ """
193
+ plan: ImportPlan | None = known.names.plan
194
+ enum: str | None = (
195
+ value.value.id if isinstance(value, ast.Attribute) and isinstance(value.value, ast.Name) else None
196
+ )
197
+ spelled: str | None = None
198
+ if (
199
+ enum != hint.annotation
200
+ or enum not in module.enums
201
+ or name not in module.once
202
+ or (spelled := None if plan is None else plan.spell(TYPING_FINAL)) is None
203
+ ):
204
+ return None
205
+ return Inference(
206
+ spelled,
207
+ f"{hint.reason}, an enum's member: `Final` keeps its `Literal`",
208
+ hint.kinds | {FINAL_KIND},
209
+ )
210
+
211
+
212
+ def bound_once(tree: ast.Module) -> frozenset[str]:
213
+ """Name what a module's own scope binds once, and no function declares `global`.
214
+
215
+ A class's member of the same name (`OPEN = 1` in `State`, then `OPEN = State.OPEN`) isn't the
216
+ module's; a function's `global X` may bind it again. A comprehension's target counts too.
217
+
218
+ Returns:
219
+ Their names.
220
+
221
+ """
222
+ counted: Counter[str] = Counter()
223
+ declared: set[str] = set()
224
+ node: ast.AST
225
+ for node in own_nodes(tree.body):
226
+ if isinstance(node, _DEFINITIONS):
227
+ counted[node.name] += 1
228
+ declared.update(
229
+ name for each in walk(node) if isinstance(each, ast.Global) for name in each.names
230
+ )
231
+ elif isinstance(node, ast.Import | ast.ImportFrom):
232
+ counted.update((alias.asname or alias.name).partition(".")[0] for alias in node.names)
233
+ elif isinstance(node, ast.Name) and not isinstance(node.ctx, ast.Load):
234
+ counted[node.id] += 1
235
+ return frozenset(name for name, times in counted.items() if times == 1 and name not in declared)
236
+
237
+
146
238
  def _bound_vars(tree: ast.Module, type_vars: frozenset[str]) -> dict[str, frozenset[str]]:
147
239
  """Map each class to the type variables its bases name, which its methods may use.
148
240
 
@@ -14,7 +14,8 @@ the checker printed it:
14
14
  `Color`), and `LiteralString` to `str`, then a union's repeated members dropped;
15
15
  - anything that isn't an annotation (`Module("os")`, a callable's signature, `Self@C`) is dropped,
16
16
  as is a vague one (`Any`, `list[Unknown]`), a bare `None`, one with `Never` or `NoReturn` in it
17
- (an empty display's `list[Never]`, or code the checker takes not to run), one nested as deep as
17
+ (an empty display's `list[Never]`, or code the checker takes not to run), `NotImplementedType`
18
+ alone (a binary dunder's declared return, never what the operation gives), one nested as deep as
18
19
  LVA006 reports, or a tuple as long as LVA011 does;
19
20
  - a special form alone (`type[Generic]`) is dropped, as is a union inside the hint
20
21
  (`dict[str, int | bytes]`), and a `Literal` in a class's own arguments, which may be bound to it
@@ -174,6 +175,9 @@ _RUNTIME: Final = {
174
175
  }
175
176
  _TYPES: Final = "types"
176
177
  _BOTTOM: Final = frozenset({"Never", "NoReturn"}) # the type of no value: never a variable's
178
+ # What a binary dunder declares it may return, which checkers hint for the operation's result where
179
+ # the operand's class is in reach (pandas' `cat == cat`): what the operation gives is never it.
180
+ _UNIMPLEMENTED: Final = "NotImplementedType"
177
181
 
178
182
 
179
183
  class Site(NamedTuple):
@@ -341,7 +345,7 @@ def _spelled(text: str, known: Known, imports: tuple[str, ...], site: Site) -> s
341
345
  root = _abstract(root, plan, origins)
342
346
  lone: set[str] = _lone(root)
343
347
  # `TypeAlias` is `type_alias`'s to write. A special form alone isn't a type.
344
- if _aliases(root) or lone & _FORMS or _misnamed(root, plan) or _bottom(root):
348
+ if _aliases(root) or lone & _FORMS or _misnamed(root, plan) or _bottom(root) or _unimplemented(root):
345
349
  return None
346
350
  names: list[str] = sorted(
347
351
  {
@@ -452,6 +456,18 @@ def _bottom(root: ast.expr) -> bool:
452
456
  )
453
457
 
454
458
 
459
+ def _unimplemented(root: ast.expr) -> bool:
460
+ """Check whether an annotation is `NotImplementedType` alone, however it's spelled.
461
+
462
+ Returns:
463
+ Whether it is.
464
+
465
+ """
466
+ return (isinstance(root, ast.Name) and root.id == _UNIMPLEMENTED) or (
467
+ isinstance(root, ast.Attribute) and root.attr == _UNIMPLEMENTED
468
+ )
469
+
470
+
455
471
  def _misnamed(root: ast.expr, plan: ImportPlan) -> bool:
456
472
  """Check whether an annotation names what the file binds to another thing than the checker means.
457
473
 
@@ -22,6 +22,8 @@ CAN_BE_FINAL: Final = "LVA012"
22
22
  UNANNOTATED_ATTRIBUTE: Final = "LVA013"
23
23
  UNANNOTATED_RETURN: Final = "LVA014"
24
24
  UNANNOTATED_PARAMETER: Final = "LVA015"
25
+ # An annotation a traced run's value differed from: `python -m constricter.trace --check`'s, no check's.
26
+ TRACED: Final = "LVA016"
25
27
  # The guessing mechanisms that type a parameter (LVA015 writes what they give on it).
26
28
  PARAMETER_KINDS: Final = frozenset({"callers", "reads", "fixture", "named"})
27
29
  # Codes reported only when selected by their full code (`--select LVA012`), never by a prefix.
@@ -114,7 +116,6 @@ STARRED_SUBSCRIPTS: Final = (3, 11) # the first Python to parse `tuple[int, *Ts
114
116
  # The guesses `--likely` applies: each a whole set of mechanisms, measured (see docs/LIKELY.md).
115
117
  LIKELY: Final = frozenset(
116
118
  {
117
- frozenset({"agreed", "checker"}), # a hint two or more checkers give alike (`--infer-with`)
118
119
  frozenset({"arithmetic", "copy"}),
119
120
  frozenset({"arithmetic", "copy", "literal"}),
120
121
  frozenset({"arithmetic", "literal"}),
@@ -59,6 +59,9 @@ _DEPTH: Final = 2 # how deep a container's elements are spelled
59
59
  _MEMBERS: Final = 3 # how many types a container's elements may have
60
60
  _LENGTH: Final = 4 # the longest tuple spelled part by part
61
61
  _IDLE: Final = 20 # how many times with nothing new end a statement's recording, or a function's
62
+ # What reading a value's type raises where its class isn't one as Python makes them (a `__module__`
63
+ # that's no name), or a container another thread changes as it's read.
64
+ _UNREADABLE: Final = (AttributeError, LookupError, RuntimeError, TypeError, ValueError)
62
65
  _QUIET: Final = 50_000 # how many lines with nothing new end a function's: one that loops, and never returns
63
66
  _INSTALLED: Final = "site-packages"
64
67
  _MODULE: Final = "<module>" # the name of a module body's code
@@ -227,14 +230,19 @@ def named(cls: type) -> str:
227
230
  """Name a class as an annotation would: a builtin bare, another as `module:Class`.
228
231
 
229
232
  Returns:
230
- It; `UNKNOWN` for one no annotation can name (a function's, a nested one, a mock).
233
+ It; `UNKNOWN` for one no annotation can name (a function's, a nested one, a mock, one that
234
+ says it's in no module).
231
235
 
232
236
  """
233
- module: str = cls.__module__
237
+ module: str | None = cast("str | None", cls.__module__)
234
238
  name: str = cls.__qualname__
235
239
  if module == _BUILTINS:
236
240
  return name if _held(builtins, name) is cls else UNKNOWN
237
- if module.startswith(_MOCK) or not all(part.isidentifier() for part in name.split(_DOT)):
241
+ if (
242
+ module is None
243
+ or module.startswith(_MOCK)
244
+ or not all(part.isidentifier() for part in name.split(_DOT))
245
+ ):
238
246
  return UNKNOWN
239
247
  if _DOT in name and _reached(module, name) is not cls: # a class in another, by another name
240
248
  return UNKNOWN
@@ -346,6 +354,7 @@ class _Function:
346
354
 
347
355
  Function: TypeAlias = _Function # as what tells a recorder's `ended` more names it
348
356
  Statement: TypeAlias = _Statement # as what reads the statement a frame is in names it
357
+ File: TypeAlias = _File # as what reads a recorded file's source names it
349
358
 
350
359
 
351
360
  def _plans(tree: ast.Module) -> dict[int, dict[int, _Statement]]:
@@ -501,7 +510,10 @@ class Recorder:
501
510
  return True
502
511
  self.ended(frame, function)
503
512
  if returned and not frame.f_code.co_flags & SUSPENDS:
504
- _returning(frame, function, value)
513
+ try:
514
+ _returning(frame, function, value)
515
+ except _UNREADABLE: # a class that isn't one: its function isn't recorded
516
+ self._dropped(frame.f_code, function)
505
517
  function.idle = 0 if function.fresh else function.idle + 1
506
518
  function.fresh = False
507
519
  return self.functions[id(frame.f_code)] is function and not function.spent
@@ -515,19 +527,26 @@ class Recorder:
515
527
  return
516
528
  try:
517
529
  new: bool = _noted(function.file.held, statement.stores, frame.f_locals)
518
- except (AttributeError, LookupError, RuntimeError, TypeError, ValueError):
530
+ except _UNREADABLE:
519
531
  # A container another thread changed, or a class that isn't one: its function isn't recorded.
520
- self.functions[id(code)] = None
521
- line: int
522
- name: str
523
- for line, name in (store for each in function.lines.values() for store in each.stores):
524
- _ = function.file.held.get(line, {}).pop(name, None)
532
+ self._dropped(frame.f_code, function)
525
533
  return
526
534
  statement.idle = 0 if new else statement.idle + 1
527
535
  function.fresh = function.fresh or new
528
536
  if new:
529
537
  function.quiet = 0
530
538
 
539
+ def _dropped(self, code: CodeType, function: _Function) -> None:
540
+ """Record `code`'s function no more, and forget what was noted of it: its names and its returns."""
541
+ self.functions[id(code)] = None
542
+ line: int
543
+ name: str
544
+ for line, name in (store for each in function.lines.values() for store in each.stores):
545
+ _ = function.file.held.get(line, {}).pop(name, None)
546
+ at: int
547
+ for at in (line for _, _, line in code.co_lines() if line):
548
+ _ = function.file.held.get(at, {}).pop(RETURN, None)
549
+
531
550
  def raised(self, frame: FrameType) -> None:
532
551
  """Forget the statement `frame` was in: an exception ended it."""
533
552
  _ = self.pending.pop(id(frame), None)
@@ -20,7 +20,7 @@ from constricter.fix.core.known import ImportPlan, Inference
20
20
  from constricter.fix.values import callables, displays, hinted
21
21
  from constricter.fix.values import fills as filling
22
22
  from constricter.fix.values import unchecked as misused
23
- from constricter.fix.values.doubts import contains_inner, narrowing, spelled_self
23
+ from constricter.fix.values.doubts import FINAL_KIND, contains_inner, narrowing, spelled_self
24
24
  from constricter.fix.values.inference import RETURNED
25
25
  from constricter.fix.values.narrowed import narrowed_at
26
26
  from constricter.offences import (
@@ -42,7 +42,7 @@ from constricter.offences import (
42
42
  from constricter.rules import widened
43
43
  from constricter.rules.rebinding import Refit, refit
44
44
  from constricter.rules.rebound import apart, converted, emptied, heads, looped, operated, unites
45
- from constricter.rules.scope import FINAL_KIND, Scope, guesses_in
45
+ from constricter.rules.scope import Scope, guesses_in
46
46
  from constricter.source.annotations import node_name, roots
47
47
  from constricter.source.flow import Binding, Lifetime, members
48
48
  from constricter.source.syntax import FunctionDef
@@ -12,6 +12,8 @@ from constricter.fix.libraries import stdlib
12
12
  from constricter.fix.libraries.library import chains
13
13
  from constricter.fix.values import aliased, callables, classvars, fills, hinted
14
14
  from constricter.fix.values.doubts import (
15
+ FINAL_KIND,
16
+ TYPING_FINAL,
15
17
  Facts,
16
18
  Owner,
17
19
  as_declared,
@@ -24,6 +26,7 @@ from constricter.fix.values.doubts import (
24
26
  narrowing,
25
27
  none_tested,
26
28
  says_self,
29
+ sentinel,
27
30
  tested,
28
31
  undeclared,
29
32
  )
@@ -66,8 +69,6 @@ _SELF: Final = "self"
66
69
  _NONE: Final = "None"
67
70
  _STATICMETHOD: Final = "staticmethod"
68
71
  _SELF_WORD: Final = re.compile(r"\bSelf\b") # `Self` in an annotation, `typing.Self` too
69
- FINAL_KIND: Final = "final" # the fix kind of LVA012's `Final`
70
- _TYPING_FINAL: Final = "typing.Final"
71
72
  _LITERAL_DOUBT: Final = frozenset({"literal"}) # a constant's literal, which `doubts` makes a guess
72
73
  _READS: Final = (ast.Name, ast.Attribute, ast.Subscript) # a read of a value a type checker may narrow
73
74
  TESTED: Final = "tested" # the fix kind of a read a test around it narrows
@@ -263,7 +264,14 @@ class Scope:
263
264
  found = called[0], *guesses_in(self, [called[1]])
264
265
  hint: Inference | None
265
266
  if found is None and (hint := self.hint(target, value)) is not None:
266
- found = hint, True, hinted.resting(hint)
267
+ final: Inference | None = (
268
+ None
269
+ if function is not None or owner is not None
270
+ else sentinel(target.id, value, hint, facts, self.settings.known)
271
+ )
272
+ if final is not None: # an enum's member, read as the enum still
273
+ self.inferred.learn(target.id, hint.annotation, hinted.resting(hint))
274
+ found = final or hint, True, hinted.resting(hint)
267
275
  return found or vague
268
276
 
269
277
  def _member(
@@ -452,7 +460,7 @@ class Scope:
452
460
 
453
461
  """
454
462
  plan: ImportPlan | None = self.settings.known.names.plan
455
- spelled: str | None = None if plan is None else plan.spell(_TYPING_FINAL)
463
+ spelled: str | None = None if plan is None else plan.spell(TYPING_FINAL)
456
464
  self.inferred.learn(name, fix.annotation, _LITERAL_DOUBT)
457
465
  return (
458
466
  None
@@ -503,7 +503,7 @@ def _reported(recording: witness.Witness, parts: Path) -> bool:
503
503
  Whether any did.
504
504
 
505
505
  """
506
- lines: list[str] = witness.report(witness.gathered(parts, recording.judged()))
506
+ lines: list[str] = witness.report(witness.gathered(parts, recording.judged()), recording.root)
507
507
  _ = sys.stdout.write("\n".join(lines) + "\n")
508
508
  return len(lines) > 1
509
509