-
Notifications
You must be signed in to change notification settings - Fork 36
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
numpydoc style(signac/contrib/job.py) #319
Conversation
pass | ||
|
||
def save(self): | ||
""" """ | ||
for job in self.jobs: | ||
job._reset_sp() |
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 am not sure what class _sp_save_hook
does, what should I add in its doc string?
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.
Maybe just say "used to override default save and load behavior for synced data structures" in the class description? @vyasr @mikemhenry Any other ideas? The entire class is internal, so the comments could be more oriented towards developers instead of users.
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.
Definitely agree that the docs should be more for developers. The goal of the _sp_save_hook
is to force the job's statepoint resetting to happen whenever the statepoint is changed. Resetting a statepoint requires recomputing the hash and moving the folder, which is outside the scope of just what the synced dict does, so that's what this documentation should indicate.
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.
thanks for the details, I have added the doc string accordingly.
Codecov Report
@@ Coverage Diff @@
## numpy_docs #319 +/- ##
===========================================
Coverage 76.19% 76.20%
===========================================
Files 43 43
Lines 7079 7080 +1
===========================================
+ Hits 5394 5395 +1
Misses 1685 1685
Continue to review full report at Codecov.
|
@mikemhenry @tommy-waltmann i have added all of the docstrings i can. Can you please help with the rest! |
signac/contrib/job.py
Outdated
@@ -23,14 +23,22 @@ | |||
|
|||
|
|||
class _sp_save_hook(object): | |||
""" |
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.
Maybe something like "Force the job's statepoint to reset to whenever the statepoint is changed. Resetting a statepoint requires recomputing the hash and moving the folder"
persistent JSON file, use `job.document()` instead of `job.doc`. | ||
For more information, see :attr:`Job.statepoint` or | ||
:class:`~signac.JSONDict`. | ||
""" |
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.
We should keep this warning IMHO
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 think this got deleted by mistake.
signac/contrib/job.py
Outdated
Parameters | ||
---------- | ||
new_sp : | ||
new state point to be assign. |
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.
new state point to be assign. | |
new state point to be assigned. |
signac/contrib/job.py
Outdated
|
||
Raises | ||
------ | ||
|
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.
@mikemhenry @tommy-waltmann @vyasr what should I put in this?
signac/contrib/job.py
Outdated
|
||
Raises | ||
------ | ||
|
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.
@mikemhenry @tommy-waltmann @vyasr what should I put in this?
@ac-optimus if you don't see any exceptions raised inside a method, you can remove the |
@vyasr yes sure, actually my comments were related to the exceptions that are raised and I am confused with what to write in their descriptions. |
Oh sorry @ac-optimus that's my fault, I didn't realize that all of these functions were actually raising exceptions. Although you're asking about specific functions, this issue raises an important question about exactly what exceptions we should document. The numpydoc guide suggests that the |
Yes it does @vyasr . So according to that I should remove all the
and
|
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.
LGTM!
I took a quick glance at this PR. It seems like some docstrings might be indicating the wrong behavior or have the wrong types (e.g. iterables of jobs vs. a single job). Also I saw some rST errors with |
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 have a number of changes, but you should be able to just batch commit all my suggestions and then I think this is good. The only thing I'm somewhat uncertain about is how things like referring to Job
will work with numpydoc. I've looked online for examples because numpydoc's documentation doesn't say anything about it, and it seems like it should properly link with doing the :class:
-type domain prefix, but I don't know if there are any limitations to this. @ac-optimus it would be great if you could try and build this locally once to just see if the links work so that we know for future PRs.
sure, working on it... |
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.
Address the comments from @vyasr and I think we'll be good to go
@tommy-waltmann I think I have addressed them all. Any specific one, just in case I missed it? |
I was referring to trying to build the documentation locally to see if numpydoc works as we expect. Otherwise, I think this PR is in good shape. |
Yes, I tried it and even had conversation with @vyasr as well on slack. This is working fine! |
* numpydoc style(signac/contrib/schema.py) (#318) * numpydoc style(signac/contrib/project.py) (#320) * numpydoc style(signac/contrib/job.py) (#319) * numpydoc style(signac/contrib/linked_view.py, signac/contrib/utility.py, signac/core/utility.py) (#326) * numpydoc style(signac/contrib/errors.py, signac/contrib/filesystems.py, signac/contrib/filterparser.py, signac/contrib/hashing.py) (#322) * numpydoc style (signac/contrib/collection.py) (#329) * Make core submodule adhere to numpydoc conventions. (#339) * add a docstring for public module (#337) * numpydoc style (signac/contrib/import_export.py) (#333) * Apply NumPy docstyle to remaining files in "signac" root. (#343) * Apply fixes from minirst. (#356) * Enforce pydocstyle in core, common, contrib. (#354) Co-authored-by: Bradley Dice <[email protected]> Co-authored-by: Alyssa Travitz <[email protected]> Co-authored-by: Abhavya Chandra <[email protected]> Co-authored-by: vyasr <[email protected]> Co-authored-by: Pengji <[email protected]> Co-authored-by: Mike Henry <[email protected]>
Description
issue #315
Motivation and Context
Types of Changes
1The change breaks (or has the potential to break) existing functionality.
Checklist:
If necessary:
Change of doc string to
numpydoc
in schema.py