Skip to content

Commit 2bb7edd

Browse files
Merge pull request #1825 from VWS-Python/more-ruff
Enable more ruff checks
2 parents 68817c4 + 12117fa commit 2bb7edd

File tree

6 files changed

+31
-11
lines changed

6 files changed

+31
-11
lines changed

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"ms-python.black-formatter",
4+
"charliermarsh.ruff",
5+
"ms-python.python"
6+
]
7+
}

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"[python]": {
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll": true
5+
},
6+
"editor.defaultFormatter": "ms-python.black-formatter",
7+
"editor.formatOnSave": true
8+
}
9+
}

pyproject.toml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ line-length = 79
9292

9393
branch = true
9494

95+
[tool.coverage.report]
96+
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]
97+
9598
[tool.pytest.ini_options]
9699

97100
xfail_strict = true
@@ -174,9 +177,6 @@ ignore = [
174177
"D205",
175178
"D212",
176179
"D213",
177-
# Allow backslashes in a docstring.
178-
# See https://click.palletsprojects.com/en/8.0.x/documentation/#preventing-rewrapping.
179-
"D301",
180180
# It is too much work to make every docstring imperative.
181181
"D401",
182182
# We ignore some docstyle errors which do not apply to Google style
@@ -188,14 +188,9 @@ ignore = [
188188
"N818",
189189
# Ignore "too-many-*" errors as they seem to get in the way more than
190190
# helping.
191-
"PLR0912",
192191
"PLR0913",
193192
# Allow 'assert' as we use it for tests.
194193
"S101",
195-
# Allow imports which are only used for type checking to be outside type
196-
# checking blocks.
197-
"TCH002",
198-
"TCH003",
199194
]
200195

201196
[tool.ruff.per-file-ignores]

src/vws/query.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from __future__ import annotations
66

77
import datetime
8-
import io
98
from http import HTTPStatus
9+
from typing import TYPE_CHECKING
1010
from urllib.parse import urljoin
1111

1212
import requests
@@ -27,6 +27,9 @@
2727
from vws.include_target_data import CloudRecoIncludeTargetData
2828
from vws.reports import QueryResult, TargetData
2929

30+
if TYPE_CHECKING:
31+
import io
32+
3033

3134
class CloudRecoService:
3235
"""

src/vws/vws.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
from __future__ import annotations
66

77
import base64
8-
import io
98
import json
109
from datetime import date
1110
from time import sleep
11+
from typing import TYPE_CHECKING
1212
from urllib.parse import urljoin
1313

1414
import requests
@@ -47,6 +47,9 @@
4747
TargetSummaryReport,
4848
)
4949

50+
if TYPE_CHECKING:
51+
import io
52+
5053

5154
def _target_api_request(
5255
server_access_key: str,

tests/test_vws.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
import base64
88
import datetime
9-
import io
109
import random
1110
import uuid
11+
from typing import TYPE_CHECKING
1212

1313
import pytest
1414
from freezegun import freeze_time
@@ -23,6 +23,9 @@
2323
TargetSummaryReport,
2424
)
2525

26+
if TYPE_CHECKING:
27+
import io
28+
2629

2730
class TestAddTarget:
2831
"""

0 commit comments

Comments
 (0)