mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-13 15:28:27 +01:00
ls/ls-url: use tqmd instead of humanize.naturalsize
Per https://github.com/iterative/dvc/pull/9857#issuecomment-1683185006
This commit is contained in:
@@ -12,13 +12,13 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _format_entry(entry, fmt):
|
||||
from humanize import naturalsize
|
||||
from dvc.utils.humanize import naturalsize
|
||||
|
||||
size = entry.get("size")
|
||||
if size is None:
|
||||
size = ""
|
||||
else:
|
||||
size = naturalsize(size, gnu=True)
|
||||
size = naturalsize(size)
|
||||
return size, fmt(entry)
|
||||
|
||||
|
||||
|
||||
@@ -31,3 +31,11 @@ def truncate_text(text: str, max_length: int, with_ellipsis: bool = True) -> str
|
||||
return text[: max_length - 1] + ELLIPSIS
|
||||
|
||||
return text[:max_length]
|
||||
|
||||
|
||||
def naturalsize(value: float, base: int = 1024) -> str:
|
||||
from tqdm import tqdm
|
||||
|
||||
if value < base:
|
||||
return f"{value:.0f}"
|
||||
return tqdm.format_sizeof(value, divisor=base)
|
||||
|
||||
@@ -65,7 +65,6 @@ dependencies = [
|
||||
"tqdm<5,>=4.63.1",
|
||||
"voluptuous>=0.11.7",
|
||||
"zc.lockfile>=1.2.1",
|
||||
"humanize",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
||||
Reference in New Issue
Block a user