diff --git a/.gitattributes b/.gitattributes index 6f9c2763401c5596b583e058e47af0731712ea63..bdeabdf75c091205d9bf73c758be116eab5fa6de 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ -*.sh eol=lf - +*.sh text eol=lf +*.md text eol=lf +LICENSE text eol=lf diff --git a/LICENSE b/LICENSE index 697ac73bda40d1098e65d96d3657a10e5008f896..ae1214d32ef57e4e5d74b2b89af34311c474b969 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2021 Dronehub Group sp. z o. o. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2021 Dronehub Group sp. z o. o. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 6ae55d2ce4fde28ae52a7c3848091ecb2f955bdf..d59089481e26e3ffb7a7b5aa937a85b5c0e02fe8 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,24 @@ -MiniJSON -======== -[](https://travis-ci.com/Dronehub/minijson) -[](https://codeclimate.com/github/Dronehub/minijson/test_coverage) -[](https://codeclimate.com/github/Dronehub/minijson) -[](http://minijson.readthedocs.io/en/latest/?badge=latest) -[](https://pypi.python.org/pypi/minijson) -[](https://badge.fury.io/py/minijson) -[](https://pypi.python.org/pypi/minijson) - -MiniJSON is a codec for a compact binary representation of JSON. - -Usage ------ - -Refer to the [documentation](http://minijson.readthedocs.io/en/latest/?badge=latest) -for use. - -If there are no binary wheels precompiled for this platform, you will need to compile it yourself. -Alternatively, you can -[file an issue](https://github.com/Dronehub/minijson/issues/new) -and I'll do my best to compile a wheel for you. - -In order to do that you must have `Cython` installed. +MiniJSON +======== +[](https://travis-ci.com/Dronehub/minijson) +[](https://codeclimate.com/github/Dronehub/minijson/test_coverage) +[](https://codeclimate.com/github/Dronehub/minijson) +[](http://minijson.readthedocs.io/en/latest/?badge=latest) +[](https://pypi.python.org/pypi/minijson) +[](https://badge.fury.io/py/minijson) +[](https://pypi.python.org/pypi/minijson) + +MiniJSON is a codec for a compact binary representation of JSON. + +Usage +----- + +Refer to the [documentation](http://minijson.readthedocs.io/en/latest/?badge=latest) +for use. + +If there are no binary wheels precompiled for this platform, you will need to compile it yourself. +Alternatively, you can +[file an issue](https://github.com/Dronehub/minijson/issues/new) +and I'll do my best to compile a wheel for you. + +In order to do that you must have `Cython` installed. diff --git a/setup.cfg b/setup.cfg index c2c8a25d96960c21c2f2044561de8e015d82bf30..d96fdd4450462e75a27234459891710cfecd1093 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ # coding: utf-8 [metadata] -version = 2.4a1 +version = 2.4a2 name = minijson long_description = file: README.md long_description_content_type = text/markdown; charset=UTF-8 diff --git a/setup.py b/setup.py index 71dc8e980a8c0f3fb1c179195451be6a80cfc98c..87374018b0653336ff26211c8da4227d73ab2ab4 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,5 @@ if 'DEBUG' in os.environ: directive_defaults['binding'] = True macros = [('CYTHON_TRACE', '1')] - setup(ext_modules=cythonize([Extension("minijson", ["minijson.pyx"], - define_macros=macros)])) + define_macros=macros)])) diff --git a/tests/test_minijson.py b/tests/test_minijson.py index 0185028d7495a002ef09619dae5588832e3674c8..3db5d9d8208af78714c7b398a6e3fef5513b0238 100644 --- a/tests/test_minijson.py +++ b/tests/test_minijson.py @@ -18,7 +18,7 @@ class TestMiniJSON(unittest.TestCase): self.assertEqual(loads(dumps(c)), c) def test_malformed(self): - self.assertRaises(EncodingError, lambda: dumps(2+3j)) + self.assertRaises(EncodingError, lambda: dumps(2 + 3j)) self.assertLoadingIsDecodingError(b'\x00\x02a') self.assertLoadingIsDecodingError(b'\x00\x02a') self.assertLoadingIsDecodingError(b'\x09\x00') @@ -48,14 +48,14 @@ class TestMiniJSON(unittest.TestCase): def test_string(self): self.assertSameAfterDumpsAndLoads('test') - self.assertSameAfterDumpsAndLoads('t'*128) - self.assertSameAfterDumpsAndLoads('t'*65535) - self.assertSameAfterDumpsAndLoads('t'*65540) + self.assertSameAfterDumpsAndLoads('t' * 128) + self.assertSameAfterDumpsAndLoads('t' * 65535) + self.assertSameAfterDumpsAndLoads('t' * 65540) def test_lists(self): - self.assertSameAfterDumpsAndLoads([None]*4) - self.assertSameAfterDumpsAndLoads([None]*256) - self.assertSameAfterDumpsAndLoads([None]*17) + self.assertSameAfterDumpsAndLoads([None] * 4) + self.assertSameAfterDumpsAndLoads([None] * 256) + self.assertSameAfterDumpsAndLoads([None] * 17) def test_long_dicts(self): self.assertSameAfterDumpsAndLoads({str(i): i for i in range(17)}) @@ -64,13 +64,13 @@ class TestMiniJSON(unittest.TestCase): self.assertSameAfterDumpsAndLoads({i: i for i in range(17)}) def test_long_dicts_and_lists(self): - self.assertSameAfterDumpsAndLoads({str(i): i*2 for i in range(65535)}) - self.assertSameAfterDumpsAndLoads({str(i): i*2 for i in range(0x1FFFFF)}) + self.assertSameAfterDumpsAndLoads({str(i): i * 2 for i in range(65535)}) + self.assertSameAfterDumpsAndLoads({str(i): i * 2 for i in range(0x1FFFFF)}) self.assertSameAfterDumpsAndLoads(list(range(0xFFFF))) self.assertSameAfterDumpsAndLoads(list(range(0x1FFFF))) def test_weird_dict(self): - self.assertSameAfterDumpsAndLoads({'a'*300: 2}) + self.assertSameAfterDumpsAndLoads({'a' * 300: 2}) def test_negatives(self): self.assertSameAfterDumpsAndLoads(-1) @@ -95,7 +95,8 @@ class TestMiniJSON(unittest.TestCase): self.assertLoadingIsDecodingError(b'\x81\xFF') def test_loads(self): - a = loads(b'\x0B\x03\x04name\x84land\x0Boperator_id\x84dupa\x0Aparameters\x0B\x03\x03lat\x09B4\xeb\x85\x03lon\x09B[33\x03alt\x09Cj\x00\x00') + a = loads( + b'\x0B\x03\x04name\x84land\x0Boperator_id\x84dupa\x0Aparameters\x0B\x03\x03lat\x09B4\xeb\x85\x03lon\x09B[33\x03alt\x09Cj\x00\x00') self.assertEqual(a, {"name": "land", "operator_id": "dupa", "parameters": {"lat": 45.22999954223633, "lon": 54.79999923706055, "alt": 234}})