mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
committed by
Saugat Pachhai
parent
0ce1f982b0
commit
d213ccb686
@@ -15,8 +15,8 @@ import colorama
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
LOCAL_CHUNK_SIZE = 2 ** 20 # 1 MB
|
||||
LARGE_FILE_SIZE = 2 ** 30 # 1 GB
|
||||
LOCAL_CHUNK_SIZE = 2**20 # 1 MB
|
||||
LARGE_FILE_SIZE = 2**30 # 1 GB
|
||||
LARGE_DIR_SIZE = 100
|
||||
TARGET_REGEX = re.compile(r"(?P<path>.*?)(:(?P<name>[^\\/:]*))??$")
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
MULTIPLIERS = {
|
||||
"kb": 1024,
|
||||
"mb": 1024 ** 2,
|
||||
"gb": 1024 ** 3,
|
||||
"tb": 1024 ** 4,
|
||||
"mb": 1024**2,
|
||||
"gb": 1024**3,
|
||||
"tb": 1024**4,
|
||||
"kib": 1024,
|
||||
"mib": 1024 ** 2,
|
||||
"gib": 1024 ** 3,
|
||||
"tib": 1024 ** 4,
|
||||
"mib": 1024**2,
|
||||
"gib": 1024**3,
|
||||
"tib": 1024**4,
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ if TYPE_CHECKING:
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
LOCAL_CHUNK_SIZE = 2 ** 20 # 1 MB
|
||||
LOCAL_CHUNK_SIZE = 2**20 # 1 MB
|
||||
|
||||
umask = os.umask(0)
|
||||
os.umask(umask)
|
||||
|
||||
@@ -253,15 +253,12 @@ def test_collect_granular_with_not_existing_output_or_stage_name(tmp_dir, dvc):
|
||||
|
||||
|
||||
def test_collect_granular_with_deps(tmp_dir, dvc, stages):
|
||||
assert (
|
||||
set(
|
||||
map(
|
||||
itemgetter(0),
|
||||
dvc.stage.collect_granular("bar.dvc", with_deps=True),
|
||||
)
|
||||
assert set(
|
||||
map(
|
||||
itemgetter(0),
|
||||
dvc.stage.collect_granular("bar.dvc", with_deps=True),
|
||||
)
|
||||
== {stages["copy-foo-bar"], stages["foo-generate"]}
|
||||
)
|
||||
) == {stages["copy-foo-bar"], stages["foo-generate"]}
|
||||
assert set(
|
||||
map(
|
||||
itemgetter(0),
|
||||
@@ -272,15 +269,12 @@ def test_collect_granular_with_deps(tmp_dir, dvc, stages):
|
||||
stages["copy-foo-bar"],
|
||||
stages["foo-generate"],
|
||||
}
|
||||
assert (
|
||||
set(
|
||||
map(
|
||||
itemgetter(0),
|
||||
dvc.stage.collect_granular(PIPELINE_FILE, with_deps=True),
|
||||
)
|
||||
assert set(
|
||||
map(
|
||||
itemgetter(0),
|
||||
dvc.stage.collect_granular(PIPELINE_FILE, with_deps=True),
|
||||
)
|
||||
== set(stages.values())
|
||||
)
|
||||
) == set(stages.values())
|
||||
|
||||
|
||||
def test_collect_granular_same_output_name_stage_name(tmp_dir, dvc, run_copy):
|
||||
|
||||
@@ -65,18 +65,12 @@ def test_get_unused_links(tmp_dir, dvc):
|
||||
assert set(dvc.state.get_unused_links([], dvc.fs)) == {"foo", "bar"}
|
||||
assert set(dvc.state.get_unused_links(links[:1], dvc.fs)) == {"bar"}
|
||||
assert set(dvc.state.get_unused_links(links, dvc.fs)) == set()
|
||||
assert (
|
||||
set(
|
||||
dvc.state.get_unused_links(
|
||||
(
|
||||
links[:1]
|
||||
+ [os.path.join(dvc.root_dir, "not-existing-file")]
|
||||
),
|
||||
dvc.fs,
|
||||
)
|
||||
assert set(
|
||||
dvc.state.get_unused_links(
|
||||
(links[:1] + [os.path.join(dvc.root_dir, "not-existing-file")]),
|
||||
dvc.fs,
|
||||
)
|
||||
== {"bar"}
|
||||
)
|
||||
) == {"bar"}
|
||||
|
||||
|
||||
def test_state_dir_config(make_tmp_dir, dvc):
|
||||
|
||||
@@ -12,7 +12,7 @@ def test_(tmp_dir, dvc, scm, capsys):
|
||||
assert main(["version"]) == 0
|
||||
|
||||
out, _ = capsys.readouterr()
|
||||
assert re.search(fr"DVC version: {DVC_VERSION_REGEX}", out)
|
||||
assert re.search(rf"DVC version: {DVC_VERSION_REGEX}", out)
|
||||
assert re.search(f"Platform: {PYTHON_VERSION_REGEX} on .*", out)
|
||||
assert find_supported_remotes(out)
|
||||
assert re.search(r"Cache types: .*", out)
|
||||
|
||||
@@ -51,7 +51,7 @@ def test_info_in_repo(scm_init, tmp_dir):
|
||||
|
||||
dvc_info = get_dvc_info()
|
||||
|
||||
assert re.search(fr"DVC version: {DVC_VERSION_REGEX}", dvc_info)
|
||||
assert re.search(rf"DVC version: {DVC_VERSION_REGEX}", dvc_info)
|
||||
assert re.search(f"Platform: {PYTHON_VERSION_REGEX} on .*", dvc_info)
|
||||
assert find_supported_remotes(dvc_info)
|
||||
assert re.search(r"Cache types: .*", dvc_info)
|
||||
@@ -126,7 +126,7 @@ def test_fs_info_in_repo(tmp_dir, dvc, caplog):
|
||||
def test_info_outside_of_repo(tmp_dir, caplog):
|
||||
dvc_info = get_dvc_info()
|
||||
|
||||
assert re.search(fr"DVC version: {DVC_VERSION_REGEX}", dvc_info)
|
||||
assert re.search(rf"DVC version: {DVC_VERSION_REGEX}", dvc_info)
|
||||
assert re.search(f"Platform: {PYTHON_VERSION_REGEX} on .*", dvc_info)
|
||||
assert find_supported_remotes(dvc_info)
|
||||
assert not re.search(r"Cache types: .*", dvc_info)
|
||||
@@ -135,7 +135,7 @@ def test_info_outside_of_repo(tmp_dir, caplog):
|
||||
|
||||
def test_fs_info_outside_of_repo(tmp_dir, caplog):
|
||||
dvc_info = get_dvc_info()
|
||||
assert re.search(fr"DVC version: {DVC_VERSION_REGEX}", dvc_info)
|
||||
assert re.search(rf"DVC version: {DVC_VERSION_REGEX}", dvc_info)
|
||||
assert re.search(f"Platform: {PYTHON_VERSION_REGEX} on .*", dvc_info)
|
||||
assert find_supported_remotes(dvc_info)
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ import pytest
|
||||
from dvc.utils.conversions import human_readable_to_bytes
|
||||
|
||||
KB = 1024
|
||||
MB = KB ** 2
|
||||
GB = KB ** 3
|
||||
TB = KB ** 4
|
||||
MB = KB**2
|
||||
GB = KB**3
|
||||
TB = KB**4
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
Reference in New Issue
Block a user