chore: replace two enums with literals (3/4) - #1286
Draft
selmanozleyen wants to merge 2 commits into
Draft
selmanozleyen wants to merge 2 commits into
selmanozleyen wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feat/stain-reference-methods #1286 +/- ##
===============================================================
Coverage ? 78.99%
===============================================================
Files ? 64
Lines ? 9460
Branches ? 1564
===============================================================
Hits ? 7473
Misses ? 1446
Partials ? 541
🚀 New features to boost your workflow:
|
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
from
September 15, 2026 16:50
1ba759b to
d05f6d0
Compare
selmanozleyen
force-pushed
the
feat/enum-to-literal
branch
from
September 15, 2026 16:50
519c1f3 to
3be7928
Compare
selmanozleyen
force-pushed
the
feat/enum-to-literal
branch
from
September 25, 2026 10:41
3be7928 to
315f074
Compare
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
2 times, most recently
from
September 25, 2026 12:48
b4fb050 to
391f486
Compare
selmanozleyen
force-pushed
the
feat/enum-to-literal
branch
2 times, most recently
from
September 25, 2026 16:05
8002862 to
ea84b09
Compare
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
from
September 25, 2026 16:05
391f486 to
69a17fe
Compare
selmanozleyen
force-pushed
the
feat/enum-to-literal
branch
from
September 25, 2026 19:42
ea84b09 to
1dc3a62
Compare
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
from
September 25, 2026 19:42
69a17fe to
2deb8b1
Compare
selmanozleyen
removed this pull request from stack #1281
September 25, 2026 20:17
selmanozleyen
force-pushed
the
feat/enum-to-literal
branch
from
September 25, 2026 20:18
1dc3a62 to
8a92508
Compare
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
from
September 25, 2026 20:18
2deb8b1 to
18ee65c
Compare
selmanozleyen
force-pushed
the
feat/enum-to-literal
branch
from
September 25, 2026 20:22
8a92508 to
60b8138
Compare
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
2 times, most recently
from
September 25, 2026 21:58
cc1cbbb to
a7bf95b
Compare
selmanozleyen
force-pushed
the
feat/enum-to-literal
branch
from
September 25, 2026 21:58
60b8138 to
ec2d430
Compare
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
from
September 25, 2026 22:04
a7bf95b to
178c9af
Compare
selmanozleyen
force-pushed
the
feat/enum-to-literal
branch
from
September 25, 2026 22:04
ec2d430 to
a6a2231
Compare
Both were closed vocabularies of strings that callers write as strings, and neither earned the class it was declared as. `DetectTissueMethod` used `enum.auto()`, so its members carried no value anyone read; every use was an equality test, and a string argument was coerced through `DetectTissueMethod[method.upper()]` before any of them ran. It was never exported either, while its own docstring told callers to pass `DetectTissueMethod.OTSU` -- advice they could not follow. The `.upper()` in that coercion is why `method` is lowered before the new membership check: `"OTSU"` was accepted before and still is. `QCMetric` was a `StrEnum`, so its members already were their own strings and worked as registry keys unchanged. Its validation, though, was `isinstance(m, QCMetric)`, which is False for the plain string the member compares equal to: `qc_image(metrics="tenengrad")` raised while the docs advertised a `StrEnum`. Both now validate against `get_args`, which accepts what callers actually write. Two behaviour changes worth naming. An unknown metric now raises `ValueError` rather than `TypeError` -- it is a bad value, not a bad type, and the old class was chosen to complain about enum membership. And `QCMetric` leaves the module namespace entirely, not just `__all__`: a page rendering as nothing but `alias of Literal[...]` documents an argument rather than a type callers hold, and the names it listed now sit on the parameter that takes them, in both `im.qc_image` and its `pl` counterpart. `InputKind` stays an enum. It is internal and never crosses the public boundary.
selmanozleyen
force-pushed
the
feat/enum-to-literal
branch
from
September 25, 2026 22:28
a6a2231 to
f97a55a
Compare
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
from
September 25, 2026 22:28
178c9af to
b5bdc06
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continuation of #1279. Because we don't want to expose different classes for this anymore