Skip to content

Commit d77a731

Browse files
Refactored ruff rules
1 parent 8b51b3f commit d77a731

8 files changed

Lines changed: 20 additions & 36 deletions

File tree

pyproject.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,6 @@ ignore = [
137137
"PLR2004",
138138
# PLR0915: Too many statements (generated code has large functions)
139139
"PLR0915",
140-
# G004: Logging statement uses f-string (acceptable for performance)
141-
"G004",
142-
# B904: Within an `except` clause, raise exceptions with `raise ... from err`
143-
"B904",
144-
# RUF012: Mutable class attributes should be annotated with `typing.ClassVar` (generated code)
145-
"RUF012",
146140
# PLW1641: Object does not implement `__hash__` method (generated code)
147141
"PLW1641",
148142
# PYI063: Use PEP 570 syntax for positional-only parameters (backward compatibility)

src/conductor/client/adapters/models/bulk_response_adapter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
from typing import ClassVar, Dict
12
from conductor.client.codegen.models import BulkResponse
23

34

45
class BulkResponseAdapter(BulkResponse):
5-
swagger_types = {
6+
swagger_types: ClassVar[Dict[str, str]] = {
67
"bulk_error_results": "dict(str, str)",
78
"bulk_successful_results": "list[str]",
89
"message": "str",
910
}
1011

11-
attribute_map = {
12+
attribute_map: ClassVar[Dict[str, str]] = {
1213
"bulk_error_results": "bulkErrorResults",
1314
"bulk_successful_results": "bulkSuccessfulResults",
1415
"message": "message",

src/conductor/client/adapters/models/health.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import ClassVar, Dict
12
import pprint
23
import re # noqa: F401
34

@@ -17,13 +18,13 @@ class Health(object):
1718
attribute_map (dict): The key is attribute name
1819
and the value is json key in definition.
1920
"""
20-
swagger_types = {
21+
swagger_types: ClassVar[Dict[str, str]] = {
2122
"details": "dict(str, object)",
2223
"error_message": "str",
2324
"healthy": "bool",
2425
}
2526

26-
attribute_map = {
27+
attribute_map: ClassVar[Dict[str, str]] = {
2728
"details": "details",
2829
"error_message": "errorMessage",
2930
"healthy": "healthy",

src/conductor/client/adapters/models/health_check_status.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import ClassVar, Dict
12
import pprint
23

34
import six
@@ -16,13 +17,13 @@ class HealthCheckStatus(object):
1617
attribute_map (dict): The key is attribute name
1718
and the value is json key in definition.
1819
"""
19-
swagger_types = {
20+
swagger_types: ClassVar[Dict[str, str]] = {
2021
"health_results": "list[Health]",
2122
"suppressed_health_results": "list[Health]",
2223
"healthy": "bool",
2324
}
2425

25-
attribute_map = {
26+
attribute_map: ClassVar[Dict[str, str]] = {
2627
"health_results": "healthResults",
2728
"suppressed_health_results": "suppressedHealthResults",
2829
"healthy": "healthy",

src/conductor/client/adapters/models/integration_def_api_adapter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import ClassVar, Dict
12
import pprint
23

34
import six
@@ -12,15 +13,15 @@ class IntegrationDefApi(object): # Model from v5.2.6 spec
1213
and the value is json key in definition.
1314
"""
1415

15-
swagger_types = {
16+
swagger_types: ClassVar[Dict[str, str]] = {
1617
"api": "str",
1718
"description": "str",
1819
"input_schema": "SchemaDef",
1920
"integration_type": "str",
2021
"output_schema": "SchemaDef",
2122
}
2223

23-
attribute_map = {
24+
attribute_map: ClassVar[Dict[str, str]] = {
2425
"api": "api",
2526
"description": "description",
2627
"input_schema": "inputSchema",

src/conductor/client/adapters/models/state_change_event_adapter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from enum import Enum
4-
from typing import Dict, List, Union, Optional
4+
from typing import ClassVar, Dict, List, Union, Optional
55

66
from typing_extensions import Self
77

@@ -17,9 +17,9 @@ class StateChangeEventType(Enum):
1717

1818

1919
class StateChangeConfig:
20-
swagger_types = {"type": "str", "events": "list[StateChangeEvent]"}
20+
swagger_types: ClassVar[Dict[str, str]] = {"type": "str", "events": "list[StateChangeEvent]"}
2121

22-
attribute_map = {"type": "type", "events": "events"}
22+
attribute_map: ClassVar[Dict[str, str]] = {"type": "type", "events": "events"}
2323

2424
# Keep original init for backward compatibility
2525
def __init__(

src/conductor/client/adapters/models/task_result_adapter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ def status(self, status):
1515
if isinstance(status, str):
1616
try:
1717
status = TaskResultStatus(status)
18-
except ValueError:
18+
except ValueError as e:
1919
raise ValueError(
2020
f"Invalid value for `status` ({status}), must be one of {[e.value for e in TaskResultStatus]}"
21-
)
21+
) from e
2222
elif not isinstance(status, TaskResultStatus):
2323
raise TypeError(f"status must be a TaskStatus enum or string, got {type(status)}")
2424

src/conductor/client/adapters/rest_adapter.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,7 @@ def __init__(self, response: Response):
2828

2929
# Log HTTP protocol version
3030
http_version = getattr(response, "http_version", "Unknown")
31-
logger.debug(f"HTTP response received - Status: {self.status}, Protocol: {http_version}")
32-
33-
# Log HTTP/2 usage
34-
if http_version == "HTTP/2":
35-
logger.info(f"HTTP/2 connection established - URL: {response.url}")
36-
elif http_version == "HTTP/1.1":
37-
logger.debug(f"HTTP/1.1 connection used - URL: {response.url}")
38-
else:
39-
logger.debug(f"HTTP protocol version: {http_version} - URL: {response.url}")
31+
logger.debug("HTTP response received - Status: %s, Protocol: %s", self.status, http_version)
4032

4133
def getheaders(self):
4234
"""Get response headers."""
@@ -123,18 +115,12 @@ def close(self):
123115
def check_http2_support(self, url: str) -> bool:
124116
"""Check if the server supports HTTP/2 by making a test request."""
125117
try:
126-
logger.info(f"Checking HTTP/2 support for: {url}")
127118
response = self.GET(url)
128119
is_http2 = response.is_http2()
129120

130-
if is_http2:
131-
logger.info(f"✓ HTTP/2 supported by {url}")
132-
else:
133-
logger.info(f"✗ HTTP/2 not supported by {url}, using {response.http_version}")
134-
135121
return is_http2
136122
except Exception as e:
137-
logger.error(f"Failed to check HTTP/2 support for {url}: {e}")
123+
logger.error("Failed to check HTTP/2 support for %s: %s", url, e)
138124
return False
139125

140126
def request(
@@ -185,7 +171,7 @@ def request(
185171

186172
try:
187173
# Log the request attempt
188-
logger.debug(f"Making HTTP request - Method: {method}, URL: {url}")
174+
logger.debug("Making HTTP request - Method: %s, URL: %s", method, url)
189175
# Prepare request parameters
190176
request_kwargs = {
191177
"method": method,

0 commit comments

Comments
 (0)