Skip to content

Commit

Permalink
chore(python): use black==22.3.0 (#295)
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 and leahecole committed Sep 15, 2023
1 parent b799764 commit 8f22f04
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 52 deletions.
6 changes: 3 additions & 3 deletions videointelligence/samples/analyze/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

def analyze_explicit_content(path):
# [START video_analyze_explicit_content]
""" Detects explicit content from the GCS path to a video. """
"""Detects explicit content from the GCS path to a video."""
video_client = videointelligence.VideoIntelligenceServiceClient()
features = [videointelligence.Feature.EXPLICIT_CONTENT_DETECTION]

Expand All @@ -62,7 +62,7 @@ def analyze_explicit_content(path):

def analyze_labels(path):
# [START video_analyze_labels_gcs]
""" Detects labels given a GCS path. """
"""Detects labels given a GCS path."""
video_client = videointelligence.VideoIntelligenceServiceClient()
features = [videointelligence.Feature.LABEL_DETECTION]

Expand Down Expand Up @@ -231,7 +231,7 @@ def analyze_labels_file(path):

def analyze_shots(path):
# [START video_analyze_shots]
""" Detects camera shot changes. """
"""Detects camera shot changes."""
video_client = videointelligence.VideoIntelligenceServiceClient()
features = [videointelligence.Feature.SHOT_CHANGE_DETECTION]
operation = video_client.annotate_video(
Expand Down
6 changes: 3 additions & 3 deletions videointelligence/samples/analyze/beta_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def stream_generator():
confidence = annotation.frames[0].confidence
# description is in Unicode
print(
u"{}s: {} (confidence: {})".format(time_offset, description, confidence)
"{}s: {} (confidence: {})".format(time_offset, description, confidence)
)
# [END video_streaming_label_detection_beta]

Expand Down Expand Up @@ -420,7 +420,7 @@ def stream_generator():

# description is in Unicode
print("{}s".format(time_offset))
print(u"\tEntity description: {}".format(description))
print("\tEntity description: {}".format(description))
print("\tTrack Id: {}".format(track_id))
if annotation.entity.entity_id:
print("\tEntity id: {}".format(annotation.entity.entity_id))
Expand Down Expand Up @@ -728,7 +728,7 @@ def stream_generator():

# description is in Unicode
print("{}s".format(time_offset))
print(u"\tEntity description: {}".format(description))
print("\tEntity description: {}".format(description))
print("\tTrack Id: {}".format(track_id))
if annotation.entity.entity_id:
print("\tEntity id: {}".format(annotation.entity.entity_id))
Expand Down
4 changes: 2 additions & 2 deletions videointelligence/samples/analyze/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
36 changes: 18 additions & 18 deletions videointelligence/samples/analyze/video_detect_logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def detect_logo(local_file_path="path/to/your/video.mp4"):
request={"features": features, "input_content": input_content}
)

print(u"Waiting for operation to complete...")
print("Waiting for operation to complete...")
response = operation.result()

# Get the first response, since we sent only one video.
Expand All @@ -44,61 +44,61 @@ def detect_logo(local_file_path="path/to/your/video.mp4"):

# Opaque entity ID. Some IDs may be available in [Google Knowledge Graph
# Search API](https://developers.google.com/knowledge-graph/).
print(u"Entity Id : {}".format(entity.entity_id))
print("Entity Id : {}".format(entity.entity_id))

print(u"Description : {}".format(entity.description))
print("Description : {}".format(entity.description))

# All logo tracks where the recognized logo appears. Each track corresponds
# to one logo instance appearing in consecutive frames.
for track in logo_recognition_annotation.tracks:
# Video segment of a track.
print(
u"\n\tStart Time Offset : {}.{}".format(
"\n\tStart Time Offset : {}.{}".format(
track.segment.start_time_offset.seconds,
track.segment.start_time_offset.microseconds * 1000,
)
)
print(
u"\tEnd Time Offset : {}.{}".format(
"\tEnd Time Offset : {}.{}".format(
track.segment.end_time_offset.seconds,
track.segment.end_time_offset.microseconds * 1000,
)
)
print(u"\tConfidence : {}".format(track.confidence))
print("\tConfidence : {}".format(track.confidence))

# The object with timestamp and attributes per frame in the track.
for timestamped_object in track.timestamped_objects:

# Normalized Bounding box in a frame, where the object is located.
normalized_bounding_box = timestamped_object.normalized_bounding_box
print(u"\n\t\tLeft : {}".format(normalized_bounding_box.left))
print(u"\t\tTop : {}".format(normalized_bounding_box.top))
print(u"\t\tRight : {}".format(normalized_bounding_box.right))
print(u"\t\tBottom : {}".format(normalized_bounding_box.bottom))
print("\n\t\tLeft : {}".format(normalized_bounding_box.left))
print("\t\tTop : {}".format(normalized_bounding_box.top))
print("\t\tRight : {}".format(normalized_bounding_box.right))
print("\t\tBottom : {}".format(normalized_bounding_box.bottom))

# Optional. The attributes of the object in the bounding box.
for attribute in timestamped_object.attributes:
print(u"\n\t\t\tName : {}".format(attribute.name))
print(u"\t\t\tConfidence : {}".format(attribute.confidence))
print(u"\t\t\tValue : {}".format(attribute.value))
print("\n\t\t\tName : {}".format(attribute.name))
print("\t\t\tConfidence : {}".format(attribute.confidence))
print("\t\t\tValue : {}".format(attribute.value))

# Optional. Attributes in the track level.
for track_attribute in track.attributes:
print(u"\n\t\tName : {}".format(track_attribute.name))
print(u"\t\tConfidence : {}".format(track_attribute.confidence))
print(u"\t\tValue : {}".format(track_attribute.value))
print("\n\t\tName : {}".format(track_attribute.name))
print("\t\tConfidence : {}".format(track_attribute.confidence))
print("\t\tValue : {}".format(track_attribute.value))

# All video segments where the recognized logo appears. There might be
# multiple instances of the same logo class appearing in one VideoSegment.
for segment in logo_recognition_annotation.segments:
print(
u"\n\tStart Time Offset : {}.{}".format(
"\n\tStart Time Offset : {}.{}".format(
segment.start_time_offset.seconds,
segment.start_time_offset.microseconds * 1000,
)
)
print(
u"\tEnd Time Offset : {}.{}".format(
"\tEnd Time Offset : {}.{}".format(
segment.end_time_offset.seconds,
segment.end_time_offset.microseconds * 1000,
)
Expand Down
36 changes: 18 additions & 18 deletions videointelligence/samples/analyze/video_detect_logo_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def detect_logo_gcs(input_uri="gs://YOUR_BUCKET_ID/path/to/your/file.mp4"):
request={"features": features, "input_uri": input_uri}
)

print(u"Waiting for operation to complete...")
print("Waiting for operation to complete...")
response = operation.result()

# Get the first response, since we sent only one video.
Expand All @@ -39,61 +39,61 @@ def detect_logo_gcs(input_uri="gs://YOUR_BUCKET_ID/path/to/your/file.mp4"):

# Opaque entity ID. Some IDs may be available in [Google Knowledge Graph
# Search API](https://developers.google.com/knowledge-graph/).
print(u"Entity Id : {}".format(entity.entity_id))
print("Entity Id : {}".format(entity.entity_id))

print(u"Description : {}".format(entity.description))
print("Description : {}".format(entity.description))

# All logo tracks where the recognized logo appears. Each track corresponds
# to one logo instance appearing in consecutive frames.
for track in logo_recognition_annotation.tracks:

# Video segment of a track.
print(
u"\n\tStart Time Offset : {}.{}".format(
"\n\tStart Time Offset : {}.{}".format(
track.segment.start_time_offset.seconds,
track.segment.start_time_offset.microseconds * 1000,
)
)
print(
u"\tEnd Time Offset : {}.{}".format(
"\tEnd Time Offset : {}.{}".format(
track.segment.end_time_offset.seconds,
track.segment.end_time_offset.microseconds * 1000,
)
)
print(u"\tConfidence : {}".format(track.confidence))
print("\tConfidence : {}".format(track.confidence))

# The object with timestamp and attributes per frame in the track.
for timestamped_object in track.timestamped_objects:
# Normalized Bounding box in a frame, where the object is located.
normalized_bounding_box = timestamped_object.normalized_bounding_box
print(u"\n\t\tLeft : {}".format(normalized_bounding_box.left))
print(u"\t\tTop : {}".format(normalized_bounding_box.top))
print(u"\t\tRight : {}".format(normalized_bounding_box.right))
print(u"\t\tBottom : {}".format(normalized_bounding_box.bottom))
print("\n\t\tLeft : {}".format(normalized_bounding_box.left))
print("\t\tTop : {}".format(normalized_bounding_box.top))
print("\t\tRight : {}".format(normalized_bounding_box.right))
print("\t\tBottom : {}".format(normalized_bounding_box.bottom))

# Optional. The attributes of the object in the bounding box.
for attribute in timestamped_object.attributes:
print(u"\n\t\t\tName : {}".format(attribute.name))
print(u"\t\t\tConfidence : {}".format(attribute.confidence))
print(u"\t\t\tValue : {}".format(attribute.value))
print("\n\t\t\tName : {}".format(attribute.name))
print("\t\t\tConfidence : {}".format(attribute.confidence))
print("\t\t\tValue : {}".format(attribute.value))

# Optional. Attributes in the track level.
for track_attribute in track.attributes:
print(u"\n\t\tName : {}".format(track_attribute.name))
print(u"\t\tConfidence : {}".format(track_attribute.confidence))
print(u"\t\tValue : {}".format(track_attribute.value))
print("\n\t\tName : {}".format(track_attribute.name))
print("\t\tConfidence : {}".format(track_attribute.confidence))
print("\t\tValue : {}".format(track_attribute.value))

# All video segments where the recognized logo appears. There might be
# multiple instances of the same logo class appearing in one VideoSegment.
for segment in logo_recognition_annotation.segments:
print(
u"\n\tStart Time Offset : {}.{}".format(
"\n\tStart Time Offset : {}.{}".format(
segment.start_time_offset.seconds,
segment.start_time_offset.microseconds * 1000,
)
)
print(
u"\tEnd Time Offset : {}.{}".format(
"\tEnd Time Offset : {}.{}".format(
segment.end_time_offset.seconds,
segment.end_time_offset.microseconds * 1000,
)
Expand Down
2 changes: 1 addition & 1 deletion videointelligence/samples/labels/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@


def analyze_labels(path):
""" Detects labels given a GCS path. """
"""Detects labels given a GCS path."""
# [START video_label_tutorial_construct_request]
video_client = videointelligence.VideoIntelligenceServiceClient()
features = [videointelligence.Feature.LABEL_DETECTION]
Expand Down
4 changes: 2 additions & 2 deletions videointelligence/samples/labels/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 videointelligence/samples/quickstart/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 videointelligence/samples/shotchange/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
2 changes: 1 addition & 1 deletion videointelligence/samples/shotchange/shotchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@


def analyze_shots(path):
""" Detects camera shot changes. """
"""Detects camera shot changes."""
# [START video_shot_tutorial_construct_request]
video_client = videointelligence.VideoIntelligenceServiceClient()
features = [videointelligence.Feature.SHOT_CHANGE_DETECTION]
Expand Down

0 comments on commit 8f22f04

Please sign in to comment.