mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Follow Flake8 pep3101 and remove modulo formatting (#7339)
* ci: Add ``flake8-pep3101`` plugin to ``pre-commit`` * refactor: Remove all modulo string formatting * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor: Remove ``flake8-pep3101`` plugin from ``pre-commit`` * revert: Revert to modulo formatting * refactor: Use f-string instead of `join` Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
7f6e0b656f
commit
f15cc2f01c
@ -41,22 +41,19 @@ def make_key_files(name: str, key_size: int) -> None:
|
||||
if os.path.exists(f"{name}_pubkey.txt") or os.path.exists(f"{name}_privkey.txt"):
|
||||
print("\nWARNING:")
|
||||
print(
|
||||
'"%s_pubkey.txt" or "%s_privkey.txt" already exists. \n'
|
||||
f'"{name}_pubkey.txt" or "{name}_privkey.txt" already exists. \n'
|
||||
"Use a different name or delete these files and re-run this program."
|
||||
% (name, name)
|
||||
)
|
||||
sys.exit()
|
||||
|
||||
public_key, private_key = generate_key(key_size)
|
||||
print(f"\nWriting public key to file {name}_pubkey.txt...")
|
||||
with open(f"{name}_pubkey.txt", "w") as fo:
|
||||
fo.write(
|
||||
"%d,%d,%d,%d" % (public_key[0], public_key[1], public_key[2], public_key[3])
|
||||
)
|
||||
fo.write(f"{public_key[0]},{public_key[1]},{public_key[2]},{public_key[3]}")
|
||||
|
||||
print(f"Writing private key to file {name}_privkey.txt...")
|
||||
with open(f"{name}_privkey.txt", "w") as fo:
|
||||
fo.write("%d,%d" % (private_key[0], private_key[1]))
|
||||
fo.write(f"{private_key[0]},{private_key[1]}")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
@ -37,9 +37,8 @@ def make_key_files(name: str, key_size: int) -> None:
|
||||
if os.path.exists(f"{name}_pubkey.txt") or os.path.exists(f"{name}_privkey.txt"):
|
||||
print("\nWARNING:")
|
||||
print(
|
||||
'"%s_pubkey.txt" or "%s_privkey.txt" already exists. \n'
|
||||
f'"{name}_pubkey.txt" or "{name}_privkey.txt" already exists. \n'
|
||||
"Use a different name or delete these files and re-run this program."
|
||||
% (name, name)
|
||||
)
|
||||
sys.exit()
|
||||
|
||||
|
Reference in New Issue
Block a user