@@ -59,10 +59,11 @@ class Configuration(IConf, object):
5959 __pattern_with_boolean_element = re .compile (r'\btrue|True|false|False\b' )
6060 __pattern_with_element = re .compile (r'((?<=\')[^,\b]+?(?=\'))|((?<=\")[^,\b]+?(?=\"))' )
6161 __pattern_with_element_strip = re .compile (r'(?<=\').+?(?=\')|(?<=\").+?(?=\")' )
62- _config = {}
6362
6463 def __init__ (self ):
6564 super (Configuration , self ).__init__ ()
65+ # private property
66+ self .__config = {}
6667
6768 def obtain_config (self , config_file ):
6869 """the read xxx.cfg"""
@@ -99,7 +100,7 @@ def obtain_config(self, config_file):
99100 self .__resolve_with_str (key , suspicious_value )
100101 else :
101102 self .__resolve_with_str (key , suspicious_value )
102- return self ._config
103+ return self .__config
103104
104105 def __resolve_with_list (self , match_with_immature_list , key , suspicious_value ):
105106 'the resolve list data structure'
@@ -111,7 +112,7 @@ def __resolve_with_list(self, match_with_immature_list, key, suspicious_value):
111112 the_default_element_list_with_parsed = list ()
112113 for element_value in iterator_object_with_callback_type_is_match_object :
113114 the_default_element_list_with_parsed .append (element_value .group ())
114- self ._config [key ] = the_default_element_list_with_parsed
115+ self .__config [key ] = the_default_element_list_with_parsed
115116 else :
116117 # ignore invaild split value
117118 logging .warning (
@@ -128,7 +129,7 @@ def __resolve_with_digital(self, match_with_immature_digital, key, suspicious_va
128129 element_value = match_with_immature_digital .group ()
129130 try :
130131 if element_value and suspicious_value == element_value and isinstance (int (element_value ), Number ):
131- self ._config [key ] = int (element_value )
132+ self .__config [key ] = int (element_value )
132133 else :
133134 self .__resolve_with_str (key , suspicious_value )
134135 except ValueError :
@@ -140,9 +141,9 @@ def __resolve_with_boolean(self, match_with_immature_boolean, key, suspicious_va
140141 try :
141142 if element_value and suspicious_value == element_value :
142143 if 'true' == element_value or 'True' == element_value :
143- self ._config [key ] = bool (1 )
144+ self .__config [key ] = bool (1 )
144145 else :
145- self ._config [key ] = bool (0 )
146+ self .__config [key ] = bool (0 )
146147 else :
147148 self .__resolve_with_str (key , suspicious_value )
148149 except ValueError :
@@ -152,6 +153,6 @@ def __resolve_with_str(self, key, suspicious_value):
152153 'the resolve str data structure'
153154 match_with_immature_str = self .__pattern_with_element_strip .search (suspicious_value )
154155 if match_with_immature_str :
155- self ._config [key ] = match_with_immature_str .group ()
156+ self .__config [key ] = match_with_immature_str .group ()
156157 else :
157- self ._config [key ] = suspicious_value
158+ self .__config [key ] = suspicious_value
0 commit comments