././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6657298 oslo_serialization-5.7.0/0000775000175000017500000000000000000000000015457 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/.coveragerc0000664000175000017500000000017700000000000017605 0ustar00zuulzuul00000000000000[run] branch = True source = oslo_serialization omit = oslo_serialization/tests/* [report] ignore_errors = True precision = 2 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/.mailmap0000664000175000017500000000013000000000000017072 0ustar00zuulzuul00000000000000# Format is: # # ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/.pre-commit-config.yaml0000664000175000017500000000221700000000000021742 0ustar00zuulzuul00000000000000repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: trailing-whitespace # Replaces or checks mixed line ending - id: mixed-line-ending args: ['--fix', 'lf'] exclude: '.*\.(svg)$' # Forbid files which have a UTF-8 byte-order marker - id: check-byte-order-marker # Checks that non-binary executables have a proper shebang - id: check-executables-have-shebangs # Check for files that contain merge conflict strings. - id: check-merge-conflict # Check for debugger imports and py37+ breakpoint() # calls in python source - id: debug-statements - id: check-yaml files: .*\.(yaml|yml)$ - repo: https://opendev.org/openstack/hacking rev: 7.0.0 hooks: - id: hacking additional_dependencies: [] exclude: '^(doc|releasenotes|tools)/.*$' - repo: https://github.com/PyCQA/bandit rev: 1.7.10 hooks: - id: bandit args: ['-x', 'tests', '--skip', 'B411'] - repo: https://github.com/asottile/pyupgrade rev: v3.18.0 hooks: - id: pyupgrade args: [--py3-only] ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/.stestr.conf0000664000175000017500000000007300000000000017730 0ustar00zuulzuul00000000000000[DEFAULT] test_path=./oslo_serialization/tests top_path=./ ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/.zuul.yaml0000664000175000017500000000033300000000000017417 0ustar00zuulzuul00000000000000- project: templates: - check-requirements - lib-forward-testing-python3 - openstack-python3-jobs - periodic-stable-jobs - publish-openstack-docs-pti - release-notes-jobs-python3 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147099.0 oslo_serialization-5.7.0/AUTHORS0000664000175000017500000000704100000000000016531 0ustar00zuulzuul00000000000000Akihiro Motoki Alexander Gorodnev Andreas Jaeger Andreas Jaeger Ann Kamyshnikova Ben Nemec Brant Knudson Chang Bo Guo ChangBo Guo(gcb) Christian Berendt Chuck Short Corey Bryant Cyril Roelandt Dan Prince Dan Smith Daniel Bengtsson Davanum Srinivas (dims) Davanum Srinivas Davanum Srinivas Dirk Mueller Doug Hellmann Edan David Eric Brown Eric Harney Flavio Percoco Gary Kotton Gevorg Davoian Ghanshyam Ghanshyam Mann He Jie Xu Hervé Beraud Ian Cordasco Ihar Hrachyshka James Carey James Page Jay Pipes Jeremy Stanley Jim Baker Joe Gordon Joe Gordon Joel Capitao Johannes Erdfelt John L. Villalovos Joshua Harlow Joshua Harlow Joshua Harlow Julien Danjou Kenneth Giusti Luis A. Garcia Luong Anh Tuan Martin Kopec Matt Riedemann Mehdi Abaakouk Mike Heald Moisés Guimarães de Medeiros Monty Taylor Morgan Morgan Fainberg Nataliia Uvarova OpenStack Release Bot Phil Day Ronald Bradford Russell Bryant Sean McGinnis Sirushti Murugesan Sofia Enriquez Stanislaw Pitucha Stephen Finucane Steve Martinelli Takashi Kajinami Thomas Goirand Tim Daly Jr Tony Breeds Victor Sergeyev Victor Stinner Vu Cong Tuan YAMAMOTO Takashi ZhiQiang Fan ZhijunWei ZhongShengping Zhongyue Luo Zhongyue Luo avnish caoyuan gecong1973 gujin jacky06 jiangzhilin melissaml ricolin songwenping wu.shiming xianming.mao yangyawei yanheven yatinkarel zhangboye zhoulinhui ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/CONTRIBUTING.rst0000664000175000017500000000133700000000000020124 0ustar00zuulzuul00000000000000If you would like to contribute to the development of oslo's libraries, first you must take a look to this page: https://specs.openstack.org/openstack/oslo-specs/specs/policy/contributing.html If you would like to contribute to the development of OpenStack, you must follow the steps in this page: http://docs.openstack.org/infra/manual/developers.html Once those steps have been completed, changes to OpenStack should be submitted for review via the Gerrit tool, following the workflow documented at: http://docs.openstack.org/infra/manual/developers.html#development-workflow Pull requests submitted through GitHub will be ignored. Bugs should be filed on Launchpad, not GitHub: https://bugs.launchpad.net/oslo.serialization ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147099.0 oslo_serialization-5.7.0/ChangeLog0000664000175000017500000003410600000000000017235 0ustar00zuulzuul00000000000000CHANGES ======= 5.7.0 ----- * Drop fallback for Python < 3.9 * Skip installation to speed up pep8 * Ignore iteritems() and use items() solely * reno: Update master for unmaintained/2023.1 5.6.0 ----- * Remove explicit pbr dependency * Add note about requirements lower bounds * Run pyupgrade to clean up Python 2 syntaxes * Fix outdated tox minversion * Declare Python 3.12 support * Remove Python 3.8 support * Update master for stable/2024.2 5.5.0 ----- * [jsonutils] Add handling of datetime.date format * reno: Update master for unmaintained/zed * Remove old excludes * Update master for stable/2024.1 * reno: Update master for unmaintained/xena * reno: Update master for unmaintained/wallaby * reno: Update master for unmaintained/victoria 5.4.0 ----- * Display coverage report * reno: Update master for unmaintained/yoga * Update python classifier in setup.cfg 5.3.0 ----- * pre-commit: Integrate bandit * pre-commit: Bump versions * bandit: Disable B411 * Require pytz only in Python < 3.9 * jsonutils: Raise ValueError in case the input can't be converted * Update master for stable/2023.2 5.2.0 ----- * Remove extra spaces in tox.ini * Bump bandit * Fix compatibility with Python 3.8 * Revert "Moves supported python runtimes from version 3.8 to 3.10" * Moves supported python runtimes from version 3.8 to 3.10 * Implement zoneinfo support to drop dependency to pytz * Use the new openstack-python3-jobs template * Update master for stable/2023.1 5.1.1 ----- * Fix issues related to tox4 5.1.0 ----- * Add Python3 antelope unit tests * Update master for stable/zed 5.0.0 ----- * Drop python3.6/3.7 support in testing runtime * Remove unnecessary unicode prefixes * Add Python3 zed unit tests * Update master for stable/yoga 4.3.0 ----- * Add Python3 yoga unit tests * Update master for stable/xena 4.2.0 ----- * setup.cfg: Replace dashes with underscores * setup.cfg: Replace dashes with underscores * Move flake8 as a pre-commit local target * Add Python3 xena unit tests * Update master for stable/wallaby * Remove lower-constraints remnants * Drop use of deprecated collections classes 4.1.0 ----- * Fix json to\_primitive when using IO OBjects * Use TOX\_CONSTRAINTS\_FILE * Dropping lower constraints testing * Use py3 as the default runtime for tox * Fix hacking min version to 3.0.1 * Add Python3 wallaby unit tests * Update master for stable/victoria * ignore reno generated artifacts * Adding pre-commit 4.0.1 ----- * Bump bandit version * Update openstackdocstheme 4.0.0 ----- * Remove the yamlutils module * Fix pygments style 3.2.0 ----- * Stop to use the \_\_future\_\_ module * Switch to newer openstackdocstheme and reno versions * Remove the unused coding style modules * Remove translation sections from setup.cfg * Align contributing doc with oslo's policy * Bump default tox env from py37 to py38 * Add py38 package metadata * Add release notes links to doc index * Add Python3 victoria unit tests * Update master for stable/ussuri 3.1.1 ----- * Update hacking for Python3 * Use unittest.mock instead of third party mock * Remove Python 3-specific conditional in dump\_as\_bytes * Drop use of six 3.1.0 ----- * Remove long-dead workaround * Add releasenote to deprecate the yamlutils module * Deprecated the yamlutils module * Update the minversion parameter * remove outdated header * reword releasenote for py27 support dropping 3.0.0 ----- * [ussuri][goal] Drop python 2.7 support and testing * tox: Trivial cleanup * Switch to Ussuri jobs * tox: Keeping going with docs * Update master for stable/train 2.29.2 ------ * Add Python 3 Train unit tests * Cap sphinx for py2 to match global requirements * Sync Sphinx requirement * Resolve some issue with tox.ini, setup.cfg * Dropping the py35 testing 2.29.1 ------ * Replace git.openstack.org URLs with opendev.org URLs * Explicitly set default\_flow\_style to False 2.29.0 ------ * OpenDev Migration Patch * Update master for stable/stein * Introduce a base yaml parser for all openstack components 2.28.2 ------ * add python 3.7 unit test job * Update hacking version * Fix README * Use template for lower-constraints * Update mailinglist from dev to discuss * Clean up .gitignore references to personal tools * Update the home-page to latest 2.28.1 ------ * add lib-forward-testing-python3 test job * add python 3.6 unit test job * import zuul job settings from project-config * import zuul job settings from project-config * py37: deal with Exception repr changes * Update reno for stable/rocky * Switch to stestr * Add release notes link to README 2.27.0 ------ * fix tox python3 overrides * Stop using encoding='utf-8' with msgpack 2.26.0 ------ * Unblock requirements changes * Remove stale pip-missing-reqs tox test * Trivial: Update pypi url to new url * set default python to python3 * add lower-constraints job * Updated from global requirements 2.25.0 ------ * Follow the new PTI for document build * Update links in README * Update reno for stable/queens * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * msgpack-python has been renamed to msgpack 2.23.0 ------ * Updated from global requirements * Add bandit to pep8 job 2.22.0 ------ * Remove -U from pip install * Avoid tox\_install.sh for constraints support * Remove setting of version/release from releasenotes * Updated from global requirements * Updated from global requirements 2.21.2 ------ * When serializing an exception return its 'repr' 2.21.1 ------ * jsonutils.to\_primitive(): add fallback parameter 2.21.0 ------ * Updated from global requirements * warn developers when can't convert value into primitive * Updated from global requirements * Updated from global requirements * Update reno for stable/pike * Updated from global requirements 2.20.0 ------ * Revert "Explicitly raise ValueError in to\_primitive" * Update URLs in documents according to document migration * rearrange existing documentation to fit the new standard layout * switch from oslosphinx to openstackdocstheme 2.19.1 ------ 2.19.0 ------ * Updated from global requirements * Don't iterate through addresses in netaddr.IPNetwork * Updated from global requirements * Updated from global requirements * Explicitly raise ValueError in to\_primitive * Updated from global requirements * Updated from global requirements 2.18.0 ------ * Use Sphinx 1.5 warning-is-error 2.17.0 ------ * Updated from global requirements * [Fix gate]Update test requirement * Updated from global requirements * Update reno for stable/ocata * Remove references to Python 3.4 2.16.0 ------ * Prefer raising the python2.x type error for b64 decode errors * Add Constraints support * Don't raise TypeError for invalid b64 * Replace six.iteritems() with .items() * Replaces uuid.uuid4 with uuidutils.generate\_uuid() * Show team and repo badges on README 2.15.0 ------ * Updated from global requirements * Updated from global requirements * Add reno for release notes management * Updated from global requirements 2.14.0 ------ * Add a title to the API Documentation page * Updated from global requirements * modify the home-page info with the developer documentation 2.13.0 ------ * Drop H803 in flake8 ignore list * Fix serialization of binary strings in Python3 2.12.0 ------ * Updated from global requirements * Fix parameters of assertEqual are misplaced * Add Python 3.5 classifier and venv 2.11.0 ------ * Updated from global requirements * Updated from global requirements * Use {} instead of dict() 2.10.0 ------ * Updated from global requirements 2.9.0 ----- 2.8.0 ----- * Replace TypeError by ValueError in msgpackutils * Support serializing ipaddress objs with jsonutils * Updated from global requirements * Updated from global requirements * Updated from global requirements 2.7.0 ----- * Trivial: ignore openstack/common in flake8 exclude list 2.6.0 ----- * [Trivial] Remove executable privilege of doc/source/conf.py 2.5.0 ----- * Drop babel as requirement since its not used * Updated from global requirements * Unified and simplified API for all serializers * Make msgpack registries copyable (and add \_\_contains\_\_) * msgpack: fix datetime serialization 2.4.0 ----- * Updated from global requirements 2.3.0 ----- * Updated from global requirements * Updated from global requirements * Updated from global requirements * Remove fallback to simplejson in jsonutils 2.2.0 ----- * Remove iso8601 dependency * Updated from global requirements * Updated from global requirements * Trival: Remove 'MANIFEST.in' 2.1.0 ----- * msgpackutils: drop Python 2.6 support 2.0.0 ----- * Updated from global requirements * Updated from global requirements * Remove python 2.6 classifier * Fix bug track URL * Remove python 2.6 and cleanup tox.ini * Updated from global requirements 1.11.0 ------ * Updated from global requirements * Use versionadded and versionchanged in doc * Fix coverage configuration and execution 1.10.0 ------ * Add utilities for base64 * Also check for the existence of \`items\` in to\_primitive() * Move 'history' -> release notes section * Add jsonutils.dump\_as\_bytes() function for py3 * Change ignore-errors to ignore\_errors * Updated from global requirements 1.9.0 ----- * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements 1.8.0 ----- * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Drop stale test - test\_jsonutils 1.7.0 ----- * Stop using deprecated oslo\_utils.timeutils.strtime * Add tox target to find missing requirements * Remove oslo namespace package * Do not use oslo namespace for oslo.i18n lib * Updated from global requirements * Updated from global requirements * Switch badges from 'pypip.in' to 'shields.io' 1.6.0 ----- * Revert "jsonutils: replace strtime() usage with isoformat()" * jsonutils: encode dict keys * jsonutils: simplify simple value handling * jsonutils: replace strtime() usage with isoformat() * Advertise support for Python3.4 / Remove support for Python 3.3 * Do not sync run\_cross\_tests.sh * Updated from global requirements * Remove run\_cross\_tests.sh * Fixes wrong folder for listing tests 1.5.0 ----- * Expose base msgpack exceptions so users don't need to import * Uncap library requirements for liberty * More docstring cleanups/tweaks * Add docstring(s) to handler registry(s) * Add pypi download + version badges * Cleanup README.rst and setup.cfg * Make the msgpackutils handlers more extendable * Updated from global requirements 1.4.0 ----- * Updated from global requirements 1.3.0 ----- * add dependency warning to requirements.txt * Correctly load and dump items with datetime.date(s) * Avoid using strtime for serializing datetimes * jsonutils: add set() tests and simplify recursive code * jsonutils: support UUID encoding * Use default in dumps() * Updated from global requirements * Update Oslo imports to remove namespace package * Add a messagepack utils helper module * Bump to hacking 0.10 * Updated from global requirements * fix bug tracker link in README.rst 1.2.0 ----- * Move files out of the namespace package * Activate pep8 check that \_ is imported * Updated from global requirements * Workflow documentation is now in infra-manual 1.1.0 ----- * Add pbr to installation requirements * Updated from global requirements * Fix pep8, docs, requirements issues in jsonutils and tests * Remove extraneous vim editor configuration comments * Support building wheels (PEP-427) * Fix coverage testing * Updated from global requirements * Support 'built-in' datetime module 1.0.0 ----- * Updated from global requirements * Add history/changelog to docs 0.2.0 ----- * Check for namedtuple\_as\_object support before using it * Work toward Python 3.4 support and testing 0.1.0 ----- * Updated from global requirements * Clean up docs before first release * Updated from global requirements * Added JSONEncoder and JSONDecoder * Add some basic docstring(s) * Fix docs build to run properly * Use oslo libraries - i18n and utils * Specify namedtuple\_as\_object=False when using simplejson * Get unit tests passing * exported from oslo-incubator by graduate.sh * Added missing jsonutils.dump() function * pep8: fixed multiple violations * Add kwargs to jsonutils.load(s) functions * Enforce unicode json output for jsonutils.load[s]() * jsonutils.load() accepts file pointer, not string * On Python <= 2.6, use simplejson if available * Use oslotest instead of common test module * Python3: enable test\_jsonutils.py * Use six.moves.xmlrpc\_client instead of xmlrpclib * Translation Message improvements * Python3 support for xmlrpclib * Use six.iteritems to make dict work on Python2/3 * Remove vim header * Ensure that Message objects will be sent via RPC in unicode format * jsonutils: make types py3 compatible * jsonutils: do not require xmlrpclib * Make dependency on netaddr optional * Bump hacking to 0.7.0 * Replace using tests.utils with openstack.common.test * Enable H302 hacking check * Add netaddr.IPAddress support to to\_primitive() * python3: python3 binary/text data compatbility * Convert unicode for python3 portability * Optimise to\_primitive common cases * Update to use flake8 * Fix Copyright Headers - Rename LLC to Foundation * Don't LOG.error on max\_depth (by default) * to\_primitive imposes what seems to be an arbitary data structure depth of 3, but there is at least on case in Nova (Security group Rules) which requires a depth beyond this * Allow to\_primitive to ignore datetimes * Replace direct use of testtools BaseTestCase * Use testtools as test base class * Fixes import order errors * Make project pyflakes clean * Add missing convert\_instances arg * Track to\_primitive() depth after iteritems() * Update iteritems test case to actually test iteritems * Use strtime() in to\_primitive() for datetime objs * Add 'filedecoder' method to the jsonutils wrapper module * Make jsonutils.dumps more general * Handle xmlrpclib.DateTime types when serializing to JSON * Revert "Add a load function wrapper to jsonutils" * Add a load function wrapper to jsonutils * Create openstack.common.jsonutils ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/HACKING.rst0000664000175000017500000000023500000000000017255 0ustar00zuulzuul00000000000000oslo.serialization Style Commandments ===================================== Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/LICENSE0000664000175000017500000002363600000000000016476 0ustar00zuulzuul00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6657298 oslo_serialization-5.7.0/PKG-INFO0000644000175000017500000000410300000000000016550 0ustar00zuulzuul00000000000000Metadata-Version: 2.1 Name: oslo.serialization Version: 5.7.0 Summary: Oslo Serialization library Home-page: https://docs.openstack.org/oslo.serialization/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Requires-Python: >=3.9 License-File: LICENSE Requires-Dist: msgpack>=0.5.2 Requires-Dist: oslo.utils>=3.33.0 Requires-Dist: tzdata>=2022.4 ======================== Team and repository tags ======================== .. image:: https://governance.openstack.org/tc/badges/oslo.serialization.svg :target: https://governance.openstack.org/tc/ference/tags/index.html .. Change things from this point on =================== oslo.serialization =================== .. image:: https://img.shields.io/pypi/v/oslo.serialization.svg :target: https://pypi.org/project/oslo.serialization/ :alt: Latest Version .. image:: https://img.shields.io/pypi/dm/oslo.serialization.svg :target: https://pypi.org/project/oslo.serialization/ :alt: Downloads The oslo.serialization library provides support for representing objects in transmittable and storable formats, such as Base64, JSON and MessagePack. * Free software: Apache license * Documentation: https://docs.openstack.org/oslo.serialization/latest/ * Source: https://opendev.org/openstack/oslo.serialization * Bugs: https://bugs.launchpad.net/oslo.serialization * Release notes: https://docs.openstack.org/releasenotes/oslo.serialization/ ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/README.rst0000664000175000017500000000204500000000000017147 0ustar00zuulzuul00000000000000======================== Team and repository tags ======================== .. image:: https://governance.openstack.org/tc/badges/oslo.serialization.svg :target: https://governance.openstack.org/tc/ference/tags/index.html .. Change things from this point on =================== oslo.serialization =================== .. image:: https://img.shields.io/pypi/v/oslo.serialization.svg :target: https://pypi.org/project/oslo.serialization/ :alt: Latest Version .. image:: https://img.shields.io/pypi/dm/oslo.serialization.svg :target: https://pypi.org/project/oslo.serialization/ :alt: Downloads The oslo.serialization library provides support for representing objects in transmittable and storable formats, such as Base64, JSON and MessagePack. * Free software: Apache license * Documentation: https://docs.openstack.org/oslo.serialization/latest/ * Source: https://opendev.org/openstack/oslo.serialization * Bugs: https://bugs.launchpad.net/oslo.serialization * Release notes: https://docs.openstack.org/releasenotes/oslo.serialization/ ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6577299 oslo_serialization-5.7.0/doc/0000775000175000017500000000000000000000000016224 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/doc/requirements.txt0000664000175000017500000000017300000000000021511 0ustar00zuulzuul00000000000000# These are needed for docs generation openstackdocstheme>=2.2.2 # Apache-2.0 sphinx>=2.0.0 # BSD reno>=3.1.0 # Apache-2.0 ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6577299 oslo_serialization-5.7.0/doc/source/0000775000175000017500000000000000000000000017524 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/doc/source/conf.py0000664000175000017500000000471300000000000021030 0ustar00zuulzuul00000000000000# Copyright (C) 2020 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import os import sys sys.path.insert(0, os.path.abspath('../..')) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', 'openstackdocstheme' ] # openstackdocstheme options openstackdocs_repo_name = 'openstack/oslo.serialization' openstackdocs_bug_project = 'oslo.serialization' openstackdocs_bug_tag = '' # autodoc generation is a bit aggressive and a nuisance when doing heavy # text edit cycles. # execute "export SPHINX_DEBUG=1" in your terminal to disable # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General information about the project. project = 'oslo.serialization' copyright = '2014, OpenStack Foundation' # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). add_module_names = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'native' # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. # html_theme_path = ["."] # html_theme = '_theme' # html_static_path = ['static'] html_theme = 'openstackdocs' # Output file base name for HTML help builder. htmlhelp_basename = '%sdoc' % project # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', '%s.tex' % project, '%s Documentation' % project, 'OpenStack Foundation', 'manual'), ] ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6577299 oslo_serialization-5.7.0/doc/source/contributor/0000775000175000017500000000000000000000000022076 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/doc/source/contributor/index.rst0000664000175000017500000000012400000000000023734 0ustar00zuulzuul00000000000000============== Contributing ============== .. include:: ../../../CONTRIBUTING.rst ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/doc/source/index.rst0000664000175000017500000000126300000000000021367 0ustar00zuulzuul00000000000000============================================== Welcome to oslo.serialization's documentation! ============================================== The `oslo`_ serialization library provides support for representing objects in transmittable and storable formats, such as JSON and MessagePack. Contents ======== .. toctree:: :maxdepth: 1 install/index user/index contributor/index reference/index Release Notes ============= Read also the `oslo.serialization Release Notes `_. Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` .. _oslo: https://wiki.openstack.org/wiki/Oslo ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6577299 oslo_serialization-5.7.0/doc/source/install/0000775000175000017500000000000000000000000021172 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/doc/source/install/index.rst0000664000175000017500000000033600000000000023035 0ustar00zuulzuul00000000000000============ Installation ============ At the command line:: $ pip install oslo.serialization Or, if you have virtualenvwrapper installed:: $ mkvirtualenv oslo.serialization $ pip install oslo.serialization././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6577299 oslo_serialization-5.7.0/doc/source/reference/0000775000175000017500000000000000000000000021462 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/doc/source/reference/index.rst0000664000175000017500000000043300000000000023323 0ustar00zuulzuul00000000000000============= API Reference ============= base64 ====== .. automodule:: oslo_serialization.base64 :members: jsonutils ========= .. automodule:: oslo_serialization.jsonutils :members: msgpackutils ============ .. automodule:: oslo_serialization.msgpackutils :members: ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6577299 oslo_serialization-5.7.0/doc/source/user/0000775000175000017500000000000000000000000020502 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/doc/source/user/history.rst0000664000175000017500000000004000000000000022727 0ustar00zuulzuul00000000000000.. include:: ../../../ChangeLog ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/doc/source/user/index.rst0000664000175000017500000000040600000000000022343 0ustar00zuulzuul00000000000000======================== Using oslo.serialization ======================== .. toctree:: :maxdepth: 2 .. Add more contents here .. history contains a lot of sections, toctree with maxdepth 1 is used. .. toctree:: :maxdepth: 1 Release Notes ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6657298 oslo_serialization-5.7.0/oslo.serialization.egg-info/0000775000175000017500000000000000000000000023001 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147099.0 oslo_serialization-5.7.0/oslo.serialization.egg-info/PKG-INFO0000644000175000017500000000410300000000000024072 0ustar00zuulzuul00000000000000Metadata-Version: 2.1 Name: oslo.serialization Version: 5.7.0 Summary: Oslo Serialization library Home-page: https://docs.openstack.org/oslo.serialization/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Requires-Python: >=3.9 License-File: LICENSE Requires-Dist: msgpack>=0.5.2 Requires-Dist: oslo.utils>=3.33.0 Requires-Dist: tzdata>=2022.4 ======================== Team and repository tags ======================== .. image:: https://governance.openstack.org/tc/badges/oslo.serialization.svg :target: https://governance.openstack.org/tc/ference/tags/index.html .. Change things from this point on =================== oslo.serialization =================== .. image:: https://img.shields.io/pypi/v/oslo.serialization.svg :target: https://pypi.org/project/oslo.serialization/ :alt: Latest Version .. image:: https://img.shields.io/pypi/dm/oslo.serialization.svg :target: https://pypi.org/project/oslo.serialization/ :alt: Downloads The oslo.serialization library provides support for representing objects in transmittable and storable formats, such as Base64, JSON and MessagePack. * Free software: Apache license * Documentation: https://docs.openstack.org/oslo.serialization/latest/ * Source: https://opendev.org/openstack/oslo.serialization * Bugs: https://bugs.launchpad.net/oslo.serialization * Release notes: https://docs.openstack.org/releasenotes/oslo.serialization/ ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147099.0 oslo_serialization-5.7.0/oslo.serialization.egg-info/SOURCES.txt0000664000175000017500000000450500000000000024671 0ustar00zuulzuul00000000000000.coveragerc .mailmap .pre-commit-config.yaml .stestr.conf .zuul.yaml AUTHORS CONTRIBUTING.rst ChangeLog HACKING.rst LICENSE README.rst requirements.txt setup.cfg setup.py test-requirements.txt tox.ini doc/requirements.txt doc/source/conf.py doc/source/index.rst doc/source/contributor/index.rst doc/source/install/index.rst doc/source/reference/index.rst doc/source/user/history.rst doc/source/user/index.rst oslo.serialization.egg-info/PKG-INFO oslo.serialization.egg-info/SOURCES.txt oslo.serialization.egg-info/dependency_links.txt oslo.serialization.egg-info/not-zip-safe oslo.serialization.egg-info/pbr.json oslo.serialization.egg-info/requires.txt oslo.serialization.egg-info/top_level.txt oslo_serialization/__init__.py oslo_serialization/base64.py oslo_serialization/jsonutils.py oslo_serialization/msgpackutils.py oslo_serialization/serializer/__init__.py oslo_serialization/serializer/base_serializer.py oslo_serialization/serializer/json_serializer.py oslo_serialization/serializer/msgpack_serializer.py oslo_serialization/tests/__init__.py oslo_serialization/tests/test_base64.py oslo_serialization/tests/test_jsonutils.py oslo_serialization/tests/test_msgpackutils.py releasenotes/notes/add-reno-996dd44974d53238.yaml releasenotes/notes/bug-1908607-fix-json-to_primitive-IO-OBjects-04faff4a1b5cf48f.yaml releasenotes/notes/deprecate-yamlutils-module-96eee55f7ae57382.yaml releasenotes/notes/drop-python27-support-185668eec068ffa5.yaml releasenotes/notes/implement-zoneinfo-to-remove-pytz-c136b33bbfbfe59f.yaml releasenotes/notes/jsonutils-to_primitive-value-error-89338f90310e9518.yaml releasenotes/notes/remove-py38-2c724027a885cf0b.yaml releasenotes/notes/remove-yamlutils-94c921247ab33003.yaml releasenotes/source/2023.1.rst releasenotes/source/2023.2.rst releasenotes/source/2024.1.rst releasenotes/source/2024.2.rst releasenotes/source/conf.py releasenotes/source/index.rst releasenotes/source/ocata.rst releasenotes/source/pike.rst releasenotes/source/queens.rst releasenotes/source/rocky.rst releasenotes/source/stein.rst releasenotes/source/train.rst releasenotes/source/unreleased.rst releasenotes/source/ussuri.rst releasenotes/source/victoria.rst releasenotes/source/wallaby.rst releasenotes/source/xena.rst releasenotes/source/yoga.rst releasenotes/source/zed.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholder././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147099.0 oslo_serialization-5.7.0/oslo.serialization.egg-info/dependency_links.txt0000664000175000017500000000000100000000000027047 0ustar00zuulzuul00000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147099.0 oslo_serialization-5.7.0/oslo.serialization.egg-info/not-zip-safe0000664000175000017500000000000100000000000025227 0ustar00zuulzuul00000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147099.0 oslo_serialization-5.7.0/oslo.serialization.egg-info/pbr.json0000664000175000017500000000005600000000000024460 0ustar00zuulzuul00000000000000{"git_version": "bff992d", "is_release": true}././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147099.0 oslo_serialization-5.7.0/oslo.serialization.egg-info/requires.txt0000664000175000017500000000006100000000000025376 0ustar00zuulzuul00000000000000msgpack>=0.5.2 oslo.utils>=3.33.0 tzdata>=2022.4 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147099.0 oslo_serialization-5.7.0/oslo.serialization.egg-info/top_level.txt0000664000175000017500000000002300000000000025526 0ustar00zuulzuul00000000000000oslo_serialization ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6577299 oslo_serialization-5.7.0/oslo_serialization/0000775000175000017500000000000000000000000021370 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/__init__.py0000664000175000017500000000000000000000000023467 0ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/base64.py0000664000175000017500000000525700000000000023037 0ustar00zuulzuul00000000000000# Copyright 2015 Red Hat # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ Utilities to encode and decode Base64. .. versionadded:: 1.10 """ import base64 import binascii def encode_as_bytes(s, encoding='utf-8'): """Encode a string using Base64. If *s* is a text string, first encode it to *encoding* (UTF-8 by default). :param s: bytes or text string to be encoded :param encoding: encoding used to encode *s* if it's a text string :returns: Base64 encoded byte string (bytes) Use encode_as_text() to get the Base64 encoded string as text. """ if isinstance(s, str): s = s.encode(encoding) return base64.b64encode(s) def encode_as_text(s, encoding='utf-8'): """Encode a string using Base64. If *s* is a text string, first encode it to *encoding* (UTF-8 by default). :param s: bytes or text string to be encoded :param encoding: encoding used to encode *s* if it's a text string :returns: Base64 encoded text string (Unicode) Use encode_as_bytes() to get the Base64 encoded string as bytes. """ encoded = encode_as_bytes(s, encoding=encoding) return encoded.decode('ascii') def decode_as_bytes(encoded): """Decode a Base64 encoded string. :param encoded: bytes or text Base64 encoded string to be decoded :returns: decoded bytes string (bytes) Use decode_as_text() to get the decoded string as text. A TypeError is raised if the input is invalid (or incorrectly padded). """ if isinstance(encoded, bytes): encoded = encoded.decode('ascii') try: return base64.b64decode(encoded) except binascii.Error as e: # Transform this exception for consistency. raise TypeError(str(e)) def decode_as_text(encoded, encoding='utf-8'): """Decode a Base64 encoded string. Decode the Base64 string and then decode the result from *encoding* (UTF-8 by default). :param encoded: bytes or text Base64 encoded string to be decoded :returns: decoded text string (bytes) Use decode_as_bytes() to get the decoded string as bytes. """ decoded = decode_as_bytes(encoded) return decoded.decode(encoding) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/jsonutils.py0000664000175000017500000002332400000000000024000 0ustar00zuulzuul00000000000000# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Justin Santa Barbara # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ''' JSON related utilities. This module provides a few things: #. A handy function for getting an object down to something that can be JSON serialized. See :func:`.to_primitive`. #. Wrappers around :func:`.loads` and :func:`.dumps`. The :func:`.dumps` wrapper will automatically use :func:`.to_primitive` for you if needed. #. This sets up ``anyjson`` to use the :func:`.loads` and :func:`.dumps` wrappers if ``anyjson`` is available. ''' import codecs import datetime import functools import inspect import io import itertools import json import uuid from xmlrpc import client as xmlrpclib from oslo_utils import encodeutils from oslo_utils import importutils from oslo_utils import timeutils _ISO8601_DATE_FORMAT = '%Y-%m-%d' ipaddress = importutils.try_import("ipaddress") netaddr = importutils.try_import("netaddr") _nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod, inspect.isfunction, inspect.isgeneratorfunction, inspect.isgenerator, inspect.istraceback, inspect.isframe, inspect.iscode, inspect.isbuiltin, inspect.isroutine, inspect.isabstract] _simple_types = (str, int, type(None), bool, float) def to_primitive(value, convert_instances=False, convert_datetime=True, level=0, max_depth=3, encoding='utf-8', fallback=None): """Convert a complex object into primitives. Handy for JSON serialization. We can optionally handle instances, but since this is a recursive function, we could have cyclical data structures. To handle cyclical data structures we could track the actual objects visited in a set, but not all objects are hashable. Instead we just track the depth of the object inspections and don't go too deep. Therefore, ``convert_instances=True`` is lossy ... be aware. If the object cannot be converted to primitive, it is returned unchanged if fallback is not set, return fallback(value) otherwise. .. versionchanged:: 2.22 Added *fallback* parameter. .. versionchanged:: 1.3 Support UUID encoding. .. versionchanged:: 1.6 Dictionary keys are now also encoded. """ orig_fallback = fallback if fallback is None: fallback = str # handle obvious types first - order of basic types determined by running # full tests on nova project, resulting in the following counts: # 572754 # 460353 # 379632 # 274610 # 199918 # 114200 # 51817 # 26164 # 6491 # 283 # 19 if isinstance(value, _simple_types): return value if isinstance(value, bytes): return value.decode(encoding=encoding) # It's not clear why xmlrpclib created their own DateTime type, but # for our purposes, make it a datetime type which is explicitly # handled if isinstance(value, xmlrpclib.DateTime): value = datetime.datetime(*tuple(value.timetuple())[:6]) if isinstance(value, datetime.datetime): if convert_datetime: return value.strftime(timeutils.PERFECT_TIME_FORMAT) else: return value if isinstance(value, datetime.date): if convert_datetime: return value.strftime(_ISO8601_DATE_FORMAT) else: return value if isinstance(value, uuid.UUID): return str(value) if netaddr and isinstance(value, (netaddr.IPAddress, netaddr.IPNetwork)): return str(value) if ipaddress and isinstance(value, (ipaddress.IPv4Address, ipaddress.IPv6Address)): return str(value) # For exceptions, return the 'repr' of the exception object if isinstance(value, Exception): return repr(value) # value of itertools.count doesn't get caught by nasty_type_tests # and results in infinite loop when list(value) is called. if type(value) is itertools.count: return fallback(value) if any(test(value) for test in _nasty_type_tests): return fallback(value) if level > max_depth: return None # The try block may not be necessary after the class check above, # but just in case ... try: recursive = functools.partial(to_primitive, convert_instances=convert_instances, convert_datetime=convert_datetime, level=level, max_depth=max_depth, encoding=encoding, fallback=orig_fallback) if isinstance(value, dict): return {recursive(k): recursive(v) for k, v in value.items()} elif hasattr(value, 'items'): return recursive(dict(value.items()), level=level + 1) elif hasattr(value, '__iter__') and not isinstance(value, io.IOBase): return list(map(recursive, value)) elif convert_instances and hasattr(value, '__dict__'): # Likely an instance of something. Watch for cycles. # Ignore class member vars. return recursive(value.__dict__, level=level + 1) except TypeError: # Class objects are tricky since they may define something like # __iter__ defined but it isn't callable as list(). return fallback(value) if orig_fallback is None: raise ValueError("Cannot convert {!r} to primitive".format(value)) return orig_fallback(value) JSONEncoder = json.JSONEncoder JSONDecoder = json.JSONDecoder def dumps(obj, default=to_primitive, **kwargs): """Serialize ``obj`` to a JSON formatted ``str``. :param obj: object to be serialized :param default: function that returns a serializable version of an object, :func:`to_primitive` is used by default. :param kwargs: extra named parameters, please see documentation \ of `json.dumps `_ :returns: json formatted string Use dump_as_bytes() to ensure that the result type is ``bytes`` on Python 2 and Python 3. """ return json.dumps(obj, default=default, **kwargs) def dump_as_bytes(obj, default=to_primitive, encoding='utf-8', **kwargs): """Serialize ``obj`` to a JSON formatted ``bytes``. :param obj: object to be serialized :param default: function that returns a serializable version of an object, :func:`to_primitive` is used by default. :param encoding: encoding used to encode the serialized JSON output :param kwargs: extra named parameters, please see documentation \ of `json.dumps `_ :returns: json formatted string .. versionadded:: 1.10 """ return dumps(obj, default=default, **kwargs).encode(encoding) def dump(obj, fp, *args, **kwargs): """Serialize ``obj`` as a JSON formatted stream to ``fp`` :param obj: object to be serialized :param fp: a ``.write()``-supporting file-like object :param default: function that returns a serializable version of an object, :func:`to_primitive` is used by default. :param args: extra arguments, please see documentation \ of `json.dump `_ :param kwargs: extra named parameters, please see documentation \ of `json.dump `_ .. versionchanged:: 1.3 The *default* parameter now uses :func:`to_primitive` by default. """ default = kwargs.get('default', to_primitive) return json.dump(obj, fp, default=default, *args, **kwargs) def loads(s, encoding='utf-8', **kwargs): """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON :param s: string to deserialize :param encoding: encoding used to interpret the string :param kwargs: extra named parameters, please see documentation \ of `json.loads `_ :returns: python object """ return json.loads(encodeutils.safe_decode(s, encoding), **kwargs) def load(fp, encoding='utf-8', **kwargs): """Deserialize ``fp`` to a Python object. :param fp: a ``.read()`` -supporting file-like object :param encoding: encoding used to interpret the string :param kwargs: extra named parameters, please see documentation \ of `json.loads `_ :returns: python object """ return json.load(codecs.getreader(encoding)(fp), **kwargs) try: import anyjson except ImportError: pass else: anyjson._modules.append((__name__, 'dumps', TypeError, 'loads', ValueError, 'load')) anyjson.force_implementation(__name__) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/msgpackutils.py0000664000175000017500000003550700000000000024462 0ustar00zuulzuul00000000000000# Copyright (C) 2015 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ''' MessagePack related utilities. This module provides a few things: #. A handy registry for getting an object down to something that can be msgpack serialized. See :class:`.HandlerRegistry`. #. Wrappers around :func:`.loads` and :func:`.dumps`. The :func:`.dumps` wrapper will automatically use the :py:attr:`~oslo_serialization.msgpackutils.default_registry` for you if needed. .. versionadded:: 1.3 ''' import datetime import functools import itertools import uuid from xmlrpc import client as xmlrpclib import zoneinfo import msgpack from oslo_utils import importutils netaddr = importutils.try_import("netaddr") class Interval: """Small and/or simple immutable integer/float interval class. Interval checking is **inclusive** of the min/max boundaries. """ def __init__(self, min_value, max_value): if min_value > max_value: raise ValueError("Minimum value %s must be less than" " or equal to maximum value %s" % (min_value, max_value)) self._min_value = min_value self._max_value = max_value @property def min_value(self): return self._min_value @property def max_value(self): return self._max_value def __contains__(self, value): return value >= self.min_value and value <= self.max_value def __repr__(self): return 'Interval({}, {})'.format(self._min_value, self._max_value) # Expose these so that users don't have to import msgpack to gain these. PackException = msgpack.PackException UnpackException = msgpack.UnpackException class HandlerRegistry: """Registry of *type* specific msgpack handlers extensions. See: https://github.com/msgpack/msgpack/blob/master/spec.md#formats-ext Do note that due to the current limitations in the msgpack python library we can not *currently* dump/load a tuple without converting it to a list. This may be fixed in: https://github.com/msgpack/msgpack-python/pull/100 .. versionadded:: 1.5 """ reserved_extension_range = Interval(0, 32) """ These ranges are **always** reserved for use by ``oslo.serialization`` and its own add-ons extensions (these extensions are meant to be generally applicable to all of python). """ non_reserved_extension_range = Interval(33, 127) """ These ranges are **always** reserved for use by applications building their own type specific handlers (the meaning of extensions in this range will typically vary depending on application). """ min_value = 0 """ Applications can assign 0 to 127 to store application (or library) specific type handlers; see above ranges for what is reserved by this library and what is not. """ max_value = 127 """ Applications can assign 0 to 127 to store application (or library) specific type handlers; see above ranges for what is reserved by this library and what is not. """ def __init__(self): self._handlers = {} self._num_handlers = 0 self.frozen = False def __iter__(self): """Iterates over **all** registered handlers.""" for handlers in self._handlers.values(): yield from handlers def register(self, handler, reserved=False, override=False): """Register a extension handler to handle its associated type.""" if self.frozen: raise ValueError("Frozen handler registry can't be modified") if reserved: ok_interval = self.reserved_extension_range else: ok_interval = self.non_reserved_extension_range ident = handler.identity if ident < ok_interval.min_value: raise ValueError("Handler '%s' identity must be greater" " or equal to %s" % (handler, ok_interval.min_value)) if ident > ok_interval.max_value: raise ValueError("Handler '%s' identity must be less than" " or equal to %s" % (handler, ok_interval.max_value)) if ident in self._handlers and override: existing_handlers = self._handlers[ident] # Insert at the front so that overrides get selected before # whatever existed before the override... existing_handlers.insert(0, handler) self._num_handlers += 1 elif ident in self._handlers and not override: raise ValueError("Already registered handler(s) with" " identity %s: %s" % (ident, self._handlers[ident])) else: self._handlers[ident] = [handler] self._num_handlers += 1 def __len__(self): """Return how many extension handlers are registered.""" return self._num_handlers def __contains__(self, identity): """Return if any handler exists for the given identity (number).""" return identity in self._handlers def copy(self, unfreeze=False): """Deep copy the given registry (and its handlers).""" c = type(self)() for ident, handlers in self._handlers.items(): cloned_handlers = [] for h in handlers: if hasattr(h, 'copy'): h = h.copy(c) cloned_handlers.append(h) c._handlers[ident] = cloned_handlers c._num_handlers += len(cloned_handlers) if not unfreeze and self.frozen: c.frozen = True return c def get(self, identity): """Get the handler for the given numeric identity (or none).""" maybe_handlers = self._handlers.get(identity) if maybe_handlers: # Prefer the first (if there are many) as this is how we # override built-in extensions (for those that wish to do this). return maybe_handlers[0] else: return None def match(self, obj): """Match the registries handlers to the given object (or none).""" for possible_handlers in self._handlers.values(): for h in possible_handlers: if isinstance(obj, h.handles): return h return None class UUIDHandler: identity = 0 handles = (uuid.UUID,) @staticmethod def serialize(obj): return str(obj.hex).encode('ascii') @staticmethod def deserialize(data): return uuid.UUID(hex=str(data, encoding='ascii')) class DateTimeHandler: identity = 1 handles = (datetime.datetime,) def __init__(self, registry): self._registry = registry def copy(self, registry): return type(self)(registry) def serialize(self, dt): dct = { 'day': dt.day, 'month': dt.month, 'year': dt.year, 'hour': dt.hour, 'minute': dt.minute, 'second': dt.second, 'microsecond': dt.microsecond, } if dt.tzinfo: dct['tz'] = str(dt.tzinfo) return dumps(dct, registry=self._registry) def deserialize(self, blob): dct = loads(blob, registry=self._registry) if b"day" in dct: # NOTE(sileht): oslo.serialization <= 2.4.1 was # storing thing as unicode for py3 while is was # bytes for py2 # For python2, we don't care bytes or unicode works # for dict keys and tz # But for python3, we have some backward compability # to take care in case of the payload have been produced # by python2 and now read by python3 dct = {k.decode("ascii"): v for k, v in dct.items()} if 'tz' in dct: dct['tz'] = dct['tz'].decode("ascii") dt = datetime.datetime(day=dct['day'], month=dct['month'], year=dct['year'], hour=dct['hour'], minute=dct['minute'], second=dct['second'], microsecond=dct['microsecond']) if 'tz' in dct and dct['tz']: dt = dt.replace(tzinfo=zoneinfo.ZoneInfo(dct['tz'])) return dt class CountHandler: identity = 2 handles = (itertools.count,) @staticmethod def serialize(obj): # FIXME(harlowja): figure out a better way to avoid hacking into # the string representation of count to get at the right numbers... obj = str(obj) start = obj.find("(") + 1 end = obj.rfind(")") pieces = obj[start:end].split(",") if len(pieces) == 1: start = int(pieces[0]) step = 1 else: start = int(pieces[0]) step = int(pieces[1]) return msgpack.packb([start, step]) @staticmethod def deserialize(data): value = msgpack.unpackb(data) start, step = value return itertools.count(start, step) if netaddr is not None: class NetAddrIPHandler: identity = 3 handles = (netaddr.IPAddress,) @staticmethod def serialize(obj): return msgpack.packb(obj.value) @staticmethod def deserialize(data): return netaddr.IPAddress(msgpack.unpackb(data)) else: NetAddrIPHandler = None class SetHandler: identity = 4 handles = (set,) def __init__(self, registry): self._registry = registry def copy(self, registry): return type(self)(registry) def serialize(self, obj): return dumps(list(obj), registry=self._registry) def deserialize(self, data): return self.handles[0](loads(data, registry=self._registry)) class FrozenSetHandler(SetHandler): identity = 5 handles = (frozenset,) class XMLRPCDateTimeHandler: handles = (xmlrpclib.DateTime,) identity = 6 def __init__(self, registry): self._handler = DateTimeHandler(registry) def copy(self, registry): return type(self)(registry) def serialize(self, obj): dt = datetime.datetime(*tuple(obj.timetuple())[:6]) return self._handler.serialize(dt) def deserialize(self, blob): dt = self._handler.deserialize(blob) return xmlrpclib.DateTime(dt.timetuple()) class DateHandler: identity = 7 handles = (datetime.date,) def __init__(self, registry): self._registry = registry def copy(self, registry): return type(self)(registry) def serialize(self, d): dct = { 'year': d.year, 'month': d.month, 'day': d.day, } return dumps(dct, registry=self._registry) def deserialize(self, blob): dct = loads(blob, registry=self._registry) if b"day" in dct: # NOTE(sileht): see DateTimeHandler.deserialize() dct = {k.decode("ascii"): v for k, v in dct.items()} return datetime.date(year=dct['year'], month=dct['month'], day=dct['day']) def _serializer(registry, obj): handler = registry.match(obj) if handler is None: raise ValueError("No serialization handler registered" " for type '%s'" % (type(obj).__name__)) return msgpack.ExtType(handler.identity, handler.serialize(obj)) def _unserializer(registry, code, data): handler = registry.get(code) if not handler: return msgpack.ExtType(code, data) else: return handler.deserialize(data) def _create_default_registry(): registry = HandlerRegistry() registry.register(DateTimeHandler(registry), reserved=True) registry.register(DateHandler(registry), reserved=True) registry.register(UUIDHandler(), reserved=True) registry.register(CountHandler(), reserved=True) registry.register(SetHandler(registry), reserved=True) registry.register(FrozenSetHandler(registry), reserved=True) if netaddr is not None: registry.register(NetAddrIPHandler(), reserved=True) registry.register(XMLRPCDateTimeHandler(registry), reserved=True) registry.frozen = True return registry default_registry = _create_default_registry() """ Default, read-only/frozen registry that will be used when none is provided. This registry has msgpack extensions for the following: * ``DateTime`` objects. * ``Date`` objects. * ``UUID`` objects. * ``itertools.count`` objects/iterators. * ``set`` and ``frozenset`` container(s). * ``netaddr.IPAddress`` objects (only if ``netaddr`` is importable). * ``xmlrpclib.DateTime`` datetime objects. .. versionadded:: 1.5 """ def load(fp, registry=None): """Deserialize ``fp`` into a Python object. .. versionchanged:: 1.5 Added *registry* parameter. """ if registry is None: registry = default_registry # NOTE(harlowja): the reason we can't use the more native msgpack functions # here is that the unpack() function (oddly) doesn't seem to take a # 'ext_hook' parameter.. ext_hook = functools.partial(_unserializer, registry) return msgpack.Unpacker(fp, ext_hook=ext_hook, raw=False).unpack() def dump(obj, fp, registry=None): """Serialize ``obj`` as a messagepack formatted stream to ``fp``. .. versionchanged:: 1.5 Added *registry* parameter. """ if registry is None: registry = default_registry return msgpack.pack(obj, fp, default=functools.partial(_serializer, registry), use_bin_type=True) def dumps(obj, registry=None): """Serialize ``obj`` to a messagepack formatted ``str``. .. versionchanged:: 1.5 Added *registry* parameter. """ if registry is None: registry = default_registry return msgpack.packb(obj, default=functools.partial(_serializer, registry), use_bin_type=True) def loads(s, registry=None): """Deserialize ``s`` messagepack ``str`` into a Python object. .. versionchanged:: 1.5 Added *registry* parameter. """ if registry is None: registry = default_registry ext_hook = functools.partial(_unserializer, registry) return msgpack.unpackb(s, ext_hook=ext_hook, raw=False) ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6617298 oslo_serialization-5.7.0/oslo_serialization/serializer/0000775000175000017500000000000000000000000023541 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/serializer/__init__.py0000664000175000017500000000000000000000000025640 0ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/serializer/base_serializer.py0000664000175000017500000000315700000000000027264 0ustar00zuulzuul00000000000000# Copyright 2016 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ Unified and simplified API for oslo.serialization's serializers. """ import abc class BaseSerializer(metaclass=abc.ABCMeta): """Generic (de-)serialization definition abstract base class.""" @abc.abstractmethod def dump(self, obj, fp): """Serialize ``obj`` as a stream to ``fp``. :param obj: python object to be serialized :param fp: ``.write()``-supporting file-like object """ @abc.abstractmethod def dump_as_bytes(self, obj): """Serialize ``obj`` to a byte string. :param obj: python object to be serialized :returns: byte string """ @abc.abstractmethod def load(self, fp): """Deserialize ``fp`` to a python object. :param fp: ``.read()``-supporting file-like object :returns: python object """ @abc.abstractmethod def load_from_bytes(self, s): """Deserialize ``s`` to a python object. :param s: byte string to be deserialized :returns: python object """ ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/serializer/json_serializer.py0000664000175000017500000000254000000000000027316 0ustar00zuulzuul00000000000000# Copyright 2016 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_serialization import jsonutils from oslo_serialization.serializer.base_serializer import BaseSerializer class JSONSerializer(BaseSerializer): """JSON serializer based on the jsonutils module.""" def __init__(self, default=jsonutils.to_primitive, encoding='utf-8'): self._default = default self._encoding = encoding def dump(self, obj, fp): return jsonutils.dump(obj, fp) def dump_as_bytes(self, obj): return jsonutils.dump_as_bytes(obj, default=self._default, encoding=self._encoding) def load(self, fp): return jsonutils.load(fp, encoding=self._encoding) def load_from_bytes(self, s): return jsonutils.loads(s, encoding=self._encoding) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/serializer/msgpack_serializer.py0000664000175000017500000000242000000000000027767 0ustar00zuulzuul00000000000000# Copyright 2016 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_serialization import msgpackutils from oslo_serialization.serializer.base_serializer import BaseSerializer class MessagePackSerializer(BaseSerializer): """MessagePack serializer based on the msgpackutils module.""" def __init__(self, registry=None): self._registry = registry def dump(self, obj, fp): return msgpackutils.dump(obj, fp, registry=self._registry) def dump_as_bytes(self, obj): return msgpackutils.dumps(obj, registry=self._registry) def load(self, fp): return msgpackutils.load(fp, registry=self._registry) def load_from_bytes(self, s): return msgpackutils.loads(s, registry=self._registry) ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6617298 oslo_serialization-5.7.0/oslo_serialization/tests/0000775000175000017500000000000000000000000022532 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/tests/__init__.py0000664000175000017500000000000000000000000024631 0ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/tests/test_base64.py0000664000175000017500000000460600000000000025235 0ustar00zuulzuul00000000000000# Copyright 2015 Red Hat # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_serialization import base64 from oslotest import base as test_base class Base64Tests(test_base.BaseTestCase): def test_encode_as_bytes(self): self.assertEqual(b'dGV4dA==', base64.encode_as_bytes(b'text')) self.assertEqual(b'dGV4dA==', base64.encode_as_bytes('text')) self.assertEqual(b'ZTrDqQ==', base64.encode_as_bytes('e:\xe9')) self.assertEqual(b'ZTrp', base64.encode_as_bytes('e:\xe9', encoding='latin1')) def test_encode_as_text(self): self.assertEqual('dGV4dA==', base64.encode_as_text(b'text')) self.assertEqual('dGV4dA==', base64.encode_as_text('text')) self.assertEqual('ZTrDqQ==', base64.encode_as_text('e:\xe9')) self.assertEqual('ZTrp', base64.encode_as_text('e:\xe9', encoding='latin1')) def test_decode_as_bytes(self): self.assertEqual(b'text', base64.decode_as_bytes(b'dGV4dA==')) self.assertEqual(b'text', base64.decode_as_bytes('dGV4dA==')) def test_decode_as_bytes__error(self): self.assertRaises(TypeError, base64.decode_as_bytes, 'hello world') def test_decode_as_text(self): self.assertEqual('text', base64.decode_as_text(b'dGV4dA==')) self.assertEqual('text', base64.decode_as_text('dGV4dA==')) self.assertEqual('e:\xe9', base64.decode_as_text('ZTrDqQ==')) self.assertEqual('e:\xe9', base64.decode_as_text('ZTrp', encoding='latin1')) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/tests/test_jsonutils.py0000664000175000017500000003064100000000000026201 0ustar00zuulzuul00000000000000# Copyright 2011 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import collections.abc import datetime import functools import io import ipaddress import itertools import json from unittest import mock from xmlrpc import client as xmlrpclib import netaddr from oslo_i18n import fixture from oslotest import base as test_base from oslo_serialization import jsonutils class ReprObject: def __repr__(self): return 'repr' class JSONUtilsTestMixin: json_impl = None def setUp(self): super().setUp() self.json_patcher = mock.patch.multiple( jsonutils, json=self.json_impl, ) self.json_impl_mock = self.json_patcher.start() def tearDown(self): self.json_patcher.stop() super().tearDown() def test_dumps(self): self.assertEqual('{"a": "b"}', jsonutils.dumps({'a': 'b'})) def test_dumps_default(self): args = [ReprObject()] convert = functools.partial(jsonutils.to_primitive, fallback=repr) self.assertEqual('["repr"]', jsonutils.dumps(args, default=convert)) def test_dump_as_bytes(self): self.assertEqual(b'{"a": "b"}', jsonutils.dump_as_bytes({'a': 'b'})) def test_dumps_namedtuple(self): n = collections.namedtuple("foo", "bar baz")(1, 2) self.assertEqual('[1, 2]', jsonutils.dumps(n)) def test_dump(self): expected = '{"a": "b"}' json_dict = {'a': 'b'} fp = io.StringIO() jsonutils.dump(json_dict, fp) self.assertEqual(expected, fp.getvalue()) def test_dump_namedtuple(self): expected = '[1, 2]' json_dict = collections.namedtuple("foo", "bar baz")(1, 2) fp = io.StringIO() jsonutils.dump(json_dict, fp) self.assertEqual(expected, fp.getvalue()) def test_loads(self): self.assertEqual({'a': 'b'}, jsonutils.loads('{"a": "b"}')) def test_loads_unicode(self): self.assertIsInstance(jsonutils.loads(b'"foo"'), str) self.assertIsInstance(jsonutils.loads('"foo"'), str) # 'test' in Ukrainian i18n_str_unicode = '"\u0442\u0435\u0441\u0442"' self.assertIsInstance(jsonutils.loads(i18n_str_unicode), str) i18n_str = i18n_str_unicode.encode('utf-8') self.assertIsInstance(jsonutils.loads(i18n_str), str) def test_loads_with_kwargs(self): jsontext = '{"foo": 3}' result = jsonutils.loads(jsontext, parse_int=lambda x: 5) self.assertEqual(5, result['foo']) def test_load(self): jsontext = '{"a": "\u0442\u044d\u0441\u0442"}' expected = {'a': '\u0442\u044d\u0441\u0442'} for encoding in ('utf-8', 'cp1251'): fp = io.BytesIO(jsontext.encode(encoding)) result = jsonutils.load(fp, encoding=encoding) self.assertEqual(expected, result) for key, val in result.items(): self.assertIsInstance(key, str) self.assertIsInstance(val, str) def test_dumps_exception_value(self): self.assertIn(jsonutils.dumps({"a": ValueError("hello")}), ['{"a": "ValueError(\'hello\',)"}', '{"a": "ValueError(\'hello\')"}']) class JSONUtilsTestJson(JSONUtilsTestMixin, test_base.BaseTestCase): json_impl = json class ToPrimitiveTestCase(test_base.BaseTestCase): def setUp(self): super().setUp() self.trans_fixture = self.useFixture(fixture.Translation()) def test_bytes(self): self.assertEqual(jsonutils.to_primitive(b'abc'), 'abc') def test_list(self): self.assertEqual([1, 2, 3], jsonutils.to_primitive([1, 2, 3])) def test_empty_list(self): self.assertEqual([], jsonutils.to_primitive([])) def test_tuple(self): self.assertEqual([1, 2, 3], jsonutils.to_primitive((1, 2, 3))) def test_dict(self): self.assertEqual(dict(a=1, b=2, c=3), jsonutils.to_primitive(dict(a=1, b=2, c=3))) def test_empty_dict(self): self.assertEqual({}, jsonutils.to_primitive({})) def test_datetime(self): x = datetime.datetime(1920, 2, 3, 4, 5, 6, 7) self.assertEqual('1920-02-03T04:05:06.000007', jsonutils.to_primitive(x)) def test_datetime_preserve(self): x = datetime.datetime(1920, 2, 3, 4, 5, 6, 7) self.assertEqual(x, jsonutils.to_primitive(x, convert_datetime=False)) def test_date(self): x = datetime.date(1920, 2, 3) self.assertEqual('1920-02-03', jsonutils.to_primitive(x)) def test_date_preserve(self): x = datetime.date(1920, 2, 3) self.assertEqual(x, jsonutils.to_primitive(x, convert_datetime=False)) def test_DateTime(self): x = xmlrpclib.DateTime() x.decode("19710203T04:05:06") self.assertEqual('1971-02-03T04:05:06.000000', jsonutils.to_primitive(x)) def test_iter(self): class IterClass: def __init__(self): self.data = [1, 2, 3, 4, 5] self.index = 0 def __iter__(self): return self def next(self): if self.index == len(self.data): raise StopIteration self.index = self.index + 1 return self.data[self.index - 1] __next__ = next x = IterClass() self.assertEqual([1, 2, 3, 4, 5], jsonutils.to_primitive(x)) def test_items(self): class ItemsClass: def __init__(self): self.data = dict(a=1, b=2, c=3).items() self.index = 0 def items(self): return self.data x = ItemsClass() p = jsonutils.to_primitive(x) self.assertEqual({'a': 1, 'b': 2, 'c': 3}, p) def test_items_with_cycle(self): class ItemsClass: def __init__(self): self.data = dict(a=1, b=2, c=3) self.index = 0 def items(self): return self.data.items() x = ItemsClass() x2 = ItemsClass() x.data['other'] = x2 x2.data['other'] = x # If the cycle isn't caught, to_primitive() will eventually result in # an exception due to excessive recursion depth. jsonutils.to_primitive(x) def test_mapping(self): # Make sure collections.abc.Mapping is converted to a dict # and not a list. class MappingClass(collections.abc.Mapping): def __init__(self): self.data = dict(a=1, b=2, c=3) def __getitem__(self, val): return self.data[val] def __iter__(self): return iter(self.data) def __len__(self): return len(self.data) x = MappingClass() p = jsonutils.to_primitive(x) self.assertEqual({'a': 1, 'b': 2, 'c': 3}, p) def test_instance(self): class MysteryClass: a = 10 def __init__(self): self.b = 1 x = MysteryClass() self.assertEqual(dict(b=1), jsonutils.to_primitive(x, convert_instances=True)) self.assertRaises(ValueError, jsonutils.to_primitive, x) def test_typeerror(self): x = bytearray # Class, not instance self.assertEqual("", jsonutils.to_primitive(x)) def test_nasties(self): def foo(): pass x = [datetime, foo, dir] ret = jsonutils.to_primitive(x) self.assertEqual(3, len(ret)) self.assertTrue(ret[0].startswith(".foo at 0x' )) self.assertEqual('', ret[2]) def test_depth(self): class LevelsGenerator: def __init__(self, levels): self._levels = levels def items(self): if self._levels == 0: return iter([]) else: return iter([(0, LevelsGenerator(self._levels - 1))]) l4_obj = LevelsGenerator(4) json_l2 = {0: {0: None}} json_l3 = {0: {0: {0: None}}} json_l4 = {0: {0: {0: {0: None}}}} ret = jsonutils.to_primitive(l4_obj, max_depth=2) self.assertEqual(json_l2, ret) ret = jsonutils.to_primitive(l4_obj, max_depth=3) self.assertEqual(json_l3, ret) ret = jsonutils.to_primitive(l4_obj, max_depth=4) self.assertEqual(json_l4, ret) def test_ipaddr_using_netaddr(self): thing = {'ip_addr': netaddr.IPAddress('1.2.3.4')} ret = jsonutils.to_primitive(thing) self.assertEqual({'ip_addr': '1.2.3.4'}, ret) def test_ipaddr_using_ipaddress_v4(self): thing = {'ip_addr': ipaddress.ip_address('192.168.0.1')} ret = jsonutils.to_primitive(thing) self.assertEqual({'ip_addr': '192.168.0.1'}, ret) def test_ipaddr_using_ipaddress_v6(self): thing = {'ip_addr': ipaddress.ip_address('2001:db8::')} ret = jsonutils.to_primitive(thing) self.assertEqual({'ip_addr': '2001:db8::'}, ret) def test_ipnet_using_netaddr(self): thing = {'ip_net': netaddr.IPNetwork('1.2.3.0/24')} ret = jsonutils.to_primitive(thing) self.assertEqual({'ip_net': '1.2.3.0/24'}, ret) def test_message_with_param(self): msg = self.trans_fixture.lazy('A message with param: %s') msg = msg % 'test_domain' ret = jsonutils.to_primitive(msg) self.assertEqual(msg, ret) def test_message_with_named_param(self): msg = self.trans_fixture.lazy('A message with params: %(param)s') msg = msg % {'param': 'hello'} ret = jsonutils.to_primitive(msg) self.assertEqual(msg, ret) def test_fallback(self): obj = ReprObject() self.assertRaises(ValueError, jsonutils.to_primitive, obj) ret = jsonutils.to_primitive(obj, fallback=repr) self.assertEqual('repr', ret) def test_fallback_list(self): obj = ReprObject() obj_list = [obj] self.assertRaises(ValueError, jsonutils.to_primitive, obj_list) ret = jsonutils.to_primitive(obj_list, fallback=repr) self.assertEqual(['repr'], ret) def test_fallback_itertools_count(self): obj = itertools.count(1) ret = jsonutils.to_primitive(obj) self.assertEqual(str(obj), ret) ret = jsonutils.to_primitive(obj, fallback=lambda _: 'itertools_count') self.assertEqual('itertools_count', ret) def test_fallback_nasty(self): obj = int ret = jsonutils.to_primitive(obj) self.assertEqual(str(obj), ret) def formatter(typeobj): return 'type:%s' % typeobj.__name__ ret = jsonutils.to_primitive(obj, fallback=formatter) self.assertEqual("type:int", ret) def test_fallback_typeerror(self): class NotIterable: # __iter__ is not callable, cause a TypeError in to_primitive() __iter__ = None obj = NotIterable() ret = jsonutils.to_primitive(obj) self.assertEqual(str(obj), ret) ret = jsonutils.to_primitive(obj, fallback=lambda _: 'fallback') self.assertEqual('fallback', ret) def test_fallback_typeerror_IO_object(self): # IO Objects are not callable, cause a TypeError in to_primitive() obj = io.IOBase ret = jsonutils.to_primitive(obj) self.assertEqual(str(obj), ret) ret = jsonutils.to_primitive(obj, fallback=lambda _: 'fallback') self.assertEqual('fallback', ret) def test_exception(self): self.assertIn(jsonutils.to_primitive(ValueError("an exception")), ["ValueError('an exception',)", "ValueError('an exception')"]) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/oslo_serialization/tests/test_msgpackutils.py0000664000175000017500000001500300000000000026650 0ustar00zuulzuul00000000000000# Copyright (C) 2015 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import datetime import itertools from xmlrpc import client as xmlrpclib import zoneinfo import netaddr from oslotest import base as test_base from oslo_serialization import msgpackutils from oslo_utils import uuidutils _TZ_FMT = '%Y-%m-%d %H:%M:%S %Z%z' class Color: def __init__(self, r, g, b): self.r = r self.g = g self.b = b class ColorHandler: handles = (Color,) identity = ( msgpackutils.HandlerRegistry.non_reserved_extension_range.min_value + 1 ) @staticmethod def serialize(obj): blob = '{}, {}, {}'.format(obj.r, obj.g, obj.b) blob = blob.encode('ascii') return blob @staticmethod def deserialize(data): chunks = [int(c.strip()) for c in data.split(b",")] return Color(chunks[0], chunks[1], chunks[2]) class MySpecialSetHandler: handles = (set,) identity = msgpackutils.SetHandler.identity def _dumps_loads(obj): obj = msgpackutils.dumps(obj) return msgpackutils.loads(obj) class MsgPackUtilsTest(test_base.BaseTestCase): def test_list(self): self.assertEqual([1, 2, 3], _dumps_loads([1, 2, 3])) def test_empty_list(self): self.assertEqual([], _dumps_loads([])) def test_tuple(self): # Seems like we do lose whether it was a tuple or not... # # Maybe fixed someday: # # https://github.com/msgpack/msgpack-python/issues/98 self.assertEqual([1, 2, 3], _dumps_loads((1, 2, 3))) def test_dict(self): self.assertEqual(dict(a=1, b=2, c=3), _dumps_loads(dict(a=1, b=2, c=3))) def test_empty_dict(self): self.assertEqual({}, _dumps_loads({})) def test_complex_dict(self): src = { 'now': datetime.datetime(1920, 2, 3, 4, 5, 6, 7), 'later': datetime.datetime(1921, 2, 3, 4, 5, 6, 9), 'a': 1, 'b': 2.0, 'c': [], 'd': {1, 2, 3}, 'zzz': uuidutils.generate_uuid(), 'yyy': 'yyy', 'ddd': b'bbb', 'today': datetime.date.today(), } self.assertEqual(src, _dumps_loads(src)) def test_itercount(self): it = itertools.count(1) next(it) next(it) it2 = _dumps_loads(it) self.assertEqual(next(it), next(it2)) it = itertools.count(0) it2 = _dumps_loads(it) self.assertEqual(next(it), next(it2)) def test_itercount_step(self): it = itertools.count(1, 3) it2 = _dumps_loads(it) self.assertEqual(next(it), next(it2)) def test_set(self): self.assertEqual({1, 2}, _dumps_loads({1, 2})) def test_empty_set(self): self.assertEqual(set(), _dumps_loads(set())) def test_frozenset(self): self.assertEqual(frozenset([1, 2]), _dumps_loads(frozenset([1, 2]))) def test_empty_frozenset(self): self.assertEqual(frozenset([]), _dumps_loads(frozenset([]))) def test_datetime_preserve(self): x = datetime.datetime(1920, 2, 3, 4, 5, 6, 7) self.assertEqual(x, _dumps_loads(x)) def test_datetime(self): x = xmlrpclib.DateTime() x.decode("19710203T04:05:06") self.assertEqual(x, _dumps_loads(x)) def test_ipaddr(self): thing = {'ip_addr': netaddr.IPAddress('1.2.3.4')} self.assertEqual(thing, _dumps_loads(thing)) def test_today(self): today = datetime.date.today() self.assertEqual(today, _dumps_loads(today)) def test_datetime_tz_clone(self): now = datetime.datetime.now() eastern = zoneinfo.ZoneInfo('US/Eastern') e_dt = now.replace(tzinfo=eastern) e_dt2 = _dumps_loads(e_dt) self.assertEqual(e_dt, e_dt2) self.assertEqual(e_dt.strftime(_TZ_FMT), e_dt2.strftime(_TZ_FMT)) def test_datetime_tz_different(self): now = datetime.datetime.now() eastern = zoneinfo.ZoneInfo('US/Eastern') pacific = zoneinfo.ZoneInfo('US/Pacific') e_dt = now.replace(tzinfo=eastern) p_dt = now.replace(tzinfo=pacific) self.assertNotEqual(e_dt, p_dt) self.assertNotEqual(e_dt.strftime(_TZ_FMT), p_dt.strftime(_TZ_FMT)) e_dt2 = _dumps_loads(e_dt) p_dt2 = _dumps_loads(p_dt) self.assertNotEqual(e_dt2, p_dt2) self.assertNotEqual(e_dt2.strftime(_TZ_FMT), p_dt2.strftime(_TZ_FMT)) self.assertEqual(e_dt, e_dt2) self.assertEqual(p_dt, p_dt2) def test_copy_then_register(self): registry = msgpackutils.default_registry self.assertRaises(ValueError, registry.register, MySpecialSetHandler(), reserved=True, override=True) registry = registry.copy(unfreeze=True) registry.register(MySpecialSetHandler(), reserved=True, override=True) h = registry.match(set()) self.assertIsInstance(h, MySpecialSetHandler) def test_bad_register(self): registry = msgpackutils.default_registry self.assertRaises(ValueError, registry.register, MySpecialSetHandler(), reserved=True, override=True) self.assertRaises(ValueError, registry.register, MySpecialSetHandler()) registry = registry.copy(unfreeze=True) registry.register(ColorHandler()) self.assertRaises(ValueError, registry.register, ColorHandler()) def test_custom_register(self): registry = msgpackutils.default_registry.copy(unfreeze=True) registry.register(ColorHandler()) c = Color(255, 254, 253) c_b = msgpackutils.dumps(c, registry=registry) c = msgpackutils.loads(c_b, registry=registry) self.assertEqual(255, c.r) self.assertEqual(254, c.g) self.assertEqual(253, c.b) def test_object(self): self.assertRaises(ValueError, msgpackutils.dumps, object()) ././@PaxHeader0000000000000000000000000000003200000000000011450 xustar000000000000000026 mtime=1740147099.65373 oslo_serialization-5.7.0/releasenotes/0000775000175000017500000000000000000000000020150 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6617298 oslo_serialization-5.7.0/releasenotes/notes/0000775000175000017500000000000000000000000021300 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/notes/add-reno-996dd44974d53238.yaml0000664000175000017500000000007200000000000025676 0ustar00zuulzuul00000000000000--- other: - Introduce reno for deployer release notes. ././@PaxHeader0000000000000000000000000000021600000000000011454 xustar0000000000000000120 path=oslo_serialization-5.7.0/releasenotes/notes/bug-1908607-fix-json-to_primitive-IO-OBjects-04faff4a1b5cf48f.yaml 22 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/notes/bug-1908607-fix-json-to_primitive-IO-OBjects-04faff4a1b50000664000175000017500000000021000000000000032525 0ustar00zuulzuul00000000000000--- fixes: - | `Bug #1908607 `_: Fix json to_primitive when using IO OBjects. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/notes/deprecate-yamlutils-module-96eee55f7ae57382.yaml0000664000175000017500000000020200000000000031657 0ustar00zuulzuul00000000000000--- deprecations: - | The ``yamlutils`` module is deprecated in Ussuri and support will be removed in a future release. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/notes/drop-python27-support-185668eec068ffa5.yaml0000664000175000017500000000017700000000000030573 0ustar00zuulzuul00000000000000--- upgrade: - | Support for Python 2.7 has been dropped. The minimum version of Python now supported is Python 3.6. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/notes/implement-zoneinfo-to-remove-pytz-c136b33bbfbfe59f.yaml0000664000175000017500000000015400000000000033357 0ustar00zuulzuul00000000000000--- other: - | Implement zoneinfo to allow us to remove pytz's dependency for Python 3.9 and 3.10 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/notes/jsonutils-to_primitive-value-error-89338f90310e9518.yaml0000664000175000017500000000021500000000000033120 0ustar00zuulzuul00000000000000--- upgrade: - | The ``oslo_utils.jsonutils.to_primitive`` function now raises ValueError when the input value can't be converted. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/notes/remove-py38-2c724027a885cf0b.yaml0000664000175000017500000000016600000000000026416 0ustar00zuulzuul00000000000000--- upgrade: - | Support for Python 3.8 has been removed. Now the minimum python version supported is 3.9 . ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/notes/remove-yamlutils-94c921247ab33003.yaml0000664000175000017500000000011000000000000027454 0ustar00zuulzuul00000000000000--- other: - Remove the yamlutils, the pyyaml is now safe by default. ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6657298 oslo_serialization-5.7.0/releasenotes/source/0000775000175000017500000000000000000000000021450 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/2023.1.rst0000664000175000017500000000021000000000000022720 0ustar00zuulzuul00000000000000=========================== 2023.1 Series Release Notes =========================== .. release-notes:: :branch: unmaintained/2023.1 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/2023.2.rst0000664000175000017500000000020200000000000022722 0ustar00zuulzuul00000000000000=========================== 2023.2 Series Release Notes =========================== .. release-notes:: :branch: stable/2023.2 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/2024.1.rst0000664000175000017500000000020200000000000022722 0ustar00zuulzuul00000000000000=========================== 2024.1 Series Release Notes =========================== .. release-notes:: :branch: stable/2024.1 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/2024.2.rst0000664000175000017500000000020200000000000022723 0ustar00zuulzuul00000000000000=========================== 2024.2 Series Release Notes =========================== .. release-notes:: :branch: stable/2024.2 ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6657298 oslo_serialization-5.7.0/releasenotes/source/_static/0000775000175000017500000000000000000000000023076 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/_static/.placeholder0000664000175000017500000000000000000000000025347 0ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1740147099.6657298 oslo_serialization-5.7.0/releasenotes/source/_templates/0000775000175000017500000000000000000000000023605 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/_templates/.placeholder0000664000175000017500000000000000000000000026056 0ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/conf.py0000664000175000017500000002150600000000000022753 0ustar00zuulzuul00000000000000# Copyright (C) 2020 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'openstackdocstheme', 'reno.sphinxext', ] # openstackdocstheme options openstackdocs_repo_name = 'openstack/oslo.serialization' openstackdocs_bug_project = 'oslo.serialization' openstackdocs_bug_tag = '' openstackdocs_auto_name = False # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = 'oslo.serialization Release Notes' copyright = '2016, oslo.serialization Developers' # Release notes do not need a version in the title, they span # multiple versions. # The full version, including alpha/beta/rc tags. release = '' # The short X.Y version. version = '' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all # documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'native' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. # keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'openstackdocs' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. # html_extra_path = [] # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'oslo.serializationReleaseNotesDoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'oslo.serializationReleaseNotes.tex', 'oslo.serialization Release Notes Documentation', 'oslo.serialization Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'oslo.serializationReleaseNotes', 'oslo.serialization Release Notes Documentation', ['oslo.serialization Developers'], 1) ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'oslo.serializationReleaseNotes', 'oslo.serialization Release Notes Documentation', 'oslo.serialization Developers', 'oslo.serializationReleaseNotes', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False # -- Options for Internationalization output ------------------------------ locale_dirs = ['locale/'] ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/index.rst0000664000175000017500000000045300000000000023313 0ustar00zuulzuul00000000000000================================== oslo.serialization Release Notes ================================== .. toctree:: :maxdepth: 1 unreleased 2024.2 2024.1 2023.2 2023.1 zed yoga xena wallaby victoria ussuri train stein rocky queens pike ocata ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/ocata.rst0000664000175000017500000000023000000000000023264 0ustar00zuulzuul00000000000000=================================== Ocata Series Release Notes =================================== .. release-notes:: :branch: origin/stable/ocata ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/pike.rst0000664000175000017500000000021700000000000023132 0ustar00zuulzuul00000000000000=================================== Pike Series Release Notes =================================== .. release-notes:: :branch: stable/pike ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/queens.rst0000664000175000017500000000022300000000000023477 0ustar00zuulzuul00000000000000=================================== Queens Series Release Notes =================================== .. release-notes:: :branch: stable/queens ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/rocky.rst0000664000175000017500000000022100000000000023324 0ustar00zuulzuul00000000000000=================================== Rocky Series Release Notes =================================== .. release-notes:: :branch: stable/rocky ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/stein.rst0000664000175000017500000000022100000000000023317 0ustar00zuulzuul00000000000000=================================== Stein Series Release Notes =================================== .. release-notes:: :branch: stable/stein ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/train.rst0000664000175000017500000000017600000000000023323 0ustar00zuulzuul00000000000000========================== Train Series Release Notes ========================== .. release-notes:: :branch: stable/train ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/unreleased.rst0000664000175000017500000000016000000000000024326 0ustar00zuulzuul00000000000000============================== Current Series Release Notes ============================== .. release-notes:: ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/ussuri.rst0000664000175000017500000000020200000000000023526 0ustar00zuulzuul00000000000000=========================== Ussuri Series Release Notes =========================== .. release-notes:: :branch: stable/ussuri ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/victoria.rst0000664000175000017500000000022000000000000024014 0ustar00zuulzuul00000000000000============================= Victoria Series Release Notes ============================= .. release-notes:: :branch: unmaintained/victoria ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/wallaby.rst0000664000175000017500000000021400000000000023632 0ustar00zuulzuul00000000000000============================ Wallaby Series Release Notes ============================ .. release-notes:: :branch: unmaintained/wallaby ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/xena.rst0000664000175000017500000000020000000000000023125 0ustar00zuulzuul00000000000000========================= Xena Series Release Notes ========================= .. release-notes:: :branch: unmaintained/xena ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/yoga.rst0000664000175000017500000000020000000000000023131 0ustar00zuulzuul00000000000000========================= Yoga Series Release Notes ========================= .. release-notes:: :branch: unmaintained/yoga ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/releasenotes/source/zed.rst0000664000175000017500000000017400000000000022766 0ustar00zuulzuul00000000000000======================== Zed Series Release Notes ======================== .. release-notes:: :branch: unmaintained/zed ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/requirements.txt0000664000175000017500000000113300000000000020741 0ustar00zuulzuul00000000000000# Requirements lower bounds listed here are our best effort to keep them up to # date but we do not test them so no guarantee of having them all correct. If # you find any incorrect lower bounds, let us know or propose a fix. # NOTE(harlowja): Because oslo.serialization is used by the client libraries, # we do not want to add a lot of dependencies to it. If you find that # adding a new feature to oslo.serialization means adding a new dependency, # that is a likely indicator that the feature belongs somewhere else. msgpack>=0.5.2 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 tzdata>=2022.4 # MIT ././@PaxHeader0000000000000000000000000000003200000000000011450 xustar000000000000000026 mtime=1740147099.66973 oslo_serialization-5.7.0/setup.cfg0000664000175000017500000000160300000000000017300 0ustar00zuulzuul00000000000000[metadata] name = oslo.serialization summary = Oslo Serialization library description_file = README.rst author = OpenStack author_email = openstack-discuss@lists.openstack.org home_page = https://docs.openstack.org/oslo.serialization/latest/ python_requires = >=3.9 classifier = Environment :: OpenStack Intended Audience :: Information Technology Intended Audience :: System Administrators License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 Programming Language :: Python :: 3 :: Only Programming Language :: Python :: Implementation :: CPython [files] packages = oslo_serialization [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/setup.py0000664000175000017500000000127100000000000017172 0ustar00zuulzuul00000000000000# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import setuptools setuptools.setup( setup_requires=['pbr>=2.0.0'], pbr=True) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/test-requirements.txt0000664000175000017500000000021000000000000021711 0ustar00zuulzuul00000000000000netaddr>=0.7.18 # BSD stestr>=2.0.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0 coverage>=4.0 # Apache-2.0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1740147051.0 oslo_serialization-5.7.0/tox.ini0000664000175000017500000000250300000000000016772 0ustar00zuulzuul00000000000000[tox] minversion = 3.18.0 envlist = py3,pep8 [testenv] deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt commands = stestr run --slowest {posargs} [testenv:pep8] skip_install = true deps = pre-commit commands = pre-commit run -a [testenv:venv] commands = {posargs} [testenv:cover] setenv = PYTHON=coverage run --source oslo_serialization --parallel-mode commands = coverage erase stestr run {posargs} coverage combine coverage html -d cover coverage xml -o cover/coverage.xml coverage report --show-missing [testenv:docs] allowlist_externals = rm deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/doc/requirements.txt commands = rm -fr doc/build sphinx-build -W --keep-going -b html doc/source doc/build/html [testenv:releasenotes] allowlist_externals = rm deps = {[testenv:docs]deps} commands = rm -rf releasenotes/build sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html [flake8] # E123, E125 skipped as they are invalid PEP-8. # W504 line break after binary operator show-source = True ignore = E123,E125,W504 exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build