@@ -53,7 +53,10 @@ def __init__(self, window: tk.Tk) -> None:
53
53
self .my_key_field .grid (column = 0 , row = 1 , sticky = tk .W )
54
54
self .my_key_field .config (state = "disabled" )
55
55
# Auto-load generated private key if such exists: username_crypt4gh.key (can be changed in UI)
56
- default_private_key_path = os .path .join (os .path .dirname (os .path .abspath (__file__ )), f"{ getpass .getuser ()} _crypt4gh.key" )
56
+ default_private_key_path = os .path .join (
57
+ os .path .dirname (os .path .abspath (__file__ )),
58
+ f"{ getpass .getuser ()} _crypt4gh.key" ,
59
+ )
57
60
if os .path .isfile (default_private_key_path ):
58
61
self .my_key_value .set (default_private_key_path )
59
62
@@ -103,7 +106,12 @@ def __init__(self, window: tk.Tk) -> None:
103
106
)
104
107
self .load_their_key_button .grid (column = 1 , row = 2 , sticky = tk .E , columnspan = 2 )
105
108
106
- self .select_file_button = tk .Button (window , text = "Select File" , width = OS_CONFIG ["config_button_width" ], command = partial (self .open_file , "file" ))
109
+ self .select_file_button = tk .Button (
110
+ window ,
111
+ text = "Select File" ,
112
+ width = OS_CONFIG ["config_button_width" ],
113
+ command = partial (self .open_file , "file" ),
114
+ )
107
115
self .select_file_button .grid (column = 1 , row = 3 , sticky = tk .E , columnspan = 2 )
108
116
109
117
self .encrypt_button = tk .Button (
@@ -156,7 +164,11 @@ def password_prompt(self, action: Optional[str]) -> None:
156
164
# This if-clause is for preventing error messages
157
165
if password1 is None :
158
166
return
159
- password2 = askstring ("Private Key Passphrase" , "Re-type Private Key Passphrase to Confirm" , show = "*" )
167
+ password2 = askstring (
168
+ "Private Key Passphrase" ,
169
+ "Re-type Private Key Passphrase to Confirm" ,
170
+ show = "*" ,
171
+ )
160
172
if password2 is None :
161
173
return
162
174
if password1 != password2 :
@@ -191,7 +203,11 @@ def password_prompt(self, action: Optional[str]) -> None:
191
203
if password is None :
192
204
return
193
205
while len (password ) == 0 :
194
- password = askstring ("Private Key Passphrase" , "Passphrase can't be empty" , show = "*" )
206
+ password = askstring (
207
+ "Private Key Passphrase" ,
208
+ "Passphrase can't be empty" ,
209
+ show = "*" ,
210
+ )
195
211
# This if-clause is for preventing error messages
196
212
if password is None :
197
213
return
@@ -207,7 +223,7 @@ def password_prompt(self, action: Optional[str]) -> None:
207
223
if private_key is not None :
208
224
their_key = get_public_key (self .their_key_value .get ())
209
225
print ("Encrypting..." )
210
- encrypted_file : Union [BufferedWriter , BufferedReader ]
226
+ encrypted_file_wb : Union [BufferedWriter , BufferedReader ]
211
227
original_file = open (self .file_value .get (), "rb" )
212
228
encrypted_file_wb = open (f"{ self .file_value .get ()} .c4gh" , "wb" )
213
229
encrypt ([(0 , private_key , their_key )], original_file , encrypted_file_wb )
@@ -230,7 +246,11 @@ def password_prompt(self, action: Optional[str]) -> None:
230
246
if password is None :
231
247
return
232
248
while len (password ) == 0 :
233
- password = askstring ("Private Key Passphrase" , "Passphrase can't be empty" , show = "*" )
249
+ password = askstring (
250
+ "Private Key Passphrase" ,
251
+ "Passphrase can't be empty" ,
252
+ show = "*" ,
253
+ )
234
254
# This if-clause is for preventing error messages
235
255
if password is None :
236
256
return
0 commit comments