From 0150437c46614e475a977af8474d601c84b25217 Mon Sep 17 00:00:00 2001 From: Amrit Ghimire Date: Wed, 16 Oct 2024 14:17:41 +0545 Subject: [PATCH] Fix init --- src/datachain/config.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/datachain/config.py b/src/datachain/config.py index f5a73905..6a997c28 100644 --- a/src/datachain/config.py +++ b/src/datachain/config.py @@ -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 @@ -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 @@ -125,10 +122,10 @@ def get_remote_config(self, remote: str = "") -> Mapping[str, str]: return remote_conf -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] else: into[key] = val