mirror of
https://github.com/ultrajson/ultrajson.git
synced 2024-05-06 08:46:11 +02:00
Update pre-commit
This commit is contained in:
parent
bcde89c882
commit
197a7fd4d8
|
@ -1,15 +1,20 @@
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v2.6.1
|
rev: v2.7.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: ["--py3-plus"]
|
args: ["--py36-plus"]
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 19.10b0
|
rev: 20.8b1
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- 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
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 3.8.3
|
rev: 3.8.3
|
||||||
|
@ -17,24 +22,14 @@ repos:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]
|
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
|
- repo: https://github.com/pre-commit/pygrep-hooks
|
||||||
rev: v1.5.1
|
rev: v1.6.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: python-check-blanket-noqa
|
- id: python-check-blanket-noqa
|
||||||
- id: rst-backticks
|
- id: rst-backticks
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v3.1.0
|
rev: v3.2.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-merge-conflict
|
- id: check-merge-conflict
|
||||||
- id: check-json
|
- id: check-json
|
||||||
|
|
|
@ -2,4 +2,7 @@
|
||||||
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
|
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
target_version = ["py35"]
|
target_version = ["py36"]
|
||||||
|
|
||||||
|
[tool.isort]
|
||||||
|
profile = "black"
|
||||||
|
|
|
@ -1,10 +1,2 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
max_line_length = 88
|
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
|
|
||||||
|
|
|
@ -46,8 +46,8 @@ def results_record_result(callback, is_encode, count):
|
||||||
library = callback_name.split("_")[-1]
|
library = callback_name.split("_")[-1]
|
||||||
try:
|
try:
|
||||||
results = timeit.repeat(
|
results = timeit.repeat(
|
||||||
"{}()".format(callback_name),
|
f"{callback_name}()",
|
||||||
"from __main__ import {}".format(callback_name),
|
f"from __main__ import {callback_name}",
|
||||||
repeat=10,
|
repeat=10,
|
||||||
number=count,
|
number=count,
|
||||||
)
|
)
|
||||||
|
@ -84,10 +84,10 @@ def results_output_table():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if not skip_lib_comparisons:
|
if not skip_lib_comparisons:
|
||||||
print("- nujson : {}".format(nujson.__version__))
|
print(f"- nujson : {nujson.__version__}")
|
||||||
print("- orjson : {}".format(orjson.__version__))
|
print(f"- orjson : {orjson.__version__}")
|
||||||
print("- simplejson: {}".format(simplejson.__version__))
|
print(f"- simplejson: {simplejson.__version__}")
|
||||||
print("- ujson : {}".format(ujson.__version__))
|
print(f"- ujson : {ujson.__version__}")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
column_widths = [max(len(r[0]) for r in benchmark_results)]
|
column_widths = [max(len(r[0]) for r in benchmark_results)]
|
||||||
|
|
|
@ -498,7 +498,11 @@ def test_decode_no_assert(test_input):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"test_input, expected", [("31337", 31337), ("-31337", -31337)],
|
"test_input, expected",
|
||||||
|
[
|
||||||
|
("31337", 31337),
|
||||||
|
("-31337", -31337),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
def test_decode(test_input, expected):
|
def test_decode(test_input, expected):
|
||||||
assert ujson.decode(test_input) == expected
|
assert ujson.decode(test_input) == expected
|
||||||
|
@ -682,7 +686,11 @@ def test_encode(test_input, expected):
|
||||||
9223372036854775807,
|
9223372036854775807,
|
||||||
9223372036854775807,
|
9223372036854775807,
|
||||||
],
|
],
|
||||||
[18446744073709551615, 18446744073709551615, 18446744073709551615],
|
[
|
||||||
|
18446744073709551615,
|
||||||
|
18446744073709551615,
|
||||||
|
18446744073709551615,
|
||||||
|
],
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_encode_list_long_conversion(test_input):
|
def test_encode_list_long_conversion(test_input):
|
||||||
|
@ -692,7 +700,11 @@ def test_encode_list_long_conversion(test_input):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"test_input", [9223372036854775807, 18446744073709551615],
|
"test_input",
|
||||||
|
[
|
||||||
|
9223372036854775807,
|
||||||
|
18446744073709551615,
|
||||||
|
],
|
||||||
)
|
)
|
||||||
def test_encode_long_conversion(test_input):
|
def test_encode_long_conversion(test_input):
|
||||||
output = ujson.encode(test_input)
|
output = ujson.encode(test_input)
|
||||||
|
@ -702,7 +714,17 @@ def test_encode_long_conversion(test_input):
|
||||||
assert test_input == ujson.decode(output)
|
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):
|
def test_encode_decode(test_input):
|
||||||
output = ujson.encode(test_input)
|
output = ujson.encode(test_input)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue