Skip to content

Conversation

@MetRonnie
Copy link
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.

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
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
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
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
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
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
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
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)

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.

2 participants