File tree Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ def h2b(hex:str)-> bytes:
18
18
19
19
20
20
# Convert a number to an array of numbers
21
- def numberToArr (n , base ) -> list :
21
+ def numberToArr (n : int , base : int ) -> list :
22
22
if n == 0 : return [0 ]
23
23
digits = []
24
24
while n :
@@ -28,7 +28,7 @@ def numberToArr(n, base) -> list:
28
28
29
29
30
30
# Convert from base 10 to base 4
31
- def quat (n ) -> int :
31
+ def quat (n : int ) -> int :
32
32
b = bin (n )[2 :]
33
33
34
34
if len (b ) % 2 != 0 :
@@ -41,7 +41,7 @@ def quat(n) -> int:
41
41
return quaternary_n
42
42
43
43
# Convert from int to base 2,4,8 or 16
44
- def conv (x , base ) :
44
+ def conv (x : int , base : int ) -> str :
45
45
if base == 2 :
46
46
return bin (x )[2 :]
47
47
elif base == 4 :
Original file line number Diff line number Diff line change 11
11
12
12
13
13
# Generate a key with Fernet.generate_key(), save it to a file and return the path
14
- def gen_key (new_filename = None ) -> str :
14
+ def gen_key (new_filename : str = None ) -> str :
15
15
key = Fernet .generate_key ()
16
16
17
17
if new_filename :
@@ -35,7 +35,7 @@ def gen_key(new_filename=None) -> str:
35
35
36
36
37
37
# Load the key from the path
38
- def load_key (path ) -> bytes :
38
+ def load_key (path : str ) -> bytes :
39
39
stem = Path (path ).stem
40
40
41
41
with open (path , 'rb' ) as f :
@@ -80,7 +80,7 @@ def get_key_paths() -> list:
80
80
81
81
82
82
# Decrypt the content of the file and filename trying with all the key files
83
- def decrypt_content (file , filename ) -> dict :
83
+ def decrypt_content (file : bytes , filename : bytes ) -> dict :
84
84
for key_path in get_key_paths ():
85
85
fernet = Fernet (load_key (key_path ))
86
86
try :
Original file line number Diff line number Diff line change 5
5
from utils .ctxt import *
6
6
7
7
# Create folders if they don't exist
8
- def create_folders (* args ) -> None :
8
+ def create_folders (* args : str ) -> None :
9
9
folders = args
10
10
11
11
for folder in folders :
12
12
# Create folder if it doesn't exist
13
13
os .makedirs (folder , exist_ok = True )
14
14
15
15
16
- def folder2png (folder ) -> None :
16
+ def folder2png (folder : str ) -> None :
17
17
for file in os .listdir (folder ):
18
18
ext = Path (file ).suffix
19
19
stem = Path (file ).stem
Original file line number Diff line number Diff line change 1
1
import os
2
2
from pathlib import Path
3
+ from xmlrpc .client import boolean
3
4
4
5
from utils .ctxt import *
5
6
6
7
def check_path (path :str ) -> bool :
7
8
return os .path .isfile (path )
8
9
9
- def get_valid_filename (msg :str , exts :list = None , allow_blank = False ) -> str :
10
+ def get_valid_filename (msg :str , exts :list = None , allow_blank : bool = False ) -> str :
10
11
while True :
11
12
filename = input (msg ).strip ()
12
13
ext = Path (filename ).suffix
You can’t perform that action at this time.
0 commit comments