yijin928 commited on
Commit
18d4471
·
verified ·
1 Parent(s): a4e3518

Delete utils

Browse files
Files changed (3) hide show
  1. utils/__init__.py +0 -0
  2. utils/extra_config.py +0 -33
  3. utils/json_util.py +0 -26
utils/__init__.py DELETED
File without changes
utils/extra_config.py DELETED
@@ -1,33 +0,0 @@
1
- import os
2
- import yaml
3
- import folder_paths
4
- import logging
5
-
6
- def load_extra_path_config(yaml_path):
7
- with open(yaml_path, 'r') as stream:
8
- config = yaml.safe_load(stream)
9
- yaml_dir = os.path.dirname(os.path.abspath(yaml_path))
10
- for c in config:
11
- conf = config[c]
12
- if conf is None:
13
- continue
14
- base_path = None
15
- if "base_path" in conf:
16
- base_path = conf.pop("base_path")
17
- base_path = os.path.expandvars(os.path.expanduser(base_path))
18
- if not os.path.isabs(base_path):
19
- base_path = os.path.abspath(os.path.join(yaml_dir, base_path))
20
- is_default = False
21
- if "is_default" in conf:
22
- is_default = conf.pop("is_default")
23
- for x in conf:
24
- for y in conf[x].split("\n"):
25
- if len(y) == 0:
26
- continue
27
- full_path = y
28
- if base_path:
29
- full_path = os.path.join(base_path, full_path)
30
- elif not os.path.isabs(full_path):
31
- full_path = os.path.abspath(os.path.join(yaml_dir, y))
32
- logging.info("Adding extra search path {} {}".format(x, full_path))
33
- folder_paths.add_model_folder_path(x, full_path, is_default)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
utils/json_util.py DELETED
@@ -1,26 +0,0 @@
1
- def merge_json_recursive(base, update):
2
- """Recursively merge two JSON-like objects.
3
- - Dictionaries are merged recursively
4
- - Lists are concatenated
5
- - Other types are overwritten by the update value
6
-
7
- Args:
8
- base: Base JSON-like object
9
- update: Update JSON-like object to merge into base
10
-
11
- Returns:
12
- Merged JSON-like object
13
- """
14
- if not isinstance(base, dict) or not isinstance(update, dict):
15
- if isinstance(base, list) and isinstance(update, list):
16
- return base + update
17
- return update
18
-
19
- merged = base.copy()
20
- for key, value in update.items():
21
- if key in merged:
22
- merged[key] = merge_json_recursive(merged[key], value)
23
- else:
24
- merged[key] = value
25
-
26
- return merged