19
19
# -- END LICENSE BLOCK ------------------------------------------------
20
20
21
21
"""Contains everything around the config file"""
22
- from __future__ import print_function
22
+ from __future__ import print_function , absolute_import
23
23
24
24
import re
25
25
import yaml
26
26
27
- from window import Window
28
- import tmux_wrapper as tmux
27
+ from catmux . window import Window
28
+ import catmux . tmux_wrapper as tmux
29
29
30
30
31
31
def check_boolean_field (boolean ):
@@ -52,7 +52,7 @@ def init_from_filepath(self, filepath):
52
52
"""Initializes the data from a file read from filepath."""
53
53
54
54
try :
55
- self .__yaml_data = yaml .load (file (filepath , 'r' ))
55
+ self .__yaml_data = yaml .load (open (filepath , 'r' ))
56
56
except yaml .YAMLError as exc :
57
57
print ('Error while loading config file: %s' , exc )
58
58
print ('Loaded file was: %s' , filepath )
@@ -114,11 +114,11 @@ def _parse_parameters(self):
114
114
115
115
print ('Parameters found in session config:' )
116
116
print (' - ' + '\n - ' .join ('{} = {}' .format (key , value )
117
- for key , value in self ._parameters .items ()))
117
+ for key , value in list ( self ._parameters .items () )))
118
118
if self ._runtime_params :
119
119
print ('Parameters found during runtime (overwrites):' )
120
120
print (' - ' + '\n - ' .join ('{} = {}' .format (key , value )
121
- for key , value in self ._runtime_params .items ()))
121
+ for key , value in list ( self ._runtime_params .items () )))
122
122
# Overwrite parameters given from command line
123
123
self ._parameters .update (self ._runtime_params )
124
124
@@ -127,13 +127,13 @@ def _parse_parameters(self):
127
127
128
128
def _replace_parameters (self , data ):
129
129
if isinstance (data , dict ):
130
- for key , value in data .items ():
130
+ for key , value in list ( data .items () ):
131
131
data [key ] = self ._replace_parameters (value )
132
132
elif isinstance (data , list ):
133
133
for index , item in enumerate (data ):
134
134
data [index ] = self ._replace_parameters (item )
135
135
elif isinstance (data , str ):
136
- for key , value in self ._parameters .items ():
136
+ for key , value in list ( self ._parameters .items () ):
137
137
# print('-\nValue {}: {}\n='.format(value, type(data)))
138
138
# if isinstance(value, str):
139
139
# print('replacing {} in {}'.format(key, data))
0 commit comments