Repository navigation
Conversation
The Args section documented `filter` and `type`, but the function parameters are `filter_string` and `job_type`. Passing the documented names as keyword arguments raises TypeError. Also clarify that INSPECT_JOB is the API default when `job_type` is not set; 'INSPECT' is not one of the accepted values.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the docstring of the list_dlp_jobs function in dlp/snippets/Jobs/list_jobs.py to rename the filter parameter to filter_string and the type parameter to job_type, aligning the documentation with the correct parameter names and clarifying the default job type behavior. No review comments were provided, and there is no additional feedback.
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
No linked issue: this is a docstring-only fix in one sample.
The
Args:section oflist_dlp_jobsindlp/snippets/Jobs/list_jobs.pydocumentsfilterandtype, but the function signature is:Calling the sample with the documented names fails before any API call:
Changes:
filter_stringandjob_type. The__main__block already passesfilter_string=args.filter, job_type=args.type, so the CLI flags stay as they are.job_typeentry, replace "Defaults to 'INSPECT'" with "If not set, the API defaults to INSPECT_JOB". The parameter default isNone, and'INSPECT'is not a key ofjob_type_to_int, so passing it raisesKeyError. The API default comes fromListDlpJobsRequest.type_("Defaults toDlpJobType.INSPECT"), whose enum member isINSPECT_JOB. The CLI help in the same file already saysAPI defaults to "INSPECT".Checked in a
python:3.10-slimcontainer withdlp/snippets/requirements.txtinstalled:Args:section now binds withinspect.signature(list_dlp_jobs).bind(...)(before:filterandtyperaisedTypeError).flake8with theFLAKE8_COMMON_ARGSfromnoxfile-template.pyonlist_jobs.py: no findings.Checklist
Testing
Not run against a live project: only the docstring changed, no code path changed.
Compliance & Style
Post-Approval Actions