-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_from_file.py
38 lines (30 loc) · 958 Bytes
/
run_from_file.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
28
29
30
31
32
33
34
35
36
37
38
"""Get movie id from passed argument."""
import argparse
from src.main import GetInfo
class GetArgument:
"""Get passed movie ID and get info about it via GetInfo instance."""
@staticmethod
def get_argument():
"""Get the movie id from argument if it is integer.
Return
----------
movie_id: int
Movie ID as an integer
"""
parser = argparse.ArgumentParser()
parser.add_argument(
'-m',
'--movie_id',
help="Please provide movie id as an integer",
type=int,
required=True)
movie_id = parser.parse_args().movie_id
return movie_id
def from_file(self):
"""Get the movie_id as passed argument and create GetInfo object."""
movie_id = self.get_argument()
get_info = GetInfo()
get_info.main(movie_id)
if __name__ == "__main__":
ga = GetArgument()
ga.from_file()