Skip to content

Commit

Permalink
Fix init
Browse files Browse the repository at this point in the history
  • Loading branch information
amritghimire committed Oct 16, 2024
1 parent 1f636cd commit 0150437
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/datachain/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Mapping
from contextlib import contextmanager
from typing import Optional
from typing import Optional, Union

from tomlkit import TOMLDocument, dump, load

Expand Down Expand Up @@ -37,9 +37,6 @@ def init(self):
d = DataChainDir(self.get_dir(self.level))
d.init()

with open(d.config, "w"):
return self

def load_one(self, level: Optional[str] = None) -> TOMLDocument:
config_path = DataChainDir(self.get_dir(level)).config

Expand Down Expand Up @@ -125,10 +122,10 @@ def get_remote_config(self, remote: str = "") -> Mapping[str, str]:
return remote_conf

Check warning on line 122 in src/datachain/config.py

View check run for this annotation

Codecov / codecov/patch

src/datachain/config.py#L122

Added line #L122 was not covered by tests


def merge(into, update):
def merge(into: Union[TOMLDocument, dict], update: Union[TOMLDocument, dict]):
"""Merges second dict into first recursively"""
for key, val in update.items():
if isinstance(into.get(key), dict) and isinstance(val, dict):
merge(into[key], val)
merge(into[key], val) # type: ignore[arg-type]

Check warning on line 129 in src/datachain/config.py

View check run for this annotation

Codecov / codecov/patch

src/datachain/config.py#L129

Added line #L129 was not covered by tests
else:
into[key] = val

Check warning on line 131 in src/datachain/config.py

View check run for this annotation

Codecov / codecov/patch

src/datachain/config.py#L131

Added line #L131 was not covered by tests

0 comments on commit 0150437

Please sign in to comment.