Skip to content
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

Edit docstring in run_tardis #1723

Merged
merged 2 commits into from
Jul 22, 2021

Conversation

atharva-2001
Copy link
Member

@atharva-2001 atharva-2001 commented Jul 15, 2021

This edits the docstring in run_tardis function.

Description

The docstrings in run_tardis functions are incomplete and need to be edited.

Motivation and context

Resolves #1719

How has this been tested?

  • Testing pipeline.
  • Other.

Examples

Link to the API documentation

Type of change

  • Bug fix.
  • New feature.
  • Breaking change.
  • None of the above.

Checklist

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
    • (optional) I have built the documentation on my fork following the instructions.
  • I have assigned and requested two reviewers for this pull request.

@codecov
Copy link

codecov bot commented Jul 15, 2021

Codecov Report

Merging #1723 (e102585) into master (2c47baa) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1723   +/-   ##
=======================================
  Coverage   61.88%   61.88%           
=======================================
  Files          63       63           
  Lines        5851     5851           
=======================================
  Hits         3621     3621           
  Misses       2230     2230           
Impacted Files Coverage Δ
tardis/tardis/base.py 57.69% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c47baa...e102585. Read the comment docs.

tardis/base.py Outdated
log_state : str, optional
Set the level of the TARDIS logger. (Default level of the logger is set to CRITICAL.)
specific : bool, optional
If True, only show the log messages from a particular log level, set by `log_state`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain what happens if set to False.

tardis/base.py Outdated
virtual_packet_logging : bool, default False, optional
Option to enable virtual packet logging.
log_state : str, optional
Set the level of the TARDIS logger. (Default level of the logger is set to CRITICAL.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List options for this argument.

tardis/base.py Outdated
@@ -1,4 +1,4 @@
# functions that are important for the general usage of TARDIS
"""Functions that are important for the general usage of TARDIS."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep this as a regular comment.

@atharva-2001 atharva-2001 force-pushed the run_tardis_docstring branch from 314a6f5 to 3cd8c61 Compare July 15, 2021 17:11
@atharva-2001 atharva-2001 marked this pull request as ready for review July 15, 2021 17:11
@tardis-bot
Copy link
Contributor

Before a pull request is accepted, it must meet the following criteria:

  • Is the necessary information provided?
  • Is this a duplicate PR?
    • If a new PR is clearly a duplicate, ask how this PR is different from the original PR?
    • If this PR is about to be merged, close the original PR with a link to this new PR that solved the issue.
  • Does it pass existing tests and are new tests provided if required?
    • The test coverage should not decrease, and for new features should be close to 100%.
  • Is the code tidy?
    • No unnecessary print lines or code comments.

@atharva-2001 atharva-2001 force-pushed the run_tardis_docstring branch from 3cd8c61 to d3f2d79 Compare July 15, 2021 17:15
Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this necessary thing - there are few things I've commented.

Also make sure to get this merged first and then rebase #1636

tardis/base.py Outdated
[[callback1, callback_arg1], [callback2, callback_arg2], ...]
Where the callback function signature should look like:
callback_function(simulation, extra_arg1, ...)
virtual_packet_logging : bool, default False, optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you can write default values in parameter type, they should be in parameter description AFAIR

Copy link
Member Author

@atharva-2001 atharva-2001 Jul 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid the examples mentioned here have the default values next to parameter type, that's why I used it.
I didn't follow that convention in #1636 and I will fix it ASAP. Pandas also follows the NumPy style guide, it seems they did the same too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see so numpydoc says both are valid (in type or in description). Thanks for linking up examples

If you're keeping it in type then do it throughout the module - when there are options we should follow one option consistently since that will enhance readability

Copy link
Contributor

@DhruvSondhi DhruvSondhi Jul 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Jaladh. We should have consistent docstring formats throughour the whole Project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default: False like you did below

tardis/base.py Outdated
Comment on lines 42 to 47
log_state : str, optional
Set the level of the TARDIS logger. Options include `NOTSET`, `DEBUG`, `INFO`, `WARNING`, `ERROR`, and `CRITICAL`.
Default level of the logger is set to CRITICAL.
specific : bool, optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this - you are also breaking consistency by mentioning some default values in parameter type - let's keep all in description

Copy link
Member Author

@atharva-2001 atharva-2001 Jul 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value of the argument in the function is None, but that of the logger is actually CRITICAL, which is set here I believe. I guess moving this to the parameter section would mean that the default argument is CRITICAL, but it's actually None.

Maybe it would be a good idea to mention that the default value is set here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then add default: None here and explain in description what does none imply

tardis/base.py Outdated Show resolved Hide resolved
tardis/base.py Outdated Show resolved Hide resolved
@atharva-2001 atharva-2001 force-pushed the run_tardis_docstring branch 2 times, most recently from e2674f0 to ba488dd Compare July 15, 2021 19:46
Copy link
Contributor

@DhruvSondhi DhruvSondhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks better than before but I have some concerns regarding the log_state argument definition.

tardis/base.py Outdated Show resolved Hide resolved
Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updates. These are small change requests but please pay attention to details - you're missing the point of consistency that I mentioned earlier (so that you don't have to redo it 😄 )

Please let me know if there are any doubts

tardis/base.py Outdated
Comment on lines 45 to 46
The default value of the argument is `None` but the default level
of the logger is `CRITICAL`.
Copy link
Member

@jaladh-singhal jaladh-singhal Jul 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This confusing to even me. You just need to tell what happens to logging when this parameter is set to None, let me know if it is still unclear?
@DhruvSondhi can you help him out?

Copy link
Contributor

@DhruvSondhi DhruvSondhi Jul 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually correct because the default value is being set via the YAML parameter. It is a little complicated. @jaladh-singhal please do discuss this with me.

tardis/base.py Show resolved Hide resolved
tardis/base.py Show resolved Hide resolved
tardis/base.py Outdated
packet_source : class, optional
A custom packet source class or a child class of `tardis.montecarlo.packet_source`
used to override the TARDIS `BasePacketSource` class.
simulation_callbacks : list of lists, optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value missing in type, also we need description what empty list does

tardis/base.py Outdated Show resolved Hide resolved
tardis/base.py Outdated
[[callback1, callback_arg1], [callback2, callback_arg2], ...]
Where the callback function signature should look like:
callback_function(simulation, extra_arg1, ...)
virtual_packet_logging : bool, default False, optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default: False like you did below

@atharva-2001 atharva-2001 force-pushed the run_tardis_docstring branch from ca82574 to 915a791 Compare July 19, 2021 05:43
@DhruvSondhi
Copy link
Contributor

Can you please share the preview link for the documentation?

@atharva-2001
Copy link
Member Author

atharva-2001 commented Jul 19, 2021

Sure, could you please check this out?

Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - you just need to rebase it and rename log_state to log_level (#1730)

@jaladh-singhal jaladh-singhal merged commit 2010e81 into tardis-sn:master Jul 22, 2021
@jaladh-singhal jaladh-singhal mentioned this pull request Jul 22, 2021
10 tasks
DhruvSondhi pushed a commit to DhruvSondhi/tardis that referenced this pull request Aug 1, 2021
* edit docstring in run_tardis

* [build docs]
DhruvSondhi pushed a commit to DhruvSondhi/tardis that referenced this pull request Aug 9, 2021
* edit docstring in run_tardis

* [build docs]
DhruvSondhi pushed a commit to DhruvSondhi/tardis that referenced this pull request Aug 9, 2021
* edit docstring in run_tardis

* [build docs]
atharva-2001 added a commit to atharva-2001/tardis that referenced this pull request Oct 1, 2021
* edit docstring in run_tardis

* [build docs]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

run_tardis docstring missing descriptions for logstate and specific
5 participants