Skip to content

Commit 8877fa1

Browse files
committed
Eliminate dependency on 'mergedeep'
It turns out the only code path taken through it was a trivial loop.
1 parent 65ed6c3 commit 8877fa1

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

properdocs/utils/yaml.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import logging
55
import os
66
import os.path
7+
from collections.abc import Mapping
78
from typing import IO, TYPE_CHECKING, Any
89

9-
import mergedeep # type: ignore
1010
import yaml
1111
import yaml_env_tag # type: ignore
1212

@@ -152,5 +152,14 @@ def yaml_load(
152152
log.debug(f"Loading inherited configuration file: {abspath}")
153153
with open(abspath, 'rb') as fd:
154154
parent = yaml_load(fd, loader)
155-
result = mergedeep.merge(parent, result)
155+
result = deep_merge_dicts(parent, result)
156156
return result
157+
158+
159+
def deep_merge_dicts(dst: dict[str, Any], src: Mapping[str, Any]) -> dict[str, Any]:
160+
for key, src_value in src.items():
161+
if isinstance(dst.get(key), Mapping) and isinstance(src_value, Mapping):
162+
deep_merge_dicts(dst[key], src_value)
163+
else:
164+
dst[key] = src_value
165+
return dst

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ dependencies = [
4444
"pyyaml_env_tag >=0.1",
4545
"importlib-metadata >=4.4; python_version < '3.10'",
4646
"packaging >=20.5",
47-
"mergedeep >=1.3.4",
4847
"pathspec >=0.11.1",
4948
"platformdirs >=2.2.0",
5049
"colorama >=0.4; platform_system == 'Windows'",

0 commit comments

Comments
 (0)