-
Notifications
You must be signed in to change notification settings - Fork 0
/
configset.py
43 lines (30 loc) · 1.22 KB
/
configset.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
39
40
41
42
43
def _add_comment(address, comment, store):
assert address not in store
store[address] = comment
def _get_comment(address, store):
return store.get(address, None)
class Config():
def __init__(self):
self.forced_chunk_ends = []
self.pre_comments = {}
self.inline_comments = {}
self.post_comments = {}
def add_pre_comment(self, address, comment):
return _add_comment(address, comment, self.pre_comments)
def add_inline_comment(self, address, comment):
return _add_comment(address, comment, self.inline_comments)
def add_post_comment(self, address, comment):
return _add_comment(address, comment, self.post_comments)
def get_pre_comment(self, address):
return _get_comment(address, self.pre_comments)
def get_inline_comment(self, address):
return _get_comment(address, self.inline_comments)
def get_post_comment(self, address):
return _get_comment(address, self.post_comments)
class NullConfig():
def get_pre_comment(self, address):
return None
def get_inline_comment(self, address):
return None
def get_post_comment(self, address):
return None