Skip to content

Commit

Permalink
chore(python): use ubuntu 22.04 in docs image (#377)
Browse files Browse the repository at this point in the history
Source-Link: googleapis/synthtool@f15cc72
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd
  • Loading branch information
gcf-owl-bot[bot] committed Apr 21, 2022
1 parent d43441a commit c6777a4
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 16 deletions.
1 change: 0 additions & 1 deletion dlp/snippets/deid_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import tempfile

import google.cloud.dlp_v2

import pytest

import deid
Expand Down
18 changes: 9 additions & 9 deletions dlp/snippets/inspect_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,15 +466,15 @@ def inspect_gcs_file(
"""

# Import the client library.
# This sample also uses threading.Event() to wait for the job to finish.
import threading

import google.cloud.dlp

# This sample additionally uses Cloud Pub/Sub to receive results from
# potentially long-running operations.
import google.cloud.pubsub

# This sample also uses threading.Event() to wait for the job to finish.
import threading

# Instantiate a client.
dlp = google.cloud.dlp_v2.DlpServiceClient()

Expand Down Expand Up @@ -626,15 +626,15 @@ def inspect_datastore(
"""

# Import the client library.
# This sample also uses threading.Event() to wait for the job to finish.
import threading

import google.cloud.dlp

# This sample additionally uses Cloud Pub/Sub to receive results from
# potentially long-running operations.
import google.cloud.pubsub

# This sample also uses threading.Event() to wait for the job to finish.
import threading

# Instantiate a client.
dlp = google.cloud.dlp_v2.DlpServiceClient()

Expand Down Expand Up @@ -796,15 +796,15 @@ def inspect_bigquery(
"""

# Import the client library.
# This sample also uses threading.Event() to wait for the job to finish.
import threading

import google.cloud.dlp

# This sample additionally uses Cloud Pub/Sub to receive results from
# potentially long-running operations.
import google.cloud.pubsub

# This sample also uses threading.Event() to wait for the job to finish.
import threading

# Instantiate a client.
dlp = google.cloud.dlp_v2.DlpServiceClient()

Expand Down
1 change: 0 additions & 1 deletion dlp/snippets/inspect_content_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import inspect_content


UNIQUE_STRING = str(uuid.uuid4()).split("-")[0]

GCLOUD_PROJECT = os.getenv("GOOGLE_CLOUD_PROJECT")
Expand Down
23 changes: 22 additions & 1 deletion dlp/snippets/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

import nox


# WARNING - WARNING - WARNING - WARNING - WARNING
# WARNING - WARNING - WARNING - WARNING - WARNING
# DO NOT EDIT THIS FILE EVER!
# WARNING - WARNING - WARNING - WARNING - WARNING
# WARNING - WARNING - WARNING - WARNING - WARNING

BLACK_VERSION = "black==22.3.0"
ISORT_VERSION = "isort==5.10.1"

# Copy `noxfile_config.py` to your directory and modify it instead.

Expand Down Expand Up @@ -168,12 +168,33 @@ def lint(session: nox.sessions.Session) -> None:

@nox.session
def blacken(session: nox.sessions.Session) -> None:
"""Run black. Format code to uniform standard."""
session.install(BLACK_VERSION)
python_files = [path for path in os.listdir(".") if path.endswith(".py")]

session.run("black", *python_files)


#
# format = isort + black
#


@nox.session
def format(session: nox.sessions.Session) -> None:
"""
Run isort to sort imports. Then run black
to format code to uniform standard.
"""
session.install(BLACK_VERSION, ISORT_VERSION)
python_files = [path for path in os.listdir(".") if path.endswith(".py")]

# Use the --fss option to sort imports using strict alphabetical order.
# See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
session.run("isort", "--fss", *python_files)
session.run("black", *python_files)


#
# Sample Tests
#
Expand Down
1 change: 0 additions & 1 deletion dlp/snippets/quickstart_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import quickstart


GCLOUD_PROJECT = os.getenv("GOOGLE_CLOUD_PROJECT")


Expand Down
1 change: 0 additions & 1 deletion dlp/snippets/redact.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# [END dlp_redact_image]
import os


# [START dlp_redact_image]


Expand Down
1 change: 0 additions & 1 deletion dlp/snippets/risk_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import risk


UNIQUE_STRING = str(uuid.uuid4()).split("-")[0]
GCLOUD_PROJECT = os.environ.get("GOOGLE_CLOUD_PROJECT")
TABLE_PROJECT = os.environ.get("GOOGLE_CLOUD_PROJECT")
Expand Down
1 change: 0 additions & 1 deletion dlp/snippets/triggers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import google.api_core.exceptions
import google.cloud.storage

import pytest

import triggers
Expand Down

0 comments on commit c6777a4

Please sign in to comment.