1616"""
1717
1818import os
19- import types
2019
2120import logbook
2221import yaml
@@ -27,7 +26,7 @@ def get_logger(logger_name="postgresql-metrics"):
2726
2827
2928def figure_out_log_level (given_level ):
30- if isinstance (given_level , types . StringTypes ):
29+ if isinstance (given_level , str ):
3130 return logbook .lookup_level (given_level .strip ().upper ())
3231 else :
3332 return given_level
@@ -83,7 +82,7 @@ def merge_configs(to_be_merged, default):
8382 ['get_stats_seconds_since_last_vacuum_per_table', 60]]
8483 """
8584 if isinstance (to_be_merged , dict ) and isinstance (default , dict ):
86- for k , v in default .iteritems ():
85+ for k , v in default .items ():
8786 if k not in to_be_merged :
8887 to_be_merged [k ] = v
8988 else :
@@ -113,7 +112,7 @@ def find_and_parse_config(config_path):
113112 for config_dir in (default_root , config_root ):
114113 current_path = os .path .join (config_dir , config_filename )
115114 if os .path .isfile (current_path ):
116- with file (current_path , 'r' ) as f :
115+ with open (current_path , 'r' ) as f :
117116 read_config_dict = yaml .load (f )
118117 config_dict = merge_configs (read_config_dict , config_dict )
119118 return config_dict
0 commit comments