From d494126cc51b12f5bc6711027dfdced89db5b59f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 19:59:05 +0545 Subject: [PATCH] build(deps): bump mypy from 1.10.1 to 1.11.1 (#10495) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Saugat Pachhai (सौगात) --- dvc/lock.py | 5 +++-- dvc/repo/datasets.py | 2 +- dvc/testing/path_info.py | 4 ++-- pyproject.toml | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dvc/lock.py b/dvc/lock.py index 26ce3aac9..7e5d923b9 100644 --- a/dvc/lock.py +++ b/dvc/lock.py @@ -4,6 +4,7 @@ import hashlib import os from abc import ABC, abstractmethod from datetime import timedelta +from typing import Optional, Union import flufl.lock import zc.lockfile @@ -174,9 +175,9 @@ class HardlinkLock(flufl.lock.Lock, LockBase): self._owned = True self._retry_errnos = [] - def lock(self): + def lock(self, timeout: Optional[Union[timedelta, int]] = None): try: - super().lock(timedelta(seconds=DEFAULT_TIMEOUT)) + super().lock(timeout or timedelta(seconds=DEFAULT_TIMEOUT)) except flufl.lock.TimeOutError: raise LockError(FAILED_TO_LOCK_MESSAGE) # noqa: B904 diff --git a/dvc/repo/datasets.py b/dvc/repo/datasets.py index bc15c87b0..3510b3948 100644 --- a/dvc/repo/datasets.py +++ b/dvc/repo/datasets.py @@ -76,7 +76,7 @@ class SerDe: return asdict(self, filter=filter_defaults, value_serializer=value_serializer) @classmethod - def from_dict(cls: type["Self"], d: dict[str, Any]) -> "Self": + def from_dict(cls, d: dict[str, Any]) -> "Self": _fields = fields(cast("type[AttrsInstance]", cls)) kwargs = {f.name: d[f.name] for f in _fields if f.name in d} return cls(**kwargs) diff --git a/dvc/testing/path_info.py b/dvc/testing/path_info.py index 49d5ee2aa..b7fe23b60 100644 --- a/dvc/testing/path_info.py +++ b/dvc/testing/path_info.py @@ -79,13 +79,13 @@ class PathInfo(pathlib.PurePath, _BasePath): and self._cparts[:n] == other._cparts # type: ignore[attr-defined] ) - def relative_to(self, other): + def relative_to(self, other, *args, **kwargs): # pathlib relative_to raises exception when one path is not a direct # descendant of the other when os.path.relpath would return abspath. # For DVC PathInfo we only need the relpath behavior. # See: https://bugs.python.org/issue40358 try: - path = super().relative_to(other) + path = super().relative_to(other, *args, **kwargs) except ValueError: path = relpath(self, other) return self.__class__(path) diff --git a/pyproject.toml b/pyproject.toml index 3f9d70cbb..cc916be87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,7 +83,7 @@ gdrive = ["dvc-gdrive>=3,<4"] gs = ["dvc-gs>=3,<4"] hdfs = ["dvc-hdfs>=3,<4"] lint = [ - "mypy==1.10.1", + "mypy==1.11.1", "pandas-stubs", "types-colorama", "types-psutil",