From fc5684e2b0726264f577c7cf4b2025b00be718ee Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Mon, 27 Dec 2021 14:21:17 -0500 Subject: [PATCH] black --- src/_zkapauthorizer/_storage_server.py | 25 ++++++++++++++++- src/_zkapauthorizer/eliot.py | 25 ++++++++++++++++- src/_zkapauthorizer/model.py | 25 ++++++++++++++++- src/_zkapauthorizer/resource.py | 25 ++++++++++++++++- src/_zkapauthorizer/storage_common.py | 26 +++++++++++++++++- src/_zkapauthorizer/tests/strategies.py | 27 +++++++++++++++++-- .../tests/test_client_resource.py | 25 ++++++++++++++++- src/_zkapauthorizer/tests/test_controller.py | 7 +++++ src/_zkapauthorizer/tests/test_plugin.py | 25 ++++++++++++++++- .../tests/test_pricecalculator.py | 25 ++++++++++++++++- 10 files changed, 225 insertions(+), 10 deletions(-) diff --git a/src/_zkapauthorizer/_storage_server.py b/src/_zkapauthorizer/_storage_server.py index 2d774ac..f81f75b 100644 --- a/src/_zkapauthorizer/_storage_server.py +++ b/src/_zkapauthorizer/_storage_server.py @@ -27,8 +27,31 @@ from __future__ import print_function from __future__ import unicode_literals from future.utils import PY2 + if PY2: - from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 + from future.builtins import ( + filter, + map, + zip, + ascii, + chr, + hex, + input, + next, + oct, + open, + pow, + round, + super, + bytes, + dict, + list, + object, + range, + str, + max, + min, + ) # noqa: F401 from datetime import timedelta from errno import ENOENT diff --git a/src/_zkapauthorizer/eliot.py b/src/_zkapauthorizer/eliot.py index ccd8472..2adc410 100644 --- a/src/_zkapauthorizer/eliot.py +++ b/src/_zkapauthorizer/eliot.py @@ -22,8 +22,31 @@ from __future__ import print_function from __future__ import unicode_literals from future.utils import PY2 + if PY2: - from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 + from future.builtins import ( + filter, + map, + zip, + ascii, + chr, + hex, + input, + next, + oct, + open, + pow, + round, + super, + bytes, + dict, + list, + object, + range, + str, + max, + min, + ) # noqa: F401 from eliot import ActionType, Field, MessageType diff --git a/src/_zkapauthorizer/model.py b/src/_zkapauthorizer/model.py index 57b7cb4..14306b1 100644 --- a/src/_zkapauthorizer/model.py +++ b/src/_zkapauthorizer/model.py @@ -23,8 +23,31 @@ from __future__ import print_function from __future__ import unicode_literals from future.utils import PY2 + if PY2: - from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 + from future.builtins import ( + filter, + map, + zip, + ascii, + chr, + hex, + input, + next, + oct, + open, + pow, + round, + super, + bytes, + dict, + list, + object, + range, + str, + max, + min, + ) # noqa: F401 from past.builtins import long from datetime import datetime diff --git a/src/_zkapauthorizer/resource.py b/src/_zkapauthorizer/resource.py index 89b0a11..9436b19 100644 --- a/src/_zkapauthorizer/resource.py +++ b/src/_zkapauthorizer/resource.py @@ -27,8 +27,31 @@ from __future__ import print_function from __future__ import unicode_literals from future.utils import PY2 + if PY2: - from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 + from future.builtins import ( + filter, + map, + zip, + ascii, + chr, + hex, + input, + next, + oct, + open, + pow, + round, + super, + bytes, + dict, + list, + object, + range, + str, + max, + min, + ) # noqa: F401 from past.builtins import long from itertools import islice diff --git a/src/_zkapauthorizer/storage_common.py b/src/_zkapauthorizer/storage_common.py index aeb8618..4239ee5 100644 --- a/src/_zkapauthorizer/storage_common.py +++ b/src/_zkapauthorizer/storage_common.py @@ -22,8 +22,31 @@ from __future__ import print_function from __future__ import unicode_literals from future.utils import PY2 + if PY2: - from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 + from future.builtins import ( + filter, + map, + zip, + ascii, + chr, + hex, + input, + next, + oct, + open, + pow, + round, + super, + bytes, + dict, + list, + object, + range, + str, + max, + min, + ) # noqa: F401 from past.builtins import long from base64 import b64encode @@ -146,6 +169,7 @@ def get_configured_allowed_public_keys(node_config): _dict_values = type(dict().values()) + def required_passes(bytes_per_pass, share_sizes): """ Calculate the number of passes that are required to store shares of the diff --git a/src/_zkapauthorizer/tests/strategies.py b/src/_zkapauthorizer/tests/strategies.py index 6ce17b9..1b6528c 100644 --- a/src/_zkapauthorizer/tests/strategies.py +++ b/src/_zkapauthorizer/tests/strategies.py @@ -22,8 +22,31 @@ from __future__ import print_function from __future__ import unicode_literals from future.utils import PY2 + if PY2: - from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 + from future.builtins import ( + filter, + map, + zip, + ascii, + chr, + hex, + input, + next, + oct, + open, + pow, + round, + super, + bytes, + dict, + list, + object, + range, + str, + max, + min, + ) # noqa: F401 from base64 import b64encode, urlsafe_b64encode from datetime import datetime, timedelta @@ -258,7 +281,7 @@ def server_configurations(signing_key_path): { "pass-value": # The configuration is ini so everything is always a byte string! - integers(min_value=1).map(lambda v: u"{}".format(v).encode("ascii")), + integers(min_value=1).map(lambda v: "{}".format(v).encode("ascii")), } ), just({}), diff --git a/src/_zkapauthorizer/tests/test_client_resource.py b/src/_zkapauthorizer/tests/test_client_resource.py index 26f0786..6b0d677 100644 --- a/src/_zkapauthorizer/tests/test_client_resource.py +++ b/src/_zkapauthorizer/tests/test_client_resource.py @@ -23,8 +23,31 @@ from __future__ import print_function from __future__ import unicode_literals from future.utils import PY2 + if PY2: - from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 + from future.builtins import ( + filter, + map, + zip, + ascii, + chr, + hex, + input, + next, + oct, + open, + pow, + round, + super, + bytes, + dict, + list, + object, + range, + str, + max, + min, + ) # noqa: F401 from datetime import datetime from io import BytesIO diff --git a/src/_zkapauthorizer/tests/test_controller.py b/src/_zkapauthorizer/tests/test_controller.py index 1dc1794..fa15e3c 100644 --- a/src/_zkapauthorizer/tests/test_controller.py +++ b/src/_zkapauthorizer/tests/test_controller.py @@ -1297,6 +1297,7 @@ class BracketTests(TestCase): """ Tests for ``bracket``. """ + def test_success(self): """ ``bracket`` calls ``first`` then ``between`` then ``last`` and returns a @@ -1305,9 +1306,11 @@ class BracketTests(TestCase): result = object() actions = [] first = partial(actions.append, "first") + def between(): actions.append("between") return result + last = partial(actions.append, "last") self.assertThat( bracket(first, last, between), @@ -1325,13 +1328,17 @@ class BracketTests(TestCase): ``bracket`` calls ``first`` then ``between`` then ``last`` and returns a ``Deferred`` that fires with the failure result of ``between``. """ + class SomeException(Exception): pass + actions = [] first = partial(actions.append, "first") + def between(): actions.append("between") raise SomeException() + last = partial(actions.append, "last") self.assertThat( bracket(first, last, between), diff --git a/src/_zkapauthorizer/tests/test_plugin.py b/src/_zkapauthorizer/tests/test_plugin.py index 56c63aa..10f25b4 100644 --- a/src/_zkapauthorizer/tests/test_plugin.py +++ b/src/_zkapauthorizer/tests/test_plugin.py @@ -22,8 +22,31 @@ from __future__ import print_function from __future__ import unicode_literals from future.utils import PY2 + if PY2: - from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 + from future.builtins import ( + filter, + map, + zip, + ascii, + chr, + hex, + input, + next, + oct, + open, + pow, + round, + super, + bytes, + dict, + list, + object, + range, + str, + max, + min, + ) # noqa: F401 from datetime import timedelta from functools import partial diff --git a/src/_zkapauthorizer/tests/test_pricecalculator.py b/src/_zkapauthorizer/tests/test_pricecalculator.py index 2dd7ab9..b2b3969 100644 --- a/src/_zkapauthorizer/tests/test_pricecalculator.py +++ b/src/_zkapauthorizer/tests/test_pricecalculator.py @@ -23,8 +23,31 @@ from __future__ import print_function from __future__ import unicode_literals from future.utils import PY2 + if PY2: - from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 + from future.builtins import ( + filter, + map, + zip, + ascii, + chr, + hex, + input, + next, + oct, + open, + pow, + round, + super, + bytes, + dict, + list, + object, + range, + str, + max, + min, + ) # noqa: F401 from past.builtins import long from functools import partial -- GitLab