The year_low and year_high parameters in search_pubs and _construct_url are annotated as int but default to None, which means they should be Optional[int].
Affected methods:
_Scholarly.search_pubs (scholarly/_scholarly.py:93-94)
_Scholarly._construct_url (scholarly/_scholarly.py:572-573)
This causes type checkers (e.g., ty, mypy, pyright) to incorrectly flag passing None or int | None values as invalid:
error[invalid-argument-type]: Argument to bound method search_pubs is incorrect
year_low=..., Expected `int`, found `int | None`
The code already handles None internally (lines 579-580 check if year_low is not None), so the fix is simply to update the annotations to Optional[int].
The
year_lowandyear_highparameters insearch_pubsand_construct_urlare annotated asintbut default toNone, which means they should beOptional[int].Affected methods:
_Scholarly.search_pubs(scholarly/_scholarly.py:93-94)_Scholarly._construct_url(scholarly/_scholarly.py:572-573)This causes type checkers (e.g.,
ty,mypy,pyright) to incorrectly flag passingNoneorint | Nonevalues as invalid:The code already handles
Noneinternally (lines 579-580 checkif year_low is not None), so the fix is simply to update the annotations toOptional[int].