Repository navigation
v5.3.0: StrEnum config enums, typing.Self, and the Python 3.11 floor - #226
Merged
Merged
Conversation
…onfig
Clears ruff UP042 under the new py311 target. MatchMode, Prompts,
Effort, CacheMode, MergeMode and ResolutionKind were (str, Enum)
mixins, whose str() renders "MatchMode.EAGER" rather than the value.
Config building parses every enum key with parse_enum(..., str(raw)),
so an embedder passing a member in a Mapping config, e.g.
{"online": {"lookup": {"match": MatchMode.EAGER}}}, got a ValueError
listing the very value it passed. Only CacheMode dodged this, through
an isinstance special case that StrEnum makes redundant, so drop it.
Also applies ruff format to tests/test_mtime.py, left unformatted by
the datetime.UTC autofix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… leftovers typing.Self is stdlib from 3.11. Use it for the two cls(...) factory classmethods (CliOverrides.from_auth_list, OnlineSessionState.from_lookup) and for two test fakes that return self. Remove the stale "needed for python 3.10" comment on datetime.now(tz=UTC), reword the zipremove typeshed comment, and target 3.11 in the righttyper script. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to 9637f39 (minimum Python is now 3.11): clears the remaining
make fixerrors and adopts the 3.11 features that apply here.Changes
fix(config): StrEnum for the str-valued enums. Clears the 6 ruff UP042 errors.
MatchMode,Prompts,Effort,CacheMode,MergeModeandResolutionKindwere(str, Enum)mixins, and theirstr()renders"MatchMode.EAGER", not the value. The config builder parses every enum key withparse_enum(..., str(raw)), so passing an enum member in a config mapping failed:CacheModedodged this through anisinstancespecial case in_build_cache; StrEnum makes that redundant, so it's gone. The newtests/unit/test_config_enum_inputs.pyfails 4/5 on develop and passes 5/5 here. As a side effect, these members'str()and f-string output is now the value (ask), notMatchMode.ASK; nothing depended on the old form.refactor:
typing.Selffor the twocls(...)factory classmethods (CliOverrides.from_auth_list,OnlineSessionState.from_lookup) and two test fakes that returnself. Also drops the stale "needed for python 3.10" comment instamp.py, rewords a 3.10 typeshed comment, and points the righttyper script at 3.11.v5.3.0. Minor, not patch, because dropping Python 3.10 is breaking. NEWS gets a new section.
ruff formatalso reformatstests/test_mtime.py, which thedatetime.UTCautofix had left unformatted.Not adopted
No code here benefits from
tomllib, exception groups,TaskGroup/asyncio.timeout,hashlib.file_digest,contextlib.chdiror the broaderfromisoformat.typing_extensionsstays because it's only used foroverride(3.12). PlainEnumclasses with string values stay as they are, because converting them would make their members compare equal to strings.Verification
make fix,make lintandmake tyare clean.make test: 2259 passed, 1 skipped on Python 3.14, and the same on 3.11.🤖 Generated with Claude Code