Skip to content

Commit a9591c7

Browse files
author
rootware
committed
clean up code smells
1 parent 9a96c48 commit a9591c7

File tree

4 files changed

+12
-23
lines changed

4 files changed

+12
-23
lines changed

pyredactkit/unredact.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def unredact(self, redacted_file=str, lookup_file=str):
4343
Returns:
4444
Writes unredacted_file.txt with original unmasked data.
4545
"""
46-
count = 0
4746
with open(redacted_file, encoding="utf-8") as redacted_target:
4847
try:
4948
with open(lookup_file, encoding="utf-8") as lookup_target:

test/file_handling.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ def read_file(savedir="./"):
2020
return content
2121

2222

23-
def process_report(savedir="./"):
24-
content = read_file()
25-
with open(
26-
f"{savedir}redacted_{os.path.basename('test.txt')}",
27-
"w",
28-
encoding="utf-8",
29-
) as result:
30-
for line in content:
31-
print(line)
32-
33-
34-
process_report()
23+
# def process_report(savedir="./"):
24+
# content = read_file()
25+
# with open(
26+
# f"{savedir}redacted_{os.path.basename('test.txt')}",
27+
# "w",
28+
# encoding="utf-8",
29+
# ) as result:
30+
# for line in content:
31+
# print(line)
32+
33+
34+
# process_report()

test/hash_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def salt_hash(to_hash):
6363

6464

6565
def process_redact():
66-
count = 0
6766
hash_map = {}
6867
with open("test.txt", encoding="utf-8") as target_file:
6968
with open(
@@ -75,7 +74,6 @@ def process_redact():
7574
for id in regexes:
7675
redact_pattern = id['pattern']
7776
if re.search(redact_pattern, line, flags=re.IGNORECASE):
78-
count += 1
7977
pattern_string = re.search(
8078
redact_pattern, line, flags=re.IGNORECASE)
8179
pattern_string = pattern_string.group(0)

test/unredact.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,3 @@ def replace_all(text, dictionary):
2828

2929

3030
unredact("redacted_test.txt", ".hashshadow.json")
31-
32-
33-
# with fileinput.FileInput("redacted_test.txt", inplace=True, backup='.bak') as file:
34-
# for line in file:
35-
# line.replace("c9b72036-172d-461a-ab87-b1098ad5649d",
36-
# "www.linkedin.com")
37-
38-
# file.write(line)

0 commit comments

Comments
 (0)