1010
1111import re
1212from .inject_secrets import SecretInjector
13+ from .python_compat import iteritems , string_types , primitive_types
1314
1415
1516def is_interpolation (value ):
16- return isinstance (value , (basestring )) and '{{' in value and '}}' in value
17+ return isinstance (value , string_types ) and '{{' in value and '}}' in value
18+
1719
1820def is_full_interpolation (value ):
1921 return is_interpolation (value ) and value .startswith ('{{' ) and value .endswith ('}}' )
2022
23+
2124def remove_white_spaces (value ):
2225 return re .sub (r"\s+" , "" , value )
2326
@@ -59,7 +62,7 @@ def __init__(self):
5962 pass
6063
6164 def loop_all_items (self , data , process_func ):
62- if isinstance (data , basestring ):
65+ if isinstance (data , string_types ):
6366 return process_func (data )
6467 if isinstance (data , list ):
6568 items = []
@@ -134,13 +137,13 @@ def __init__(self):
134137
135138 def resolve (self , line , data ):
136139 """
137- :param input : {{env.name}}
140+ :param line : {{env.name}}
138141 :param data: (env: name: dev)
139142 :return: dev
140143 """
141144
142145 self .parse_leaves (data , "" )
143- for key , value in self .results . iteritems ( ):
146+ for key , value in iteritems ( self .results ):
144147 placeholder = "{{" + key + "}}"
145148 if placeholder not in line :
146149 continue
@@ -151,7 +154,7 @@ def resolve(self, line, data):
151154 return line
152155
153156 def parse_leaves (self , data , partial_key ):
154- if isinstance (data , ( basestring , int , bool ) ):
157+ if isinstance (data , primitive_types ):
155158 self .results [partial_key ] = data
156159 return
157160 if isinstance (data , dict ):
0 commit comments