Skip to content

Commit 8a9e8f0

Browse files
Fixing lint error
1 parent 2c17783 commit 8a9e8f0

6 files changed

Lines changed: 19 additions & 13 deletions

File tree

src/datacustomcode/cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ def deploy(
249249
logger.info(f"Inferred use_in_feature: {use_in_feature}")
250250
else:
251251
click.secho(
252-
"Error: Could not infer function invoke options. Please provide --use-in-feature",
252+
"Error: Could not infer function invoke options. "
253+
"Please provide --use-in-feature",
253254
fg="red",
254255
)
255256
raise click.Abort()
@@ -331,7 +332,8 @@ def init(directory: str, code_type: str, use_in_feature: Optional[str]):
331332
click.echo(
332333
"Test your function locally with "
333334
+ click.style(
334-
f"datacustomcode run {entrypoint_path} --test-with {test_json_path}",
335+
f"datacustomcode run {entrypoint_path} "
336+
f"--test-with {test_json_path}",
335337
fg="blue",
336338
bold=True,
337339
)

src/datacustomcode/function_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ def inspect_function_types(
215215
Either can be None if not found or on error
216216
217217
Example:
218-
>>> request_name, response_name = inspect_function_types("payload/entrypoint.py")
218+
>>> request_name, response_name = inspect_function_types(
219+
... "payload/entrypoint.py"
220+
... )
219221
>>> print(request_name) # "SearchIndexChunkingV1Request"
220222
>>> print(response_name) # "SearchIndexChunkingV1Response"
221223
"""

src/datacustomcode/run.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ def run_function_with_test(entrypoint: str, test_file: str) -> None:
164164
load_function_module,
165165
)
166166

167-
# Import the entrypoint module in the current environment (with all dependencies loaded)
167+
# Import the entrypoint module in the current environment
168+
# (with all dependencies loaded)
168169
module = load_function_module(entrypoint, "entrypoint_module")
169170
function_callable = get_function_callable(module)
170171
request_type = get_request_type(entrypoint)

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def function(
6666
output=chunks,
6767
status=SearchIndexStatusResponse(
6868
status_type="success",
69-
status_message=f"Successfully chunked {len(request.input)} documents into {len(chunks)} chunks",
69+
status_message=(
70+
f"Successfully chunked {len(request.input)} documents "
71+
f"into {len(chunks)} chunks"
72+
),
7073
),
7174
)

tests/test_function_utils.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
@pytest.fixture
2929
def sample_entrypoint():
3030
"""Create a temporary entrypoint file with a function."""
31-
with tempfile.NamedTemporaryFile(
32-
mode="w", suffix=".py", delete=False
33-
) as temp_file:
31+
with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as temp_file:
3432
entrypoint_content = textwrap.dedent(
3533
"""
3634
from typing import List
@@ -62,9 +60,7 @@ def function(request: SampleRequest) -> SampleResponse:
6260
@pytest.fixture
6361
def entrypoint_no_annotations():
6462
"""Create an entrypoint with no type annotations."""
65-
with tempfile.NamedTemporaryFile(
66-
mode="w", suffix=".py", delete=False
67-
) as temp_file:
63+
with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as temp_file:
6864
entrypoint_content = textwrap.dedent(
6965
"""
7066
def function(request):
@@ -117,6 +113,7 @@ def test_inspect_function_types_static(sample_entrypoint, entrypoint_no_annotati
117113
assert req_name is None
118114
assert resp_name is None
119115

116+
120117
def test_inspect_function_types(sample_entrypoint):
121118
"""Test dynamic inspection of function types."""
122119
req_name, resp_name = function_utils.inspect_function_types(sample_entrypoint)
@@ -139,7 +136,7 @@ def test_get_request_type(sample_entrypoint, entrypoint_no_annotations):
139136

140137

141138
def test_generate_test_json():
142-
"""Test generating test.json file from entrypoint with simple and complex nested types."""
139+
"""Test generating test.json with simple and complex nested types."""
143140
temp_dir = tempfile.mkdtemp()
144141
models_file = os.path.join(temp_dir, "test_models.py")
145142

@@ -235,4 +232,4 @@ def function(request: ComplexRequest):
235232
if temp_dir in sys.path:
236233
sys.path.remove(temp_dir)
237234
if os.path.exists(temp_dir):
238-
shutil.rmtree(temp_dir)
235+
shutil.rmtree(temp_dir)

tests/test_sf_cli_contract.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def test_accepts_network_flag(
188188
result = runner.invoke(deploy, [*self._BASE_ARGS, "--network", "custom"])
189189
assert result.exit_code != 2, result.output
190190

191+
191192
class TestRunArgContract:
192193
"""
193194
SF CLI spawn:

0 commit comments

Comments
 (0)