Zoneinfo was introduced within python 3.9.
The support of pytz will be removed within RHEL 10 [1].
2023.2 (bobcat) will move our testing runtime to py3.9 and py3.10
so we want to see pytz removed within this series.
tzdata is required at runtime in our gates, because, by default,
zoneinfo uses the system’s time zone data if available; if no system
time zone data is available, the library will fall back to using the
first-party tzdata package available on PyPI. Apparently our gates have no
time zone data available nor tzdata installed by default because we get the
following error without tzdata installed [3]:
`ModuleNotFoundError: No module named 'tzdata'
So I prefer to add tzdata in our requirements to avoid runtime failure
related to time zone and ensure that time zone are always available.
[1] https://issues.redhat.com/browse/RHEL-219
[2] https://review.opendev.org/c/openstack/governance/+/872232
[3]
https://zuul.opendev.org/t/openstack/build/0a1576775e894b09bc31269fea00ba03/log/job-output.txt#1445`
Depends-on: https://review.opendev.org/c/openstack/requirements/+/875854
Change-Id: I8d87d54f6f5ded8caee6cb780bacb39afea0fea1
msgpack is throwing a warning that the unpacker has deprecated the use
of encoding argument. Instead the unpacker uses `raw=False`, which
does an unpack with similar behavior to the old encoding='utf-8'
mechanism.
This will reduce a lot of warning spam for projects using msgpack
such as Keystone. The change to the kwarg "raw" from "bytes_as_raw"
happned between 0.5.1 and 0.5.2. Changing the lower constraint is
required to ensure the new arguments are matching the method
signature.
Change-Id: Iadbee3ec8def9512369a415fb4603dc05d0cbc56
1.As mentioned in [1], we should avoid using
six.iteritems to achieve iterators. We can use
dict.items instead, as it will return iterators
in PY3 as well. And dict.items/keys will more readable.
2.In py2, the performance about list should be negligible,
see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Change-Id: Ifbe7929580ec61a2cd50232794c0cbd0cbf37edc
There are some differences in the behaviour of json and msgpack
serializers. Msgpack throws TypeError when it doesn't know
how to handle an object. Json throws ValueError instead. Regarding
the fact that serialization should be configurable (in particular,
serializers should have similar behaviour; right now transition from
json to msgpack leads to errors and fails) this patch proposes to
raise ValueError instead of TypeError on failures so that libraries
already using jsonutils would be able to also work with msgpackutils.
Change-Id: I3d21b7d136e5a426a3c4a70a953c82ddcd6ef5af
In order to make it easy to extend the default msgpack extension
registry add a copy method to registries and select type handlers
so that a registry with additional values can be easily provided
to the various msgpack utils loads/dumps code.
This also re-adds the msgpackutils tests which appear to have
not shifted over (or otherwise disappeared somehow?) from when the
tests used to live in the root directory.
Closes-Bug: #1537716
Change-Id: I9785a9071044d0e8c044a36ae9af9912fd06c49d
If the datetime is serialized with python2 and deserializer
with python3 we got KeyError, because python3 will read
the data written with python2 as bytes and doesn't convert it in unicode.
So ensure we use always unicode everywhere.
Change-Id: I4bee7369a278fa7705cde860c68e133cee2fa79e
Closes-bug: #1556081
We doesn't support python 2.6 now, this commit
removes Python 2.6 related code in module msgpackutls.
Change-Id: Id148239ee6c1ad461188fa38b06ca0d7913d7454
Document in which version new types and functions were added using
".. versionadded:: x.y". Document changes using
".. versionchanged:: x.y."
For base64 module, add the versionadded tag in the module top
docstring, not on each type/function.
I used "git blame" + "git tag --contains=SHA1" to find these version,
and then I checked manually each version.
Change-Id: I4a891b18064fe7b857a79c57030ff31f7a0370b4
Ensure jsonutils and msgpackutils headers are linkable and
connect into there associated functions and classes so that
clicking on links works (instead of not working).
Change-Id: Ifa28421e7d21a85290ee13d04918325c3f991b92
Ensure that the handler registry (and the default
registry) appears in the generated docs and make sure that a
note is added that we can not currently serialize and restore
tuples correctly (at least until the mentioned pull request is
merged and a release is made avaiable with it).
Change-Id: Ic5b9c41b401c6983bd416fd6726319cc674c1759
This change revamps the current serialization and
deserialization functions to be tiny objects that
have the ability to serialize there expected types.
It also adds a registry of these handlers objects
and allows for passing a registry into the dumps
and loads methods for people that want to add there
own handlers on.
Change-Id: Ib1a8a507c6c3d4f0372114d67163d3f2ab495c9f
The timeutils module already provides a better
marshall/unmarshall routine that doesn't use strtime
but uses dictionary conversion instead so we should
just use that (to avoid the weirdness with strtime).
Change-Id: Ia7c88ec4266f914d0c89b67a3fb2b936cc1a1c93
Messagepack is used by some projects, so providing a more
featureful encoding/decoding functionality that works better
with specialized types such as datetime, uuids and so-on in
a customized manner would be quite useful for those projects
that use it so they don't blow up when encoding and don't need
to resort to lossy serialization (by using jsonutils).
Change-Id: I295bfca0737301d15414410822bfbb28f66370dd