Name | bespon JSON |
Version |
0.7.0
JSON |
| download |
home_page | |
Summary | Python library for BespON |
upload_time | 2023-10-15 19:17:21 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.7 |
license | Copyright 2016-2017 Geoffrey M. Poore Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
configuration
serialization
interchange
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
=====================================
``bespon`` package for Python
=====================================
The ``bespon`` package for Python encodes and decodes data in the
`BespON format <https://bespon.org>`_.
Basic usage
===========
Data is loaded in a manner analogous to Python's ``json`` module:
* ``bespon.load(<file-like object>)``
* ``bespon.loads(<string or bytes>)``
Similarly, dumping data to a file or string:
* ``bespon.dump(<obj>, <file-like object>)``
* ``bespon.dumps(<obj>)``
Only dicts, lists, Unicode strings, byte strings, floats, ints, bools, and
``None`` are supported for dumping by default. See the ``extended_types``
and ``python_types`` keywords for optional support of additional types.
Lossless round-trip support
===========================
There is also support for lossless round-tripping. Data can be loaded,
modified, and then saved with minimal impact on the data file layout.
Data can be loaded from a file or string into an instance of the
``RoundtripAst`` class.
* ``bespon.load_roundtrip_ast(<file-like object>)``
* ``bespon.loads_roundtrip_ast(<string or bytes>)``
This class has two methods that allow data to be modified.
* ``replace_val(<path>, <obj>)`` This replaces the object currently located
at ``<path>`` within the data with ``<obj>``. ``<path>`` must be a list or
tuple consisting of dict keys and list indices. ``<obj>`` must have the
same type as the object it is replacing. There is **experimental** support
for replacing dicts and lists; all other types are fully supported.
* ``replace_key(<path>, <obj>)`` This replaces the dict key at the end of
``<path>`` with the new key ``<obj>`` (which will map to the same value as
the replaced key). ``<obj>`` must be a Unicode string, int, or bool, and
must have the same type as the object it is replacing.
**Experimental** support for changing data types may be enabled by loading
data with the option ``enforce_types=False``.
There is also **preliminary** support for ``__getitem__``-style access
(``ast['key']``, etc.). Data accessed in this manner has the following
attributes.
* ``key``: Key of the current location, if in a dict.
Allows assignment, as long as the new object is of the same type as the old
object, and the type is supported. For example, ``ast['key'].key =
'new_key'`` will rename the key.
* ``key_doc_comment``: Doc comment of key, if in a dict. ``None`` if there
is no doc comment. Currently only supports assignment for existing doc
comments.
* ``key_trailing_comment``: Trailing line comment (``#comment``) that
immediately follows a key on the same line.
* ``value``: Value of the current location. Can be assigned, as long as the
new object is of the same type as the old object, and the type is supported.
When ``value`` is accessed or assigned and is a mutable object like a dict
or list, the object should not be modified. Currently, modifying the object
will not change the actual data contained in the AST (the AST does not
update automatically). But modifying the object will make the AST's
temporary representation of itself (available via ``value``) invalid. If
you need to modify the object returned by ``value``, use ``copy.deepcopy()``
to create a completely independent copy. If you need to assign an object
that will later be modified, assign a deepcopy of the object.
* ``value_doc_comment``: Doc comment of the value at the current location.
``None`` if there is no doc comment. Currently only supports assignment for
existing doc comments.
* ``value_trailing_comment``: Trailing line comment (``#comment``) that
immediately follows a non-collection type on the same line.
* ``value_start_trailing_comment``: Trailing line comment that immediately
follows the start of a collection in inline-style syntax ("``{``" or
"``[``").
* ``value_end_trailing_comment``: Trailing line comment that immediately
follows the end of a collection in inline-style syntax ("``}``" or "``]``").
After data in a ``RoundtripAst`` instance has been modified, it may be encoded
back into a string with the ``dumps()`` method. An example is shown below.
::
>>> ast = bespon.loads_roundtrip_ast("""
key.subkey.first = 123 # Comment
key.subkey.second = 0b1101
key.subkey.third = `literal \string`
""")
>>> ast.replace_key(['key', 'subkey'], 'sk')
>>> ast.replace_val(['key', 'sk', 'second'], 7)
>>> ast.replace_val(['key', 'sk', 'third'], '\\another \\literal')
>>> ast.replace_key(['key', 'sk', 'third'], 'fourth')
>>> print(ast.dumps())
key.sk.first = 123 # Comment
key.sk.second = 0b111
key.sk.fourth = `\another \literal`
Here is the same example using the preliminary ``__getitem__``-style syntax.
::
>>> ast = bespon.loads_roundtrip_ast("""
key.subkey.first = 123 # Comment
key.subkey.second = 0b1101
key.subkey.third = `literal \string`
""")
>>> ast['key']['subkey'].key = 'sk'
>>> ast['key']['sk']['second'].value = 7
>>> ast['key']['sk']['third'].value = '\\another \\literal'
>>> ast['key']['sk']['third'].key = 'fourth'
>>> print(ast.dumps())
key.sk.first = 123 # Comment
key.sk.second = 0b111
key.sk.fourth = `\another \literal`
This example illustrates several of BespON's round-trip capabilities.
* Comments and layout are preserved exactly.
* Key renaming works with key paths. Every time a key appears in key paths,
it is renamed.
* When a number is modified, the new value is expressed in the same base as
the old value.
* When a quoted string is modified, the new value is quoted in the same
style as the old value (at least to the extent that this is practical).
* As soon as a key is modified, the new key must be used for further
modifications. The old key is invalid.
Advanced loading and dumping
============================
The loading and dumping functions support several keyword arguments to
customize data handling.
**Loading**
* ``aliases`` (boolean, default ``True``): Allow aliases.
* ``circular_references`` (boolean, default ``False``): Allow aliases to
create circular references.
* ``custom_parsers`` (dict, default ``None``): Replace the default parser
for a specified type with a custom parser. For example, using
``custom_parsers={'int': float}`` would cause all integers to be parsed
with the ``float()`` function.
* ``custom_types`` (``bespon.LoadType`` instance, or list or tuple of
``bespon.LoadType``): Enable preliminary support for custom types.
``bespon.LoadType`` takes up to five named arguments (for examples, see the
definitions of built-in types at the end of ``load_types.py``):
* ``name`` (string): Type name.
* ``compatible_implicit_types`` (string, or set or list or tuple of
strings): Names of built-in implicit types with which the type being
defined is compatible. Implicit types include ``none``, ``bool``,
``int``, ``float``, ``str``, ``complex``, ``rational``, ``dict``, and
``list``.
* ``parser`` (function): Function that converts a string (for scalar types)
or dict or list (collection types) into an instance of the type being
defined.
* ``ascii_bytes`` (boolean, default ``False``): For types based on strings.
Determines whether the raw string is encoded into binary as an ASCII byte
string before being passed to the parser function. If this is done, only
bytes-compatible backslash escapes are allowed in the string.
* ``mutable`` (boolean, default ``False``): For collection types.
Specifies whether instances are mutable after being created. Mutable
collections have greater flexibility in terms of circular references.
* ``empty_default`` (function, default ``None``): When an empty string or
file is loaded (or one that only consists of comments and whitespace), this
function is called with no arguments to provide a default value, instead of
an error being raised. For example, ``empty_default=dict``.
* ``extended_types`` (boolean, default ``False``): Enable preliminary support
for ``set`` and ``odict`` tagged collections (for example, ``(set)> [1, 2,
3]``). Enable preliminary support for complex number literals and rational
number literals. Complex numbers currently use the general form
``1.0+2.0i``, where the real part is optional, the imaginary unit is
represented with ``i``, and numbers must be floats (either in decimal or hex
form). Rational numbers use the form ``1/2``, where the numerator and
denominator must both be decimal integers, and any sign must come before the
fraction.
* ``float_overflow_to_inf`` (boolean, default ``False``): Whether
non-``inf`` floats are permitted to overflow into ``inf`` without raising an
error.
* ``integers`` (boolean, default ``True``): Whether integers are permitted.
Otherwise they are interpreted as floats.
* ``max_nesting_depth`` (int, default ``100``): Maximum permitted nesting
depth for collections. When ``circular_references=True``, this is the
maximum permitted depth before a circular reference is encountered.
* ``only_ascii_source`` (boolean, default ``False``): Whether non-ASCII code
points are allowed to appear literally in the source (without being
represented via backslash-escapes).
* ``only_ascii_unquoted`` (boolean, default ``True``): Whether non-ASCII
identifier-style strings are allowed unquoted.
* ``python_types`` (boolean, default ``False``): Enable preliminary support
for Python-specific data types. Currently this only supports ``tuple``.
**Dumping**
* ``aliases`` (boolean, default ``True``): Allow aliases so that a
collection may appear multiple times within data.
* ``baseclass`` (boolean, default ``False``): Encode unknown data types as
their baseclasses if supported. For example, ``collections.OrderedDict``
would be encoded as a ``dict``, and a custom integer class would be encoded
as ``int``.
* ``circular_references`` (boolean, default ``False``): Allow aliases to
create circular references.
* ``compact_inline`` (boolean, default ``False``): In inline syntax, put
everything on one line to make it as compact as possible.
* ``extended_types`` (boolean, default ``False``): Enable preliminary support
for ``set`` and ``odict`` tagged collections (for example, ``(set)> [1, 2,
3]``). Enable preliminary support for complex number literals and rational
number literals. Complex numbers currently use the general form
``1.0+2.0i``, where the real part is optional, the imaginary unit is
represented with ``i``, and numbers must be floats (either in decimal or hex
form). Rational numbers use the form ``1/2``, where the numerator and
denominator must both be decimal integers, and any sign must come before the
fraction.
* ``flush_start_list_item`` (string, default ``*<space>``): How a list item
starts in indentation-style syntax when it is at the top level, within
another list, or otherwise in a context when the ``*`` must be aligned flush
with a designated margin. Must start with a single ``*`` followed by zero
or more spaces or tabs.
* ``hex_floats`` (boolean, default ``False``): Whether floats are
dumped in hex form.
* ``inline_depth`` (boolean, default ``max_nesting_depth+1``): Nesting depth
at which to switch from indentation-style to inline-style syntax. A value
of ``0`` will make everything inline, ``1`` will make the top-level
collection indentation-style but everything inside it inline-style, and
so forth.
* ``integers`` (boolean, default ``True``): Whether integers are permitted.
Otherwise they are interpreted as floats.
* ``max_nesting_depth`` (int, default ``100``): Maximum permitted nesting
depth of collections. When ``circular_references=True``, this is the
maximum permitted depth before a circular reference is encountered.
* ``nesting_indent`` (string, default ``<space><space><space><space>``):
Indentation added for each nesting level.
* ``only_ascii_source`` (boolean, default ``False``): Whether non-ASCII code
points are allowed to appear literally in the source (without being
represented via backslash-escapes).
* ``only_ascii_unquoted`` (boolean, default ``True``): Whether non-ASCII
identifier-style strings are allowed unquoted.
* ``python_types`` (boolean, default ``False``): Enable preliminary support
for Python-specific data types. Currently this only supports ``tuple``.
* ``trailing_commas`` (boolean, default ``False``): In inline syntax, leave
a comma after the last item in a collection. This can minimize diffs.
* ``start_list_item`` (string, default ``<space><space>*<space>``): How a
list item starts in indentation-style syntax. This must begin with one or
more spaces or tabs and contain a single ``*``. The leading spaces or tabs
define the relative indentation from the previous indentation level.
Spec conformance
================
The ``bespon`` package passes the
`BespON test suite <https://github.com/bespon/bespon_tests>`_.
Raw data
{
"_id": null,
"home_page": "",
"name": "bespon",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "configuration,serialization,interchange",
"author": "",
"author_email": "\"Geoffrey M. Poore\" <gpoore@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c8/48/80322750e4225bfc8023829b4405f0f3a7f7612b1578a0ec7154c26ce276/bespon-0.7.0.tar.gz",
"platform": null,
"description": "=====================================\r\n ``bespon`` package for Python\r\n=====================================\r\n\r\n\r\n\r\nThe ``bespon`` package for Python encodes and decodes data in the\r\n`BespON format <https://bespon.org>`_.\r\n\r\n\r\n\r\nBasic usage\r\n===========\r\n\r\nData is loaded in a manner analogous to Python's ``json`` module:\r\n\r\n* ``bespon.load(<file-like object>)``\r\n* ``bespon.loads(<string or bytes>)``\r\n\r\nSimilarly, dumping data to a file or string:\r\n\r\n* ``bespon.dump(<obj>, <file-like object>)``\r\n* ``bespon.dumps(<obj>)``\r\n\r\nOnly dicts, lists, Unicode strings, byte strings, floats, ints, bools, and\r\n``None`` are supported for dumping by default. See the ``extended_types``\r\nand ``python_types`` keywords for optional support of additional types.\r\n\r\n\r\n\r\nLossless round-trip support\r\n===========================\r\n\r\nThere is also support for lossless round-tripping. Data can be loaded,\r\nmodified, and then saved with minimal impact on the data file layout.\r\n\r\nData can be loaded from a file or string into an instance of the\r\n``RoundtripAst`` class.\r\n\r\n* ``bespon.load_roundtrip_ast(<file-like object>)``\r\n* ``bespon.loads_roundtrip_ast(<string or bytes>)``\r\n\r\nThis class has two methods that allow data to be modified.\r\n\r\n* ``replace_val(<path>, <obj>)`` This replaces the object currently located\r\n at ``<path>`` within the data with ``<obj>``. ``<path>`` must be a list or\r\n tuple consisting of dict keys and list indices. ``<obj>`` must have the\r\n same type as the object it is replacing. There is **experimental** support\r\n for replacing dicts and lists; all other types are fully supported.\r\n* ``replace_key(<path>, <obj>)`` This replaces the dict key at the end of\r\n ``<path>`` with the new key ``<obj>`` (which will map to the same value as\r\n the replaced key). ``<obj>`` must be a Unicode string, int, or bool, and\r\n must have the same type as the object it is replacing.\r\n\r\n**Experimental** support for changing data types may be enabled by loading\r\ndata with the option ``enforce_types=False``.\r\n\r\nThere is also **preliminary** support for ``__getitem__``-style access\r\n(``ast['key']``, etc.). Data accessed in this manner has the following\r\nattributes.\r\n\r\n* ``key``: Key of the current location, if in a dict.\r\n Allows assignment, as long as the new object is of the same type as the old\r\n object, and the type is supported. For example, ``ast['key'].key =\r\n 'new_key'`` will rename the key.\r\n* ``key_doc_comment``: Doc comment of key, if in a dict. ``None`` if there\r\n is no doc comment. Currently only supports assignment for existing doc\r\n comments.\r\n* ``key_trailing_comment``: Trailing line comment (``#comment``) that\r\n immediately follows a key on the same line.\r\n* ``value``: Value of the current location. Can be assigned, as long as the\r\n new object is of the same type as the old object, and the type is supported.\r\n When ``value`` is accessed or assigned and is a mutable object like a dict\r\n or list, the object should not be modified. Currently, modifying the object\r\n will not change the actual data contained in the AST (the AST does not\r\n update automatically). But modifying the object will make the AST's\r\n temporary representation of itself (available via ``value``) invalid. If\r\n you need to modify the object returned by ``value``, use ``copy.deepcopy()``\r\n to create a completely independent copy. If you need to assign an object\r\n that will later be modified, assign a deepcopy of the object.\r\n* ``value_doc_comment``: Doc comment of the value at the current location.\r\n ``None`` if there is no doc comment. Currently only supports assignment for\r\n existing doc comments.\r\n* ``value_trailing_comment``: Trailing line comment (``#comment``) that\r\n immediately follows a non-collection type on the same line.\r\n* ``value_start_trailing_comment``: Trailing line comment that immediately\r\n follows the start of a collection in inline-style syntax (\"``{``\" or\r\n \"``[``\").\r\n* ``value_end_trailing_comment``: Trailing line comment that immediately\r\n follows the end of a collection in inline-style syntax (\"``}``\" or \"``]``\").\r\n\r\nAfter data in a ``RoundtripAst`` instance has been modified, it may be encoded\r\nback into a string with the ``dumps()`` method. An example is shown below.\r\n\r\n::\r\n\r\n >>> ast = bespon.loads_roundtrip_ast(\"\"\"\r\n key.subkey.first = 123 # Comment\r\n key.subkey.second = 0b1101\r\n key.subkey.third = `literal \\string`\r\n \"\"\")\r\n >>> ast.replace_key(['key', 'subkey'], 'sk')\r\n >>> ast.replace_val(['key', 'sk', 'second'], 7)\r\n >>> ast.replace_val(['key', 'sk', 'third'], '\\\\another \\\\literal')\r\n >>> ast.replace_key(['key', 'sk', 'third'], 'fourth')\r\n >>> print(ast.dumps())\r\n\r\n key.sk.first = 123 # Comment\r\n key.sk.second = 0b111\r\n key.sk.fourth = `\\another \\literal`\r\n\r\nHere is the same example using the preliminary ``__getitem__``-style syntax.\r\n\r\n::\r\n\r\n >>> ast = bespon.loads_roundtrip_ast(\"\"\"\r\n key.subkey.first = 123 # Comment\r\n key.subkey.second = 0b1101\r\n key.subkey.third = `literal \\string`\r\n \"\"\")\r\n >>> ast['key']['subkey'].key = 'sk'\r\n >>> ast['key']['sk']['second'].value = 7\r\n >>> ast['key']['sk']['third'].value = '\\\\another \\\\literal'\r\n >>> ast['key']['sk']['third'].key = 'fourth'\r\n >>> print(ast.dumps())\r\n\r\n key.sk.first = 123 # Comment\r\n key.sk.second = 0b111\r\n key.sk.fourth = `\\another \\literal`\r\n\r\nThis example illustrates several of BespON's round-trip capabilities.\r\n\r\n* Comments and layout are preserved exactly.\r\n* Key renaming works with key paths. Every time a key appears in key paths,\r\n it is renamed.\r\n* When a number is modified, the new value is expressed in the same base as\r\n the old value.\r\n* When a quoted string is modified, the new value is quoted in the same\r\n style as the old value (at least to the extent that this is practical).\r\n* As soon as a key is modified, the new key must be used for further\r\n modifications. The old key is invalid.\r\n\r\n\r\n\r\nAdvanced loading and dumping\r\n============================\r\n\r\nThe loading and dumping functions support several keyword arguments to\r\ncustomize data handling.\r\n\r\n\r\n**Loading**\r\n\r\n* ``aliases`` (boolean, default ``True``): Allow aliases.\r\n\r\n* ``circular_references`` (boolean, default ``False``): Allow aliases to\r\n create circular references.\r\n\r\n* ``custom_parsers`` (dict, default ``None``): Replace the default parser\r\n for a specified type with a custom parser. For example, using\r\n ``custom_parsers={'int': float}`` would cause all integers to be parsed\r\n with the ``float()`` function.\r\n\r\n* ``custom_types`` (``bespon.LoadType`` instance, or list or tuple of\r\n ``bespon.LoadType``): Enable preliminary support for custom types.\r\n ``bespon.LoadType`` takes up to five named arguments (for examples, see the\r\n definitions of built-in types at the end of ``load_types.py``):\r\n\r\n * ``name`` (string): Type name.\r\n\r\n * ``compatible_implicit_types`` (string, or set or list or tuple of\r\n strings): Names of built-in implicit types with which the type being\r\n defined is compatible. Implicit types include ``none``, ``bool``,\r\n ``int``, ``float``, ``str``, ``complex``, ``rational``, ``dict``, and\r\n ``list``.\r\n\r\n * ``parser`` (function): Function that converts a string (for scalar types)\r\n or dict or list (collection types) into an instance of the type being\r\n defined.\r\n\r\n * ``ascii_bytes`` (boolean, default ``False``): For types based on strings.\r\n Determines whether the raw string is encoded into binary as an ASCII byte\r\n string before being passed to the parser function. If this is done, only\r\n bytes-compatible backslash escapes are allowed in the string.\r\n\r\n * ``mutable`` (boolean, default ``False``): For collection types.\r\n Specifies whether instances are mutable after being created. Mutable\r\n collections have greater flexibility in terms of circular references.\r\n\r\n* ``empty_default`` (function, default ``None``): When an empty string or\r\n file is loaded (or one that only consists of comments and whitespace), this\r\n function is called with no arguments to provide a default value, instead of\r\n an error being raised. For example, ``empty_default=dict``.\r\n\r\n* ``extended_types`` (boolean, default ``False``): Enable preliminary support\r\n for ``set`` and ``odict`` tagged collections (for example, ``(set)> [1, 2,\r\n 3]``). Enable preliminary support for complex number literals and rational\r\n number literals. Complex numbers currently use the general form\r\n ``1.0+2.0i``, where the real part is optional, the imaginary unit is\r\n represented with ``i``, and numbers must be floats (either in decimal or hex\r\n form). Rational numbers use the form ``1/2``, where the numerator and\r\n denominator must both be decimal integers, and any sign must come before the\r\n fraction.\r\n\r\n* ``float_overflow_to_inf`` (boolean, default ``False``): Whether\r\n non-``inf`` floats are permitted to overflow into ``inf`` without raising an\r\n error.\r\n\r\n* ``integers`` (boolean, default ``True``): Whether integers are permitted.\r\n Otherwise they are interpreted as floats.\r\n\r\n* ``max_nesting_depth`` (int, default ``100``): Maximum permitted nesting\r\n depth for collections. When ``circular_references=True``, this is the\r\n maximum permitted depth before a circular reference is encountered.\r\n\r\n* ``only_ascii_source`` (boolean, default ``False``): Whether non-ASCII code\r\n points are allowed to appear literally in the source (without being\r\n represented via backslash-escapes).\r\n\r\n* ``only_ascii_unquoted`` (boolean, default ``True``): Whether non-ASCII\r\n identifier-style strings are allowed unquoted.\r\n\r\n* ``python_types`` (boolean, default ``False``): Enable preliminary support\r\n for Python-specific data types. Currently this only supports ``tuple``.\r\n\r\n\r\n\r\n**Dumping**\r\n\r\n* ``aliases`` (boolean, default ``True``): Allow aliases so that a\r\n collection may appear multiple times within data.\r\n\r\n* ``baseclass`` (boolean, default ``False``): Encode unknown data types as\r\n their baseclasses if supported. For example, ``collections.OrderedDict``\r\n would be encoded as a ``dict``, and a custom integer class would be encoded\r\n as ``int``.\r\n\r\n* ``circular_references`` (boolean, default ``False``): Allow aliases to\r\n create circular references.\r\n\r\n* ``compact_inline`` (boolean, default ``False``): In inline syntax, put\r\n everything on one line to make it as compact as possible.\r\n\r\n* ``extended_types`` (boolean, default ``False``): Enable preliminary support\r\n for ``set`` and ``odict`` tagged collections (for example, ``(set)> [1, 2,\r\n 3]``). Enable preliminary support for complex number literals and rational\r\n number literals. Complex numbers currently use the general form\r\n ``1.0+2.0i``, where the real part is optional, the imaginary unit is\r\n represented with ``i``, and numbers must be floats (either in decimal or hex\r\n form). Rational numbers use the form ``1/2``, where the numerator and\r\n denominator must both be decimal integers, and any sign must come before the\r\n fraction.\r\n\r\n* ``flush_start_list_item`` (string, default ``*<space>``): How a list item\r\n starts in indentation-style syntax when it is at the top level, within\r\n another list, or otherwise in a context when the ``*`` must be aligned flush\r\n with a designated margin. Must start with a single ``*`` followed by zero\r\n or more spaces or tabs.\r\n\r\n* ``hex_floats`` (boolean, default ``False``): Whether floats are\r\n dumped in hex form.\r\n\r\n* ``inline_depth`` (boolean, default ``max_nesting_depth+1``): Nesting depth\r\n at which to switch from indentation-style to inline-style syntax. A value\r\n of ``0`` will make everything inline, ``1`` will make the top-level\r\n collection indentation-style but everything inside it inline-style, and\r\n so forth.\r\n\r\n* ``integers`` (boolean, default ``True``): Whether integers are permitted.\r\n Otherwise they are interpreted as floats.\r\n\r\n* ``max_nesting_depth`` (int, default ``100``): Maximum permitted nesting\r\n depth of collections. When ``circular_references=True``, this is the\r\n maximum permitted depth before a circular reference is encountered.\r\n\r\n* ``nesting_indent`` (string, default ``<space><space><space><space>``):\r\n Indentation added for each nesting level.\r\n\r\n* ``only_ascii_source`` (boolean, default ``False``): Whether non-ASCII code\r\n points are allowed to appear literally in the source (without being\r\n represented via backslash-escapes).\r\n\r\n* ``only_ascii_unquoted`` (boolean, default ``True``): Whether non-ASCII\r\n identifier-style strings are allowed unquoted.\r\n\r\n* ``python_types`` (boolean, default ``False``): Enable preliminary support\r\n for Python-specific data types. Currently this only supports ``tuple``.\r\n\r\n* ``trailing_commas`` (boolean, default ``False``): In inline syntax, leave\r\n a comma after the last item in a collection. This can minimize diffs.\r\n\r\n* ``start_list_item`` (string, default ``<space><space>*<space>``): How a\r\n list item starts in indentation-style syntax. This must begin with one or\r\n more spaces or tabs and contain a single ``*``. The leading spaces or tabs\r\n define the relative indentation from the previous indentation level.\r\n\r\n\r\n\r\nSpec conformance\r\n================\r\n\r\nThe ``bespon`` package passes the\r\n`BespON test suite <https://github.com/bespon/bespon_tests>`_.\r\n",
"bugtrack_url": null,
"license": "Copyright 2016-2017 Geoffrey M. Poore Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
"summary": "Python library for BespON",
"version": "0.7.0",
"project_urls": {
"changelog": "https://github.com/gpoore/bespon_py/blob/master/CHANGELOG.md",
"homepage": "https://bespon.org/",
"repository": "http://github.com/gpoore/bespon_py"
},
"split_keywords": [
"configuration",
"serialization",
"interchange"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "919cb40279f0dbba6fa5877c652226ec499b4167a355395446dcba4b0c82a8d2",
"md5": "8028984f70784cbf0dbf7ed002ea694e",
"sha256": "5fa231b2dee005f33b73b70811ff3f43f109cbf5235c5513b6e7b67550f26f41"
},
"downloads": -1,
"filename": "bespon-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8028984f70784cbf0dbf7ed002ea694e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 83360,
"upload_time": "2023-10-15T19:17:18",
"upload_time_iso_8601": "2023-10-15T19:17:18.921594Z",
"url": "https://files.pythonhosted.org/packages/91/9c/b40279f0dbba6fa5877c652226ec499b4167a355395446dcba4b0c82a8d2/bespon-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c84880322750e4225bfc8023829b4405f0f3a7f7612b1578a0ec7154c26ce276",
"md5": "d67dcb6d7b9966956f1cf894137dd211",
"sha256": "746b57c38baaea97725c155f4a2f6cee408552a0353ceeea584198d09340cfc4"
},
"downloads": -1,
"filename": "bespon-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "d67dcb6d7b9966956f1cf894137dd211",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 80291,
"upload_time": "2023-10-15T19:17:21",
"upload_time_iso_8601": "2023-10-15T19:17:21.824241Z",
"url": "https://files.pythonhosted.org/packages/c8/48/80322750e4225bfc8023829b4405f0f3a7f7612b1578a0ec7154c26ce276/bespon-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-15 19:17:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gpoore",
"github_project": "bespon_py",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "bespon"
}