oslo.serialization-3.1.1/0000775000175000017500000000000013643050444015371 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/.zuul.yaml0000664000175000017500000000041313643050341017324 0ustar zuulzuul00000000000000- project: templates: - check-requirements - lib-forward-testing-python3 - openstack-lower-constraints-jobs - openstack-python3-ussuri-jobs - periodic-stable-jobs - publish-openstack-docs-pti - release-notes-jobs-python3 oslo.serialization-3.1.1/requirements.txt0000664000175000017500000000123613643050341020653 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. # 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. pbr!=2.1.0,>=2.0.0 # Apache-2.0 msgpack>=0.5.2 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 pytz>=2013.6 # MIT PyYAML>=3.12 # MIT debtcollector>=1.2.0 # Apache-2.0 oslo.serialization-3.1.1/setup.py0000664000175000017500000000127113643050341017100 0ustar zuulzuul00000000000000# 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) oslo.serialization-3.1.1/babel.cfg0000664000175000017500000000002013643050341017103 0ustar zuulzuul00000000000000[python: **.py] oslo.serialization-3.1.1/LICENSE0000664000175000017500000002363613643050341016404 0ustar zuulzuul00000000000000 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. oslo.serialization-3.1.1/.coveragerc0000664000175000017500000000017713643050341017513 0ustar zuulzuul00000000000000[run] branch = True source = oslo_serialization omit = oslo_serialization/tests/* [report] ignore_errors = True precision = 2 oslo.serialization-3.1.1/HACKING.rst0000664000175000017500000000023513643050341017163 0ustar zuulzuul00000000000000oslo.serialization Style Commandments ===================================== Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest oslo.serialization-3.1.1/oslo.serialization.egg-info/0000775000175000017500000000000013643050444022713 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/oslo.serialization.egg-info/top_level.txt0000664000175000017500000000002313643050444025440 0ustar zuulzuul00000000000000oslo_serialization oslo.serialization-3.1.1/oslo.serialization.egg-info/SOURCES.txt0000664000175000017500000000341213643050444024577 0ustar zuulzuul00000000000000.coveragerc .mailmap .stestr.conf .zuul.yaml AUTHORS CONTRIBUTING.rst ChangeLog HACKING.rst LICENSE README.rst babel.cfg lower-constraints.txt 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/yamlutils.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 oslo_serialization/tests/test_yamlutils.py releasenotes/notes/add-reno-996dd44974d53238.yaml releasenotes/notes/deprecate-yamlutils-module-96eee55f7ae57382.yaml releasenotes/notes/drop-python27-support-185668eec068ffa5.yaml 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/_static/.placeholder releasenotes/source/_templates/.placeholderoslo.serialization-3.1.1/oslo.serialization.egg-info/not-zip-safe0000664000175000017500000000000113643050444025141 0ustar zuulzuul00000000000000 oslo.serialization-3.1.1/oslo.serialization.egg-info/PKG-INFO0000664000175000017500000000421013643050444024005 0ustar zuulzuul00000000000000Metadata-Version: 1.2 Name: oslo.serialization Version: 3.1.1 Summary: Oslo Serialization library Home-page: https://docs.openstack.org/oslo.serialization/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: ======================== 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/ Platform: UNKNOWN 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.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Requires-Python: >=3.6 oslo.serialization-3.1.1/oslo.serialization.egg-info/dependency_links.txt0000664000175000017500000000000113643050444026761 0ustar zuulzuul00000000000000 oslo.serialization-3.1.1/oslo.serialization.egg-info/requires.txt0000664000175000017500000000014413643050444025312 0ustar zuulzuul00000000000000pbr!=2.1.0,>=2.0.0 msgpack>=0.5.2 oslo.utils>=3.33.0 pytz>=2013.6 PyYAML>=3.12 debtcollector>=1.2.0 oslo.serialization-3.1.1/oslo.serialization.egg-info/pbr.json0000664000175000017500000000005613643050444024372 0ustar zuulzuul00000000000000{"git_version": "5ee9b7b", "is_release": true}oslo.serialization-3.1.1/PKG-INFO0000664000175000017500000000421013643050444016463 0ustar zuulzuul00000000000000Metadata-Version: 1.2 Name: oslo.serialization Version: 3.1.1 Summary: Oslo Serialization library Home-page: https://docs.openstack.org/oslo.serialization/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: ======================== 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/ Platform: UNKNOWN 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.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Requires-Python: >=3.6 oslo.serialization-3.1.1/releasenotes/0000775000175000017500000000000013643050444020062 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/releasenotes/source/0000775000175000017500000000000013643050444021362 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/releasenotes/source/conf.py0000664000175000017500000002163013643050341022657 0ustar zuulzuul00000000000000# -*- coding: utf-8 -*- # 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 repository_name = 'openstack/oslo.serialization' bug_project = 'oslo.serialization' bug_tag = '' # 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 = u'oslo.serialization Release Notes' copyright = u'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 = 'sphinx' # 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 not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%Y-%m-%d %H:%M' # 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', u'oslo.serialization Release Notes Documentation', u'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', u'oslo.serialization Release Notes Documentation', [u'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', u'oslo.serialization Release Notes Documentation', u'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/'] oslo.serialization-3.1.1/releasenotes/source/train.rst0000664000175000017500000000017613643050341023231 0ustar zuulzuul00000000000000========================== Train Series Release Notes ========================== .. release-notes:: :branch: stable/train oslo.serialization-3.1.1/releasenotes/source/rocky.rst0000664000175000017500000000022113643050341023232 0ustar zuulzuul00000000000000=================================== Rocky Series Release Notes =================================== .. release-notes:: :branch: stable/rocky oslo.serialization-3.1.1/releasenotes/source/index.rst0000664000175000017500000000031313643050341023214 0ustar zuulzuul00000000000000================================== oslo.serialization Release Notes ================================== .. toctree:: :maxdepth: 1 unreleased train stein rocky queens pike ocata oslo.serialization-3.1.1/releasenotes/source/ocata.rst0000664000175000017500000000023013643050341023172 0ustar zuulzuul00000000000000=================================== Ocata Series Release Notes =================================== .. release-notes:: :branch: origin/stable/ocata oslo.serialization-3.1.1/releasenotes/source/_static/0000775000175000017500000000000013643050444023010 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/releasenotes/source/_static/.placeholder0000664000175000017500000000000013643050341025255 0ustar zuulzuul00000000000000oslo.serialization-3.1.1/releasenotes/source/pike.rst0000664000175000017500000000021713643050341023040 0ustar zuulzuul00000000000000=================================== Pike Series Release Notes =================================== .. release-notes:: :branch: stable/pike oslo.serialization-3.1.1/releasenotes/source/queens.rst0000664000175000017500000000022313643050341023405 0ustar zuulzuul00000000000000=================================== Queens Series Release Notes =================================== .. release-notes:: :branch: stable/queens oslo.serialization-3.1.1/releasenotes/source/stein.rst0000664000175000017500000000022113643050341023225 0ustar zuulzuul00000000000000=================================== Stein Series Release Notes =================================== .. release-notes:: :branch: stable/stein oslo.serialization-3.1.1/releasenotes/source/_templates/0000775000175000017500000000000013643050444023517 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/releasenotes/source/_templates/.placeholder0000664000175000017500000000000013643050341025764 0ustar zuulzuul00000000000000oslo.serialization-3.1.1/releasenotes/source/unreleased.rst0000664000175000017500000000016013643050341024234 0ustar zuulzuul00000000000000============================== Current Series Release Notes ============================== .. release-notes:: oslo.serialization-3.1.1/releasenotes/notes/0000775000175000017500000000000013643050444021212 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/releasenotes/notes/deprecate-yamlutils-module-96eee55f7ae57382.yaml0000664000175000017500000000020213643050341031565 0ustar zuulzuul00000000000000--- deprecations: - | The ``yamlutils`` module is deprecated in Ussuri and support will be removed in a future release. oslo.serialization-3.1.1/releasenotes/notes/add-reno-996dd44974d53238.yaml0000664000175000017500000000007213643050341025604 0ustar zuulzuul00000000000000--- other: - Introduce reno for deployer release notes. oslo.serialization-3.1.1/releasenotes/notes/drop-python27-support-185668eec068ffa5.yaml0000664000175000017500000000017713643050341030501 0ustar zuulzuul00000000000000--- upgrade: - | Support for Python 2.7 has been dropped. The minimum version of Python now supported is Python 3.6. oslo.serialization-3.1.1/lower-constraints.txt0000664000175000017500000000115213643050341021622 0ustar zuulzuul00000000000000appdirs==1.3.0 Babel==2.3.4 bandit==1.4.0 coverage==4.0 debtcollector==1.2.0 extras==1.0.0 fixtures==3.0.0 gitdb==0.6.4 GitPython==1.0.1 ipaddress===1.0.17 iso8601==0.1.11 keystoneauth1==3.4.0 linecache2==1.0.0 mccabe==0.2.1 mox3==0.20.0 msgpack==0.5.2 netaddr==0.7.18 netifaces==0.10.4 os-client-config==1.28.0 oslo.i18n==3.15.3 oslo.utils==3.33.0 oslotest==3.2.0 pbr==2.0.0 pyparsing==2.1.0 python-mimeparse==1.6.0 python-subunit==1.0.0 pytz==2013.6 PyYAML==3.12 requests==2.14.2 requestsexceptions==1.2.0 smmap==0.9.0 stestr==2.0.0 stevedore==1.20.0 testtools==2.2.0 traceback2==1.4.0 unittest2==1.1.0 wrapt==1.7.0 oslo.serialization-3.1.1/setup.cfg0000664000175000017500000000226413643050444017216 0ustar zuulzuul00000000000000[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.6 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.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3 :: Only Programming Language :: Python :: Implementation :: CPython [files] packages = oslo_serialization [compile_catalog] directory = oslo.serialization/locale domain = oslo.serialization [update_catalog] domain = oslo.serialization output_dir = oslo.serialization/locale input_file = oslo.serialization/locale/oslo.serialization.pot [extract_messages] keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = oslo.serialization/locale/oslo.serialization.pot [egg_info] tag_build = tag_date = 0 oslo.serialization-3.1.1/AUTHORS0000664000175000017500000000613713643050444016450 0ustar zuulzuul00000000000000Akihiro 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 Flavio Percoco Gary Kotton Gevorg Davoian 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 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 Monty Taylor Morgan Morgan Fainberg Nataliia Uvarova OpenStack Release Bot Phil Day Ronald Bradford Russell Bryant Sean McGinnis Sirushti Murugesan Stanislaw Pitucha Stephen Finucane Steve Martinelli 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 melissaml ricolin xianming.mao yanheven zhangboye oslo.serialization-3.1.1/test-requirements.txt0000664000175000017500000000067513643050341021636 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. hacking>=3.0,<3.1.0 # Apache-2.0 netaddr>=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.4,>=4.0 # Apache-2.0 # Bandit security code scanner bandit>=1.1.0 # Apache-2.0 oslo.serialization-3.1.1/.stestr.conf0000664000175000017500000000007313643050341017636 0ustar zuulzuul00000000000000[DEFAULT] test_path=./oslo_serialization/tests top_path=./ oslo.serialization-3.1.1/README.rst0000664000175000017500000000204513643050341017055 0ustar zuulzuul00000000000000======================== 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/ oslo.serialization-3.1.1/ChangeLog0000664000175000017500000002625013643050444017150 0ustar zuulzuul00000000000000CHANGES ======= 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 oslo.serialization-3.1.1/tox.ini0000664000175000017500000000266513643050341016711 0ustar zuulzuul00000000000000[tox] minversion = 3.2.0 envlist = py37,pep8 basepython = python3 ignore_basepython_conflict = true [testenv] deps = -c{env:UPPER_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] commands = flake8 # Run security linter bandit -r oslo_serialization tests -n5 [testenv:venv] commands = {posargs} [testenv:cover] commands = python setup.py test --coverage --coverage-package-name=oslo_serialization --testr-args='{posargs}' [testenv:docs] whitelist_externals = rm deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/doc/requirements.txt commands = rm -fr doc/build sphinx-build -W --keep-going -b html doc/source doc/build/html [testenv:releasenotes] whitelist_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 [testenv:lower-constraints] deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt [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 oslo.serialization-3.1.1/oslo_serialization/0000775000175000017500000000000013643050444021302 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/oslo_serialization/yamlutils.py0000664000175000017500000000657313643050341023706 0ustar zuulzuul00000000000000# 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. """YAML related utilities. The main goal of this module is to standardize yaml management inside openstack. This module reduce technical debt by avoiding re-implementations of yaml manager in all the openstack projects. Use this module inside openstack projects to handle yaml securely and properly. """ from debtcollector import removals import yaml removals.removed_module( 'oslo_serialization.yamlutils', version='3.0.0', removal_version='4.0.0', message='The oslo_serialization.yamlutils will be removed') def load(stream, is_safe=True): """Converts a YAML document to a Python object. :param stream: the YAML document to convert into a Python object. Accepts a byte string, a Unicode string, an open binary file object, or an open text file object. :param is_safe: Turn off safe loading. True by default and only load standard YAML. This option can be turned off by passing ``is_safe=False`` if you need to load not only standard YAML tags or if you need to construct an arbitrary python object. Stream specifications: * An empty stream contains no documents. * Documents are separated with ``---``. * Documents may optionally end with ``...``. * A single document may or may not be marked with ``---``. Parses the given stream and returns a Python object constructed from the first document in the stream. If there are no documents in the stream, it returns None. """ yaml_loader = yaml.Loader if is_safe: if hasattr(yaml, 'CSafeLoader'): yaml_loader = yaml.CSafeLoader else: yaml_loader = yaml.SafeLoader return yaml.load(stream, yaml_loader) # nosec B506 def dumps(obj, is_safe=True): """Converts a Python object to a YAML document. :param obj: python object to convert into YAML representation. :param is_safe: Turn off safe dumping. Serializes the given Python object to a string and returns that string. """ yaml_dumper = yaml.Dumper if is_safe: if hasattr(yaml, 'CSafeDumper'): yaml_dumper = yaml.CSafeDumper else: yaml_dumper = yaml.SafeDumper return yaml.dump(obj, default_flow_style=False, Dumper=yaml_dumper) def dump(obj, fp, is_safe=True): """Converts a Python object as a YAML document to ``fp``. :param obj: python object to convert into YAML representation. :param fp: a ``.write()``-supporting file-like object :param is_safe: Turn off safe dumping. """ yaml_dumper = yaml.Dumper if is_safe: if hasattr(yaml, 'CSafeDumper'): yaml_dumper = yaml.CSafeDumper else: yaml_dumper = yaml.SafeDumper return yaml.dump(obj, fp, default_flow_style=False, Dumper=yaml_dumper) oslo.serialization-3.1.1/oslo_serialization/base64.py0000664000175000017500000000532713643050341022743 0ustar zuulzuul00000000000000# 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 """ from __future__ import absolute_import 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) oslo.serialization-3.1.1/oslo_serialization/serializer/0000775000175000017500000000000013643050444023453 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/oslo_serialization/serializer/base_serializer.py0000664000175000017500000000316713643050341027173 0ustar zuulzuul00000000000000# 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(object, 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 """ oslo.serialization-3.1.1/oslo_serialization/serializer/json_serializer.py0000664000175000017500000000254013643050341027224 0ustar zuulzuul00000000000000# 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) oslo.serialization-3.1.1/oslo_serialization/serializer/msgpack_serializer.py0000664000175000017500000000242013643050341027675 0ustar zuulzuul00000000000000# 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) oslo.serialization-3.1.1/oslo_serialization/serializer/__init__.py0000664000175000017500000000000013643050341025546 0ustar zuulzuul00000000000000oslo.serialization-3.1.1/oslo_serialization/tests/0000775000175000017500000000000013643050444022444 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/oslo_serialization/tests/test_msgpackutils.py0000664000175000017500000001501013643050341026554 0ustar zuulzuul00000000000000# 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 netaddr from oslotest import base as test_base from pytz import timezone from oslo_serialization import msgpackutils from oslo_utils import uuidutils _TZ_FMT = '%Y-%m-%d %H:%M:%S %Z%z' class Color(object): def __init__(self, r, g, b): self.r = r self.g = g self.b = b class ColorHandler(object): handles = (Color,) identity = ( msgpackutils.HandlerRegistry.non_reserved_extension_range.min_value + 1 ) @staticmethod def serialize(obj): blob = '%s, %s, %s' % (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(object): 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': set([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(set([1, 2]), _dumps_loads(set([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): eastern = timezone('US/Eastern') now = datetime.datetime.now() e_dt = eastern.localize(now) 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): eastern = timezone('US/Eastern') pacific = timezone('US/Pacific') now = datetime.datetime.now() e_dt = eastern.localize(now) p_dt = pacific.localize(now) 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()) oslo.serialization-3.1.1/oslo_serialization/tests/test_yamlutils.py0000664000175000017500000000502313643050341026074 0ustar zuulzuul00000000000000# 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 tempfile import textwrap import uuid from oslotest import base from oslo_serialization import yamlutils as yaml class BehaviorTestCase(base.BaseTestCase): def test_loading(self): payload = textwrap.dedent(''' - foo: bar - list: - [one, two] - {check: yaml, in: test} ''') expected = [ {'foo': 'bar'}, {'list': None}, ['one', 'two'], {'check': 'yaml', 'in': 'test'} ] loaded = yaml.load(payload) self.assertEqual(loaded, expected) def test_loading_with_unsafe(self): payload = textwrap.dedent(''' !!python/object/apply:os.system ['echo "hello"'] ''') loaded = yaml.load(payload, is_safe=False) expected = 0 self.assertEqual(loaded, expected) def test_dumps(self): payload = [ {'foo': 'bar'}, {'list': None}, ['one', 'two'], {'check': 'yaml', 'in': 'test'} ] dumped = yaml.dumps(payload) expected = textwrap.dedent('''\ - foo: bar - list: null - - one - two - check: yaml in: test ''') self.assertEqual(dumped, expected) def test_dump(self): payload = [ {'foo': 'bar'}, {'list': None}, ['one', 'two'], {'check': 'yaml', 'in': 'test'} ] tmpfile = os.path.join(tempfile.gettempdir(), str(uuid.uuid4())) with open(tmpfile, 'w+') as fp: yaml.dump(payload, fp) with open(tmpfile, 'r') as fp: file_content = fp.read() expected = textwrap.dedent('''\ - foo: bar - list: null - - one - two - check: yaml in: test ''') self.assertEqual(file_content, expected) oslo.serialization-3.1.1/oslo_serialization/tests/test_jsonutils.py0000664000175000017500000003145313643050341026111 0ustar zuulzuul00000000000000# 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 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(object): def __repr__(self): return 'repr' class JSONUtilsTestMixin(object): json_impl = None def setUp(self): super(JSONUtilsTestMixin, self).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(JSONUtilsTestMixin, self).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(u'"foo"'), str) # 'test' in Ukrainian i18n_str_unicode = u'"\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 = u'{"foo": 3}' result = jsonutils.loads(jsontext, parse_int=lambda x: 5) self.assertEqual(5, result['foo']) def test_load(self): jsontext = u'{"a": "\u0442\u044d\u0441\u0442"}' expected = {u'a': u'\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(ToPrimitiveTestCase, self).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_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(object): 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_iteritems(self): class IterItemsClass(object): def __init__(self): self.data = dict(a=1, b=2, c=3).items() self.index = 0 def iteritems(self): return self.data x = IterItemsClass() p = jsonutils.to_primitive(x) self.assertEqual({'a': 1, 'b': 2, 'c': 3}, p) def test_iteritems_with_cycle(self): class IterItemsClass(object): def __init__(self): self.data = dict(a=1, b=2, c=3) self.index = 0 def iteritems(self): return self.data.items() x = IterItemsClass() x2 = IterItemsClass() 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_items(self): # Use items() when iteritems() is not available. class ItemsClass(object): def __init__(self): self.data = dict(a=1, b=2, c=3) def items(self): return self.data.items() x = ItemsClass() p = jsonutils.to_primitive(x) self.assertEqual({'a': 1, 'b': 2, 'c': 3}, p) def test_precedence_items_iteritems(self): class ItemsIterItemsClass(object): def items(self): return {'items': 'items'} def iteritems(self): return {'iteritems': 'iteritems'} x = ItemsIterItemsClass() p = jsonutils.to_primitive(x) # Prefer iteritems over items self.assertEqual({'iteritems': 'iteritems'}, p) def test_mapping(self): # Make sure collections.Mapping is converted to a dict # and not a list. class MappingClass(collections.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) @mock.patch('warnings.warn') def test_instance(self, warn_mock): class MysteryClass(object): a = 10 def __init__(self): self.b = 1 x = MysteryClass() self.assertEqual(dict(b=1), jsonutils.to_primitive(x, convert_instances=True)) self.assertEqual(x, jsonutils.to_primitive(x)) warn_mock.assert_called_once() def test_typeerror(self): x = bytearray # Class, not instance self.assertEqual(u"", 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(u".foo at 0x' )) self.assertEqual('', ret[2]) def test_depth(self): class LevelsGenerator(object): def __init__(self, levels): self._levels = levels def iteritems(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(u'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(u'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() ret = jsonutils.to_primitive(obj) self.assertIs(obj, ret) ret = jsonutils.to_primitive(obj, fallback=repr) self.assertEqual('repr', ret) def test_fallback_list(self): obj = ReprObject() obj_list = [obj] ret = jsonutils.to_primitive(obj_list) self.assertEqual([obj], ret) 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(object): # __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_exception(self): self.assertIn(jsonutils.to_primitive(ValueError("an exception")), ["ValueError('an exception',)", "ValueError('an exception')"]) oslo.serialization-3.1.1/oslo_serialization/tests/test_base64.py0000664000175000017500000000463013643050341025140 0ustar zuulzuul00000000000000# 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(u'text')) self.assertEqual(b'ZTrDqQ==', base64.encode_as_bytes(u'e:\xe9')) self.assertEqual(b'ZTrp', base64.encode_as_bytes(u'e:\xe9', encoding='latin1')) def test_encode_as_text(self): self.assertEqual(u'dGV4dA==', base64.encode_as_text(b'text')) self.assertEqual(u'dGV4dA==', base64.encode_as_text(u'text')) self.assertEqual(u'ZTrDqQ==', base64.encode_as_text(u'e:\xe9')) self.assertEqual(u'ZTrp', base64.encode_as_text(u'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(u'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(u'text', base64.decode_as_text(b'dGV4dA==')) self.assertEqual(u'text', base64.decode_as_text(u'dGV4dA==')) self.assertEqual(u'e:\xe9', base64.decode_as_text(u'ZTrDqQ==')) self.assertEqual(u'e:\xe9', base64.decode_as_text(u'ZTrp', encoding='latin1')) oslo.serialization-3.1.1/oslo_serialization/tests/__init__.py0000664000175000017500000000000013643050341024537 0ustar zuulzuul00000000000000oslo.serialization-3.1.1/oslo_serialization/jsonutils.py0000664000175000017500000002342313643050341023706 0ustar zuulzuul00000000000000# 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 itertools import json import uuid import warnings from xmlrpc import client as xmlrpclib from oslo_utils import encodeutils from oslo_utils import importutils from oslo_utils import timeutils 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, 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) == 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, 'iteritems'): return recursive(dict(value.iteritems()), level=level + 1) # Python 3 does not have iteritems elif hasattr(value, 'items'): return recursive(dict(value.items()), level=level + 1) elif hasattr(value, '__iter__'): 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 not None: return orig_fallback(value) # TODO(gcb) raise ValueError in version 3.0 warnings.warn("Cannot convert %r to primitive, will raise ValueError " "instead of warning in version 3.0" % (value,)) return 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__) oslo.serialization-3.1.1/oslo_serialization/msgpackutils.py0000664000175000017500000003573513643050341024373 0ustar zuulzuul00000000000000# 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 msgpack from oslo_utils import importutils from pytz import timezone netaddr = importutils.try_import("netaddr") class Interval(object): """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(%s, %s)' % (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(object): """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(): for h in handlers: yield h 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(object): 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(object): 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 = { u'day': dt.day, u'month': dt.month, u'year': dt.year, u'hour': dt.hour, u'minute': dt.minute, u'second': dt.second, u'microsecond': dt.microsecond, } if dt.tzinfo: tz = dt.tzinfo.tzname(None) dct[u'tz'] = tz 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 = dict((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: tzinfo = timezone(dct['tz']) dt = tzinfo.localize(dt) return dt class CountHandler(object): 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(object): 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(object): 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(object): 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(object): 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 = { u'year': d.year, u'month': d.month, u'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 = dict((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) oslo.serialization-3.1.1/oslo_serialization/__init__.py0000664000175000017500000000000013643050341023375 0ustar zuulzuul00000000000000oslo.serialization-3.1.1/.mailmap0000664000175000017500000000013013643050341017000 0ustar zuulzuul00000000000000# Format is: # # oslo.serialization-3.1.1/CONTRIBUTING.rst0000664000175000017500000000103113643050341020021 0ustar zuulzuul00000000000000If 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 oslo.serialization-3.1.1/doc/0000775000175000017500000000000013643050444016136 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/doc/requirements.txt0000664000175000017500000000052613643050341021421 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. # These are needed for docs generation openstackdocstheme>=1.18.1 # Apache-2.0 sphinx>=1.8.0,!=2.1.0 # BSD reno>=2.5.0 # Apache-2.0 oslo.serialization-3.1.1/doc/source/0000775000175000017500000000000013643050444017436 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/doc/source/reference/0000775000175000017500000000000013643050444021374 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/doc/source/reference/index.rst0000664000175000017500000000043313643050341023231 0ustar zuulzuul00000000000000============= API Reference ============= base64 ====== .. automodule:: oslo_serialization.base64 :members: jsonutils ========= .. automodule:: oslo_serialization.jsonutils :members: msgpackutils ============ .. automodule:: oslo_serialization.msgpackutils :members: oslo.serialization-3.1.1/doc/source/conf.py0000664000175000017500000000516013643050341020733 0ustar zuulzuul00000000000000# -*- coding: utf-8 -*- # 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', #'sphinx.ext.intersphinx', 'openstackdocstheme' ] # openstackdocstheme options repository_name = 'openstack/oslo.serialization' bug_project = 'oslo.serialization' 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 = u'oslo.serialization' copyright = u'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 = 'sphinx' # -- 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' html_last_updated_fmt = '%Y-%m-%d %H:%M' # 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, u'%s Documentation' % project, u'OpenStack Foundation', 'manual'), ] # Example configuration for intersphinx: refer to the Python standard library. #intersphinx_mapping = {'http://docs.python.org/': None} oslo.serialization-3.1.1/doc/source/index.rst0000664000175000017500000000101213643050341021265 0ustar zuulzuul00000000000000============================================== 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. .. toctree:: :maxdepth: 1 install/index user/index contributor/index reference/index .. rubric:: Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` .. _oslo: https://wiki.openstack.org/wiki/Oslo oslo.serialization-3.1.1/doc/source/install/0000775000175000017500000000000013643050444021104 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/doc/source/install/index.rst0000664000175000017500000000033613643050341022743 0ustar zuulzuul00000000000000============ Installation ============ At the command line:: $ pip install oslo.serialization Or, if you have virtualenvwrapper installed:: $ mkvirtualenv oslo.serialization $ pip install oslo.serializationoslo.serialization-3.1.1/doc/source/contributor/0000775000175000017500000000000013643050444022010 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/doc/source/contributor/index.rst0000664000175000017500000000012413643050341023642 0ustar zuulzuul00000000000000============== Contributing ============== .. include:: ../../../CONTRIBUTING.rst oslo.serialization-3.1.1/doc/source/user/0000775000175000017500000000000013643050444020414 5ustar zuulzuul00000000000000oslo.serialization-3.1.1/doc/source/user/index.rst0000664000175000017500000000040613643050341022251 0ustar zuulzuul00000000000000======================== 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 oslo.serialization-3.1.1/doc/source/user/history.rst0000664000175000017500000000004013643050341022635 0ustar zuulzuul00000000000000.. include:: ../../../ChangeLog