diff options
author | Michał Górny <mgorny@gentoo.org> | 2023-01-21 20:29:18 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2023-01-21 20:52:18 +0100 |
commit | ee4f947258fbaddddfbaecc3141abd5c59608818 (patch) | |
tree | e783da9a7ea0878d0ec91d86f2d15f93a00c02b8 | |
parent | 67f247d42bf296b15446ad5e59ab7bdf2bd57e28 (diff) | |
download | gemato-ee4f947258fbaddddfbaecc3141abd5c59608818.tar.gz |
openpgp: Convert OpenPGPSignatureData into a dataclass
Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r-- | gemato/openpgp.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/gemato/openpgp.py b/gemato/openpgp.py index 460de11..e85dfd8 100644 --- a/gemato/openpgp.py +++ b/gemato/openpgp.py @@ -1,8 +1,9 @@ # gemato: OpenPGP verification support -# (c) 2017-2022 Michał Górny +# (c) 2017-2023 Michał Górny # Licensed under the terms of 2-clause BSD license import base64 +import dataclasses import datetime import email.utils import errno @@ -13,6 +14,7 @@ import os.path import shutil import subprocess import tempfile +import typing import urllib.parse import warnings @@ -44,16 +46,12 @@ GNUPG = os.environ.get('GNUPG', 'gpg') GNUPGCONF = os.environ.get('GNUPGCONF', 'gpgconf') +@dataclasses.dataclass class OpenPGPSignatureData: - __slots__ = ['fingerprint', 'timestamp', 'expire_timestamp', - 'primary_key_fingerprint'] - - def __init__(self, fingerprint, timestamp, expire_timestamp, - primary_key_fingerprint): - self.fingerprint = fingerprint - self.timestamp = timestamp - self.expire_timestamp = expire_timestamp - self.primary_key_fingerprint = primary_key_fingerprint + fingerprint: str = "" + timestamp: typing.Optional[datetime.datetime] = None + expire_timestamp: typing.Optional[datetime.datetime] = None + primary_key_fingerprint: str = "" ZBASE32_TRANSLATE = bytes.maketrans( |