PyLance-compatible docstrings and clarifications in point.py, grid.py#114
Open
Tyler-g-hudson wants to merge 7 commits intoinsarlab:mainfrom
Open
PyLance-compatible docstrings and clarifications in point.py, grid.py#114Tyler-g-hudson wants to merge 7 commits intoinsarlab:mainfrom
Tyler-g-hudson wants to merge 7 commits intoinsarlab:mainfrom
Conversation
Reviewer's GuideRefines docstrings for the solid Earth tide point and grid helper functions to be clearer, more explicit about parameter/return types and behavior, and formatted in a style that works well with PyLance, without changing any runtime behavior. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- In the docstrings, parameters like
lat/lonanddt0/1are not valid individual names for Pylance-style parsing; consider documenting them as separate entries (lat,lon,dt0,dt1) so tools can reliably associate types and descriptions with actual function parameters. - There are a couple of typos in the new docstrings (e.g.,
Deaultsinstead ofDefaultsin thestep_secdescriptions) that should be corrected to avoid confusion in generated help. - The
calc_solid_earth_tides_griddocstring declaresdt_objas adatetime.datetime, but the example passes a string'20180219'; it would be helpful to align the documented type and the example (or explicitly note both accepted types) for clearer usage guidance.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the docstrings, parameters like `lat/lon` and `dt0/1` are not valid individual names for Pylance-style parsing; consider documenting them as separate entries (`lat`, `lon`, `dt0`, `dt1`) so tools can reliably associate types and descriptions with actual function parameters.
- There are a couple of typos in the new docstrings (e.g., `Deaults` instead of `Defaults` in the `step_sec` descriptions) that should be corrected to avoid confusion in generated help.
- The `calc_solid_earth_tides_grid` docstring declares `dt_obj` as a `datetime.datetime`, but the example passes a string `'20180219'`; it would be helpful to align the documented type and the example (or explicitly note both accepted types) for clearer usage guidance.
## Individual Comments
### Comment 1
<location path="src/pysolid/point.py" line_range="84-85" />
<code_context>
+ latitude/longitude of the point of interest, in degrees
+ dt0/1 : datetime.datetime
+ start/end datetimes
+ step_sec : int, optional
+ Time step, in seconds, of the output. Deaults to 60.
+ display : bool, optional
+ If True, plot the calculated SET. Defaults to False.
</code_context>
<issue_to_address>
**nitpick (typo):** Typo in `step_sec` description ("Deaults" -> "Defaults")
Please update the docstring text accordingly.
```suggestion
step_sec : int, optional
Time step, in seconds, of the output. Defaults to 60.
```
</issue_to_address>
### Comment 2
<location path="src/pysolid/grid.py" line_range="30-39" />
<code_context>
+ dt_obj : datetime.datetime
</code_context>
<issue_to_address>
**issue:** Type in `dt_obj` docstring conflicts with example usage
The docstring types `dt_obj` as `datetime.datetime`, but the example passes a string (`'20180219'`). Please either update the type hint to include strings if they’re supported, or change the example to use a `datetime` instance to keep the documentation consistent.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Author
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- The docstrings mix singular and plural section headers (e.g.,
Example:vsExamples:) and vary slightly in phrasing; consider standardizing section names and style across these helpers for consistency. - There is a small typo in
calc_solid_earth_tides_point_per_day's docstring (Deaultsinstead ofDefaults), and similarly the examples referencedt.datetimewithout clarifying thatdatetimehas been imported asimport datetime as dt.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The docstrings mix singular and plural section headers (e.g., `Example:` vs `Examples:`) and vary slightly in phrasing; consider standardizing section names and style across these helpers for consistency.
- There is a small typo in `calc_solid_earth_tides_point_per_day`'s docstring (`Deaults` instead of `Defaults`), and similarly the examples reference `dt.datetime` without clarifying that `datetime` has been imported as `import datetime as dt`.
## Individual Comments
### Comment 1
<location path="src/pysolid/point.py" line_range="180-181" />
<code_context>
+ The datetime of the beginning of the SET calculation.
+ dt1 : datetime.datetime
+ The datetime of the end of the SET calculation.
+ step_sec : int, optional
+ Time step, in seconds, of the output. Defaults to 60.
+ display : bool, optional
</code_context>
<issue_to_address>
**nitpick (typo):** Fix the typo in the description of `step_sec` (“Deaults” → “Defaults”).
```suggestion
step_sec : int, optional
Time step, in seconds, of the output. Defaults to 60.
```
</issue_to_address>
### Comment 2
<location path="src/pysolid/grid.py" line_range="37-39" />
<code_context>
+ LENGTH/WIDTH
+ X/Y_FIRST
+ X/Y_STEP
+ step_size : float
+ grid step size in meters; fed into the fortran code to speed up the
+ calculation.
+ display : bool, optional
</code_context>
<issue_to_address>
**suggestion:** Mark `step_size` as optional and document its default value to match the function signature.
The signature sets `step_size=1e3`, but the docstring doesn’t show it as optional or document the default. Please update the parameter line to `step_size : float, optional` and mention that it defaults to 1e3 so callers can rely on the documented default.
```suggestion
step_size : float, optional
Grid step size in meters; fed into the Fortran code to speed up the
calculation. Defaults to 1e3.
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are no code modifications associated with this PR, it is purely a documentation change.
This PR addresses Issue #113 by clarifying the docstrings in
point.pyandgrid.pyand reformatting them to be PyLance compatible.Summary by Sourcery
Clarify and expand docstrings for solid earth tide calculation functions in point and grid modules to be more descriptive and PyLance-compatible.
Documentation: