Skip to content

Commit 6444a15

Browse files
chore(python): use black==22.3.0 (#307)
Source-Link: googleapis/synthtool@6fab84a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe
1 parent 01653f4 commit 6444a15

10 files changed

+32
-22
lines changed

securitycenter/snippets/noxfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# WARNING - WARNING - WARNING - WARNING - WARNING
3030
# WARNING - WARNING - WARNING - WARNING - WARNING
3131

32-
BLACK_VERSION = "black==19.10b0"
32+
BLACK_VERSION = "black==22.3.0"
3333

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

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

254254

255255
def _get_repo_root() -> Optional[str]:
256-
""" Returns the root folder of the project. """
256+
"""Returns the root folder of the project."""
257257
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
258258
p = Path(os.getcwd())
259259
for i in range(10):

securitycenter/snippets/snippets_findings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020
def create_source(organization_id):
21-
"""Create a new findings source. """
21+
"""Create a new findings source."""
2222
# [START securitycenter_create_source]
2323
from google.cloud import securitycenter
2424

@@ -189,7 +189,7 @@ def create_finding(source_name, finding_id):
189189

190190

191191
def create_finding_with_source_properties(source_name):
192-
"""Demonstrate creating a new finding with source properties. """
192+
"""Demonstrate creating a new finding with source properties."""
193193
# [START securitycenter_create_finding_with_source_properties]
194194
import datetime
195195

securitycenter/snippets/snippets_findings_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
@pytest.fixture(scope="module")
2525
def organization_id():
26-
"""Get Organization ID from the environment variable """
26+
"""Get Organization ID from the environment variable"""
2727
return os.environ["GCLOUD_ORGANIZATION"]
2828

2929

securitycenter/snippets/snippets_list_assets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def list_point_in_time_changes(organization_id):
131131

132132

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

155155

156156
def group_filtered_assets(organization_id):
157-
"""Demonstrates grouping assets by type with a filter. """
157+
"""Demonstrates grouping assets by type with a filter."""
158158
i = 0
159159
# [START securitycenter_group_all_assets_with_filter]
160160
from google.cloud import securitycenter

securitycenter/snippets/snippets_list_assets_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
@pytest.fixture(scope="module")
2626
def organization_id():
27-
"""Get Organization ID from the environment variable """
27+
"""Get Organization ID from the environment variable"""
2828
return os.environ["GCLOUD_ORGANIZATION"]
2929

3030

securitycenter/snippets/snippets_notification_configs.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ def delete_notification_config(organization_id, notification_config_id):
5757
# TODO: organization_id = "your-org-id"
5858
# TODO: notification_config_id = "your-config-id"
5959

60-
notification_config_name = "organizations/{org_id}/notificationConfigs/{config_id}".format(
61-
org_id=organization_id, config_id=notification_config_id
60+
notification_config_name = (
61+
"organizations/{org_id}/notificationConfigs/{config_id}".format(
62+
org_id=organization_id, config_id=notification_config_id
63+
)
6264
)
6365

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

80-
notification_config_name = "organizations/{org_id}/notificationConfigs/{config_id}".format(
81-
org_id=organization_id, config_id=notification_config_id
82+
notification_config_name = (
83+
"organizations/{org_id}/notificationConfigs/{config_id}".format(
84+
org_id=organization_id, config_id=notification_config_id
85+
)
8286
)
8387

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

124-
notification_config_name = "organizations/{org_id}/notificationConfigs/{config_id}".format(
125-
org_id=organization_id, config_id=notification_config_id
128+
notification_config_name = (
129+
"organizations/{org_id}/notificationConfigs/{config_id}".format(
130+
org_id=organization_id, config_id=notification_config_id
131+
)
126132
)
127133

128134
updated_description = "New updated description"

securitycenter/snippets/snippets_notification_test.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@
3838
def cleanup_notification_config(notification_config_id):
3939
client = securitycenter.SecurityCenterClient()
4040

41-
notification_config_name = "organizations/{org_id}/notificationConfigs/{config_id}".format(
42-
org_id=ORG_ID, config_id=notification_config_id
41+
notification_config_name = (
42+
"organizations/{org_id}/notificationConfigs/{config_id}".format(
43+
org_id=ORG_ID, config_id=notification_config_id
44+
)
4345
)
4446
client.delete_notification_config(request={"name": notification_config_name})
4547

@@ -107,8 +109,10 @@ def deleted_notification_config():
107109

108110

109111
def test_create_notification_config():
110-
created_notification_config = snippets_notification_configs.create_notification_config(
111-
ORG_ID, CREATE_CONFIG_ID, PUBSUB_TOPIC
112+
created_notification_config = (
113+
snippets_notification_configs.create_notification_config(
114+
ORG_ID, CREATE_CONFIG_ID, PUBSUB_TOPIC
115+
)
112116
)
113117
assert created_notification_config is not None
114118

securitycenter/snippets/snippets_orgs_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
@pytest.fixture(scope="module")
2525
def organization_id():
26-
"""Get Organization ID from the environment variable """
26+
"""Get Organization ID from the environment variable"""
2727
return os.environ["GCLOUD_ORGANIZATION"]
2828

2929

securitycenter/snippets/snippets_security_marks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def delete_and_update_marks(asset_name):
111111

112112

113113
def add_to_finding(finding_name):
114-
"""Adds security marks to a finding. """
114+
"""Adds security marks to a finding."""
115115
# [START securitycenter_add_finding_security_marks]
116116
from google.cloud import securitycenter
117117
from google.protobuf import field_mask_pb2
@@ -142,7 +142,7 @@ def add_to_finding(finding_name):
142142

143143

144144
def list_assets_with_query_marks(organization_id, asset_name):
145-
"""Lists assets with a filter on security marks. """
145+
"""Lists assets with a filter on security marks."""
146146
add_to_asset(asset_name)
147147
i = -1
148148
# [START securitycenter_list_assets_with_security_marks]

securitycenter/snippets/snippets_security_marks_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
@pytest.fixture(scope="module")
2626
def organization_id():
27-
"""Gets Organization ID from the environment variable """
27+
"""Gets Organization ID from the environment variable"""
2828
return os.environ["GCLOUD_ORGANIZATION"]
2929

3030

0 commit comments

Comments
 (0)