diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5f7cf98..03f2ecf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,20 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.6.1 + rev: v2.7.2 hooks: - id: pyupgrade - args: ["--py3-plus"] + args: ["--py36-plus"] - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 20.8b1 hooks: - id: black - args: ["--target-version", "py35"] + args: ["--target-version", "py36"] + + - repo: https://github.com/PyCQA/isort + rev: 5.5.1 + hooks: + - id: isort - repo: https://gitlab.com/pycqa/flake8 rev: 3.8.3 @@ -17,24 +22,14 @@ repos: - id: flake8 additional_dependencies: [flake8-2020, flake8-implicit-str-concat] - - repo: https://github.com/asottile/seed-isort-config - rev: v2.2.0 - hooks: - - id: seed-isort-config - - - repo: https://github.com/timothycrosley/isort - rev: 4.3.21 - hooks: - - id: isort - - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.5.1 + rev: v1.6.0 hooks: - id: python-check-blanket-noqa - id: rst-backticks - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.1.0 + rev: v3.2.0 hooks: - id: check-merge-conflict - id: check-json diff --git a/pyproject.toml b/pyproject.toml index 3f77411..95fe5b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,4 +2,7 @@ requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"] [tool.black] -target_version = ["py35"] +target_version = ["py36"] + +[tool.isort] +profile = "black" diff --git a/setup.cfg b/setup.cfg index ef7aac6..f4546ad 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,2 @@ [flake8] max_line_length = 88 - -[tool:isort] -known_third_party = pytest,setuptools,ujson -force_grid_wrap = 0 -include_trailing_comma = True -line_length = 88 -multi_line_output = 3 -use_parentheses = True diff --git a/tests/benchmark.py b/tests/benchmark.py index 13d5588..8f41f7d 100644 --- a/tests/benchmark.py +++ b/tests/benchmark.py @@ -46,8 +46,8 @@ def results_record_result(callback, is_encode, count): library = callback_name.split("_")[-1] try: results = timeit.repeat( - "{}()".format(callback_name), - "from __main__ import {}".format(callback_name), + f"{callback_name}()", + f"from __main__ import {callback_name}", repeat=10, number=count, ) @@ -84,10 +84,10 @@ def results_output_table(): ) ) if not skip_lib_comparisons: - print("- nujson : {}".format(nujson.__version__)) - print("- orjson : {}".format(orjson.__version__)) - print("- simplejson: {}".format(simplejson.__version__)) - print("- ujson : {}".format(ujson.__version__)) + print(f"- nujson : {nujson.__version__}") + print(f"- orjson : {orjson.__version__}") + print(f"- simplejson: {simplejson.__version__}") + print(f"- ujson : {ujson.__version__}") print() column_widths = [max(len(r[0]) for r in benchmark_results)] diff --git a/tests/test_ujson.py b/tests/test_ujson.py index 9123254..51b3442 100644 --- a/tests/test_ujson.py +++ b/tests/test_ujson.py @@ -498,7 +498,11 @@ def test_decode_no_assert(test_input): @pytest.mark.parametrize( - "test_input, expected", [("31337", 31337), ("-31337", -31337)], + "test_input, expected", + [ + ("31337", 31337), + ("-31337", -31337), + ], ) def test_decode(test_input, expected): assert ujson.decode(test_input) == expected @@ -682,7 +686,11 @@ def test_encode(test_input, expected): 9223372036854775807, 9223372036854775807, ], - [18446744073709551615, 18446744073709551615, 18446744073709551615], + [ + 18446744073709551615, + 18446744073709551615, + 18446744073709551615, + ], ], ) def test_encode_list_long_conversion(test_input): @@ -692,7 +700,11 @@ def test_encode_list_long_conversion(test_input): @pytest.mark.parametrize( - "test_input", [9223372036854775807, 18446744073709551615], + "test_input", + [ + 9223372036854775807, + 18446744073709551615, + ], ) def test_encode_long_conversion(test_input): output = ujson.encode(test_input) @@ -702,7 +714,17 @@ def test_encode_long_conversion(test_input): assert test_input == ujson.decode(output) -@pytest.mark.parametrize("test_input", [[[[[]]]], 31337, -31337, None, True, False]) +@pytest.mark.parametrize( + "test_input", + [ + [[[[]]]], + 31337, + -31337, + None, + True, + False, + ], +) def test_encode_decode(test_input): output = ujson.encode(test_input)