Skip to content

Commit 41efa36

Browse files
authored
drop tqdm implementation and tqdm callback (#279)
1 parent a7b0eed commit 41efa36

File tree

3 files changed

+4
-183
lines changed

3 files changed

+4
-183
lines changed

pyproject.toml

-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ tests = [
4343
dev = [
4444
"dvc-objects[tests]",
4545
"mypy==1.8.0",
46-
"tqdm>=4.63.1,<5",
47-
"types-tqdm",
48-
"typing-extensions>=3.7.4",
4946
]
5047

5148
[tool.setuptools.packages.find]

src/dvc_objects/_tqdm.py

-145
This file was deleted.

src/dvc_objects/fs/callbacks.py

+4-35
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
from functools import wraps
2-
from typing import TYPE_CHECKING, BinaryIO, Optional, Type, cast
3-
4-
import fsspec
5-
from fsspec.callbacks import DEFAULT_CALLBACK, Callback, NoOpCallback
2+
from typing import TYPE_CHECKING, BinaryIO, cast
63

74
if TYPE_CHECKING:
8-
from typing import Union
9-
10-
from tqdm import tqdm
11-
12-
13-
__all__ = ["Callback", "NoOpCallback", "TqdmCallback", "DEFAULT_CALLBACK"]
5+
import fsspec
146

157

168
class CallbackStream:
17-
def __init__(self, stream, callback: Callback):
9+
def __init__(self, stream, callback: "fsspec.Callback"):
1810
self.stream = stream
1911

2012
@wraps(stream.read)
@@ -29,28 +21,5 @@ def __getattr__(self, attr):
2921
return getattr(self.stream, attr)
3022

3123

32-
class TqdmCallback(fsspec.callbacks.TqdmCallback):
33-
def __init__(
34-
self,
35-
size: Optional[int] = None,
36-
value: int = 0,
37-
progress_bar: Optional["tqdm"] = None,
38-
tqdm_cls: Optional[Type["tqdm"]] = None,
39-
**tqdm_kwargs,
40-
):
41-
from dvc_objects._tqdm import Tqdm
42-
43-
tqdm_kwargs.pop("total", None)
44-
super().__init__(
45-
tqdm_kwargs=tqdm_kwargs, tqdm_cls=tqdm_cls or Tqdm, size=size, value=value
46-
)
47-
if progress_bar is not None:
48-
self.tqdm = progress_bar
49-
50-
def branched(self, path_1: "Union[str, BinaryIO]", path_2: str, **kwargs):
51-
desc = path_1 if isinstance(path_1, str) else path_2
52-
return TqdmCallback(bytes=True, desc=desc)
53-
54-
55-
def wrap_file(file, callback: Callback) -> BinaryIO:
24+
def wrap_file(file, callback: "fsspec.Callback") -> BinaryIO:
5625
return cast(BinaryIO, CallbackStream(file, callback))

0 commit comments

Comments
 (0)