Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 97.87%. The percentage of expected errors that received a diagnostic held steady at 97.78%. The number of fully passing files held steady at 130/145. |
Memory usage reportSummary
Significant changesClick to expand detailed breakdownsphinx
prefect
trio
flake8
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
redundant-condition-strict |
4 | 0 | 0 |
| Total | 4 | 0 | 0 |
Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.
Raw diff:
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/settings/errortracking.py:43:48 warning[redundant-condition-strict] Condition `config._report_handled_errors in ["all", "user", "third_party"]` is always false
paasta (https://github.com/yelp/paasta)
+ paasta_tools/paastaapi/api_client.py:211:12 warning[redundant-condition-strict] Condition `response_type not in ["file", "bytes"]` is always true
scipy (https://github.com/scipy/scipy)
+ scipy/optimize/tests/test__root.py:25:16 warning[redundant-condition-strict] Condition `method in ('linearmixing', 'excitingmixing')` is always false
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/chat.py:172:65 warning[redundant-condition-strict] Condition `slot not in {"_state"}` is always true
Full ecosystem report for ab05864PR #28676 ecosystem summaryThe PR adds four Affected projects1. dd-trace-py: dynamically replaced configuration attributesReport entry: ddtrace/internal/settings/errortracking.py:43 The PR adds The merge base already reports the subsequent equalities with Related ty issue: ty#2016 discusses limitations of dynamic class EnvVariable:
pass
class ErrorTrackingConfig:
_report_handled_errors = EnvVariable()
config = ErrorTrackingConfig()
setattr(config, "_report_handled_errors", "all")
# Merge base: no diagnostic
# PR: warning[redundant-condition-strict] Condition `config._report_handled_errors in ["all"]` is always false
if config._report_handled_errors in ["all"]:
passThe minimized condition evaluates to 2. paasta: a tuple parameter checked against stringsReport entry: paasta_tools/paastaapi/api_client.py:211 The parameter is annotated as def check(response_type: tuple[object]):
# Merge base: no diagnostic
# PR: warning[redundant-condition-strict] Condition `response_type not in ["file"]` is always true
if response_type not in ["file"]:
pass3. SciPy: a literal union cannot match either excluded methodReport entry: scipy/optimize/tests/test__root.py:25 The loop iterates over seven method names, excluding both for method in ["hybr", "lm"]:
# Merge base: no diagnostic
# PR: warning[redundant-condition-strict] Condition `method in ("linearmixing",)` is always false
if method in ("linearmixing",):
pass4. steam.py: excluding an absent slot nameReport entry: steam/chat.py:172 Both revisions infer # Merge base: no diagnostic
# PR: warning[redundant-condition-strict] Condition `"_user" not in {"_state"}` is always true
if "_user" not in {"_state"}:
passReproduction
|
Inline list and set membership tests now preserve the values of their individual elements, allowing ty to determine when a condition is always true or false. With the target platform set to Linux, both
sys.platform in ["linux", "windows"]andsys.platform in {"linux", "windows"}select only the matching branch, so an assignment there is inferred asLiteral[1].Reuse the precise element extraction used for iteration and membership narrowing without changing the inferred container type. Lists use the existing tuple membership equality evaluator; sets are folded only when their elements and the searched value have known builtin literal hashing and equality. Fixed-length unpacking also respects tuple subclasses that override
__iter__.Context is that in python/typing#2173 people are wanting to specify that
sys.platform in ["linux", "windows"]should work. This makes it work in ty so that we can be fine with any outcome of that specification change.Test plan
Mdtests cover platform-dependent branch reachability; positive and negative membership in inline lists and sets; inferred literal values and unions; fixed-length unpacking and tuple iterator overrides; stored mutable containers; custom equality; comparison chains; and preservation of enum-set narrowing.
Ecosystem results
The ecosystem comparison adds four
redundant-condition-strictwarnings:Noneis checked against strings, so the exclusion is always true._state, so the membership filter is redundant.setattr, which ty does not model. The resulting false positive exposes an existing limitation already present for equality and tuple membership. We accept that limitation for this change.All four changes were reproduced and minimized against the exact compared revisions. Flaky diagnostic differences are excluded from this summary.