diff --git a/google/cloud/dlp_v2/services/dlp_service/async_client.py b/google/cloud/dlp_v2/services/dlp_service/async_client.py index 54191deb..9539c767 100644 --- a/google/cloud/dlp_v2/services/dlp_service/async_client.py +++ b/google/cloud/dlp_v2/services/dlp_service/async_client.py @@ -4238,7 +4238,7 @@ async def sample_finish_dlp_job(): metadata=metadata, ) - async def __aenter__(self): + async def __aenter__(self) -> "DlpServiceAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/dlp_v2/types/storage.py b/google/cloud/dlp_v2/types/storage.py index 96e83e5e..745d30c9 100644 --- a/google/cloud/dlp_v2/types/storage.py +++ b/google/cloud/dlp_v2/types/storage.py @@ -94,71 +94,46 @@ class FileType(proto.Enum): storage scan. TEXT_FILE (2): Included file extensions: - - :: - - asc,asp, aspx, brf, c, cc,cfm, cgi, cpp, csv, cxx, c++, cs, css, dart, - dat, dot, eml,, epbub, ged, go, h, hh, hpp, hxx, h++, hs, html, htm, - mkd, markdown, m, ml, mli, perl, pl, plist, pm, php, phtml, pht, - properties, py, pyw, rb, rbw, rs, rss, rc, scala, sh, sql, swift, tex, - shtml, shtm, xhtml, lhs, ics, ini, java, js, json, kix, kml, ocaml, md, - txt, text, tsv, vb, vcard, vcs, wml, xcodeproj, xml, xsl, xsd, yml, yaml. + asc,asp, aspx, brf, c, cc,cfm, cgi, cpp, csv, + cxx, c++, cs, css, dart, dat, dot, eml,, + epbub, ged, go, h, hh, hpp, hxx, h++, hs, html, + htm, mkd, markdown, m, ml, mli, perl, pl, + plist, pm, php, phtml, pht, properties, py, + pyw, rb, rbw, rs, rss, rc, scala, sh, sql, + swift, tex, shtml, shtm, xhtml, lhs, ics, ini, + java, js, json, kix, kml, ocaml, md, txt, + text, tsv, vb, vcard, vcs, wml, xcodeproj, xml, + xsl, xsd, yml, yaml. IMAGE (3): - Included file extensions: - - :: - - bmp, gif, jpg, jpeg, jpe, png. - + Included file extensions: bmp, gif, jpg, jpeg, jpe, png. bytes_limit_per_file has no effect on image files. Image inspection is restricted to 'global', 'us', 'asia', and 'europe'. WORD (5): - Word files >30 MB will be scanned as binary files. Included - file extensions: - - :: - - docx, dotx, docm, dotm + Word files >30 MB will be scanned as binary + files. Included file extensions: + docx, dotx, docm, dotm PDF (6): - PDF files >30 MB will be scanned as binary files. Included - file extensions: - - :: - - pdf + PDF files >30 MB will be scanned as binary + files. Included file extensions: + pdf AVRO (7): Included file extensions: - - :: - - avro + avro CSV (8): Included file extensions: - - :: - - csv + csv TSV (9): Included file extensions: - - :: - - tsv + tsv POWERPOINT (11): - Powerpoint files >30 MB will be scanned as binary files. - Included file extensions: - - :: - - pptx, pptm, potx, potm, pot + Powerpoint files >30 MB will be scanned as + binary files. Included file extensions: + pptx, pptm, potx, potm, pot EXCEL (12): - Excel files >30 MB will be scanned as binary files. Included - file extensions: - - :: - - xlsx, xlsm, xltx, xltm + Excel files >30 MB will be scanned as binary + files. Included file extensions: + xlsx, xlsm, xltx, xltm """ FILE_TYPE_UNSPECIFIED = 0 BINARY_FILE = 1 diff --git a/noxfile.py b/noxfile.py index 7d411fea..69409034 100644 --- a/noxfile.py +++ b/noxfile.py @@ -287,7 +287,6 @@ def docs(session): shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( "sphinx-build", - "-W", # warnings as errors "-T", # show full traceback on exception "-N", # no colors "-b", diff --git a/owlbot.py b/owlbot.py index ce738f01..88669f7f 100644 --- a/owlbot.py +++ b/owlbot.py @@ -51,6 +51,13 @@ python.py_samples(skip_readmes=True) +# ignore docs warnings (only fail on errors). See b/275029141 +s.replace( + 'noxfile.py', + '"-W", # warnings as errors', + '' +) + # run format session for all directories which have a noxfile for noxfile in Path(".").glob("**/noxfile.py"): s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/samples/generated_samples/snippet_metadata_google.privacy.dlp.v2.json b/samples/generated_samples/snippet_metadata_google.privacy.dlp.v2.json index 8cd42196..956f9eab 100644 --- a/samples/generated_samples/snippet_metadata_google.privacy.dlp.v2.json +++ b/samples/generated_samples/snippet_metadata_google.privacy.dlp.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-dlp", - "version": "3.12.1" + "version": "0.1.0" }, "snippets": [ { diff --git a/tests/unit/gapic/dlp_v2/test_dlp_service.py b/tests/unit/gapic/dlp_v2/test_dlp_service.py index 062e0fe9..f0f2eed5 100644 --- a/tests/unit/gapic/dlp_v2/test_dlp_service.py +++ b/tests/unit/gapic/dlp_v2/test_dlp_service.py @@ -2674,9 +2674,11 @@ async def test_list_inspect_templates_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_inspect_templates(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4142,9 +4144,11 @@ async def test_list_deidentify_templates_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_deidentify_templates(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -4411,13 +4415,6 @@ def test_create_job_trigger(request_type, transport: str = "grpc"): display_name="display_name_value", description="description_value", status=dlp.JobTrigger.Status.HEALTHY, - inspect_job=dlp.InspectJobConfig( - storage_config=storage.StorageConfig( - datastore_options=storage.DatastoreOptions( - partition_id=storage.PartitionId(project_id="project_id_value") - ) - ) - ), ) response = client.create_job_trigger(request) @@ -4682,13 +4679,6 @@ def test_update_job_trigger(request_type, transport: str = "grpc"): display_name="display_name_value", description="description_value", status=dlp.JobTrigger.Status.HEALTHY, - inspect_job=dlp.InspectJobConfig( - storage_config=storage.StorageConfig( - datastore_options=storage.DatastoreOptions( - partition_id=storage.PartitionId(project_id="project_id_value") - ) - ) - ), ) response = client.update_job_trigger(request) @@ -5201,13 +5191,6 @@ def test_get_job_trigger(request_type, transport: str = "grpc"): display_name="display_name_value", description="description_value", status=dlp.JobTrigger.Status.HEALTHY, - inspect_job=dlp.InspectJobConfig( - storage_config=storage.StorageConfig( - datastore_options=storage.DatastoreOptions( - partition_id=storage.PartitionId(project_id="project_id_value") - ) - ) - ), ) response = client.get_job_trigger(request) @@ -5857,9 +5840,11 @@ async def test_list_job_triggers_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_job_triggers(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6126,13 +6111,6 @@ def test_activate_job_trigger(request_type, transport: str = "grpc"): type_=dlp.DlpJobType.INSPECT_JOB, state=dlp.DlpJob.JobState.PENDING, job_trigger_name="job_trigger_name_value", - risk_details=dlp.AnalyzeDataSourceRiskDetails( - requested_privacy_metric=dlp.PrivacyMetric( - numerical_stats_config=dlp.PrivacyMetric.NumericalStatsConfig( - field=storage.FieldId(name="name_value") - ) - ) - ), ) response = client.activate_job_trigger(request) @@ -6301,13 +6279,6 @@ def test_create_dlp_job(request_type, transport: str = "grpc"): type_=dlp.DlpJobType.INSPECT_JOB, state=dlp.DlpJob.JobState.PENDING, job_trigger_name="job_trigger_name_value", - risk_details=dlp.AnalyzeDataSourceRiskDetails( - requested_privacy_metric=dlp.PrivacyMetric( - numerical_stats_config=dlp.PrivacyMetric.NumericalStatsConfig( - field=storage.FieldId(name="name_value") - ) - ) - ), ) response = client.create_dlp_job(request) @@ -7005,9 +6976,11 @@ async def test_list_dlp_jobs_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_dlp_jobs(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -7038,13 +7011,6 @@ def test_get_dlp_job(request_type, transport: str = "grpc"): type_=dlp.DlpJobType.INSPECT_JOB, state=dlp.DlpJob.JobState.PENDING, job_trigger_name="job_trigger_name_value", - risk_details=dlp.AnalyzeDataSourceRiskDetails( - requested_privacy_metric=dlp.PrivacyMetric( - numerical_stats_config=dlp.PrivacyMetric.NumericalStatsConfig( - field=storage.FieldId(name="name_value") - ) - ) - ), ) response = client.get_dlp_job(request) @@ -8810,9 +8776,11 @@ async def test_list_stored_info_types_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_stored_info_types(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -13051,13 +13019,6 @@ def test_create_job_trigger_rest(request_type): display_name="display_name_value", description="description_value", status=dlp.JobTrigger.Status.HEALTHY, - inspect_job=dlp.InspectJobConfig( - storage_config=storage.StorageConfig( - datastore_options=storage.DatastoreOptions( - partition_id=storage.PartitionId(project_id="project_id_value") - ) - ) - ), ) # Wrap the value into a proper Response obj @@ -13337,13 +13298,6 @@ def test_update_job_trigger_rest(request_type): display_name="display_name_value", description="description_value", status=dlp.JobTrigger.Status.HEALTHY, - inspect_job=dlp.InspectJobConfig( - storage_config=storage.StorageConfig( - datastore_options=storage.DatastoreOptions( - partition_id=storage.PartitionId(project_id="project_id_value") - ) - ) - ), ) # Wrap the value into a proper Response obj @@ -13885,13 +13839,6 @@ def test_get_job_trigger_rest(request_type): display_name="display_name_value", description="description_value", status=dlp.JobTrigger.Status.HEALTHY, - inspect_job=dlp.InspectJobConfig( - storage_config=storage.StorageConfig( - datastore_options=storage.DatastoreOptions( - partition_id=storage.PartitionId(project_id="project_id_value") - ) - ) - ), ) # Wrap the value into a proper Response obj @@ -14749,13 +14696,6 @@ def test_activate_job_trigger_rest(request_type): type_=dlp.DlpJobType.INSPECT_JOB, state=dlp.DlpJob.JobState.PENDING, job_trigger_name="job_trigger_name_value", - risk_details=dlp.AnalyzeDataSourceRiskDetails( - requested_privacy_metric=dlp.PrivacyMetric( - numerical_stats_config=dlp.PrivacyMetric.NumericalStatsConfig( - field=storage.FieldId(name="name_value") - ) - ) - ), ) # Wrap the value into a proper Response obj @@ -14971,13 +14911,6 @@ def test_create_dlp_job_rest(request_type): type_=dlp.DlpJobType.INSPECT_JOB, state=dlp.DlpJob.JobState.PENDING, job_trigger_name="job_trigger_name_value", - risk_details=dlp.AnalyzeDataSourceRiskDetails( - requested_privacy_metric=dlp.PrivacyMetric( - numerical_stats_config=dlp.PrivacyMetric.NumericalStatsConfig( - field=storage.FieldId(name="name_value") - ) - ) - ), ) # Wrap the value into a proper Response obj @@ -15599,13 +15532,6 @@ def test_get_dlp_job_rest(request_type): type_=dlp.DlpJobType.INSPECT_JOB, state=dlp.DlpJob.JobState.PENDING, job_trigger_name="job_trigger_name_value", - risk_details=dlp.AnalyzeDataSourceRiskDetails( - requested_privacy_metric=dlp.PrivacyMetric( - numerical_stats_config=dlp.PrivacyMetric.NumericalStatsConfig( - field=storage.FieldId(name="name_value") - ) - ) - ), ) # Wrap the value into a proper Response obj