-
Notifications
You must be signed in to change notification settings - Fork 8
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
Hack to special case *args and *kwargs in args/parameter lists #27
base: master
Are you sure you want to change the base?
Conversation
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.
Looks like a valid hack 😄
Looks like GitHub didn't run... curious. We ought to run this on a large test set before including this on a release. |
Using pyquil (previously tested with this package), the changes on this pull request make no difference:
Interesting case in https://github.com/rigetti/pyquil/blob/v2.19.0/pyquil/simulation/tests/test_numpy.py#L273 which has one naughty def kron(*matrices: np.ndarray) -> np.ndarray:
"""Computes the kronecker product of a sequence of matrices.
A *args version of lambda args: functools.reduce(np.kron, args).
Args:
*matrices: The matrices and controls to combine with the kronecker
product.
Returns:
The resulting matrix.
"""
.... Could potentially inspect the function definition to decide which starred variable names to check for and thus ignore |
Similar in astropy, plenty of examples where the variable names are not |
This needs a little refactoring now... rebasing. |
Note Astropy uses colon and type/optional annotation
CodeClimate is rightly critical of the style of this fix. |
This might solve #18, but at the cost of hiding some true misuse of italics or bold within the same docstring. Might be worthwhile all the same?
(This is a bit of a surface level hack - A more precise fix would need deeper integration into the docutils internals)