Browse Source

yaml.load -> yaml.safe_load

See https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation
Kentaro Wada 6 năm trước cách đây
mục cha
commit
0f9a09737e
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      labelme/config/__init__.py

+ 2 - 2
labelme/config/__init__.py

@@ -30,7 +30,7 @@ def update_dict(target_dict, new_dict, validate_item=None):
 def get_default_config():
     config_file = osp.join(here, 'default_config.yaml')
     with open(config_file) as f:
-        config = yaml.load(f)
+        config = yaml.safe_load(f)
 
     # save default config to ~/.labelmerc
     user_config_file = osp.join(osp.expanduser('~'), '.labelmerc')
@@ -68,7 +68,7 @@ def get_config(config_from_args=None, config_file=None):
     # 2. config from yaml file
     if config_file is not None and osp.exists(config_file):
         with open(config_file) as f:
-            user_config = yaml.load(f) or {}
+            user_config = yaml.safe_load(f) or {}
         update_dict(config, user_config, validate_item=validate_config_item)
 
     # 3. command line argument