Skip to content

Address some warnings#6640

Merged
MetRonnie merged 3 commits intocylc:masterfrom
MetRonnie:warnings
Dec 10, 2025
Merged

Address some warnings#6640
MetRonnie merged 3 commits intocylc:masterfrom
MetRonnie:warnings

Conversation

@MetRonnie
Copy link
Copy Markdown
Member

@MetRonnie MetRonnie commented Feb 27, 2025

Spotted in pytest output

datetime.utcnow()

Deprecated since version 3.12: Use datetime.now() with UTC instead.

Note

There is a risk with this because using comparison operators (e.g. <) between timezone-aware and naive (timezone-unaware) datetimes results in a type error. However I cannot find any instances of doing any such comparisons, and all the tests are passing.

sqlite3.connect():

Changed in version 3.13: Positional use of the parameters timeout, detect_types, isolation_level, check_same_thread, factory, cached_statements, and uri is deprecated. They will become keyword-only parameters in Python 3.15.

Important

Python 3.15 is coming in Oct 2026, hence I think this ought to go into 8.7.0 at the latest

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • No dependency changes
  • No tests/docs/changelog needed
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@MetRonnie MetRonnie added this to the 8.5.0 milestone Feb 27, 2025
@MetRonnie MetRonnie self-assigned this Feb 27, 2025
@oliver-sanders
Copy link
Copy Markdown
Member

oliver-sanders commented Mar 4, 2025

@hjoliver, this PR removes a code block that isn't used any more. Can you have a quick look at it and merge if ok.

@MetRonnie
Copy link
Copy Markdown
Member Author

@hjoliver ping

Comment on lines -144 to -160
if custom_time_zone_info is not None:
custom_hours = custom_time_zone_info["hours"]
custom_minutes = custom_time_zone_info["minutes"]
if use_basic_format:
custom_string = custom_time_zone_info["string_basic"]
else:
custom_string = custom_time_zone_info["string_extended"]
if date_time_is_local:
date_time_hours = TIME_ZONE_LOCAL_UTC_OFFSET_HOURS
date_time_minutes = TIME_ZONE_LOCAL_UTC_OFFSET_MINUTES
else:
date_time_hours, date_time_minutes = (0, 0)
diff_hours = custom_hours - date_time_hours
diff_minutes = custom_minutes - date_time_minutes
date_time = date_time + timedelta(
hours=diff_hours, minutes=diff_minutes)
time_zone_string = custom_string
Copy link
Copy Markdown
Member Author

@MetRonnie MetRonnie Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjoliver, this PR removes a code block that isn't used any more. Can you have a quick look at it and merge if ok.

This code block was previously only used by the Cylc 7 GUI (7.8.15):

# Task not finished, but has started and has a meant;
# so we can compute an expected time of completion.
tetc_string = (
self._id_tetc_cache.get(id_, {}).get(tetc_unix))
if tetc_string is None:
# We have to calculate it.
tetc_string = get_time_string_from_unix_time(
tetc_unix,
custom_time_zone_info=time_zone_info)

However, even then it looks like it was only used for the same purpose that is already provided by override_use_utc:

time_zone_info = self.updater.global_summary.get("time zone info")

if get_utc_mode():
global_summary['time zone info'] = TIME_ZONE_UTC_INFO
else:
global_summary['time zone info'] = TIME_ZONE_LOCAL_INFO

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjoliver poke

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjoliver poke

@oliver-sanders
Copy link
Copy Markdown
Member

(bumped to 8.5.0 as this is non-critical, bump back if merged in time)

@oliver-sanders oliver-sanders modified the milestones: 8.5.0, 8.6.0 Jul 11, 2025
@oliver-sanders oliver-sanders modified the milestones: 8.6.0, 8.x Sep 1, 2025
@MetRonnie MetRonnie modified the milestones: 8.x, 8.7.0 Sep 29, 2025
@MetRonnie
Copy link
Copy Markdown
Member Author

MetRonnie commented Sep 29, 2025

Python 3.15 is out next year, hence I think this ought to go in soon (8.7.0 at the latest)

@hjoliver
Copy link
Copy Markdown
Member

Apologies for the massive delay!

@hjoliver
Copy link
Copy Markdown
Member

Several conflicts now, sorry.

@MetRonnie
Copy link
Copy Markdown
Member Author

Copy link
Copy Markdown
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase Reviewed

@wxtim
Copy link
Copy Markdown
Member

wxtim commented Dec 10, 2025

@MetRonnie - Please check the failing test - I've kicked it just in case it's flaky?

@MetRonnie
Copy link
Copy Markdown
Member Author

Just flaky - merging

@MetRonnie MetRonnie merged commit 043c701 into cylc:master Dec 10, 2025
33 of 34 checks passed
@MetRonnie MetRonnie deleted the warnings branch December 10, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants