Changed code to support older Python versions
This commit is contained in:
parent
eb92d2d36f
commit
582458cdd0
5027 changed files with 794942 additions and 4 deletions
|
|
@ -0,0 +1 @@
|
|||
pip
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
Metadata-Version: 2.4
|
||||
Name: ujson
|
||||
Version: 5.11.0
|
||||
Summary: Ultra fast JSON encoder and decoder for Python
|
||||
Home-page: https://github.com/ultrajson/ultrajson
|
||||
Download-URL: https://github.com/ultrajson/ultrajson
|
||||
Author: Jonas Tarnstrom
|
||||
Project-URL: Source, https://github.com/ultrajson/ultrajson
|
||||
Platform: any
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Programming Language :: C
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
Classifier: Programming Language :: Python :: 3.13
|
||||
Classifier: Programming Language :: Python :: 3.14
|
||||
Classifier: Typing :: Typed
|
||||
Requires-Python: >=3.9
|
||||
Description-Content-Type: text/markdown
|
||||
License-File: LICENSE.txt
|
||||
Dynamic: download-url
|
||||
Dynamic: license-file
|
||||
|
||||
# UltraJSON
|
||||
|
||||
[](https://pypi.org/project/ujson)
|
||||
[](https://pypi.org/project/ujson)
|
||||
[](https://pypistats.org/packages/ujson)
|
||||
[](https://github.com/ultrajson/ultrajson/actions)
|
||||
[](https://codecov.io/gh/ultrajson/ultrajson)
|
||||
[](https://zenodo.org/badge/latestdoi/1418941)
|
||||
[](https://github.com/psf/black)
|
||||
|
||||
UltraJSON is an ultra fast JSON encoder and decoder written in pure C with bindings for
|
||||
Python 3.9+.
|
||||
|
||||
Install with pip:
|
||||
|
||||
```sh
|
||||
python -m pip install ujson
|
||||
```
|
||||
|
||||
## Project status
|
||||
|
||||
> [!WARNING]
|
||||
> UltraJSON's architecture is fundamentally ill-suited to making changes without
|
||||
> risk of introducing new security vulnerabilities. As a result, this library
|
||||
> has been put into a *maintenance-only* mode. Support for new Python versions
|
||||
> will be added and critical bugs and security issues will still be
|
||||
> fixed but all other changes will be rejected. Users are encouraged to migrate
|
||||
> to [orjson](https://pypi.org/project/orjson/) which is both much faster and
|
||||
> less likely to introduce a surprise buffer overflow vulnerability in the
|
||||
> future.
|
||||
|
||||
## Usage
|
||||
|
||||
May be used as a drop in replacement for most other JSON parsers for Python:
|
||||
|
||||
```pycon
|
||||
>>> import ujson
|
||||
>>> ujson.dumps([{"key": "value"}, 81, True])
|
||||
'[{"key":"value"},81,true]'
|
||||
>>> ujson.loads("""[{"key": "value"}, 81, true]""")
|
||||
[{'key': 'value'}, 81, True]
|
||||
```
|
||||
|
||||
### Encoder options
|
||||
|
||||
#### encode_html_chars
|
||||
|
||||
Used to enable special encoding of "unsafe" HTML characters into safer Unicode
|
||||
sequences. Default is `False`:
|
||||
|
||||
```pycon
|
||||
>>> ujson.dumps("<script>John&Doe", encode_html_chars=True)
|
||||
'"\\u003cscript\\u003eJohn\\u0026Doe"'
|
||||
```
|
||||
|
||||
#### ensure_ascii
|
||||
|
||||
Limits output to ASCII and escapes all extended characters above 127. Default is `True`.
|
||||
If your end format supports UTF-8, setting this option to false is highly recommended to
|
||||
save space:
|
||||
|
||||
```pycon
|
||||
>>> ujson.dumps("åäö")
|
||||
'"\\u00e5\\u00e4\\u00f6"'
|
||||
>>> ujson.dumps("åäö", ensure_ascii=False)
|
||||
'"åäö"'
|
||||
```
|
||||
|
||||
#### escape_forward_slashes
|
||||
|
||||
Controls whether forward slashes (`/`) are escaped. Default is `True`:
|
||||
|
||||
```pycon
|
||||
>>> ujson.dumps("https://example.com")
|
||||
'"https:\\/\\/example.com"'
|
||||
>>> ujson.dumps("https://example.com", escape_forward_slashes=False)
|
||||
'"https://example.com"'
|
||||
```
|
||||
|
||||
#### indent
|
||||
|
||||
Controls whether indentation ("pretty output") is enabled. Default is `0` (disabled):
|
||||
|
||||
```pycon
|
||||
>>> ujson.dumps({"foo": "bar"})
|
||||
'{"foo":"bar"}'
|
||||
>>> print(ujson.dumps({"foo": "bar"}, indent=4))
|
||||
{
|
||||
"foo": "bar"
|
||||
}
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||
*UltraJSON* calls/sec compared to other popular JSON parsers with performance gain
|
||||
specified below each.
|
||||
|
||||
### Test machine
|
||||
|
||||
Linux 5.15.0-1037-azure x86_64 #44-Ubuntu SMP Thu Apr 20 13:19:31 UTC 2023
|
||||
|
||||
### Versions
|
||||
|
||||
- CPython 3.11.3 (main, Apr 6 2023, 07:55:46) [GCC 11.3.0]
|
||||
- ujson : 5.7.1.dev26
|
||||
- orjson : 3.9.0
|
||||
- simplejson : 3.19.1
|
||||
- json : 2.0.9
|
||||
|
||||
| | ujson | orjson | simplejson | json |
|
||||
|-------------------------------------------------------------------------------|-----------:|-----------:|-----------:|-----------:|
|
||||
| Array with 256 doubles | | | | |
|
||||
| encode | 18,282 | 79,569 | 5,681 | 5,935 |
|
||||
| decode | 28,765 | 93,283 | 13,844 | 13,367 |
|
||||
| Array with 256 UTF-8 strings | | | | |
|
||||
| encode | 3,457 | 26,437 | 3,630 | 3,653 |
|
||||
| decode | 3,576 | 4,236 | 522 | 1,978 |
|
||||
| Array with 256 strings | | | | |
|
||||
| encode | 44,769 | 125,920 | 21,401 | 23,565 |
|
||||
| decode | 28,518 | 75,043 | 41,496 | 42,221 |
|
||||
| Medium complex object | | | | |
|
||||
| encode | 11,672 | 47,659 | 3,913 | 5,729 |
|
||||
| decode | 12,522 | 23,599 | 8,007 | 9,720 |
|
||||
| Array with 256 True values | | | | |
|
||||
| encode | 110,444 | 425,919 | 81,428 | 84,347 |
|
||||
| decode | 203,430 | 318,193 | 146,867 | 156,249 |
|
||||
| Array with 256 dict{string, int} pairs | | | | |
|
||||
| encode | 14,170 | 72,514 | 3,050 | 7,079 |
|
||||
| decode | 19,116 | 27,542 | 9,374 | 13,713 |
|
||||
| Dict with 256 arrays with 256 dict{string, int} pairs | | | | |
|
||||
| encode | 55 | 282 | 11 | 26 |
|
||||
| decode | 48 | 53 | 27 | 34 |
|
||||
| Dict with 256 arrays with 256 dict{string, int} pairs, outputting sorted keys | | | | |
|
||||
| encode | 42 | | 8 | 27 |
|
||||
| Complex object | | | | |
|
||||
| encode | 462 | | 397 | 444 |
|
||||
| decode | 480 | 618 | 177 | 310 |
|
||||
|
||||
Above metrics are in call/sec, larger is better.
|
||||
|
||||
## Build options
|
||||
|
||||
For those with particular needs, such as Linux distribution packagers, several
|
||||
build options are provided in the form of environment variables.
|
||||
|
||||
### Debugging symbols
|
||||
|
||||
#### UJSON_BUILD_NO_STRIP
|
||||
|
||||
By default, debugging symbols are stripped on Linux platforms. Setting this
|
||||
environment variable with a value of `1` or `True` disables this behavior.
|
||||
|
||||
### Using an external or system copy of the double-conversion library
|
||||
|
||||
These two environment variables are typically used together, something like:
|
||||
|
||||
```sh
|
||||
export UJSON_BUILD_DC_INCLUDES='/usr/include/double-conversion'
|
||||
export UJSON_BUILD_DC_LIBS='-ldouble-conversion'
|
||||
```
|
||||
|
||||
Users planning to link against an external shared library should be aware of
|
||||
the ABI-compatibility requirements this introduces when upgrading system
|
||||
libraries or copying compiled wheels to other machines.
|
||||
|
||||
#### UJSON_BUILD_DC_INCLUDES
|
||||
|
||||
One or more directories, delimited by `os.pathsep` (same as the `PATH`
|
||||
environment variable), in which to look for `double-conversion` header files;
|
||||
the default is to use the bundled copy.
|
||||
|
||||
#### UJSON_BUILD_DC_LIBS
|
||||
|
||||
Compiler flags needed to link the `double-conversion` library; the default
|
||||
is to use the bundled copy.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
ujson-5.11.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
ujson-5.11.0.dist-info/METADATA,sha256=OFWMAFAnMCyFCy3Kz6s18cl1X7cdJyHMhjU5iWWTsYk,9372
|
||||
ujson-5.11.0.dist-info/RECORD,,
|
||||
ujson-5.11.0.dist-info/WHEEL,sha256=N6PyfvHGx46Sh1ny6KlB0rtGwHkXZAwlLCEEPBiTPn8,152
|
||||
ujson-5.11.0.dist-info/licenses/LICENSE.txt,sha256=NoZjRPCkhlQb2YAPGkB6BWwMIUqCxljwWWlNrz3DlNI,5975
|
||||
ujson-5.11.0.dist-info/top_level.txt,sha256=0y7HOCkRmhxBpeIgQNihfjMyrRGi9S7ZkzEZbPQ3Yw8,18
|
||||
ujson-stubs/__init__.pyi,sha256=1CU9-3CuE8Fre8QGhJ2Tf1Qe15NvV4nQKAv2s-nsWFs,1606
|
||||
ujson.cpython-311-x86_64-linux-gnu.so,sha256=JGFkYB4_QmEOb3LutzQUvY8HMtq74cRnP9hDCSj8Ads,106280
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: setuptools (80.9.0)
|
||||
Root-Is-Purelib: false
|
||||
Tag: cp311-cp311-manylinux_2_24_x86_64
|
||||
Tag: cp311-cp311-manylinux_2_28_x86_64
|
||||
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
Developed by ESN, an Electronic Arts Inc. studio.
|
||||
Copyright (c) 2014, Electronic Arts Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* Neither the name of ESN, Electronic Arts Inc. 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 ELECTRONIC ARTS INC. 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.
|
||||
|
||||
----
|
||||
|
||||
Portions of code from MODP_ASCII - Ascii transformations (upper/lower, etc)
|
||||
https://github.com/client9/stringencoders
|
||||
|
||||
Copyright 2005, 2006, 2007
|
||||
Nick Galbreath -- nickg [at] modp [dot] com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
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.
|
||||
|
||||
Neither the name of the modp.com 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
|
||||
OWNER 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.
|
||||
|
||||
This is the standard "new" BSD license:
|
||||
http://www.opensource.org/licenses/bsd-license.php
|
||||
|
||||
https://github.com/client9/stringencoders/blob/cfd5c1507325ae497ea9bacdacba12c0ffd79d30/COPYING
|
||||
|
||||
----
|
||||
|
||||
Numeric decoder derived from from TCL library
|
||||
https://opensource.apple.com/source/tcl/tcl-14/tcl/license.terms
|
||||
* Copyright (c) 1988-1993 The Regents of the University of California.
|
||||
* Copyright (c) 1994 Sun Microsystems, Inc.
|
||||
|
||||
This software is copyrighted by the Regents of the University of
|
||||
California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
|
||||
Corporation and other parties. The following terms apply to all files
|
||||
associated with the software unless explicitly disclaimed in
|
||||
individual files.
|
||||
|
||||
The authors hereby grant permission to use, copy, modify, distribute,
|
||||
and license this software and its documentation for any purpose, provided
|
||||
that existing copyright notices are retained in all copies and that this
|
||||
notice is included verbatim in any distributions. No written agreement,
|
||||
license, or royalty fee is required for any of the authorized uses.
|
||||
Modifications to this software may be copyrighted by their authors
|
||||
and need not follow the licensing terms described here, provided that
|
||||
the new terms are clearly indicated on the first page of each file where
|
||||
they apply.
|
||||
|
||||
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
|
||||
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
|
||||
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
|
||||
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
|
||||
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
||||
MODIFICATIONS.
|
||||
|
||||
GOVERNMENT USE: If you are acquiring this software on behalf of the
|
||||
U.S. government, the Government shall have only "Restricted Rights"
|
||||
in the software and related documentation as defined in the Federal
|
||||
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
|
||||
are acquiring the software on behalf of the Department of Defense, the
|
||||
software shall be classified as "Commercial Computer Software" and the
|
||||
Government shall have only "Restricted Rights" as defined in Clause
|
||||
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
|
||||
authors grant the U.S. Government and others acting in its behalf
|
||||
permission to use and distribute the software in accordance with the
|
||||
terms specified in this license.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ujson
|
||||
ujson-stubs
|
||||
Loading…
Add table
Add a link
Reference in a new issue