-
Notifications
You must be signed in to change notification settings - Fork 159
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
Fixing prepare step bug #450
Conversation
Makes sense to me. It's not obvious from the docstring what type Also, we could potentially consider starting to use PEP 484-style comments to define types. |
@milliams I'll glance at the links later but I just wanted to make sure I don't end up with a huge commit addressing lots of bugs again in the future. |
OK, frankly this is why I prefer strong typed languages. I've no idea what to do with the documentation I'm simply going to add a line stating that this is expected to be a string due to the |
Adding another docstring line for reasons
For the record the Google-style docstring looks like: def copyIntoPrepDir(self, obj2copy):
"""
Copy a file into the prepared state dir of this application
Args:
obj2copy (str): the path to the file to be copied
""" And if you wanted to use PEP 484 comment, then it would look like: def copyIntoPrepDir(self, obj2copy):
# type: (str) -> None
"""
Copy a file into the prepared state dir of this application
Args:
obj2copy (str): the path to the file to be copied
""" |
@milliams so what are we looking to standardize on? |
For now I think just the docstring format is needed, so the first of the two. The latter is only useful if we start running static analysis tools like MyPy over Ganga or for those of us using PyCharm but until then they are arguably just noise. @alexanderrichards has been arguing for the former for a while now too. |
👍 Indeed I have 😄. e.g. def copyIntoPrepDir(self, obj2copy: str) -> None:
"""
Copy a file into the prepared state dir of this application
Args:
obj2copy (str): the path to the file to be copied
""" |
I'm not going to start reading documentation on documentation, it's too meta and full of a lot of confusion when I'm trying to get other work done. I'm sticking with the first example unless someone tells me otherwise. I want to fix and get this in so I can merge it into another branch where I want this functionality, |
I think we agree that the first example (The Google-style) one is the one we should aim for at the moment as we don't run any static analysis tools as I think that it is perfectly sufficient even when we do. The main reason I wanted us to do it this way is because it gives us the ability to auto-generate doc whilst maintaining the user friendly interactive help that users expect. |
@alexanderrichards I much prefer the inline style but that is restricted to Python 3 only. The comment style was added to the PEP in the last few months to be able to provide the feature for Python 2 and to provide a forwards compatibility path. @rob-c Doing documentation properly is part of the job I'm afraid. I'm not saying that you have to have an opinion on what is the best way but is is important in a collaborative project to help out your colleagues by documenting your work appropriately. |
Ah yes forgot that 😉 |
Adding documentation for reasons
@milliams |
@@ -34,9 +34,17 @@ class IPrepareApp(IApplication): | |||
_hidden = 1 | |||
|
|||
def __init__(self): | |||
""" | |||
default constructor | |||
""" |
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.
This comment does not add anything. In fact, this __init__
method should just be removed entirely.
Editing typos, removing function
More doc changes
OK, once the final round of tests pass I plan to merge this unless there are any objections |
@@ -45,7 +47,8 @@ def prepare(self, force=False): | |||
""" | |||
Base class for all applications which can be placed into a prepared\ | |||
state. | |||
|
|||
Args: | |||
force (bool) : Fforces the prepare function to be called no matter what when True |
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.
Type on 'Fforces'
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.
This is going to take another 20min for the sake of a typo. I'll merge the PR and edit it on develop
This cleans up some code in the IPrepareApp and gives a hook to allow derrived classes to quickly and easily copy a file into the prepared state folder during the prepare step.
This is useful for my LSST work where I'm already using this and it fixes a typo which was left from this function already existing 4x in the exiting code.