-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
27 lines (21 loc) · 825 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from app.handler.check_eol_handler import CheckEOLHandler
from app.handler.remove_comments_handler import RemoveCommentsHandler
from app.handler.tokenize_handler import TokenizeHandler
from app.handler import Handler
import pandas as pd
import click
def client_code(file_path: str, handle: Handler):
with open(file_path) as f:
inputData = f.read()
click.echo(pd.DataFrame(handle.handle(inputData)).to_string())
@click.command()
@click.option('--file', '-f', help="File path to analyze")
def main(file):
remove_comments = RemoveCommentsHandler()
check_eol = CheckEOLHandler()
tokenize = TokenizeHandler()
remove_comments.set_next(check_eol) \
.set_next(tokenize)
client_code(file, remove_comments)
if __name__ == "__main__":
main()