Skip to content

Commit

Permalink
chore(python): use black==22.3.0 (#307)
Browse files Browse the repository at this point in the history
Source-Link: googleapis/synthtool@6fab84a
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe
  • Loading branch information
gcf-owl-bot[bot] authored Mar 29, 2022
1 parent 01653f4 commit 6444a15
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 22 deletions.
4 changes: 2 additions & 2 deletions securitycenter/snippets/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# WARNING - WARNING - WARNING - WARNING - WARNING
# WARNING - WARNING - WARNING - WARNING - WARNING

BLACK_VERSION = "black==19.10b0"
BLACK_VERSION = "black==22.3.0"

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

Expand Down Expand Up @@ -253,7 +253,7 @@ def py(session: nox.sessions.Session) -> None:


def _get_repo_root() -> Optional[str]:
""" Returns the root folder of the project. """
"""Returns the root folder of the project."""
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
p = Path(os.getcwd())
for i in range(10):
Expand Down
4 changes: 2 additions & 2 deletions securitycenter/snippets/snippets_findings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


def create_source(organization_id):
"""Create a new findings source. """
"""Create a new findings source."""
# [START securitycenter_create_source]
from google.cloud import securitycenter

Expand Down Expand Up @@ -189,7 +189,7 @@ def create_finding(source_name, finding_id):


def create_finding_with_source_properties(source_name):
"""Demonstrate creating a new finding with source properties. """
"""Demonstrate creating a new finding with source properties."""
# [START securitycenter_create_finding_with_source_properties]
import datetime

Expand Down
2 changes: 1 addition & 1 deletion securitycenter/snippets/snippets_findings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

@pytest.fixture(scope="module")
def organization_id():
"""Get Organization ID from the environment variable """
"""Get Organization ID from the environment variable"""
return os.environ["GCLOUD_ORGANIZATION"]


Expand Down
4 changes: 2 additions & 2 deletions securitycenter/snippets/snippets_list_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def list_point_in_time_changes(organization_id):


def group_assets(organization_id):
"""Demonstrates grouping all assets by type. """
"""Demonstrates grouping all assets by type."""
i = 0
# [START securitycenter_group_all_assets]
from google.cloud import securitycenter
Expand All @@ -154,7 +154,7 @@ def group_assets(organization_id):


def group_filtered_assets(organization_id):
"""Demonstrates grouping assets by type with a filter. """
"""Demonstrates grouping assets by type with a filter."""
i = 0
# [START securitycenter_group_all_assets_with_filter]
from google.cloud import securitycenter
Expand Down
2 changes: 1 addition & 1 deletion securitycenter/snippets/snippets_list_assets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

@pytest.fixture(scope="module")
def organization_id():
"""Get Organization ID from the environment variable """
"""Get Organization ID from the environment variable"""
return os.environ["GCLOUD_ORGANIZATION"]


Expand Down
18 changes: 12 additions & 6 deletions securitycenter/snippets/snippets_notification_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ def delete_notification_config(organization_id, notification_config_id):
# TODO: organization_id = "your-org-id"
# TODO: notification_config_id = "your-config-id"

notification_config_name = "organizations/{org_id}/notificationConfigs/{config_id}".format(
org_id=organization_id, config_id=notification_config_id
notification_config_name = (
"organizations/{org_id}/notificationConfigs/{config_id}".format(
org_id=organization_id, config_id=notification_config_id
)
)

client.delete_notification_config(request={"name": notification_config_name})
Expand All @@ -77,8 +79,10 @@ def get_notification_config(organization_id, notification_config_id):
# TODO: organization_id = "your-org-id"
# TODO: notification_config_id = "your-config-id"

notification_config_name = "organizations/{org_id}/notificationConfigs/{config_id}".format(
org_id=organization_id, config_id=notification_config_id
notification_config_name = (
"organizations/{org_id}/notificationConfigs/{config_id}".format(
org_id=organization_id, config_id=notification_config_id
)
)

notification_config = client.get_notification_config(
Expand Down Expand Up @@ -121,8 +125,10 @@ def update_notification_config(organization_id, notification_config_id, pubsub_t
# If updating a pubsub_topic, ensure this ServiceAccount has the
# "pubsub.topics.setIamPolicy" permission on the new topic.

notification_config_name = "organizations/{org_id}/notificationConfigs/{config_id}".format(
org_id=organization_id, config_id=notification_config_id
notification_config_name = (
"organizations/{org_id}/notificationConfigs/{config_id}".format(
org_id=organization_id, config_id=notification_config_id
)
)

updated_description = "New updated description"
Expand Down
12 changes: 8 additions & 4 deletions securitycenter/snippets/snippets_notification_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
def cleanup_notification_config(notification_config_id):
client = securitycenter.SecurityCenterClient()

notification_config_name = "organizations/{org_id}/notificationConfigs/{config_id}".format(
org_id=ORG_ID, config_id=notification_config_id
notification_config_name = (
"organizations/{org_id}/notificationConfigs/{config_id}".format(
org_id=ORG_ID, config_id=notification_config_id
)
)
client.delete_notification_config(request={"name": notification_config_name})

Expand Down Expand Up @@ -107,8 +109,10 @@ def deleted_notification_config():


def test_create_notification_config():
created_notification_config = snippets_notification_configs.create_notification_config(
ORG_ID, CREATE_CONFIG_ID, PUBSUB_TOPIC
created_notification_config = (
snippets_notification_configs.create_notification_config(
ORG_ID, CREATE_CONFIG_ID, PUBSUB_TOPIC
)
)
assert created_notification_config is not None

Expand Down
2 changes: 1 addition & 1 deletion securitycenter/snippets/snippets_orgs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

@pytest.fixture(scope="module")
def organization_id():
"""Get Organization ID from the environment variable """
"""Get Organization ID from the environment variable"""
return os.environ["GCLOUD_ORGANIZATION"]


Expand Down
4 changes: 2 additions & 2 deletions securitycenter/snippets/snippets_security_marks.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def delete_and_update_marks(asset_name):


def add_to_finding(finding_name):
"""Adds security marks to a finding. """
"""Adds security marks to a finding."""
# [START securitycenter_add_finding_security_marks]
from google.cloud import securitycenter
from google.protobuf import field_mask_pb2
Expand Down Expand Up @@ -142,7 +142,7 @@ def add_to_finding(finding_name):


def list_assets_with_query_marks(organization_id, asset_name):
"""Lists assets with a filter on security marks. """
"""Lists assets with a filter on security marks."""
add_to_asset(asset_name)
i = -1
# [START securitycenter_list_assets_with_security_marks]
Expand Down
2 changes: 1 addition & 1 deletion securitycenter/snippets/snippets_security_marks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

@pytest.fixture(scope="module")
def organization_id():
"""Gets Organization ID from the environment variable """
"""Gets Organization ID from the environment variable"""
return os.environ["GCLOUD_ORGANIZATION"]


Expand Down

0 comments on commit 6444a15

Please sign in to comment.