-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide type hint information for users #126
Conversation
# FIXME: feedparser includes py.typed file after 7.x. | ||
import feedparser # type: ignore[import-untyped] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max_results: float = float("inf"), | ||
max_results: int = cast(int, float("inf")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float("inf")
treats as int
in type level.
# FIXME: `self.pdf_url` is possibly `None` and following code raises `TypeError`. | ||
written_path, _ = urlretrieve(self.pdf_url, path) # type: ignore[arg-type] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arxiv.Result._get_pdf_url([])
returns None
and it raises TypeError
in this line.
# FIXME: `self.pdf_url` is possibly `None` and following code raises `AttributeError`. | ||
source_url = self.pdf_url.replace("/pdf/", "/src/") # type: ignore[union-attr] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arxiv.Result._get_pdf_url([])
returns None
and it raises AttributeError
in this line.
@eggplants thanks for submitting this. I'm running a bit behind on reviews — this interacts with #124, which is also in my review queue. Thanks for your patience 🙇 |
Description
I have introduced mypy and fixed some errors. And then I have added
py.typed
file topackage_data
to mark this package is typed. (See PEP561)Breaking changes
The annotation of
Search.max_results
changes fromfloat
intoint
. If the instance variable isfloat
like10.0
, the Arxiv API raisesmax_results must be an integer
.https://export.arxiv.org/api/query?search_query=all:electron&max_results=10.0
Relevant issues
Not found.
Checklist
...