Skip to content

Fix Ruff DTZ rules after update - #699

Open
santisoler wants to merge 3 commits into
mainfrom
fix-ruff-0.16
Open

Fix Ruff DTZ rules after update#699
santisoler wants to merge 3 commits into
mainfrom
fix-ruff-0.16

Conversation

@santisoler

@santisoler santisoler commented Jul 29, 2026

Copy link
Copy Markdown
Member

Address Ruff's DTZ rules by specifying the timezone when calling datetime functions. This fix extends the support of the IGRF classes to dates with timezone information. When interpolating the IGRF coefficients set the start of the year to the UTC time of January 1st at 00:00. Add ignore comments where the tzinfo is not relevant. Add some tests to the IGRF functions that cover dates with and without information about the timezone.

Leaving link to those rules for reference: https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz

Specify the timezone when calling `datetime` functions, to avoid naive
objects that are not time-zone aware.
Make sure to compute seconds from last epoch by setting the start of the
year in UTC time.
Parametrize igrf tests using `tzinfo` as UTC or None. Add extra tests to
check that some of the fixes work as expected.
@santisoler

Copy link
Copy Markdown
Member Author

@leouieda would you mind double checking these changes? Particularly the change to interpolate_coefficients and the test I added. The good thing is that now the IGRF supports dates with timezone information!

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.

1 participant