diff --git a/dvc/utils/__init__.py b/dvc/utils/__init__.py index 409f0eab9..b23882876 100644 --- a/dvc/utils/__init__.py +++ b/dvc/utils/__init__.py @@ -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.*?)(:(?P[^\\/:]*))??$") diff --git a/dvc/utils/conversions.py b/dvc/utils/conversions.py index 5fe2950d6..3fa0097ba 100644 --- a/dvc/utils/conversions.py +++ b/dvc/utils/conversions.py @@ -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, } diff --git a/dvc/utils/fs.py b/dvc/utils/fs.py index f3ddcaf20..c12ce4009 100644 --- a/dvc/utils/fs.py +++ b/dvc/utils/fs.py @@ -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) diff --git a/tests/func/test_stage_load.py b/tests/func/test_stage_load.py index 9485bceda..b4170f953 100644 --- a/tests/func/test_stage_load.py +++ b/tests/func/test_stage_load.py @@ -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): diff --git a/tests/func/test_state.py b/tests/func/test_state.py index 75f165233..173821a69 100644 --- a/tests/func/test_state.py +++ b/tests/func/test_state.py @@ -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): diff --git a/tests/func/test_version.py b/tests/func/test_version.py index 6a6646a13..2e5b378ce 100644 --- a/tests/func/test_version.py +++ b/tests/func/test_version.py @@ -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) diff --git a/tests/unit/test_info.py b/tests/unit/test_info.py index 22455a54e..ae3b6233c 100644 --- a/tests/unit/test_info.py +++ b/tests/unit/test_info.py @@ -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) diff --git a/tests/unit/utils/test_conversions.py b/tests/unit/utils/test_conversions.py index 063dd4556..b6fb596ee 100644 --- a/tests/unit/utils/test_conversions.py +++ b/tests/unit/utils/test_conversions.py @@ -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(