Skip to content

Commit c3c2541

Browse files
fix: formatting for ruff.
1 parent 519f831 commit c3c2541

21 files changed

+98
-199
lines changed

jigsawstack/async_request.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,7 @@ async def make_request(
250250
form_data.add_field(
251251
"file",
252252
BytesIO(data),
253-
content_type=headers.get(
254-
"Content-Type", "application/octet-stream"
255-
),
253+
content_type=headers.get("Content-Type", "application/octet-stream"),
256254
filename="file",
257255
)
258256

jigsawstack/embedding.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ def __init__(
4747
@overload
4848
def execute(self, params: EmbeddingParams) -> EmbeddingResponse: ...
4949
@overload
50-
def execute(
51-
self, blob: bytes, options: EmbeddingParams = None
52-
) -> EmbeddingResponse: ...
50+
def execute(self, blob: bytes, options: EmbeddingParams = None) -> EmbeddingResponse: ...
5351

5452
def execute(
5553
self,
@@ -101,9 +99,7 @@ def __init__(
10199
@overload
102100
async def execute(self, params: EmbeddingParams) -> EmbeddingResponse: ...
103101
@overload
104-
async def execute(
105-
self, blob: bytes, options: EmbeddingParams = None
106-
) -> EmbeddingResponse: ...
102+
async def execute(self, blob: bytes, options: EmbeddingParams = None) -> EmbeddingResponse: ...
107103

108104
async def execute(
109105
self,

jigsawstack/embedding_v2.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ def __init__(
4545
@overload
4646
def execute(self, params: EmbeddingV2Params) -> EmbeddingV2Response: ...
4747
@overload
48-
def execute(
49-
self, blob: bytes, options: EmbeddingV2Params = None
50-
) -> EmbeddingV2Response: ...
48+
def execute(self, blob: bytes, options: EmbeddingV2Params = None) -> EmbeddingV2Response: ...
5149

5250
def execute(
5351
self,

jigsawstack/helpers.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
from urllib.parse import urlencode
33

44

5-
def build_path(
6-
base_path: str, params: Optional[Dict[str, Union[str, int, bool]]] = None
7-
) -> str:
5+
def build_path(base_path: str, params: Optional[Dict[str, Union[str, int, bool]]] = None) -> str:
86
"""
97
Build an API endpoint path with query parameters.
108
@@ -20,9 +18,7 @@ def build_path(
2018

2119
# remove None values from the parameters
2220
filtered_params = {
23-
k: str(v).lower() if isinstance(v, bool) else v
24-
for k, v in params.items()
25-
if v is not None
21+
k: str(v).lower() if isinstance(v, bool) else v for k, v in params.items() if v is not None
2622
}
2723

2824
# encode the parameters

jigsawstack/image_generation.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ def __init__(
9292
api_url: str,
9393
disable_request_logging: Union[bool, None] = False,
9494
):
95-
super().__init__(
96-
api_key, api_url, disable_request_logging=disable_request_logging
97-
)
95+
super().__init__(api_key, api_url, disable_request_logging=disable_request_logging)
9896
self.config = RequestConfig(
9997
api_url=api_url,
10098
api_key=api_key,
@@ -123,9 +121,7 @@ def __init__(
123121
api_url: str,
124122
disable_request_logging: Union[bool, None] = False,
125123
):
126-
super().__init__(
127-
api_key, api_url, disable_request_logging=disable_request_logging
128-
)
124+
super().__init__(api_key, api_url, disable_request_logging=disable_request_logging)
129125
self.config = RequestConfig(
130126
api_url=api_url,
131127
api_key=api_key,

jigsawstack/prompt_engine.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,10 @@ def create(self, params: PromptEngineCreateParams) -> PromptEngineCreateResponse
119119

120120
def get(self, id: str) -> PromptEngineGetResponse:
121121
path = f"/prompt_engine/{id}"
122-
resp = Request(
123-
config=self.config, path=path, params={}, verb="get"
124-
).perform_with_content()
122+
resp = Request(config=self.config, path=path, params={}, verb="get").perform_with_content()
125123
return resp
126124

127-
def list(
128-
self, params: Union[PromptEngineListParams, None] = None
129-
) -> PromptEngineListResponse:
125+
def list(self, params: Union[PromptEngineListParams, None] = None) -> PromptEngineListResponse:
130126
if params is None:
131127
params = {}
132128

@@ -141,9 +137,7 @@ def list(
141137
base_path="/prompt_engine",
142138
params=params,
143139
)
144-
resp = Request(
145-
config=self.config, path=path, params={}, verb="get"
146-
).perform_with_content()
140+
resp = Request(config=self.config, path=path, params={}, verb="get").perform_with_content()
147141
return resp
148142

149143
def delete(self, id: str) -> PromptEngineDeleteResponse:
@@ -219,9 +213,7 @@ def __init__(
219213
disable_request_logging=disable_request_logging,
220214
)
221215

222-
async def create(
223-
self, params: PromptEngineCreateParams
224-
) -> PromptEngineCreateResponse:
216+
async def create(self, params: PromptEngineCreateParams) -> PromptEngineCreateResponse:
225217
path = "/prompt_engine"
226218
resp = await AsyncRequest(
227219
config=self.config,

jigsawstack/request.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ def perform_file(self) -> Union[T, None]:
9191
# handle error in case there is a statusCode attr present
9292
# and status != 200 and response is a json.
9393

94-
if (
95-
"application/json" not in resp.headers["content-type"]
96-
and resp.status_code != 200
97-
):
94+
if "application/json" not in resp.headers["content-type"] and resp.status_code != 200:
9895
raise_for_code_and_type(
9996
code=500,
10097
message="Failed to parse JigsawStack API response. Please try again.",

jigsawstack/search.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,7 @@ async def search(self, params: SearchParams) -> SearchResponse:
319319
).perform_with_content()
320320
return resp
321321

322-
async def suggestions(
323-
self, params: SearchSuggestionsParams
324-
) -> SearchSuggestionsResponse:
322+
async def suggestions(self, params: SearchSuggestionsParams) -> SearchSuggestionsResponse:
325323
query = params["query"]
326324
path = f"/web/search/suggest?query={query}"
327325
resp = await AsyncRequest(

jigsawstack/store.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ class FileUploadResponse(TypedDict):
2323
key: str
2424
url: str
2525
size: int
26-
temp_public_url: NotRequired[
27-
str
28-
] # Optional, only if temp_public_url is set to True in params
26+
temp_public_url: NotRequired[str] # Optional, only if temp_public_url is set to True in params
2927

3028

3129
class Store(ClientConfig):

jigsawstack/vision.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,7 @@ def vocr(
218218
return resp
219219

220220
@overload
221-
def object_detection(
222-
self, params: ObjectDetectionParams
223-
) -> ObjectDetectionResponse: ...
221+
def object_detection(self, params: ObjectDetectionParams) -> ObjectDetectionResponse: ...
224222
@overload
225223
def object_detection(
226224
self, blob: bytes, options: ObjectDetectionParams = None
@@ -307,9 +305,7 @@ async def vocr(
307305
return resp
308306

309307
@overload
310-
async def object_detection(
311-
self, params: ObjectDetectionParams
312-
) -> ObjectDetectionResponse: ...
308+
async def object_detection(self, params: ObjectDetectionParams) -> ObjectDetectionResponse: ...
313309
@overload
314310
async def object_detection(
315311
self, blob: bytes, options: ObjectDetectionParams = None

0 commit comments

Comments
 (0)