From 1ebff29fa0b78ef4e827432021cdb04e77e0cdda Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Sat, 8 Jan 2022 10:59:41 -0500 Subject: [PATCH] Use auto_attribus on a couple exception types However, we still cannot be frozen (because of Failure.cleanFailure) and cannot use attrs exception support (because we want value-based comparison). --- src/_zkapauthorizer/controller.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/_zkapauthorizer/controller.py b/src/_zkapauthorizer/controller.py index 663f65f..8823406 100644 --- a/src/_zkapauthorizer/controller.py +++ b/src/_zkapauthorizer/controller.py @@ -52,14 +52,14 @@ from .model import Voucher RETRY_INTERVAL = timedelta(milliseconds=1000) -@attr.s +@attr.s(auto_attribs=True) class UnexpectedResponse(Exception): """ The issuer responded in an unexpected and unhandled way. """ - code = attr.ib() - body = attr.ib() + code: int = attr.ib() + body: bytes = attr.ib() class AlreadySpent(Exception): @@ -77,7 +77,7 @@ class Unpaid(Exception): """ -@attr.s +@attr.s(auto_attribs=True) class UnrecognizedFailureReason(Exception): """ An attempt was made to redeem a voucher and the response contained an unknown reason. @@ -85,7 +85,7 @@ class UnrecognizedFailureReason(Exception): The redemption attempt may be automatically retried at some point. """ - response = attr.ib() + response: dict = attr.ib() @attr.s -- GitLab