update ruff and enable flake8-logging-format and flake8-type-checking (#8894)

* update ruff and enable flake8-logging-format and flake8-type-checking check

* Update dvc/external_repo.py

* Update dvc/fs/dvc.py

* Update dvc/repo/experiments/__init__.py

* Update dvc/repo/experiments/queue/base.py

* Update pyproject.toml
This commit is contained in:
skshetry
2023-01-27 19:14:19 +05:45
committed by GitHub
parent 6f0e8a8db5
commit a137b2a6bc
52 changed files with 222 additions and 210 deletions
+3 -7
View File
@@ -2,13 +2,11 @@ import datetime
import textwrap
import pytest
from pytest import CaptureFixture
from pytest_mock import MockerFixture
from dvc.ui import Console
def test_write(capsys: CaptureFixture[str]):
def test_write(capsys):
"""Test that ui.write works."""
console = Console(enable=True)
message = "hello world"
@@ -44,9 +42,7 @@ def test_write(capsys: CaptureFixture[str]):
),
],
)
def test_write_json(
capsys: CaptureFixture[str], mocker: MockerFixture, isatty, expected_output
):
def test_write_json(capsys, mocker, isatty, expected_output):
"""Test that ui.write_json works."""
console = Console(enable=True)
@@ -57,7 +53,7 @@ def test_write_json(
assert captured.out == expected_output
def test_capsys_works(capsys: CaptureFixture[str]):
def test_capsys_works(capsys):
"""Sanity check that capsys can capture outputs from a global ui."""
from dvc.ui import ui
+11 -13
View File
@@ -1,14 +1,12 @@
import textwrap
import pytest
from pytest import CaptureFixture
from pytest_mock import MockerFixture
from rich.style import Style
from dvc.ui import ui
def test_plain(capsys: CaptureFixture[str]):
def test_plain(capsys):
ui.table(
[("foo", "bar"), ("foo1", "bar1"), ("foo2", "bar2")],
headers=["first", "second"],
@@ -24,7 +22,7 @@ def test_plain(capsys: CaptureFixture[str]):
)
def test_plain_md(capsys: CaptureFixture[str]):
def test_plain_md(capsys):
ui.table(
[("foo", "bar"), ("foo1", "bar1"), ("foo2", "bar2")],
headers=["first", "second"],
@@ -42,7 +40,7 @@ def test_plain_md(capsys: CaptureFixture[str]):
)
def test_plain_pager(mocker: MockerFixture):
def test_plain_pager(mocker):
pager_mock = mocker.patch("dvc.ui.pager.pager")
ui.table(
[("foo", "bar"), ("foo1", "bar1"), ("foo2", "bar2")],
@@ -62,7 +60,7 @@ def test_plain_pager(mocker: MockerFixture):
)
def test_plain_headerless(capsys: CaptureFixture[str]):
def test_plain_headerless(capsys):
ui.table([("foo", "bar"), ("foo1", "bar1"), ("foo2", "bar2")])
captured = capsys.readouterr()
assert captured.out == textwrap.dedent(
@@ -74,7 +72,7 @@ def test_plain_headerless(capsys: CaptureFixture[str]):
)
def test_rich_simple(capsys: CaptureFixture[str]):
def test_rich_simple(capsys):
ui.table(
[("foo", "bar"), ("foo1", "bar1"), ("foo2", "bar2")],
headers=["first", "second"],
@@ -87,7 +85,7 @@ def test_rich_simple(capsys: CaptureFixture[str]):
] == ["first second", "foo bar", "foo1 bar1", "foo2 bar2"]
def test_rich_headerless(capsys: CaptureFixture[str]):
def test_rich_headerless(capsys):
ui.table(
[("foo", "bar"), ("foo1", "bar1"), ("foo2", "bar2")], rich_table=True
)
@@ -97,7 +95,7 @@ def test_rich_headerless(capsys: CaptureFixture[str]):
] == ["foo bar", "foo1 bar1", "foo2 bar2"]
def test_rich_border(capsys: CaptureFixture[str]):
def test_rich_border(capsys):
ui.table(
[("foo", "bar"), ("foo1", "bar1"), ("foo2", "bar2")],
headers=["first", "second"],
@@ -124,7 +122,7 @@ def test_rich_border(capsys: CaptureFixture[str]):
{"row_styles": [{"style": Style(bold=True)}]},
],
)
def test_rich_styles(capsys: CaptureFixture[str], extra_opts):
def test_rich_styles(capsys, extra_opts):
ui.table(
[("foo", "bar"), ("foo1", "bar1"), ("foo2", "bar2")],
headers=["first", "second"],
@@ -138,7 +136,7 @@ def test_rich_styles(capsys: CaptureFixture[str], extra_opts):
] == ["first second", "foo bar", "foo1 bar1", "foo2 bar2"]
def test_rich_pager(mocker: MockerFixture):
def test_rich_pager(mocker):
pager_mock = mocker.patch("dvc.ui.pager.pager")
ui.table(
@@ -154,13 +152,13 @@ def test_rich_pager(mocker: MockerFixture):
@pytest.mark.parametrize("rich_table", [True, False])
def test_empty(capsys: CaptureFixture[str], rich_table: str):
def test_empty(capsys, rich_table):
ui.table([], rich_table=rich_table)
out, err = capsys.readouterr()
assert (out, err) == ("", "")
def test_empty_markdown(capsys: CaptureFixture[str]):
def test_empty_markdown(capsys):
ui.table([], headers=["Col1", "Col2"], markdown=True)
out, err = capsys.readouterr()
assert (out, err) == ("| Col1 | Col2 |\n|--------|--------|\n\n", "")