Skip to content

Commit

Permalink
add types & fix case
Browse files Browse the repository at this point in the history
  • Loading branch information
eevel committed Oct 25, 2022
1 parent 02eed46 commit 4fb2582
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/twisted/conch/scripts/ckeygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def _inputSaveFile(prompt: str) -> str:
return input(prompt)


def _saveKey(key, options, input_collector=None):
def _saveKey(key, options: Dict, inputCollector: Optional[Callable] = None) -> None:
"""
Persist a SSH key on local filesystem.
Expand All @@ -333,8 +333,8 @@ def _saveKey(key, options, input_collector=None):
@type input_collector: L{function} or None.
"""
if input_collector is None:
input_collector = input
if inputCollector is None:
inputCollector = input
KeyTypeMapping = {"EC": "ecdsa", "Ed25519": "ed25519", "RSA": "rsa", "DSA": "dsa"}
keyTypeName = KeyTypeMapping[key.type()]
filename = options["filename"]
Expand All @@ -350,7 +350,7 @@ def _saveKey(key, options, input_collector=None):

if os.path.exists(filename):
print(f"{filename} already exists.")
yn = input_collector("Overwrite (y/n)? ")
yn = inputCollector("Overwrite (y/n)? ")
if yn[0].lower() != "y":
sys.exit()

Expand Down

0 comments on commit 4fb2582

Please sign in to comment.