Conversation
6 tasks
seisman
reviewed
Feb 18, 2024
| ) | ||
| warnings.warn(msg, category=SyntaxWarning, stacklevel=2) | ||
|
|
||
| # timestamp (U) is deprecated since v0.9.0. |
Member
There was a problem hiding this comment.
After this PR, the expected behaviors are:
- if
timestamp=Trueis used, Python will report the parameter is not recognized - if single-letter parameter
U=Trueis used, PyGMT should tell users thatUis not supported andFigure.timestampshould be used.
After removing lines 570-580, parameter timestamp is no longer recognized, but single-letter parameter U will still be processed. Thus, instead of removing these lines completely, we should change them to something like:
# timestamp (U)is deprecated since v0.9.0.
if "U" in kwargs:
msg = (
"Parameter timestamp/U is no longer supported since v0.12.0."
"Use Figure.timestamp() instead."
)
raise GMTInvalidInput(msg)
Member
Author
seisman
reviewed
Feb 19, 2024
Comment on lines
-119
to
-130
| @pytest.mark.mpl_image_compare(filename="test_timestamp.png") | ||
| def test_timestamp_deprecated_u(faketime): | ||
| """ | ||
| Check if the deprecated parameter 'U' works but raises a warning. | ||
| """ | ||
| fig = Figure() | ||
| with pytest.warns(expected_warning=SyntaxWarning) as record: | ||
| with config(FORMAT_TIME_STAMP=faketime): | ||
| # plot nothing (the data is outside the region) but a timestamp | ||
| fig.plot(x=0, y=0, style="p", projection="X1c", region=[1, 2, 1, 2], U=True) | ||
| assert len(record) == 1 # check that only one warning was raised | ||
| return fig |
Member
There was a problem hiding this comment.
Need to modify this test to check that the GMTInvalidInput exception is raised if U is used.
Member
There was a problem hiding this comment.
Member
Author
seisman
reviewed
Feb 26, 2024
Member
|
/format |
seisman
reviewed
Feb 27, 2024
seisman
approved these changes
Feb 27, 2024
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.
Description of proposed changes
This PR removes the deprecated
timestampe(U) parameter from all plotting methods (deprecated since v0.9.0).The standalone method
Figure.timestampshould be used instead.Fixes partly #3033
Related to #2135
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash command is:
/format: automatically format and lint the code