Skip to content

Conversation

@markusjellitsch
Copy link
Contributor

Replaced datetime.utcnow() with datetime.now(tz=datetime.timezone.utc) to fix following deprecated warning:

 Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)

This warning can be very annoying when running pytest tests with enabled HCI snooping.

bumble/snoop.py Outdated
The keyword args that may be referenced by the string pattern are:
now: the value of `datetime.now()`
utcnow: the value of `datetime.utcnow()`
utcnow: the value of 'datetime.now(tz=datetime.timezone.utc)'
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be best to keep the backquotes here instead of regular quotes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

int(
(
datetime.datetime.now(tz=datetime.timezone.utc)
- self.TIMESTAMP_ANCHOR
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that TIMESTAMP_ANCHOR would need to be updated as well, to be a timestamp with an explicit UTC timezone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update

I think that TIMESTAMP_ANCHOR would need to be updated as well, to be a timestamp with an explicit UTC timezone.

updated

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