Fix Python 3.11 StrEnum Compatibility#6242
Merged
Czaki merged 2 commits intonapari:mainfrom Sep 23, 2023
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6242 +/- ##
=======================================
Coverage 91.60% 91.61%
=======================================
Files 583 585 +2
Lines 51364 51382 +18
=======================================
+ Hits 47051 47072 +21
+ Misses 4313 4310 -3
|
Czaki
approved these changes
Sep 20, 2023
Carreau
approved these changes
Sep 21, 2023
kne42
added a commit
to kne42/napari
that referenced
this pull request
Sep 27, 2023
* main: (21 commits) [pre-commit.ci] pre-commit autoupdate (napari#6266) ENH Make `_open_preferences_dialog` return `PreferencesDialog` (napari#6269) Fix link to artifacts in update dependecies comment (napari#6270) ci(dependabot): bump docker/login-action from 2.1.0 to 3.0.0 (napari#6263) FIX add `changing` event to `EventedDict` (napari#6268) Restore 'V' keybinding for layer visibiltiy toggle (napari#6261) remove: napari.qt.progress (deprecated in 0.4.11) (napari#6252) Fix `ShapeList.outline` validations for `int`/list like argument and add a test (napari#6215) Fix nitpicks in `id` and `title` `Action` fields in samples menu (napari#6267) ci(dependabot): bump actions/checkout from 2 to 4 (napari#6264) ci(dependabot): bump actions/setup-python from 2 to 4 (napari#6201) Fix typing in _app_model (napari#6059) Update `app-model`, `dask`, `fsspec`, `hypothesis`, `imageio`, `ipython`, `jsonschema`, `matplotlib`, `numpy`, `pandas`, `pillow`, `psygnal`, `pytest`, `qtconsole`, `qtpy`, `rich`, `scipy`, `superqt`, `tensorstore`, `tifffile`, `virtualenv`, `xarray`, `zarr` (napari#6265) Fix upgrade dependencies wokflow (napari#6211) Type _WeakCounter (napari#6246) convert Color to string (napari#6243) Partially fix translations testing (napari#6014) Allow to use all ViewerModel kwargs in Viewer constructor (napari#6209) MAINT: Replace `assert np.all(? == ?)` with `assert_array_equal` (napari#6244) Fix Python 3.11 StrEnum Compatibility (napari#6242) ...
kne42
added a commit
to kne42/napari
that referenced
this pull request
Sep 28, 2023
* main: (21 commits) [pre-commit.ci] pre-commit autoupdate (napari#6266) ENH Make `_open_preferences_dialog` return `PreferencesDialog` (napari#6269) Fix link to artifacts in update dependecies comment (napari#6270) ci(dependabot): bump docker/login-action from 2.1.0 to 3.0.0 (napari#6263) FIX add `changing` event to `EventedDict` (napari#6268) Restore 'V' keybinding for layer visibiltiy toggle (napari#6261) remove: napari.qt.progress (deprecated in 0.4.11) (napari#6252) Fix `ShapeList.outline` validations for `int`/list like argument and add a test (napari#6215) Fix nitpicks in `id` and `title` `Action` fields in samples menu (napari#6267) ci(dependabot): bump actions/checkout from 2 to 4 (napari#6264) ci(dependabot): bump actions/setup-python from 2 to 4 (napari#6201) Fix typing in _app_model (napari#6059) Update `app-model`, `dask`, `fsspec`, `hypothesis`, `imageio`, `ipython`, `jsonschema`, `matplotlib`, `numpy`, `pandas`, `pillow`, `psygnal`, `pytest`, `qtconsole`, `qtpy`, `rich`, `scipy`, `superqt`, `tensorstore`, `tifffile`, `virtualenv`, `xarray`, `zarr` (napari#6265) Fix upgrade dependencies wokflow (napari#6211) Type _WeakCounter (napari#6246) convert Color to string (napari#6243) Partially fix translations testing (napari#6014) Allow to use all ViewerModel kwargs in Viewer constructor (napari#6209) MAINT: Replace `assert np.all(? == ?)` with `assert_array_equal` (napari#6244) Fix Python 3.11 StrEnum Compatibility (napari#6242) ...
Czaki
pushed a commit
that referenced
this pull request
Oct 17, 2023
in Python 3.11, using a base of `class MyEnum(str, Enum)` instead of `class MyEnum(StrEnum)` will cause it to put the enum name instead of its string value when used in an f-string see python/cpython#100458
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.
in Python 3.11, using a base of
class MyEnum(str, Enum)instead ofclass MyEnum(StrEnum)will cause it to put the enum name instead of its string value when used in an f-stringsee python/cpython#100458