Shift misplaced local function
Marco Ricci

Marco Ricci commited on 2024-07-28 15:31:09
Zeige 1 geänderte Dateien mit 7 Einfügungen und 7 Löschungen.

... ...
@@ -1052,6 +1052,13 @@ def derivepassphrase(
1052 1052
                 if k in service_keys and v is not None
1053 1053
             }
1054 1054
 
1055
+            def key_to_phrase(
1056
+                key: str | bytes | bytearray,
1057
+            ) -> bytes | bytearray:
1058
+                return dpp.Vault.phrase_from_key(
1059
+                    base64.standard_b64decode(key)
1060
+                )
1061
+
1055 1062
             # If either --key or --phrase are given, use that setting.
1056 1063
             # Otherwise, if both key and phrase are set in the config,
1057 1064
             # one must be global (ignore it) and one must be
... ...
@@ -1060,13 +1067,6 @@ def derivepassphrase(
1060 1067
             # these above cases, set the phrase via
1061 1068
             # derivepassphrase.Vault.phrase_from_key if a key is
1062 1069
             # given. Finally, if nothing is set, error out.
1063
-            def key_to_phrase(
1064
-                key: str | bytes | bytearray,
1065
-            ) -> bytes | bytearray:
1066
-                return dpp.Vault.phrase_from_key(
1067
-                    base64.standard_b64decode(key)
1068
-                )
1069
-
1070 1070
             if use_key or use_phrase:
1071 1071
                 if use_key:
1072 1072
                     kwargs['phrase'] = key_to_phrase(key)
1073 1073