-
Notifications
You must be signed in to change notification settings - Fork 235
Session.virtualfile_in: Deprecate parameter 'required_data' to 'required' (will be removed in v0.20.0) #3931
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
Changes from 1 commit
0c68337
cb507a5
c4a6a00
532b01a
4ea2ecb
2b434e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ | |
| from pygmt.helpers import ( | ||
| _validate_data_input, | ||
| data_kind, | ||
| deprecate_parameter, | ||
| tempfile_from_geojson, | ||
| tempfile_from_image, | ||
| ) | ||
|
|
@@ -1750,15 +1751,19 @@ def virtualfile_from_stringio( | |
|
|
||
| # TODO(PyGMT>=0.20.0): Remove the deprecated parameter 'required_z'. | ||
| # TODO(PyGMT>=0.20.0): Remove the deprecated parameter 'extra_arrays'. | ||
| # TODO(PyGMT>=0.20.0): Remove the deprecated parameter 'required_data'. | ||
| @deprecate_parameter( | ||
| "required_data", "required", "v0.16.0", remove_version="v0.20.0" | ||
| ) | ||
| def virtualfile_in( # noqa: PLR0912 | ||
| self, | ||
| check_kind=None, | ||
| data=None, | ||
| x=None, | ||
| y=None, | ||
| z=None, | ||
| required=True, | ||
| mincols=2, | ||
| required_data=True, | ||
| required_z=False, | ||
| extra_arrays=None, | ||
| ): | ||
|
|
@@ -1783,9 +1788,13 @@ def virtualfile_in( # noqa: PLR0912 | |
| mincols | ||
| Number of minimum required columns. Default is 2 (i.e. require x and y | ||
| columns). | ||
| required_data : bool | ||
| Set to True when 'data' is required, or False when dealing with | ||
| optional virtual files. [Default is True]. | ||
| required : bool | ||
| Set to True when 'data' is required, or False when dealing with optional | ||
| virtual files. Default is True. | ||
seisman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| .. versionchanged:: v0.16.0 | ||
| The parameter 'required_data' is renamed to 'required'. The parameter | ||
| 'required_data' is deprecated in v0.16.0 and will be removed in v0.20.0. | ||
| required_z : bool | ||
| State whether the 'z' column is required. | ||
|
|
||
|
|
@@ -1838,19 +1847,19 @@ def virtualfile_in( # noqa: PLR0912 | |
| ) | ||
| mincols = 3 | ||
|
|
||
| kind = data_kind(data, required=required_data) | ||
| kind = data_kind(data, required=required) | ||
| _validate_data_input( | ||
| data=data, | ||
| x=x, | ||
| y=y, | ||
| z=z, | ||
| mincols=mincols, | ||
| required_data=required_data, | ||
| required=required, | ||
| kind=kind, | ||
| ) | ||
|
|
||
| if check_kind: | ||
| valid_kinds = ("file", "arg") if required_data is False else ("file",) | ||
| valid_kinds = ("file", "arg") if required is False else ("file",) | ||
|
Comment on lines
1861
to
+1862
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel that valid_kinds = ("file", "arg") if optional_vfile is False else ("file",)Or we could also just keep the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You meant The
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes, I meant |
||
| if check_kind == "raster": | ||
| valid_kinds += ("grid", "image") | ||
| elif check_kind == "vector": | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -261,9 +261,7 @@ def text_( # noqa: PLR0912 | |
|
|
||
| with Session() as lib: | ||
| with lib.virtualfile_in( | ||
| check_kind="vector", | ||
| data=textfiles or data, | ||
| required_data=required_data, | ||
| check_kind="vector", data=textfiles or data, required=required_data | ||
|
||
| ) as vintbl: | ||
| lib.call_module( | ||
| module="text", | ||
|
|
||
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.
Also move this docstring to below
required.