Skip to content

Change occurrences of format() to f-strings#439

Merged
dstansby merged 4 commits intozarr-developers:mainfrom
DimitriPapadopoulos:f-strings
Aug 21, 2024
Merged

Change occurrences of format() to f-strings#439
dstansby merged 4 commits intozarr-developers:mainfrom
DimitriPapadopoulos:f-strings

Conversation

@DimitriPapadopoulos
Copy link
Copy Markdown
Contributor

Also change one occurrence of % to format(), as changing to an f-string would result in a very long line.

TODO:

  • Unit tests and/or doctests in docstrings
  • Tests pass locally
  • Docstrings and API docs for any new/modified user-facing classes and functions
  • Changes documented in docs/release.rst
  • Docs build locally
  • GitHub Actions CI passes
  • Test coverage to 100% (Codecov passes)

@codecov
Copy link
Copy Markdown

codecov bot commented May 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.91%. Comparing base (8b53fc1) to head (367e575).
Report is 68 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #439      +/-   ##
==========================================
- Coverage   99.91%   99.91%   -0.01%     
==========================================
  Files          59       59              
  Lines        2339     2334       -5     
==========================================
- Hits         2337     2332       -5     
  Misses          2        2              
Files with missing lines Coverage Δ
numcodecs/abc.py 100.00% <100.00%> (ø)
numcodecs/astype.py 100.00% <100.00%> (ø)
numcodecs/categorize.py 100.00% <100.00%> (ø)
numcodecs/compat.py 100.00% <100.00%> (ø)
numcodecs/delta.py 100.00% <100.00%> (ø)
numcodecs/fixedscaleoffset.py 100.00% <100.00%> (ø)
numcodecs/json.py 96.07% <100.00%> (-0.08%) ⬇️
numcodecs/lzma.py 100.00% <100.00%> (ø)
numcodecs/msgpacks.py 100.00% <100.00%> (ø)
numcodecs/ndarray_like.py 100.00% <100.00%> (ø)
... and 6 more
---- 🚨 Try these New Features:

@dstansby
Copy link
Copy Markdown
Contributor

Looks good in theory, but is there a ruff rule (or similar) we can enable to automate making sure this change stays in the future?

@DimitriPapadopoulos DimitriPapadopoulos force-pushed the f-strings branch 4 times, most recently from 66fec9b to cecee04 Compare August 10, 2024 09:13
@DimitriPapadopoulos
Copy link
Copy Markdown
Contributor Author

DimitriPapadopoulos commented Aug 10, 2024

I have enabled the relevant ruff rules UP.

A small part of the changes is manual, because ruff currently doesn't catch all issues.

@DimitriPapadopoulos DimitriPapadopoulos force-pushed the f-strings branch 4 times, most recently from 67757e1 to ba8e691 Compare August 10, 2024 12:30
UP006 Use `tuple` instead of `Tuple` for type annotation

UP035 `typing.Dict` is deprecated, use `dict` instead
UP035 `typing.Tuple` is deprecated, use `tuple` instead
UP035 `typing.Type` is deprecated, use `type` instead
@dstansby dstansby merged commit 4784a52 into zarr-developers:main Aug 21, 2024
@DimitriPapadopoulos DimitriPapadopoulos deleted the f-strings branch August 21, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants