Skip to content

Commit

Permalink
adapter.http: Fix reference to constant from the future
Browse files Browse the repository at this point in the history
Currently, we're using `datetime.UTC`,
a constant defined in the built-in `datetime`
module.

However, this constant was only introduced in
Python version 3.11, as you can see in the
documentation:

- Does not exist in [datetime Python 3.10]
- Exists in [datetime python 3.11]

We did not catch this, as we most likely
programmed the module with Python >= 3.11 and our
CI also ran `mypy` with Python 3.12.

[datetime Python 3.10]: https://docs.python.org/3.10/library/datetime.html#constants
[datetime python 3.11]: https://docs.python.org/3.11/library/datetime.html#datetime.UTC

Fixes eclipse-basyx#330
  • Loading branch information
s-heppner committed Nov 14, 2024
1 parent 1e93fa5 commit 767fc57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sdk/basyx/aas/adapter/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __init__(self, code: str, text: str, message_type: MessageType = MessageType
self.code: str = code
self.text: str = text
self.message_type: MessageType = message_type
self.timestamp: datetime.datetime = timestamp if timestamp is not None else datetime.datetime.now(datetime.UTC)
self.timestamp: datetime.datetime = timestamp if timestamp is not None else datetime.datetime.now(datetime.timezone.utc)


class Result:
Expand Down

0 comments on commit 767fc57

Please sign in to comment.