Skip to content

Commit ef2da63

Browse files
Set default values (from pdfRest) on optional client parameters
Assisted-by: Codex
1 parent 9ff3a86 commit ef2da63

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

src/pdfrest/client.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,7 +2136,7 @@ def summarize_text(
21362136
self,
21372137
file: PdfRestFile | Sequence[PdfRestFile],
21382138
*,
2139-
target_word_count: int | None = 400,
2139+
target_word_count: int = 400,
21402140
summary_format: SummaryFormat = "overview",
21412141
pages: PdfPageSelection | None = None,
21422142
output_format: SummaryOutputFormat = "markdown",
@@ -2183,7 +2183,7 @@ def summarize_text_to_file(
21832183
self,
21842184
file: PdfRestFile | Sequence[PdfRestFile],
21852185
*,
2186-
target_word_count: int | None = 400,
2186+
target_word_count: int = 400,
21872187
summary_format: SummaryFormat = "overview",
21882188
pages: PdfPageSelection | None = None,
21892189
output_format: SummaryOutputFormat = "markdown",
@@ -2222,7 +2222,7 @@ def convert_to_markdown(
22222222
file: PdfRestFile | Sequence[PdfRestFile],
22232223
*,
22242224
pages: PdfPageSelection | None = None,
2225-
page_break_comments: bool | None = None,
2225+
page_break_comments: bool = False,
22262226
output: str | None = None,
22272227
extra_query: Query | None = None,
22282228
extra_headers: AnyMapping | None = None,
@@ -2234,11 +2234,10 @@ def convert_to_markdown(
22342234
payload: dict[str, Any] = {
22352235
"files": file,
22362236
"output_type": "file",
2237+
"page_break_comments": page_break_comments,
22372238
}
22382239
if pages is not None:
22392240
payload["pages"] = pages
2240-
if page_break_comments is not None:
2241-
payload["page_break_comments"] = page_break_comments
22422241
if output is not None:
22432242
payload["output"] = output
22442243

@@ -3000,7 +2999,7 @@ def convert_to_jpeg(
30002999
smoothing: Literal["none", "all", "text", "line", "image"]
30013000
| Sequence[Literal["none", "all", "text", "line", "image"]]
30023001
| None = None,
3003-
jpeg_quality: int | None = None,
3002+
jpeg_quality: int = 75,
30043003
extra_query: Query | None = None,
30053004
extra_headers: AnyMapping | None = None,
30063005
extra_body: Body | None = None,
@@ -3012,15 +3011,14 @@ def convert_to_jpeg(
30123011
"files": files,
30133012
"resolution": resolution,
30143013
"color_model": color_model,
3014+
"jpeg_quality": jpeg_quality,
30153015
}
30163016
if output_prefix is not None:
30173017
payload["output_prefix"] = output_prefix
30183018
if page_range is not None:
30193019
payload["page_range"] = page_range
30203020
if smoothing is not None:
30213021
payload["smoothing"] = smoothing
3022-
if jpeg_quality is not None:
3023-
payload["jpeg_quality"] = jpeg_quality
30243022

30253023
return self._convert_to_graphic(
30263024
endpoint="/jpg",
@@ -3146,7 +3144,7 @@ async def summarize_text(
31463144
self,
31473145
file: PdfRestFile | Sequence[PdfRestFile],
31483146
*,
3149-
target_word_count: int | None = 400,
3147+
target_word_count: int = 400,
31503148
summary_format: SummaryFormat = "overview",
31513149
pages: PdfPageSelection | None = None,
31523150
output_format: SummaryOutputFormat = "markdown",
@@ -3193,7 +3191,7 @@ async def summarize_text_to_file(
31933191
self,
31943192
file: PdfRestFile | Sequence[PdfRestFile],
31953193
*,
3196-
target_word_count: int | None = 400,
3194+
target_word_count: int = 400,
31973195
summary_format: SummaryFormat = "overview",
31983196
pages: PdfPageSelection | None = None,
31993197
output_format: SummaryOutputFormat = "markdown",
@@ -3232,7 +3230,7 @@ async def convert_to_markdown(
32323230
file: PdfRestFile | Sequence[PdfRestFile],
32333231
*,
32343232
pages: PdfPageSelection | None = None,
3235-
page_break_comments: bool | None = None,
3233+
page_break_comments: bool = False,
32363234
output: str | None = None,
32373235
extra_query: Query | None = None,
32383236
extra_headers: AnyMapping | None = None,
@@ -3244,11 +3242,10 @@ async def convert_to_markdown(
32443242
payload: dict[str, Any] = {
32453243
"files": file,
32463244
"output_type": "file",
3245+
"page_break_comments": page_break_comments,
32473246
}
32483247
if pages is not None:
32493248
payload["pages"] = pages
3250-
if page_break_comments is not None:
3251-
payload["page_break_comments"] = page_break_comments
32523249
if output is not None:
32533250
payload["output"] = output
32543251

@@ -4052,7 +4049,7 @@ async def convert_to_jpeg(
40524049
smoothing: Literal["none", "all", "text", "line", "image"]
40534050
| Sequence[Literal["none", "all", "text", "line", "image"]]
40544051
| None = None,
4055-
jpeg_quality: int | None = None,
4052+
jpeg_quality: int = 75,
40564053
extra_query: Query | None = None,
40574054
extra_headers: AnyMapping | None = None,
40584055
extra_body: Body | None = None,
@@ -4064,15 +4061,14 @@ async def convert_to_jpeg(
40644061
"files": files,
40654062
"resolution": resolution,
40664063
"color_model": color_model,
4064+
"jpeg_quality": jpeg_quality,
40674065
}
40684066
if output_prefix is not None:
40694067
payload["output_prefix"] = output_prefix
40704068
if page_range is not None:
40714069
payload["page_range"] = page_range
40724070
if smoothing is not None:
40734071
payload["smoothing"] = smoothing
4074-
if jpeg_quality is not None:
4075-
payload["jpeg_quality"] = jpeg_quality
40764072

40774073
return await self._convert_to_graphic(
40784074
endpoint="/jpg",

0 commit comments

Comments
 (0)