Skip to content

Commit cb6a6c3

Browse files
committed
made fixes to the api, refactored pyredactkit to runner
1 parent 4f736c7 commit cb6a6c3

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "pyredactkit"
7-
version = "0.3.4"
7+
version = "0.3.5"
88
description = "Python cli tool to redact sensitive data"
99
authors = ["brootware <[email protected]>"]
1010
license = "GPL-3.0-or-later"

pyredactkit/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__version__ = "0.1.0"
22

3-
from pyredactkit import pyredactkit
3+
from pyredactkit import runner
44

55
if __name__ == "__main__":
6-
pyredactkit.main()
6+
runner.main()

pyredactkit/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
)
2525
sys.exit(1)
2626

27-
from pyredactkit import pyredactkit
27+
from pyredactkit import runner
2828

29-
pyredactkit.main()
29+
runner.main()

pyredactkit/core_redactor.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,18 @@ def __init__(self) -> None:
3535
"""
3636
return None
3737

38-
def identify_data(self, line: str) -> list:
38+
def identify_data(self, textchunk: str) -> list:
3939
"""Function to identify specific option
4040
Args:
41-
line (str) : line to be supplied to identify pattern
41+
textchunk (str) : textchunk to be supplied to identify pattern
4242
Returns:
4343
list (list): list of sensitive data found in lines
4444
"""
4545
sensitive_data = []
4646
for id in id_object.regexes:
4747
redact_pattern = id['pattern']
48-
if re.search(redact_pattern, line):
49-
pattern_string = re.search(redact_pattern, line)
50-
pattern_string = pattern_string.group(0)
51-
sensitive_data.append(pattern_string)
48+
sensitive_data.append(re.findall(redact_pattern, textchunk))
49+
sensitive_data = sum(sensitive_data, [])
5250
return sensitive_data
5351

5452
def redact_all(self, line: str) -> tuple:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def main():
143143
redact_obj.process_text(args.text)
144144

145145

146-
def api_return_core_identifier(text: str) -> list:
146+
def api_identify_sensitive_data(text: str) -> list:
147147
return redact_obj.identify_data(text)
148148

149149

0 commit comments

Comments
 (0)