Skip to content

Commit

Permalink
[script.module.ijson] 3.2.2 (#2497)
Browse files Browse the repository at this point in the history
  • Loading branch information
L2501 authored Aug 31, 2023
1 parent 15931e6 commit 800c72a
Show file tree
Hide file tree
Showing 19 changed files with 1,081 additions and 602 deletions.
30 changes: 0 additions & 30 deletions script.module.ijson/CHANGELOG.md

This file was deleted.

21 changes: 21 additions & 0 deletions script.module.ijson/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ijson
=====

Copyright (c) 2010, Ivan Sagalaev
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand All @@ -22,3 +25,21 @@ 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.


yajl
====

Copyright (c) 2007-2014, Lloyd Hilaiel <[email protected]>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
156 changes: 0 additions & 156 deletions script.module.ijson/README.rst

This file was deleted.

37 changes: 16 additions & 21 deletions script.module.ijson/addon.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.ijson"
name="ijson"
version="2.5"
provider-name="Rodrigo Tobar, Ivan Sagalaev">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
</requires>
<extension
point="xbmc.python.module"
library="lib" />
<extension
point="xbmc.addon.metadata">
<summary lang="en_GB">Iterative JSON parser with a standard Python iterator interface</summary>
<description lang="en_GB">Packed for KODI from https://github.com/isagalaev/ijson</description>
<license>BSD-3-Clause</license>
<website>https://pypi.org/project/ijson/</website>
<source>https://github.com/ICRAR/ijson</source>
<assets>
<icon>icon.png</icon>
</assets>
</extension>
<addon id="script.module.ijson" name="ijson" version="3.2.2" provider-name="Rodrigo Tobar, Ivan Sagalaev">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
</requires>
<extension point="xbmc.python.module" library="lib" />
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Iterative JSON parser with standard Python iterator interfaces</summary>
<description lang="en_GB">Iterative JSON parser with standard Python iterator interfaces</description>
<license>BSD-3-Clause</license>
<platform>all</platform>
<website>https://pypi.org/project/ijson/</website>
<source>https://github.com/ICRAR/ijson</source>
<assets>
<icon>resources/icon.png</icon>
</assets>
</extension>
</addon>
28 changes: 23 additions & 5 deletions script.module.ijson/lib/ijson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,40 @@
also two other backends using the C library yajl in ``ijson.backends`` that have
the same API and are faster under CPython.
'''
from ijson.common import JSONError, IncompleteJSONError, ObjectBuilder
from ijson.common import JSONError, IncompleteJSONError, ObjectBuilder, compat

from ijson.utils import coroutine, sendable_list
from .version import __version__

def _default_backend():
def get_backend(backend):
"""Import the backend named ``backend``"""
import importlib
for backend in ('yajl2_c', 'yajl2_cffi', 'yajl2', 'python'):
return importlib.import_module('ijson.backends.' + backend)

def _default_backend():
import os
if 'IJSON_BACKEND' in os.environ:
return get_backend(os.environ['IJSON_BACKEND'])
for backend in ('yajl2_c', 'yajl2_cffi', 'yajl2', 'yajl', 'python'):
try:
return importlib.import_module('ijson.backends.' + backend)
return get_backend(backend)
except ImportError:
continue
raise ImportError('no backends available')
backend = _default_backend()
del _default_backend

basic_parse = backend.basic_parse
basic_parse_coro = backend.basic_parse_coro
parse = backend.parse
parse_coro = backend.parse_coro
items = backend.items
del backend
items_coro = backend.items_coro
kvitems = backend.kvitems
kvitems_coro = backend.kvitems_coro
if compat.IS_PY35:
basic_parse_async = backend.basic_parse_async
parse_async = backend.parse_async
items_async = backend.items_async
kvitems_async = backend.kvitems_async
backend = backend.backend
5 changes: 3 additions & 2 deletions script.module.ijson/lib/ijson/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import warnings

class YAJLImportError(ImportError):
Expand Down Expand Up @@ -31,7 +32,7 @@ def find_yajl_ctypes(required):
# Example of such environment is Google App Engine (GAE).
from ctypes import util, cdll

so_name = util.find_library('yajl')
so_name = os.getenv('YAJL_DLL') or util.find_library('yajl')
if so_name is None:
raise YAJLImportError('YAJL shared object not found.')
try:
Expand All @@ -47,7 +48,7 @@ def find_yajl_cffi(ffi, required):
version (1, 2, ...) using cffi.
'''
try:
yajl = ffi.dlopen('yajl')
yajl = ffi.dlopen(os.getenv('YAJL_DLL') or 'yajl')
except OSError:
raise YAJLImportError('Unable to load YAJL.')
require_version(get_yajl_version(yajl), required)
Expand Down
Loading

0 comments on commit 800c72a

Please sign in to comment.