-
Notifications
You must be signed in to change notification settings - Fork 228
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
Conversation
…red' (will be removed in v0.20.0)
12e35e2
to
0c68337
Compare
if check_kind: | ||
valid_kinds = ("file", "arg") if required_data is False else ("file",) | ||
valid_kinds = ("file", "arg") if required is False else ("file",) |
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.
I feel that required
by itself isn't a very descriptive parmeter name. This required_data
parameter was added in #2493 to better handle optional virtual files (via the 'arg' kind). Would a name like optional_vfile
(default to True) or something along those lines work? Then the check would be:
valid_kinds = ("file", "arg") if optional_vfile is False else ("file",)
Or we could also just keep the required_data
name as is? Thoughts?
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.
Would a name like
optional_vfile
(default to True) or something along those lines work?
You meant optional_vfile
default to False?
The data_kind
takes two parameters data
and required
. Here, required_data
is renamed to required
to match the parameter name in that function. If we rename it to optional_vfile
, then we should use data_kind(data, required=not optional_vfile)
.
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.
Ah yes, I meant optional_vfile=False
by default, but that's probably not a great name either. On second thought, let's go with the required
parameter name then. Using just required
in data_kind
makes sense because we're only passing in an argument to data
, and I guess we do validate whether data
/x
/y
are not None in virtualfile_in
so there shouldn't be any ambiguity, but need to update the docstring a bit.
pygmt/src/text.py
Outdated
check_kind="vector", | ||
data=textfiles or data, | ||
required_data=required_data, | ||
check_kind="vector", data=textfiles or data, required=required_data |
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.
At L193 and L194 above. The required_data
variable wasn't changed to required
?
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.
Yes, required_data
at L193-L194 is a local variable, and required
is not a good name for it. Perhaps rename it to data_is_required
?
Done in 4ea2ecb.
if check_kind: | ||
valid_kinds = ("file", "arg") if required_data is False else ("file",) | ||
valid_kinds = ("file", "arg") if required is False else ("file",) |
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.
Ah yes, I meant optional_vfile=False
by default, but that's probably not a great name either. On second thought, let's go with the required
parameter name then. Using just required
in data_kind
makes sense because we're only passing in an argument to data
, and I guess we do validate whether data
/x
/y
are not None in virtualfile_in
so there shouldn't be any ambiguity, but need to update the docstring a bit.
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.
Just one other suggestion. Tests failing appear unrelated, was there an update to the earth_relief
grids again?
pygmt/clib/session.py
Outdated
mincols | ||
Number of minimum required columns. Default is 2 (i.e. require x and y | ||
columns). |
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
.
Address #3836.