Skip to content

Commit f35f190

Browse files
fix linting CI failures
1 parent af91379 commit f35f190

11 files changed

Lines changed: 30 additions & 29 deletions

File tree

src/datacustomcode/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def do_oauth_browser_flow(
170170

171171
# Start callback server
172172
click.echo(f"\nStarting local callback server on {redirect_uri}...")
173-
server, actual_port = _run_oauth_callback_server(redirect_uri, auth_code_queue)
173+
server, _actual_port = _run_oauth_callback_server(redirect_uri, auth_code_queue)
174174

175175
# Build authorization URL with final redirect_uri
176176
auth_url = (

src/datacustomcode/cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,6 @@ def _cmd_output(
104104

105105

106106
def cmd_output(*cmd: str, **kwargs: Any) -> Union[str, None]:
107-
returncode, stdout_b, stderr_b = _cmd_output(*cmd, **kwargs)
107+
_returncode, stdout_b, _stderr_b = _cmd_output(*cmd, **kwargs)
108108
stdout = stdout_b.decode() if stdout_b is not None else None
109109
return stdout

src/datacustomcode/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
# This lets all readers and writers to be findable via config
3838
from datacustomcode.io import * # noqa: F403
3939
from datacustomcode.io.base import BaseDataAccessLayer
40-
from datacustomcode.io.reader.base import BaseDataCloudReader # noqa: TCH002
41-
from datacustomcode.io.writer.base import BaseDataCloudWriter # noqa: TCH002
40+
from datacustomcode.io.reader.base import BaseDataCloudReader
41+
from datacustomcode.io.writer.base import BaseDataCloudWriter
4242
from datacustomcode.spark.base import BaseSparkSessionProvider
4343

4444
if TYPE_CHECKING:
@@ -53,7 +53,7 @@ class AccessLayerObjectConfig(BaseObjectConfig, Generic[_T]):
5353

5454
def to_object(self, spark: SparkSession) -> _T:
5555
type_ = self.type_base.subclass_from_config_name(self.type_config_name)
56-
return cast(_T, type_(spark=spark, **self.options))
56+
return cast("_T", type_(spark=spark, **self.options))
5757

5858

5959
class SparkConfig(ForceableConfig):
@@ -78,7 +78,7 @@ class SparkProviderConfig(BaseObjectConfig, Generic[_P]):
7878

7979
def to_object(self) -> _P:
8080
type_ = self.type_base.subclass_from_config_name(self.type_config_name)
81-
return cast(_P, type_(**self.options))
81+
return cast("_P", type_(**self.options))
8282

8383

8484
class ClientConfig(BaseConfig):

src/datacustomcode/einstein_predictions_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class EinsteinPredictionsObjectConfig(BaseObjectConfig, Generic[_E]):
3737

3838
def to_object(self) -> _E:
3939
type_ = self.type_base.subclass_from_config_name(self.type_config_name)
40-
return cast(_E, type_(**self.options))
40+
return cast("_E", type_(**self.options))
4141

4242

4343
class EinsteinPredictionsConfig(BaseConfig):

src/datacustomcode/llm_gateway/default.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
Optional,
2020
)
2121

22-
from loguru import logger
2322
import requests
23+
from loguru import logger
2424

2525
from datacustomcode.einstein_platform_client import EinsteinPlatformClient
26-
27-
2826
from datacustomcode.llm_gateway.base import LLMGateway
2927
from datacustomcode.llm_gateway.types.generate_text_request import GenerateTextRequest
3028
from datacustomcode.llm_gateway.types.generate_text_response import GenerateTextResponse
@@ -50,9 +48,7 @@ def generate_text(self, request: GenerateTextRequest) -> GenerateTextResponse:
5048
f"{request.model_name}/generations"
5149
)
5250

53-
payload: Dict[str, Any] = {
54-
"prompt": request.prompt
55-
}
51+
payload: Dict[str, Any] = {"prompt": request.prompt}
5652

5753
if request.localization:
5854
payload["localization"] = request.localization
@@ -76,6 +72,5 @@ def generate_text(self, request: GenerateTextRequest) -> GenerateTextResponse:
7672
raise RuntimeError(f"Generate text request failed: {e}") from e
7773

7874
return GenerateTextResponse(
79-
status_code=response.status_code,
80-
data=self.parse_response(response)
75+
status_code=response.status_code, data=self.parse_response(response)
8176
)

src/datacustomcode/llm_gateway_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class LLMGatewayObjectConfig(BaseObjectConfig, Generic[_E]):
3737

3838
def to_object(self) -> _E:
3939
type_ = self.type_base.subclass_from_config_name(self.type_config_name)
40-
return cast(_E, type_(**self.options))
40+
return cast("_E", type_(**self.options))
4141

4242

4343
class LLMGatewayConfig(BaseConfig):

src/datacustomcode/templates/function/payload/entrypoint.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,28 @@ def make_einstein_prediction(runtime: Runtime) -> None:
6060

6161
prediction_response = runtime.einstein_predictions.predict(prediction_request)
6262
print(
63-
f"Einstein prediction results - success: [{prediction_response.is_success}] \
64-
response data: {prediction_response.data}"
63+
f"Einstein prediction results - success: [{prediction_response.is_success}] "
64+
f"response data: {prediction_response.data}"
6565
)
6666

6767

6868
def generate_text(runtime: Runtime):
6969
builder = GenerateTextRequestBuilder()
70-
llm_request = builder.set_prompt("Generate 2 dog names").\
71-
set_model("sfdc_ai__DefaultGPT52").build()
70+
llm_request = (
71+
builder.set_prompt("Generate 2 dog names")
72+
.set_model("sfdc_ai__DefaultGPT52")
73+
.build()
74+
)
7275
llm_response = runtime.llm_gateway.generate_text(llm_request)
7376

7477
if llm_response.is_success:
7578
print(llm_response.text)
7679
else:
7780
print(llm_response.error_code)
7881

82+
83+
84+
7985
def function(request: dict, runtime: Runtime) -> dict:
8086
logger.info("Inside Function")
8187
logger.info(request)

tests/file/test_path_default.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_find_file_path_file_not_found(self):
7272

7373
with pytest.raises(
7474
FileNotFoundError,
75-
match="File 'test.txt' not found in any search location",
75+
match=r"File 'test\.txt' not found in any search location",
7676
):
7777
finder.find_file_path("test.txt")
7878

tests/test_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def test_run_oauth_callback_server_valid_uri(
148148
mock_server.server_address = ("localhost", 5555)
149149
mock_tcpserver.return_value = mock_server
150150

151-
server, port = _run_oauth_callback_server(redirect_uri, auth_code_queue)
151+
_server, port = _run_oauth_callback_server(redirect_uri, auth_code_queue)
152152

153153
assert port == 5555
154154
mock_tcpserver.assert_called_once()
@@ -186,7 +186,7 @@ def test_run_oauth_callback_server_different_port(
186186
mock_server.server_address = ("localhost", 8080)
187187
mock_tcpserver.return_value = mock_server
188188

189-
server, port = _run_oauth_callback_server(redirect_uri, auth_code_queue)
189+
_server, port = _run_oauth_callback_server(redirect_uri, auth_code_queue)
190190

191191
assert port == 8080
192192
mock_tcpserver.assert_called_once()

tests/test_deploy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ def test_verify_data_transform_config_missing(self, mock_exists):
907907
mock_exists.return_value = False
908908
with pytest.raises(
909909
FileNotFoundError,
910-
match="config.json not found at /test/dir/payload/config.json",
910+
match=r"config\.json not found at /test/dir/payload/config\.json",
911911
):
912912
get_config("/test/dir/payload")
913913

@@ -918,7 +918,7 @@ def test_verify_data_transform_config_invalid_json(self, mock_file, mock_exists)
918918
mock_exists.return_value = True
919919
with pytest.raises(
920920
ValueError,
921-
match="config.json at /test/dir/payload/config.json is not valid JSON",
921+
match=r"config\.json at /test/dir/payload/config\.json is not valid JSON",
922922
):
923923
get_config("/test/dir/payload")
924924

@@ -929,8 +929,8 @@ def test_verify_data_transform_config_missing_fields(self, mock_file, mock_exist
929929
mock_exists.return_value = True
930930
with pytest.raises(
931931
ValueError,
932-
match="config.json at /test/dir/payload/config.json is missing "
933-
"required fields: entryPoint, dataspace, permissions",
932+
match=r"config\.json at /test/dir/payload/config\.json is missing "
933+
r"required fields: entryPoint, dataspace, permissions",
934934
):
935935
get_config("/test/dir/payload")
936936

0 commit comments

Comments
 (0)