key storage: type hints / cleanup

This commit is contained in:
Thomas Waldmann 2023-01-30 18:08:05 +01:00
parent 360cd8488f
commit 2705ccb59b
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
1 changed files with 3 additions and 4 deletions

View File

@ -3,7 +3,7 @@ import os
import textwrap
from binascii import a2b_base64, b2a_base64, hexlify
from hashlib import sha256, pbkdf2_hmac
from typing import Literal, Callable
from typing import Literal, Callable, ClassVar
from ..logger import create_logger
@ -170,7 +170,7 @@ class KeyBase:
ARG_NAME = "UNDEFINED"
# Storage type (no key blob storage / keyfile / repo)
STORAGE = KeyBlobStorage.NO_STORAGE
STORAGE: ClassVar[str] = KeyBlobStorage.NO_STORAGE
# Seed for the buzhash chunker (borg.algorithms.chunker.Chunker)
# type is int
@ -279,7 +279,6 @@ class PlaintextKey(KeyBase):
TYPES_ACCEPTABLE = {TYPE}
NAME = "plaintext"
ARG_NAME = "none"
STORAGE = KeyBlobStorage.NO_STORAGE
chunk_seed = 0
logically_encrypted = False
@ -417,7 +416,7 @@ class AESKeyBase(KeyBase):
class FlexiKey:
FILE_ID = "BORG_KEY"
STORAGE = KeyBlobStorage.NO_STORAGE # override in subclass
STORAGE: ClassVar[str] = KeyBlobStorage.NO_STORAGE # override in subclass
@classmethod
def detect(cls, repository, manifest_data):