bjdata 0.4.0__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {bjdata-0.4.0 → bjdata-0.4.1}/PKG-INFO +7 -7
  2. {bjdata-0.4.0 → bjdata-0.4.1}/README.md +2 -2
  3. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata/__init__.py +2 -2
  4. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata/__main__.py +1 -1
  5. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata/compat.py +1 -1
  6. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata/decoder.py +1 -1
  7. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata/encoder.py +5 -8
  8. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata/markers.py +1 -1
  9. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata.egg-info/PKG-INFO +7 -7
  10. {bjdata-0.4.0 → bjdata-0.4.1}/setup.py +2 -2
  11. {bjdata-0.4.0 → bjdata-0.4.1}/src/_bjdata.c +1 -1
  12. {bjdata-0.4.0 → bjdata-0.4.1}/src/common.h +1 -1
  13. {bjdata-0.4.0 → bjdata-0.4.1}/src/decoder.c +1 -1
  14. {bjdata-0.4.0 → bjdata-0.4.1}/src/decoder.h +1 -1
  15. {bjdata-0.4.0 → bjdata-0.4.1}/src/encoder.c +9 -11
  16. {bjdata-0.4.0 → bjdata-0.4.1}/src/encoder.h +1 -1
  17. {bjdata-0.4.0 → bjdata-0.4.1}/src/markers.h +1 -1
  18. {bjdata-0.4.0 → bjdata-0.4.1}/src/python_funcs.c +1 -1
  19. {bjdata-0.4.0 → bjdata-0.4.1}/test/test.py +15 -7
  20. {bjdata-0.4.0 → bjdata-0.4.1}/Binary_JData_Specification.md +0 -0
  21. {bjdata-0.4.0 → bjdata-0.4.1}/CHANGELOG +0 -0
  22. {bjdata-0.4.0 → bjdata-0.4.1}/LICENSE +0 -0
  23. {bjdata-0.4.0 → bjdata-0.4.1}/MANIFEST.in +0 -0
  24. {bjdata-0.4.0 → bjdata-0.4.1}/NOTICE +0 -0
  25. {bjdata-0.4.0 → bjdata-0.4.1}/UBJSON-Specification.md +0 -0
  26. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata.egg-info/SOURCES.txt +0 -0
  27. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata.egg-info/dependency_links.txt +0 -0
  28. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata.egg-info/not-zip-safe +0 -0
  29. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata.egg-info/requires.txt +0 -0
  30. {bjdata-0.4.0 → bjdata-0.4.1}/bjdata.egg-info/top_level.txt +0 -0
  31. {bjdata-0.4.0 → bjdata-0.4.1}/ez_setup.py +0 -0
  32. {bjdata-0.4.0 → bjdata-0.4.1}/pyproject.toml +0 -0
  33. {bjdata-0.4.0 → bjdata-0.4.1}/setup.cfg +0 -0
  34. {bjdata-0.4.0 → bjdata-0.4.1}/src/python_funcs.h +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bjdata
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Binary JData and UBJSON encoder/decoder
5
5
  Home-page: https://github.com/NeuroJSON/pybj
6
6
  Author: Qianqian Fang
@@ -9,7 +9,6 @@ Maintainer: Qianqian Fang
9
9
  Maintainer-email: fangqq@gmail.com
10
10
  License: Apache License 2.0
11
11
  Keywords: JSON,JData,UBJSON,BJData,OpenJData,NeuroJSON,JNIfTI,Encoder,Decoder
12
- Platform: UNKNOWN
13
12
  Classifier: Development Status :: 4 - Beta
14
13
  Classifier: License :: OSI Approved :: Apache Software License
15
14
  Classifier: Intended Audience :: Developers
@@ -27,18 +26,21 @@ Classifier: Programming Language :: Python :: 3.9
27
26
  Classifier: Topic :: Software Development :: Libraries
28
27
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
28
  Description-Content-Type: text/markdown
30
- Provides-Extra: dev
31
29
  License-File: LICENSE
32
30
  License-File: NOTICE
31
+ Requires-Dist: numpy>=1.8.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: Pympler<0.8,>=0.7; extra == "dev"
34
+ Requires-Dist: coverage<4.6,>=4.5.3; extra == "dev"
33
35
 
34
36
  ![](https://neurojson.org/wiki/upload/neurojson_banner_long.png)
35
37
 
36
38
  # Binary JData for Python - a lightweight binary JSON format
37
39
 
38
- - Copyright: (C) Qianqian Fang (2020-2022) <q.fang at neu.edu>
40
+ - Copyright: (C) Qianqian Fang (2020-2023) <q.fang at neu.edu>
39
41
  - Copyright: (C) Iotic Labs Ltd. (2016-2019) <vilnis.termanis at iotic-labs.com>
40
42
  - License: Apache License, Version 2.0
41
- - Version: 0.4.0
43
+ - Version: 0.4.1
42
44
  - URL: https://pypi.org/project/bjdata/
43
45
  - Github: https://github.com/NeuroJSON/pybj
44
46
  - BJData Spec Version: [V1 Draft 2](https://neurojson.org/bjdata/draft2)
@@ -179,5 +181,3 @@ the below new features:
179
181
  * BJData does not convert NaN/Inf/-Inf to `null`
180
182
  * BJData uses little-Endian as the default integer/floating-point numbers while UBJSON uses big-Endian
181
183
  * BJData only permits non-zero-fixed-length data types (`UiuImlMLhdDC`) in strongly-typed array/object containers
182
-
183
-
@@ -2,10 +2,10 @@
2
2
 
3
3
  # Binary JData for Python - a lightweight binary JSON format
4
4
 
5
- - Copyright: (C) Qianqian Fang (2020-2022) <q.fang at neu.edu>
5
+ - Copyright: (C) Qianqian Fang (2020-2023) <q.fang at neu.edu>
6
6
  - Copyright: (C) Iotic Labs Ltd. (2016-2019) <vilnis.termanis at iotic-labs.com>
7
7
  - License: Apache License, Version 2.0
8
- - Version: 0.4.0
8
+ - Version: 0.4.1
9
9
  - URL: https://pypi.org/project/bjdata/
10
10
  - Github: https://github.com/NeuroJSON/pybj
11
11
  - BJData Spec Version: [V1 Draft 2](https://neurojson.org/bjdata/draft2)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
1
+ # Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
2
  # Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -38,6 +38,6 @@ except ImportError: # pragma: no cover
38
38
  from .encoder import EncoderException
39
39
  from .decoder import DecoderException
40
40
 
41
- __version__ = '0.4.0'
41
+ __version__ = '0.4.1'
42
42
 
43
43
  __all__ = ('EXTENSION_ENABLED', 'dump', 'dumpb', 'EncoderException', 'load', 'loadb', 'DecoderException')
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
1
+ # Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
2
  # Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
1
+ # Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
2
  # Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
1
+ # Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
2
  # Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
1
+ # Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
2
  # Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -288,13 +288,10 @@ def __encode_numpy(fp_write, item, islittle, default):
288
288
  item = np.array( item, order = 'C') # currently, BJData ND-array syntax only support row-major
289
289
 
290
290
  fp_write(ARRAY_START + CONTAINER_TYPE + __map_dtype(item.dtype.str) + CONTAINER_COUNT)
291
- if item.ndim == 1:
292
- __encode_int(fp_write, len(item), islittle)
293
- else:
294
- fp_write(ARRAY_START)
295
- for value in item.shape:
296
- __encode_int(fp_write, value, islittle)
297
- fp_write(ARRAY_END)
291
+ fp_write(ARRAY_START)
292
+ for value in item.shape:
293
+ __encode_int(fp_write, value, islittle)
294
+ fp_write(ARRAY_END)
298
295
 
299
296
  fp_write(item.data)
300
297
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
1
+ # Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
2
  # Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bjdata
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Binary JData and UBJSON encoder/decoder
5
5
  Home-page: https://github.com/NeuroJSON/pybj
6
6
  Author: Qianqian Fang
@@ -9,7 +9,6 @@ Maintainer: Qianqian Fang
9
9
  Maintainer-email: fangqq@gmail.com
10
10
  License: Apache License 2.0
11
11
  Keywords: JSON,JData,UBJSON,BJData,OpenJData,NeuroJSON,JNIfTI,Encoder,Decoder
12
- Platform: UNKNOWN
13
12
  Classifier: Development Status :: 4 - Beta
14
13
  Classifier: License :: OSI Approved :: Apache Software License
15
14
  Classifier: Intended Audience :: Developers
@@ -27,18 +26,21 @@ Classifier: Programming Language :: Python :: 3.9
27
26
  Classifier: Topic :: Software Development :: Libraries
28
27
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
28
  Description-Content-Type: text/markdown
30
- Provides-Extra: dev
31
29
  License-File: LICENSE
32
30
  License-File: NOTICE
31
+ Requires-Dist: numpy>=1.8.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: Pympler<0.8,>=0.7; extra == "dev"
34
+ Requires-Dist: coverage<4.6,>=4.5.3; extra == "dev"
33
35
 
34
36
  ![](https://neurojson.org/wiki/upload/neurojson_banner_long.png)
35
37
 
36
38
  # Binary JData for Python - a lightweight binary JSON format
37
39
 
38
- - Copyright: (C) Qianqian Fang (2020-2022) <q.fang at neu.edu>
40
+ - Copyright: (C) Qianqian Fang (2020-2023) <q.fang at neu.edu>
39
41
  - Copyright: (C) Iotic Labs Ltd. (2016-2019) <vilnis.termanis at iotic-labs.com>
40
42
  - License: Apache License, Version 2.0
41
- - Version: 0.4.0
43
+ - Version: 0.4.1
42
44
  - URL: https://pypi.org/project/bjdata/
43
45
  - Github: https://github.com/NeuroJSON/pybj
44
46
  - BJData Spec Version: [V1 Draft 2](https://neurojson.org/bjdata/draft2)
@@ -179,5 +181,3 @@ the below new features:
179
181
  * BJData does not convert NaN/Inf/-Inf to `null`
180
182
  * BJData uses little-Endian as the default integer/floating-point numbers while UBJSON uses big-Endian
181
183
  * BJData only permits non-zero-fixed-length data types (`UiuImlMLhdDC`) in strongly-typed array/object containers
182
-
183
-
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
1
+ # Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
2
  # Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -73,7 +73,7 @@ COMPILE_ARGS = ['-std=c99', '-DUSE__BJDATA']
73
73
 
74
74
  setup(
75
75
  name='bjdata',
76
- version='0.4.0',
76
+ version='0.4.1',
77
77
  description='Binary JData and UBJSON encoder/decoder',
78
78
  long_description=load_description('README.md'),
79
79
  long_description_content_type='text/markdown',
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
+ * Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
3
3
  * Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
+ * Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
3
3
  * Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
+ * Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
3
3
  * Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
+ * Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
3
3
  * Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
+ * Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
3
3
  * Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -317,16 +317,14 @@ static int _encode_NDarray(PyObject *obj, _bjdata_encoder_buffer_t *buffer) {
317
317
  WRITE_CHAR_OR_BAIL((char)marker);
318
318
  }
319
319
  WRITE_CHAR_OR_BAIL(CONTAINER_COUNT);
320
- if(ndim == 1) {
321
- BAIL_ON_NONZERO(_encode_longlong(bytes, buffer));
322
- } else {
323
- WRITE_CHAR_OR_BAIL(ARRAY_START);
324
- for(int i=0 ; i<ndim; i++)
325
- _encode_longlong(dims[i], buffer);
326
- if(type == NPY_UNICODE)
327
- _encode_longlong(4, buffer);
328
- WRITE_CHAR_OR_BAIL(ARRAY_END);
329
- }
320
+
321
+ WRITE_CHAR_OR_BAIL(ARRAY_START);
322
+ for(int i=0 ; i<ndim; i++)
323
+ _encode_longlong(dims[i], buffer);
324
+ if(type == NPY_UNICODE)
325
+ _encode_longlong(4, buffer);
326
+ WRITE_CHAR_OR_BAIL(ARRAY_END);
327
+
330
328
  WRITE_OR_BAIL(PyArray_BYTES(arr), bytes*total);
331
329
  Py_DECREF(arr);
332
330
  // no ARRAY_END since length was specified
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
+ * Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
3
3
  * Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
+ * Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
3
3
  * Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
+ * Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
3
3
  * Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
4
4
  *
5
5
  * Licensed under PSF license, see: https://docs.python.org/3/license.html
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
1
+ # Copyright (c) 2020-2023 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
2
2
  # Copyright (c) 2016-2019 Iotic Labs Ltd. All rights reserved.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -220,9 +220,9 @@ class TestEncodeDecodePlain(TestCase): # pylint: disable=too-many-public-method
220
220
  '-1.2345e67890'):
221
221
  # minimum length because: marker + length marker + length + value
222
222
  self.check_enc_dec(Decimal(value), 4, length_greater_or_equal=True)
223
- # cannot compare equality, so test separately (since these evaluate to "NULL"
224
- #for value in ('nan', '-inf', 'inf'):
225
- # self.assertEqual(self.bjdloadb(self.bjddumpb(Decimal(value))), None)
223
+ # cannot compare equality, so test separately
224
+ for value in ('nan', '-inf', 'inf'):
225
+ self.assertEqual(str(self.bjdloadb(self.bjddumpb(float(value)))), value)
226
226
 
227
227
  def test_float(self):
228
228
  # insufficient length
@@ -248,9 +248,10 @@ class TestEncodeDecodePlain(TestCase): # pylint: disable=too-many-public-method
248
248
  9 if type_ == TYPE_FLOAT32 else total_size,
249
249
  approximate=True,
250
250
  expected_type=(TYPE_FLOAT64 if type_ == TYPE_FLOAT32 else type_))
251
- #for value in ('nan', '-inf', 'inf'):
252
- # for no_float32 in (True, False):
253
- # self.assertEqual(self.bjdloadb(self.bjddumpb(float(value), no_float32=no_float32)), None)
251
+ for value in ('nan', '-inf', 'inf'):
252
+ for no_float32 in (True, False):
253
+ self.assertEqual(str(self.bjdloadb(self.bjddumpb(float(value), no_float32=no_float32))), value)
254
+
254
255
  # value which results in high_prec usage
255
256
  for no_float32 in (True, False):
256
257
  self.check_enc_dec(2.22e-308, 4, expected_type=TYPE_HIGH_PREC, length_greater_or_equal=True,
@@ -313,6 +314,13 @@ class TestEncodeDecodePlain(TestCase): # pylint: disable=too-many-public-method
313
314
  self.assertEqual((self.bjdloadb(self.bjddumpb(np.float16(2.2))) == 16486), True)
314
315
  self.assertEqual((self.bjdloadb(self.bjddumpb(np.float32(2.2))) == np.float32(2.2)), True)
315
316
 
317
+ self.assertEqual((self.bjdloadb(self.bjddumpb(np.array([1.3,-0.5,0.7,1000,11], dtype=np.float32))) == np.array([1.3,-0.5,0.7,1000,11], dtype=np.float32)).all(), True)
318
+ self.assertEqual((self.bjdloadb(self.bjddumpb(np.array([1,2,3,4], dtype=np.uint16))) == np.array([1,2,3,4], dtype=np.uint16)).all(), True)
319
+ self.assertEqual((self.bjdloadb(self.bjddumpb(np.array([1,2,3,4], dtype=np.uint8))) == np.array([1,2,3,4], dtype=np.uint8)).all(), True)
320
+ self.assertEqual((self.bjdloadb(self.bjddumpb(np.array([], dtype=np.int8))) == np.array([], dtype=np.int8)).all(), True)
321
+ self.assertEqual((self.bjdloadb(self.bjddumpb(np.array([-1,-2,-3,-4], dtype=np.float32))) == np.array([-1,-2,-3,-4], dtype=np.float32)).all(), True)
322
+ self.assertEqual((self.bjdloadb(self.bjddumpb(np.array([[-1,-2,5],[-3,-4,-6]], dtype=np.float64))) == np.array([[-1,-2,5],[-3,-4,-6]], dtype=np.float64)).all(), True)
323
+
316
324
  raw_start = (ARRAY_START + CONTAINER_TYPE + TYPE_INT8 + CONTAINER_COUNT + ARRAY_START + \
317
325
  TYPE_UINT8 + b'\x03' + TYPE_UINT16 + b'\x02' + b'\x00' + ARRAY_END + \
318
326
  b'\x01'+ b'\x02'+ b'\x03'+ b'\x04'+ b'\x05'+ b'\x06')
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes