Skip to content

Commit

Permalink
⚙️ fixed: change import for support ddeutil 0.4.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
korawica committed Oct 7, 2024
1 parent 32eb936 commit 26dabee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
]
requires-python = ">=3.9.13"
dependencies = [
"ddeutil[all]==0.4.0",
"ddeutil[all]==0.4.2",
"fmtutil==1.0.10",
"tzdata==2024.2",
"pydantic==2.9.2",
Expand Down
4 changes: 2 additions & 2 deletions src/ddeutil/io/files/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import msgpack
import toml
import yaml
from ddeutil.core import must_split
from ddeutil.core import splitter

try:
from yaml import CSafeLoader as SafeLoader
Expand Down Expand Up @@ -242,7 +242,7 @@ def __init__(
compress: str,
) -> None:
self.path: Path = Path(path) if isinstance(path, str) else path
_compress, sub = must_split(compress, ":", maxsplit=1)
_compress, sub = splitter.must_split(compress, ":", maxsplit=1)
self.compress: DirCompressType = _compress
self.sub_compress: str = sub or "_"

Expand Down
25 changes: 13 additions & 12 deletions src/ddeutil/io/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
)

from dateutil.relativedelta import relativedelta
from ddeutil.core import (
concat,
hash_all,
merge_dict,
)
from ddeutil.core.__base import must_rsplit
from ddeutil.core import base, hash, merge, splitter
from ddeutil.core.dtutils import get_date
from deepdiff import DeepDiff
from fmtutil import (
Expand Down Expand Up @@ -105,7 +100,7 @@ def shortname(self) -> str:
"""Return a configuration shortname, which get first character of any
split string by name partition string.
"""
return concat(word[0] for word in self.name.split("_"))
return base.concat(word[0] for word in self.name.split("_"))

@property
def fmt_group(self) -> FormatterGroupType:
Expand Down Expand Up @@ -163,7 +158,11 @@ def __init__(
loader: type[Fl] | None = None,
loader_stg: type[Fl] | None = None,
):
_domain, _name = must_rsplit(concat(name.split()), ":", maxsplit=1)
_domain, _name = splitter.must_rsplit(
base.concat(name.split()),
sep=":",
maxsplit=1,
)
super().__init__(name=_name, domain=_domain)
if not params:
raise NotImplementedError(
Expand Down Expand Up @@ -214,7 +213,7 @@ def __init__(
METADATA.pop(self.fullname, None)

def __hash__(self) -> int:
return hash(
return hash.hash_all(
self.fullname
+ self.stage
+ f"{self.timestamp:{self.params.engine.values.dt_fmt}}"
Expand Down Expand Up @@ -248,7 +247,9 @@ def data(self, hashing: bool = False) -> dict[str, Any]:
if k in self.params.engine.values.excluded
} | self.__data
return (
hash_all(_data, exclude=set(self.params.engine.values.excluded))
hash.hash_all(
_data, exclude=set(self.params.engine.values.excluded)
)
if hashing
else _data
)
Expand Down Expand Up @@ -408,7 +409,7 @@ def move(
)
if (
self.compare_data(
hash_all(
hash.hash_all(
self.pick(stage=stage),
exclude=set(self.params.engine.values.excluded),
)
Expand All @@ -427,7 +428,7 @@ def move(
_dt_fmt: str = self.params.engine.values.dt_fmt
loading.save_stage(
path=(loading.path / _filename),
data=merge_dict(
data=merge.merge_dict(
self.data(),
{
UPDATE_KEY: f"{self.timestamp:{_dt_fmt}}",
Expand Down
4 changes: 2 additions & 2 deletions src/ddeutil/io/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from typing import Callable, TypeVar

from ddeutil.core import import_string, str2args
from ddeutil.core import convert, import_string

from .files import RegexConf

Expand Down Expand Up @@ -70,7 +70,7 @@ def map_importer(value: T) -> T:
raise ValueError(
f'The @function: {searches["function"]!r} is not callable.',
)
args, kwargs = str2args(searches["arguments"])
args, kwargs = convert.str2args(searches["arguments"])
value: str = value.replace(searches["search"], _fn(*args, **kwargs))
return value

Expand Down

0 comments on commit 26dabee

Please sign in to comment.