python-constricter 0.4.6__py3-none-any.whl → 0.4.7__py3-none-any.whl

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.
constricter/_version.py CHANGED
@@ -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
  )
constricter/cli/rounds.py CHANGED
@@ -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
 
constricter/offences.py CHANGED
@@ -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"}),
constricter/recording.py CHANGED
@@ -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)
constricter/rules/late.py CHANGED
@@ -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
constricter/trace.py CHANGED
@@ -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
 
constricter/witness.py CHANGED
@@ -2,9 +2,12 @@
2
2
 
3
3
  A `Witness` records as a `Recorder` does. As a statement of a recorded function ends, each name it
4
4
  bound that the function declares (a parameter's annotation, or a local's `name: T`) is held to that
5
- annotation; as the function returns, or a generator is suspended, each annotated parameter is
6
- (not a `*args`' or a `**kwargs`'), and what it returns to its `-> T` (not a generator's or a
7
- coroutine's). An annotation is
5
+ annotation; as the function returns, or a generator is suspended, each annotated parameter is (a
6
+ `*args: T` as a `tuple[T, ...]`, a `**kwargs: T` as a `dict[str, T]`, an `Unpack` of either the
7
+ whole), and what it returns to its `-> T`: not a generator's, and a coroutine's only where
8
+ `sys.monitoring` tells its return from a suspension (Python 3.12). As the run ends, each recorded
9
+ module's annotated variables, and its classes', are held to their annotations by what they hold
10
+ then (`Witness.judged`). An annotation is
8
11
  evaluated where its function runs, once: its module's names and the frame's, then the names the
9
12
  module imports for type checking alone, imported for it.
10
13
 
@@ -29,9 +32,11 @@ import ast
29
32
  import collections
30
33
  import collections.abc
31
34
  import contextlib
35
+ import enum
32
36
  import io
33
37
  import itertools
34
38
  import json
39
+ import sys
35
40
  import types
36
41
  import typing
37
42
  from collections.abc import Iterable, Iterator, Mapping, Sequence
@@ -41,10 +46,11 @@ from types import CodeType, FrameType
41
46
  from typing import Final, TypeAlias, cast
42
47
  from unittest import mock
43
48
 
44
- from constricter import recording
49
+ from constricter import noqa, recording
50
+ from constricter.offences import TRACED
45
51
  from constricter.overrides import override
46
52
 
47
- CODE: Final = "LVA016" # what `report` lists a differing binding under
53
+ CODE: Final = TRACED # what `report` lists a differing binding under
48
54
  FIT: Final = 0
49
55
  DIFFER: Final = 1
50
56
  UNKNOWN: Final = 2
@@ -89,10 +95,17 @@ _CALLABLE: Final = collections.abc.Callable
89
95
  _UNIONS: Final = frozenset({types.UnionType, cast("object", vars(typing)["Union"])})
90
96
  _GUARD: Final = "TYPE_CHECKING" # what a module tests to import a name for type checking alone
91
97
  _BLOCKS: Final = (ast.stmt, ast.excepthandler, ast.match_case) # what holds statements
98
+ _ARGS: Final = "*" # a `*args`: its annotation is each element's
99
+ _KWARGS: Final = "**" # a `**kwargs`: its annotation is each value's
100
+ _COROUTINE: Final = 0x80 # `inspect.CO_COROUTINE`: an `async def`'s code, whose return is its awaited value
92
101
  # A binding and its annotation: its file's path, the line and column it's bound at, its name, the text.
93
102
  Key: TypeAlias = tuple[str, int, int, str, str]
94
103
  _Judged: TypeAlias = list[str | int | list[int] | list[str]] # a key, its counts, what differed
95
104
  _Counted: TypeAlias = tuple[list[int], list[str]] # a key's counts in every process, and what differed
105
+ _Names: TypeAlias = Mapping[str, object] # a module's or a class's names, and what each holds
106
+ # A module's or a class's body, what holds its names, and what its annotations are evaluated among
107
+ # besides the module's names (a class's own).
108
+ _Owned: TypeAlias = tuple[Sequence[ast.stmt], _Names, _Names]
96
109
 
97
110
 
98
111
  def holds(value: object, hint: object) -> bool | None:
@@ -352,6 +365,7 @@ class _Declared:
352
365
  columns: Mapping[tuple[int, str], int] # each store's column, by its line and name
353
366
  returns: str | None # the annotation after `->`
354
367
  guarded: tuple[str, ...] # the module's imports for type checking alone, as statements
368
+ packed: Mapping[str, str] # the `*args` (`_ARGS`) and the `**kwargs` (`_KWARGS`) annotated, by name
355
369
 
356
370
 
357
371
  def _declarations(tree: ast.Module) -> dict[int, _Declared]:
@@ -361,18 +375,41 @@ def _declarations(tree: ast.Module) -> dict[int, _Declared]:
361
375
  Each one's, by its first line (its first decorator's), as a recorder's plans are.
362
376
 
363
377
  """
364
- guarded: tuple[str, ...] = tuple(
378
+ guarded: tuple[str, ...] = _guarded(tree)
379
+ return {
380
+ min([node.lineno, *(decorator.lineno for decorator in node.decorator_list)]): _declared(node, guarded)
381
+ for node in ast.walk(tree)
382
+ if isinstance(node, recording.Def)
383
+ }
384
+
385
+
386
+ def _guarded(tree: ast.Module) -> tuple[str, ...]:
387
+ """Read a module's imports for type checking alone.
388
+
389
+ Returns:
390
+ Each, as a statement.
391
+
392
+ """
393
+ return tuple(
365
394
  ast.unparse(each)
366
395
  for stmt in tree.body
367
396
  if isinstance(stmt, ast.If) and ast.unparse(stmt.test).rsplit(".", 1)[-1] == _GUARD
368
397
  for each in stmt.body
369
398
  if isinstance(each, ast.Import | ast.ImportFrom)
370
399
  )
371
- return {
372
- min([node.lineno, *(decorator.lineno for decorator in node.decorator_list)]): _declared(node, guarded)
373
- for node in ast.walk(tree)
374
- if isinstance(node, recording.Def)
375
- }
400
+
401
+
402
+ def _variables(body: Sequence[ast.stmt]) -> Iterator[ast.AnnAssign]:
403
+ """Find a module's or a class's own annotated variables: `name: T`, at its top level.
404
+
405
+ Yields:
406
+ Each one's statement.
407
+
408
+ """
409
+ statement: ast.stmt
410
+ for statement in body:
411
+ if isinstance(statement, ast.AnnAssign) and isinstance(statement.target, ast.Name):
412
+ yield statement
376
413
 
377
414
 
378
415
  def _declared(function: recording.Def, guarded: tuple[str, ...]) -> _Declared:
@@ -386,11 +423,19 @@ def _declared(function: recording.Def, guarded: tuple[str, ...]) -> _Declared:
386
423
  names: dict[str, str] = {}
387
424
  parameters: dict[str, tuple[int, int]] = {}
388
425
  columns: dict[tuple[int, str], int] = {}
389
- arg: ast.arg
390
- for arg in (*given.posonlyargs, *given.args, *given.kwonlyargs):
391
- if arg.annotation is not None:
426
+ packing: dict[str, str] = {}
427
+ arg: ast.arg | None
428
+ how: str
429
+ for arg, how in (
430
+ *((each, "") for each in (*given.posonlyargs, *given.args, *given.kwonlyargs)),
431
+ (given.vararg, _ARGS),
432
+ (given.kwarg, _KWARGS),
433
+ ):
434
+ if arg is not None and arg.annotation is not None:
392
435
  names[arg.arg] = _written(arg.annotation)
393
436
  parameters[arg.arg] = (arg.lineno, arg.col_offset + 1)
437
+ if how:
438
+ packing[arg.arg] = how
394
439
  statement: ast.stmt
395
440
  for statement in recording.statements(function):
396
441
  if isinstance(statement, ast.AnnAssign) and isinstance(statement.target, ast.Name):
@@ -400,7 +445,7 @@ def _declared(function: recording.Def, guarded: tuple[str, ...]) -> _Declared:
400
445
  if isinstance(node, ast.Name) and isinstance(node.ctx, ast.Store):
401
446
  _ = columns.setdefault((node.lineno, node.id), node.col_offset + 1)
402
447
  returns: str | None = None if function.returns is None else _written(function.returns)
403
- return _Declared(names, parameters, columns, returns, guarded)
448
+ return _Declared(names, parameters, columns, returns, guarded, packing)
404
449
 
405
450
 
406
451
  def _written(annotation: ast.expr) -> str:
@@ -440,6 +485,7 @@ class Witness(recording.Recorder):
440
485
  self.read: dict[str, dict[int, _Declared]] = {} # each file's functions' declarations
441
486
  # What each function declares, by its id, kept with it (`None`: nothing).
442
487
  self.declared: dict[int, tuple[recording.Function, _Declared | None]] = {}
488
+ self.settled: bool = False # whether the modules' and classes' variables were held (`judged`)
443
489
 
444
490
  @override
445
491
  def ended(self, frame: FrameType, function: recording.Function) -> None:
@@ -472,7 +518,9 @@ class Witness(recording.Recorder):
472
518
 
473
519
  """
474
520
  function: recording.Function | None = self._function(frame)
475
- suspends: bool = bool(frame.f_code.co_flags & recording.SUSPENDS)
521
+ flags: int = frame.f_code.co_flags
522
+ # A coroutine's return is told apart from its suspensions only where `finished` says so.
523
+ suspends: bool = bool(flags & recording.SUSPENDS) and not (finished and flags & _COROUTINE)
476
524
  declared: _Declared | None = None if function is None else self._declared(frame, function)
477
525
  if function is not None and declared is not None:
478
526
  path: str = function.file.path.as_posix()
@@ -511,9 +559,13 @@ class Witness(recording.Recorder):
511
559
  if sum(self.verdicts.get(key, ())) >= _MOST:
512
560
  return
513
561
  if key not in self.hints:
514
- self.hints[key] = evaluated(key[4], frame, declared.guarded)
562
+ self.hints[key] = packed(evaluated(key[4], frame, declared.guarded), declared.packed.get(key[3]))
563
+ self._counted(key, value, module_of(frame))
564
+
565
+ def _counted(self, key: Key, value: object, module: str) -> None:
566
+ """Count `value`'s verdict against `key`'s evaluated annotation, its binding in `module`."""
515
567
  found: bool | None = fits(value, self.hints[key])
516
- if patched(self.hints[key], module_of(frame)): # evaluated again once the test's done
568
+ if patched(self.hints[key], module): # evaluated again once the test's done
517
569
  found = None
518
570
  del self.hints[key]
519
571
  self.verdicts.setdefault(key, [0, 0, 0])[UNKNOWN if found is None else FIT if found else DIFFER] += 1
@@ -528,34 +580,117 @@ class Witness(recording.Recorder):
528
580
  _ = output.with_suffix(VERDICTS).write_text(json.dumps(self.judged()), encoding="utf-8")
529
581
 
530
582
  def judged(self) -> list[_Judged]:
531
- """List this process's verdicts, as they're written.
583
+ """List this process's verdicts, as they're written: the modules' and classes' variables held first.
532
584
 
533
585
  Returns:
534
586
  Each key, then its counts, then what differed.
535
587
 
536
588
  """
589
+ if not self.settled:
590
+ self.settled = True
591
+ module: types.ModuleType
592
+ for module in list(sys.modules.values()):
593
+ self._held_at_end(module)
537
594
  return [[*key, counts, self.differed.get(key, [])] for key, counts in self.verdicts.items()]
538
595
 
596
+ def _held_at_end(self, module: types.ModuleType) -> None:
597
+ """Hold a recorded module's annotated variables, and its classes', to their annotations, as they end.
598
+
599
+ Each `name: T` at a module's top level, or at the top level of a class the module binds by its
600
+ name, held once to what the module or the class holds by that name now: not one it holds
601
+ nothing by (a class's instance attribute, declared alone), a descriptor (a `NamedTuple`'s
602
+ field, a slot, a method), or an enumeration's member.
603
+ """
604
+ filename: str | None = cast("str | None", getattr(module, "__file__", None))
605
+ file: recording.File | None
606
+ if (file := self._file(filename) if isinstance(filename, str) else None) is None:
607
+ return
608
+ try:
609
+ tree: ast.Module = ast.parse((self.root / file.path).read_bytes())
610
+ except (OSError, SyntaxError, ValueError):
611
+ return
612
+ guarded: tuple[str, ...] = _guarded(tree)
613
+ scope: _Names = vars(module)
614
+ owners: list[_Owned] = [(tree.body, scope, {})]
615
+ owners += [
616
+ (node.body, vars(cast("type", scope[node.name])), vars(cast("type", scope[node.name])))
617
+ for node in tree.body
618
+ if isinstance(node, ast.ClassDef)
619
+ and isinstance(scope.get(node.name), type)
620
+ and not issubclass(cast("type", scope[node.name]), enum.Enum)
621
+ ]
622
+ body: Sequence[ast.stmt]
623
+ holding: _Names
624
+ local: _Names
625
+ for body, holding, local in owners:
626
+ statement: ast.AnnAssign
627
+ for statement in _variables(body):
628
+ name: str = cast("ast.Name", statement.target).id
629
+ if name in holding and not hasattr(type(holding[name]), "__get__"):
630
+ key: Key = (
631
+ file.path.as_posix(),
632
+ statement.lineno,
633
+ statement.target.col_offset + 1,
634
+ name,
635
+ _written(statement.annotation),
636
+ )
637
+ self.hints[key] = evaluated_in(key[4], dict(scope), dict(local), guarded)
638
+ self._counted(key, holding[name], module.__name__)
639
+
539
640
 
540
641
  def evaluated(text: str, frame: FrameType, guarded: Sequence[str]) -> object:
541
642
  """Evaluate an annotation where its function runs, with `guarded` imported for it if a name's missing.
542
643
 
644
+ Returns:
645
+ What it names, or `UNSET` where it can't be evaluated there.
646
+
647
+ """
648
+ return evaluated_in(text, dict(frame.f_globals), dict(frame.f_locals), guarded)
649
+
650
+
651
+ def evaluated_in(
652
+ text: str,
653
+ scope: dict[str, object],
654
+ local: dict[str, object],
655
+ guarded: Sequence[str],
656
+ ) -> object:
657
+ """Evaluate an annotation among `scope`'s and `local`'s names, `guarded` imported for a missing one.
658
+
543
659
  Returns:
544
660
  What it names, or `UNSET` where it can't be evaluated there.
545
661
 
546
662
  """
547
663
  try:
548
- return read(text, dict(frame.f_globals), dict(frame.f_locals))
664
+ return read(text, scope, local)
549
665
  except NameError:
550
666
  pass
551
667
  except Exception: # ruff: ignore[blind-except] # pylint: disable=broad-exception-caught
552
668
  return UNSET
553
669
  try:
554
- return read(text, _imported(dict(frame.f_globals), guarded), dict(frame.f_locals))
670
+ return read(text, _imported(dict(scope), guarded), local)
555
671
  except Exception: # ruff: ignore[blind-except] # pylint: disable=broad-exception-caught
556
672
  return UNSET
557
673
 
558
674
 
675
+ def packed(hint: object, how: str | None) -> object:
676
+ """Make a `*args`' or a `**kwargs`' evaluated annotation what the parameter holds.
677
+
678
+ `how`: `_ARGS`, `_KWARGS`, or `None` for another name.
679
+
680
+ Returns:
681
+ A `tuple` of `hint`'s, or a `dict` of it by name; what an `Unpack` names (a tuple's or a
682
+ `TypedDict`'s, the whole); `hint` itself for another name, or one that couldn't be evaluated.
683
+
684
+ """
685
+ if how is None or hint is UNSET:
686
+ return hint
687
+ if typing.get_origin(hint) is typing.Unpack:
688
+ return cast("object", typing.get_args(hint)[0])
689
+ return (
690
+ types.GenericAlias(tuple, (hint, Ellipsis)) if how == _ARGS else types.GenericAlias(dict, (str, hint))
691
+ )
692
+
693
+
559
694
  def _imported(scope: dict[str, object], imports: Sequence[str]) -> dict[str, object]:
560
695
  """Run those of `imports` that can be among `scope`'s names, a copy of a module's.
561
696
 
@@ -613,17 +748,24 @@ def gathered(parts: Path, own: Iterable[_Judged]) -> dict[Key, _Counted]:
613
748
  return found
614
749
 
615
750
 
616
- def report(found: Mapping[Key, tuple[Sequence[int], Sequence[str]]]) -> list[str]:
751
+ def report(found: Mapping[Key, tuple[Sequence[int], Sequence[str]]], root: Path) -> list[str]:
617
752
  """List each binding a run's value differed from its annotation, as `constricter` lists an offence.
618
753
 
754
+ Not one whose line under `root` has a `# noqa` that covers `CODE`, as a check's offence: a cast
755
+ narrowing a value to the part its code uses, say. The last line counts those too.
756
+
619
757
  Returns:
620
758
  A line each, in the files' order, then one counting what was held.
621
759
 
622
760
  """
623
761
  lines: list[str] = []
762
+ quiet: int = 0
763
+ sources: dict[str, list[str]] = {}
624
764
  key: Key
625
765
  for key in sorted(found):
626
- if found[key][0][DIFFER]:
766
+ if found[key][0][DIFFER] and _passed_over(key, root, sources):
767
+ quiet += 1
768
+ elif found[key][0][DIFFER]:
627
769
  kinds: str = ", ".join(f"`{each}`" for each in found[key][1])
628
770
  what: str = (
629
771
  f"a function annotated to return `{key[4]}` returned"
@@ -633,4 +775,21 @@ def report(found: Mapping[Key, tuple[Sequence[int], Sequence[str]]]) -> list[str
633
775
  lines.append(f"{key[0]}:{key[1]}:{key[2]}: error: {CODE} {what} {kinds} in a traced run")
634
776
  untold: int = sum(1 for counts, _ in found.values() if not counts[FIT] and not counts[DIFFER])
635
777
  held: str = f"{len(found)} annotated bindings held to a run's values"
636
- return [*lines, f"{held}: {len(lines)} differed, {untold} couldn't be told"]
778
+ passed: str = f", {quiet} passed over by `# noqa`" if quiet else ""
779
+ return [*lines, f"{held}: {len(lines)} differed{passed}, {untold} couldn't be told"]
780
+
781
+
782
+ def _passed_over(key: Key, root: Path, sources: dict[str, list[str]]) -> bool:
783
+ """Check whether a binding's line has a `# noqa` that covers `CODE`, its file read once into `sources`.
784
+
785
+ Returns:
786
+ Whether it has; not where the file can't be read again.
787
+
788
+ """
789
+ if key[0] not in sources:
790
+ try:
791
+ sources[key[0]] = noqa.lines((root / key[0]).read_text(encoding="utf-8"))
792
+ except (OSError, ValueError):
793
+ sources[key[0]] = []
794
+ found: list[str] = sources[key[0]]
795
+ return key[1] <= len(found) and noqa.suppressed(found[key[1] - 1], CODE)
@@ -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
@@ -1,28 +1,28 @@
1
1
  constricter/__init__.py,sha256=-BOs4TLYAWU1PkcldjsCHpb-QtG4M4b8GwPsysAZMmw,1131
2
2
  constricter/__main__.py,sha256=8qIkYzUz5JqnGFEgR1RhGP5gJEIEzYwVCimZK_HW3e0,866
3
- constricter/_version.py,sha256=eWOoSDyue-smJyhYpgwx9HXSaVlzQP8AwDkanA6OROo,114
3
+ constricter/_version.py,sha256=P1ewT7M4qe8hyagdq1s_aJzLVK8OcLJp6yUBw988jgQ,114
4
4
  constricter/empty.py,sha256=V36zVhMFRZEEqDIzSDIPh2ipSQnCI9uOYjoASnpubRY,1269
5
5
  constricter/jsonc.py,sha256=678EvxfNf3m5x1SfKY1FOhU24IOStqOL74L8hfK7eiA,1507
6
6
  constricter/noqa.py,sha256=nHKnjJ8EoGKwD9sU5QlCMM0r_JT_m0h6DV_2BLV8ulw,1272
7
7
  constricter/notebook.py,sha256=kONPMOtqu_ns_l80BduPiLzU5ybynG9ThBVgSAi-8Ok,4069
8
- constricter/offences.py,sha256=Qn50c96TH7eMAHpzITeEcFPiKX2iFoe1pBLyKSSe2dA,21888
8
+ constricter/offences.py,sha256=sa2YjTb84Tv3n7EN-teWFj_ZdEKtQ-hkY9o8wftoDaE,21917
9
9
  constricter/overrides.py,sha256=afHMFosYLl_BqiokDwJbFzo23BEcOQNKvXRkZ_8QA1M,570
10
10
  constricter/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- constricter/recording.py,sha256=H_bmFUzqDHpF0_mhxFGObDU-CA5Iu6w3-jwIJVcwqso,27658
12
- constricter/trace.py,sha256=KEuw-V_NfSlcntJg0NAMS9bdiqjVPm78WK3LP_xtmW0,20310
11
+ constricter/recording.py,sha256=yXL45U1f6S5mOzlv4dyFgkaw5sBOdKyS_jN6uUuG43E,28572
12
+ constricter/trace.py,sha256=ZeZpO3gZEEMYooD9yc-fLi_SEvpVpNB5d_fCCHyTdHQ,20326
13
13
  constricter/traced.py,sha256=efebdErGSsToggZeoniFk5tsaHVtPaspQxxpUcZpJ2w,19578
14
- constricter/witness.py,sha256=fx7ZeA3_aYPw3cAzpbxUwZMFkl9ZWMZo996FPsGe8uo,27317
14
+ constricter/witness.py,sha256=zoIVtB9ewO95HA7Fa2-6EyFbO8S4AVeAJPscEE9CTm8,34242
15
15
  constricter/cli/__init__.py,sha256=Oq7QFIacNWvRGBaun0sV-ft6Rm6T7M7nEDs7FPLr0KE,104
16
16
  constricter/cli/baseline.py,sha256=qodK1GHBImOxVVL6kAtEJ6z6hdi6wOdV3qzhGw4DHgA,3370
17
17
  constricter/cli/collecting.py,sha256=mJfuAhUIEKry5bSvevj8DtkupxOzbdAlYrTf6zd18fU,2217
18
18
  constricter/cli/command.py,sha256=M3JZ5sRiddxOZlCyQ45Vd6w2WZL5T0ae0c4qoenBYZQ,21183
19
19
  constricter/cli/config.py,sha256=NlO0doPHfIntVgCIH487bd3iXUbgKZu9Aksa-502Kvo,10395
20
- constricter/cli/explain.py,sha256=i8g56HEc9D3G8tfV6FPjqxeik-TSQd62pU5_aDwORSo,6196
21
- constricter/cli/options.py,sha256=fwmBOLnA5eUC-3ZdeScrGzTHYiD7pDy2nFCGCMGmUIc,26208
20
+ constricter/cli/explain.py,sha256=3qv09CvVrztN-go6rfMfMtO24y_jK7twa-_kwXRf0uc,7002
21
+ constricter/cli/options.py,sha256=ugbdFqQOEOAIcWyoWEuWfn-IWWGVpp5QvVSVBrTtB0A,26225
22
22
  constricter/cli/paths.py,sha256=wnudczpdxT_KiIvp4Q7In8g-R6giGN_r-4uR5vFU6yE,5339
23
23
  constricter/cli/reading.py,sha256=ar6Wqr2ZnGskJIuRttuguoz6d8GndMLYcp5D2_R-LvI,1178
24
24
  constricter/cli/report.py,sha256=4IYaVoALEf9tmK6CFS6GBR4XWtoYf9zfZeN0zpvFZj0,13571
25
- constricter/cli/rounds.py,sha256=xYAy85-DqIK-IBAipU-YI8_JRu5SA4n3rWENUXBp_jk,15462
25
+ constricter/cli/rounds.py,sha256=SSLOxtxUPajDYt8PWK1wQI3R55JxsSoTsmr-s9EuMhI,15594
26
26
  constricter/cli/runs.py,sha256=HAQ18ENiK8eCfqRBIElCd7RN-WmzJl9CvNtzQjkvBD8,4466
27
27
  constricter/cli/schedule.py,sha256=2HLSFqMi3t7BNqE8GindKgWEWfZF3jkTcZKv9ysqCxs,16126
28
28
  constricter/cli/workers.py,sha256=kw2JGz_YIv1tvyWEflWEbRPKGN13GPs_j-s80DTbpic,10095
@@ -30,8 +30,8 @@ constricter/cli/lsp/__init__.py,sha256=Y87_F4loXLsOL2uVTMJWMwKG4g3-XKLn2bncMdDLM
30
30
  constricter/cli/lsp/connection.py,sha256=05dNZryEF86nxCAV0O30mt_0bEwJuPqW7jwV-M4TNfk,19622
31
31
  constricter/cli/lsp/edits.py,sha256=HliomhdW1F9u-_5De8AKg78HONiA6KSyQ_bvxVzX11U,7260
32
32
  constricter/cli/lsp/guard.py,sha256=8eZo8YP765eM6xvssd8N219nKcfYBaoQPAsgVqLVZLU,5361
33
- constricter/cli/lsp/hints.py,sha256=VHJdkejYNkcQ1pgH8QN0iJ6YSBizgaGzPkxzfzHQ5gg,21691
34
- constricter/cli/lsp/protocol.py,sha256=T2Z7MMdxmCIN4Id9i1_feqjT84UUV5RCxLLmlIh5elI,7369
33
+ constricter/cli/lsp/hints.py,sha256=0m6M7gWKfoFtDBhVBtwLC-jOvcik35qdixztnjIxkq8,21842
34
+ constricter/cli/lsp/protocol.py,sha256=nQt3J3bNcfix5mu9zpkpFV1Fwvnnw41m8TD0iNvWQy4,7688
35
35
  constricter/cli/lsp/remembered.py,sha256=kuL1JyOdh7v7D_yiutN5zRfNvPZLSyXF2dPdbDOXBgU,3363
36
36
  constricter/cli/lsp/stored.py,sha256=9NQDtA9W9vH3H_e3HXv18JDM6dELm7vUyymZnTGnU7k,8228
37
37
  constricter/fix/__init__.py,sha256=eb1dRPej3qrrWIreETPRSrNm6xmGLkLqZq7pJJfSALg,79
@@ -109,7 +109,7 @@ constricter/fix/tables/platform.json,sha256=clsu0NG66mCO7YJJFSsGsJQG0jQ-SfZCgEol
109
109
  constricter/fix/tables/returns.json,sha256=lNJ3Qp2zcfY4eKgx-jLT7YFoPfthpA7K-heyxFB-HBg,44477
110
110
  constricter/fix/tables/scalar_members.json,sha256=51_Hembsusz-cObxoKchowTAe0q2bDpwUJOnnfztqgw,10230
111
111
  constricter/fix/tables/scalars.json,sha256=0OGfiEt8hTdTxNF5urIgGrxCIk7GZWmm72rMKR3PQPA,122539
112
- constricter/fix/tables/source.json,sha256=pKiwP_xUPiYrLMgjTf8F1fplKTUBoB38FTuntkimqOg,496
112
+ constricter/fix/tables/source.json,sha256=JGgGY6Gh4FD7NG2iJDpGuANveVZHrW3KkceBHOidn14,496
113
113
  constricter/fix/tables/subscriptable.json,sha256=2jSxdPpvoMVFuVsotaXBsondknsw3XfzjtsAAFHPKjk,2371
114
114
  constricter/fix/tables/type_parameters.json,sha256=iDDW1zuWXwDUGlHBAUMsfa4A4gvihqZr-wYVtpx7ot4,6923
115
115
  constricter/fix/tables/variables.json,sha256=puI8LsdzVBDn_6p1vMl3PREJ_k8aZjyEnq6oxAqUioQ,95487
@@ -122,12 +122,12 @@ constricter/fix/values/classvars.py,sha256=wR2KUJUgr9JZ16dSjryDSf_K2EI943Cc2LVLp
122
122
  constricter/fix/values/decided.py,sha256=y8s3G2eUijfzFlfkNNeGw0mrEWkzfxOnE-J0NLX8Lf0,16634
123
123
  constricter/fix/values/displays.py,sha256=lBffqOiZK7mtqCAYEp0TCjxZVYCojEEFXtuOczP_kRY,3838
124
124
  constricter/fix/values/documented.py,sha256=g4GXAx22csWEshX3KEp6KMBPJVgAhD0DTE6jXGwWrdg,16358
125
- constricter/fix/values/doubts.py,sha256=zRktbqrXSY-B3WKXWr_SdOuEhEFDjoy4cebGz6I56rA,29379
125
+ constricter/fix/values/doubts.py,sha256=bnvfzB6y_zJbwY4GQi_mdx5hpwOGCHSn8se4dFiW49c,33269
126
126
  constricter/fix/values/echoed.py,sha256=14MwVPdITB2G7OzBQAahs_RBokpbmB0YO-rs03wfJSU,2664
127
127
  constricter/fix/values/entered.py,sha256=eA7Gj2vZ38FSjhUSPjkPe4L2bWaPX1G7eVwG9nDL7FI,13395
128
128
  constricter/fix/values/fills.py,sha256=YVnLm6bnu_wqrY7lsAUq7kjbi7Cks9zuCmJWFvv-P_4,23166
129
129
  constricter/fix/values/guesses.py,sha256=opMCdzea8-XXcvzc7Q9LXv86T0pCLwTMeaUpLpmbZJU,18066
130
- constricter/fix/values/hinted.py,sha256=dD4NDv9uTAIwcXu6Ny3oIpwgb5iOm_hanUdiSy5yPsA,37244
130
+ constricter/fix/values/hinted.py,sha256=7DFQC3f4Eq62z2Y4ou0GbKK2F7uNBbkFkdinZ2VgJMA,37938
131
131
  constricter/fix/values/inference.py,sha256=zEmrj85TjQSYCoQ-wng9DFWRBV1YytsDh1rBlNdbjL8,30827
132
132
  constricter/fix/values/loops.py,sha256=hfc-p5Jh_a-meI3I5RGC2lp4b5ASx3sMSUMcE7B3bgU,13158
133
133
  constricter/fix/values/members.py,sha256=1f9FX4B1Lm8S_HtTuf0HIMxLraAiff5sxXv9I0RLsr4,32197
@@ -152,7 +152,7 @@ constricter/rules/attributes.py,sha256=83jEnQrmQfIwRp98358C0dj2cDz3HrdoqV8n3bCn_
152
152
  constricter/rules/binding.py,sha256=jvLo_2E_GSvhZbqza4W4nbX63TU_mmmzuzrlGJEphfc,32440
153
153
  constricter/rules/calls.py,sha256=h9Iw5hS3EC2YnbZUF5OiZrQxH6CdyVXxjELNZ3nbd0E,21726
154
154
  constricter/rules/checker.py,sha256=QrSgB5X9rcmlrFiGHoX_Y-33Ftf137_CUTpOkTzYpeM,24365
155
- constricter/rules/late.py,sha256=Ha8xIJaYc_Y_q95-2Sj8-9DI-sCCtRNmWIIm2h9cnqQ,30796
155
+ constricter/rules/late.py,sha256=ndq7XOOsWhbU_Z1GIp9_tqwbyasqyDMH6RhdoUnmg34,30796
156
156
  constricter/rules/narrowing.py,sha256=ycOU-Mrve3LJ6aQDZZ4geI0mirgXGyhiVWx0XdxveT4,3922
157
157
  constricter/rules/parameters.py,sha256=Unw6lNDXagyLCZJ7rfRMsD4c7VOPuYRZhyUEt-pUjaY,3811
158
158
  constricter/rules/rebinding.py,sha256=nn91iY-8DQlNFGKAFHi_5GE52CxhoqfgCdhsjBWWAdY,7057
@@ -160,7 +160,7 @@ constricter/rules/rebound.py,sha256=5KzumLq--5PGYtg_CvmgUNm7pilBP1HQzsnLqECVNGQ,
160
160
  constricter/rules/recorded.py,sha256=59qaIlyapehL3_R7kPIpZwgeV7TIdyzjsO5gQrW8zmQ,6900
161
161
  constricter/rules/redundant.py,sha256=FfwOuq_nesrbpRJW6S2h9kMMMfhmFfAOQoYtXlntgF0,5438
162
162
  constricter/rules/returning.py,sha256=_T1_Bz9QJZr6qEMacQupOnuSjCtBwfI0NtKeAmxzru0,10570
163
- constricter/rules/scope.py,sha256=pY0_2ZiB4vVQ4ftXBxDNRe61x9rcgN_tJVQHjOukHPg,42381
163
+ constricter/rules/scope.py,sha256=CPi1XR4eziBYQ15dbC8C4WN6jSGUoXCK12j4DDVZjFI,42717
164
164
  constricter/rules/scoped.py,sha256=XuzbXpGZYqQ4fIH9PkAVmmnZdqvl8BorT41ubk-dnFA,11745
165
165
  constricter/rules/scoping.py,sha256=-Mwtl3yYmqm_dM0j2SfA_0Xy34S9xUQ3VeJRYAKFwQ0,13840
166
166
  constricter/rules/settings.py,sha256=_61BGsKyB-Xxe86ep_-0d3t3IlXU8lphGhCnZRCHPhY,8685
@@ -179,8 +179,8 @@ constricter/source/quoted.py,sha256=nlZ5K7K1WY8ZlhPYWXH8NAfQ1zJZGsFa7_YUxKMwqHM,
179
179
  constricter/source/syntax.py,sha256=s1vFPqIqwGPlI7HrqFQxskOot_FWz5MBr6KsNltvx1w,22224
180
180
  constricter/source/usable.py,sha256=sHEjVxhHkAHt8um4qRO9djtYCKgybZcnqbUUBrV0XIg,2634
181
181
  constricter/source/walked.py,sha256=kJDY_JPV619SqklfzMEOBW569s8aMpl0IIG5XaOkiXs,5330
182
- python_constricter-0.4.6.dist-info/METADATA,sha256=Qtl6ArNiSCvpQ6-QhA_jTFRImTvlrCeQ3nXdv5Do7L0,38732
183
- python_constricter-0.4.6.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
184
- python_constricter-0.4.6.dist-info/entry_points.txt,sha256=Shdju-XvHDtBWQk-2qr1peTQ2i61555_AaT4uG_Noxg,129
185
- python_constricter-0.4.6.dist-info/licenses/LICENSE.md,sha256=XN0CpS08bdeS_IAwJ2_en1IPcbShpV1WJlRQQSd6f5I,1098
186
- python_constricter-0.4.6.dist-info/RECORD,,
182
+ python_constricter-0.4.7.dist-info/METADATA,sha256=OWi63nhdKSurHBzWCx9vqeihGab2wAf4BZtaqGmJZkQ,38886
183
+ python_constricter-0.4.7.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
184
+ python_constricter-0.4.7.dist-info/entry_points.txt,sha256=Shdju-XvHDtBWQk-2qr1peTQ2i61555_AaT4uG_Noxg,129
185
+ python_constricter-0.4.7.dist-info/licenses/LICENSE.md,sha256=XN0CpS08bdeS_IAwJ2_en1IPcbShpV1WJlRQQSd6f5I,1098
186
+ python_constricter-0.4.7.dist-info/RECORD,,