-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Improve type hints #7532
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Improve type hints #7532
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7532 +/- ##
==========================================
+ Coverage 92.69% 92.76% +0.06%
==========================================
Files 104 104
Lines 17409 17403 -6
==========================================
+ Hits 16138 16144 +6
+ Misses 1271 1259 -12
|
mu: np.ndarray | float, | ||
rng: Optional[np.random.Generator] = None, | ||
size: Optional[Tuple[int]] = None, | ||
rng: np.random.Generator | None = None, |
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.
For the example: mu is always np.ndarray, rng is always provided never None
f"Number of initval dicts ({len(overrides)}) does not match the number of chains ({chains})." | ||
return ipfns | ||
|
||
assert isinstance(overrides, Sequence) and len(overrides) == chains |
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.
Already checked above
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.
It's also related to the meaning of assert
. I see it less as a control flow, more as an executable comment. Converting this to a comment would leave the possibility that the comment goes out of date.
Is this function typically hot?
Also, asserts are disabled by python -O
, perhaps this is something that we could do?
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.
I don't think anyone ever disables asserts tbh
Description
Related Issue
Checklist
Type of change
📚 Documentation preview 📚: https://pymc--7532.org.readthedocs.build/en/7532/