Ver código fonte

rename load_dict to load_json, and rename save_dict to save_json

quarrying 4 anos atrás
pai
commit
b5e216ebcf
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3 3
      khandy/utils_file_io.py

+ 3 - 3
khandy/utils_file_io.py

@@ -29,14 +29,14 @@ def save_list(filename, list_obj, encoding='utf-8', append_break=True):
                 f.write(str(item))
 
 
-def load_dict(filename, encoding='utf-8'):
+def load_json(filename, encoding='utf-8'):
     with open(filename, 'r', encoding=encoding) as f:
         dict_obj = json.load(f, object_pairs_hook=OrderedDict)
     return dict_obj
 
 
-def save_dict(filename, dict_obj, encoding='utf-8', sort=False):
+def save_json(filename, dict_obj, encoding='utf-8', sort_keys=False):
     with open(filename, 'w', encoding=encoding) as f:
         json.dump(dict_obj, f, indent=4, separators=(',',': '),
-                  ensure_ascii=False, sort_keys=sort)
+                  ensure_ascii=False, sort_keys=sort_keys)