Skip to content

Commit

Permalink
chore(python): use black==22.3.0 (#147)
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 d28ff4b commit f125de2
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 28 deletions.
6 changes: 4 additions & 2 deletions contact-center-insights/snippets/create_conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def create_conversation(
audio_uri: str = "gs://cloud-samples-data/ccai/voice_6912.txt",
) -> contact_center_insights_v1.Conversation:
# Construct a parent resource.
parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
parent = (
contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
)
)

# Construct a conversation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ def create_conversation_with_ttl(
audio_uri: str = "gs://cloud-samples-data/ccai/voice_6912.txt",
) -> contact_center_insights_v1.Conversation:
# Construct a parent resource.
parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
parent = (
contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
)
)

# Construct a conversation.
Expand Down
6 changes: 4 additions & 2 deletions contact-center-insights/snippets/create_issue_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

def create_issue_model(project_id: str) -> contact_center_insights_v1.IssueModel:
# Construct a parent resource.
parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
parent = (
contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
)
)

# Construct an issue model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ def create_phrase_matcher_all_of(
project_id: str,
) -> contact_center_insights_v1.PhraseMatcher:
# Construct a parent resource.
parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
parent = (
contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
)
)

# Construct a phrase matcher that matches all of its rule groups.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ def create_phrase_matcher_any_of(
project_id: str,
) -> contact_center_insights_v1.PhraseMatcher:
# Construct a parent resource.
parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
parent = (
contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
)
)

# Construct a phrase matcher that matches any of its rule groups.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def enable_pubsub_notifications(
) -> None:
# Construct a settings resource.
settings = contact_center_insights_v1.Settings()
settings.name = contact_center_insights_v1.ContactCenterInsightsClient.settings_path(
project_id, "us-central1"
settings.name = (
contact_center_insights_v1.ContactCenterInsightsClient.settings_path(
project_id, "us-central1"
)
)
settings.pubsub_notification_settings = {
"create-conversation": topic_create_conversation,
Expand Down
6 changes: 4 additions & 2 deletions contact-center-insights/snippets/export_to_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ def export_to_bigquery(
) -> None:
# Construct an export request.
request = contact_center_insights_v1.ExportInsightsDataRequest()
request.parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
request.parent = (
contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
)
)
request.big_query_destination.project_id = bigquery_project_id
request.big_query_destination.dataset = bigquery_dataset_id
Expand Down
4 changes: 2 additions & 2 deletions contact-center-insights/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
6 changes: 4 additions & 2 deletions contact-center-insights/snippets/set_project_ttl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
def set_project_ttl(project_id: str) -> None:
# Construct a settings resource.
settings = contact_center_insights_v1.Settings()
settings.name = contact_center_insights_v1.ContactCenterInsightsClient.settings_path(
project_id, "us-central1"
settings.name = (
contact_center_insights_v1.ContactCenterInsightsClient.settings_path(
project_id, "us-central1"
)
)

conversation_ttl = duration_pb2.Duration()
Expand Down
6 changes: 4 additions & 2 deletions contact-center-insights/snippets/test_create_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ def conversation_resource(project_id):
# Create a conversation.
insights_client = contact_center_insights_v1.ContactCenterInsightsClient()

parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
parent = (
contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
)
)

conversation = contact_center_insights_v1.Conversation()
Expand Down
6 changes: 4 additions & 2 deletions contact-center-insights/snippets/test_create_issue_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ def count_conversations(project_id, insights_client):
# See https://cloud.google.com/contact-center/insights/docs/topic-model.
list_request = contact_center_insights_v1.ListConversationsRequest()
list_request.page_size = 1000
list_request.parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
list_request.parent = (
contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
)
)
conversations = insights_client.list_conversations(request=list_request)
conversation_count = len(list(conversations))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ def pubsub_topics(project_id):
def disable_pubsub_notifications(project_id):
yield
settings = contact_center_insights_v1.Settings()
settings.name = contact_center_insights_v1.ContactCenterInsightsClient.settings_path(
project_id, "us-central1"
settings.name = (
contact_center_insights_v1.ContactCenterInsightsClient.settings_path(
project_id, "us-central1"
)
)
settings.pubsub_notification_settings = {}
update_mask = field_mask_pb2.FieldMask()
Expand Down
6 changes: 4 additions & 2 deletions contact-center-insights/snippets/test_get_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ def insights_client():
@pytest.fixture
def conversation_resource(project_id, insights_client):
# Create a conversation.
parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
parent = (
contact_center_insights_v1.ContactCenterInsightsClient.common_location_path(
project_id, "us-central1"
)
)

conversation = contact_center_insights_v1.Conversation()
Expand Down
6 changes: 4 additions & 2 deletions contact-center-insights/snippets/test_set_project_ttl.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ def project_id():
def clear_project_ttl(project_id):
yield
settings = contact_center_insights_v1.Settings()
settings.name = contact_center_insights_v1.ContactCenterInsightsClient.settings_path(
project_id, "us-central1"
settings.name = (
contact_center_insights_v1.ContactCenterInsightsClient.settings_path(
project_id, "us-central1"
)
)
settings.conversation_ttl = None
update_mask = field_mask_pb2.FieldMask()
Expand Down

0 comments on commit f125de2

Please sign in to comment.