Browse Source

rename KeyfileKeyBase -> FlexiKeyBase

it is used as direct base class for both:
- RepoKey
- KeyfileKey
Thomas Waldmann 3 năm trước cách đây
mục cha
commit
ad405892ca
2 tập tin đã thay đổi với 5 bổ sung5 xóa
  1. 3 3
      src/borg/crypto/key.py
  2. 2 2
      src/borg/testsuite/archiver.py

+ 3 - 3
src/borg/crypto/key.py

@@ -527,7 +527,7 @@ class PassphraseKey:
     NAME = 'passphrase'
 
 
-class KeyfileKeyBase(AESKeyBase):
+class FlexiKeyBase(AESKeyBase):
     @classmethod
     def detect(cls, repository, manifest_data):
         key = cls(repository)
@@ -640,7 +640,7 @@ class KeyfileKeyBase(AESKeyBase):
         raise NotImplementedError
 
 
-class KeyfileKey(ID_HMAC_SHA_256, KeyfileKeyBase):
+class KeyfileKey(ID_HMAC_SHA_256, FlexiKeyBase):
     TYPE = 0x00
     TYPES_ACCEPTABLE = {TYPE}
     NAME = 'key file'
@@ -731,7 +731,7 @@ class KeyfileKey(ID_HMAC_SHA_256, KeyfileKeyBase):
         self.target = target
 
 
-class RepoKey(ID_HMAC_SHA_256, KeyfileKeyBase):
+class RepoKey(ID_HMAC_SHA_256, FlexiKeyBase):
     TYPE = 0x03
     TYPES_ACCEPTABLE = {TYPE, PassphraseKey.TYPE}
     NAME = 'repokey'

+ 2 - 2
src/borg/testsuite/archiver.py

@@ -36,7 +36,7 @@ from ..cache import Cache, LocalCache
 from ..chunker import has_seek_hole
 from ..constants import *  # NOQA
 from ..crypto.low_level import bytes_to_long, num_cipher_blocks
-from ..crypto.key import KeyfileKeyBase, RepoKey, KeyfileKey, Passphrase, TAMRequiredError
+from ..crypto.key import FlexiKeyBase, RepoKey, KeyfileKey, Passphrase, TAMRequiredError
 from ..crypto.keymanager import RepoIdMismatch, NotABorgKeyFile
 from ..crypto.file_integrity import FileIntegrityError
 from ..helpers import Location, get_security_dir
@@ -2850,7 +2850,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         def raise_eof(*args):
             raise EOFError
 
-        with patch.object(KeyfileKeyBase, 'create', raise_eof):
+        with patch.object(FlexiKeyBase, 'create', raise_eof):
             self.cmd('init', '--encryption=repokey', self.repository_location, exit_code=1)
         assert not os.path.exists(self.repository_location)