-
Notifications
You must be signed in to change notification settings - Fork 0
/
constructors.py
35 lines (22 loc) · 943 Bytes
/
constructors.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
from fbmsgparse import FbMsgParse
messages_path ='html/messages.htm'
save_file_path ='save.p'
"""
This example highlights the different ways
you can construct a FbMsgParse object.
The constructor definition for FbMsgParse is
def__init__(self, source_path=None, save_path=None)
Construction depends on which of the 2 parameters are passed.
"""
# Forces construction by parsing a messages.htm file
fmp = FbMsgParse(messages_path)
# Can also do
# fmp = FbMsgParse(source_path=messages_path)
# Forces construction by loading from a save file
fmp = FbMsgParse(save_path=save_file_path)
# When both parameters are specified, it will try to load from the save file.
# If the save file is not valid, it will be parsed anew from source_path.
# It will also save the newly parsed object to save_path.
fmp = FbMsgParse(messages_path, save_file_path)
# Can also do
# fmp = FbMsgParse(source_path=messages_path, save_path=save_file_path)