Skip to content

Commit

Permalink
Clean up errors and remove unused ignores] [batch:39/688] [shard:2/N]
Browse files Browse the repository at this point in the history
Reviewed By: MaggieMoss

Differential Revision: D66218033

fbshipit-source-id: 68c9dec75fa90b902d14d84eec057ba116953213
  • Loading branch information
generatedunixname89002005287564 authored and facebook-github-bot committed Nov 21, 2024
1 parent ac18f48 commit d710e92
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 19 deletions.
14 changes: 1 addition & 13 deletions augly/image/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,6 @@ def convert_color(
@returns: Image.Image - Augmented PIL Image
"""
image = imutils.validate_and_load_image(image)
# pyre-fixme[6]: Expected `Union[typing_extensions.Literal[0],
# typing_extensions.Literal[1]]` for 4th param but got `int`.
aug_image = image.convert(mode, matrix, dither, palette, colors)

func_kwargs = imutils.get_func_kwargs(metadata, locals())
Expand Down Expand Up @@ -952,8 +950,6 @@ def meme_format(
text_bbox = draw.multiline_textbbox(
(x_pos, y_pos),
text,
# pyre-fixme[6]: Expected `Optional[ImageFont._Font]` for 3rd param but got
# `FreeTypeFont`.
font=font,
anchor="la",
align="center",
Expand All @@ -975,8 +971,6 @@ def meme_format(
draw.multiline_text(
(x_pos, y_pos),
text,
# pyre-fixme[6]: Expected `Optional[ImageFont._Font]` for 3rd param but got
# `FreeTypeFont`.
font=font,
anchor="la",
fill=(text_color[0], text_color[1], text_color[2], round(opacity * 255)),
Expand Down Expand Up @@ -1617,8 +1611,6 @@ def overlay_text(
xy=(x_pos * width, y_pos * height + i * (font_size + 5)),
text=text_str,
fill=(color[0], color[1], color[2], round(opacity * 255)),
# pyre-fixme[6]: Expected `Optional[ImageFont._Font]` for 4th param but got
# `FreeTypeFont`.
font=font,
)

Expand Down Expand Up @@ -1726,7 +1718,7 @@ def overlay_wrap_text(
(random_x, random_y),
line,
fill=(red, green, blue),
font=font, # pyre-ignore [6]
font=font,
)
random_y = random_y + line_height

Expand Down Expand Up @@ -2353,10 +2345,6 @@ def scale(
scaled_width = int(width * factor)
scaled_height = int(height * factor)

# pyre-fixme[6]: Expected `Union[typing_extensions.Literal[0],
# typing_extensions.Literal[1], typing_extensions.Literal[2],
# typing_extensions.Literal[3], typing_extensions.Literal[4],
# typing_extensions.Literal[5], None]` for 2nd param but got `int`.
aug_image = image.resize((scaled_width, scaled_height), resample=interpolation)

imutils.get_metadata(
Expand Down
1 change: 0 additions & 1 deletion augly/text/augmenters/insertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def insert_chars(self, text: str) -> str:
return random.choice(self.char_set).join(split_text)

separators = random.choices(self.char_set, k=len(split_text))
# pyre-fixme[6]: For 2nd param expected `int` but got `Tuple[]`.
return "".join(sum(zip(split_text, separators), ())[:-1])

def insert_chars_per_word(self, text: str) -> str:
Expand Down
1 change: 0 additions & 1 deletion augly/text/augmenters/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def rejoin_words_and_whitespace(words: List[str], whitespace: List[str]) -> str:
# The split regex returns one whitespace element than word
assert len(whitespace) == len(words) + 1, "Input lengths do not match!"
# Add a dummy entry to 'words' so we can zip it easily, then drop it
# pyre-fixme[6]: For 2nd param expected `int` but got `Tuple[]`.
ordered_elements = sum(zip(whitespace, words + [""]), ())[:-1]
return "".join(ordered_elements)

Expand Down
3 changes: 0 additions & 3 deletions augly/video/augmenters/cv2/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ def apply_augmentation(self, raw_frame: np.ndarray, **kwargs) -> np.ndarray:
# To use an ImageFont, we need to convert into PIL
distract_frame_rgb = cv2.cvtColor(distract_frame, cv2.COLOR_BGR2RGB)
distract_frame_pil = Image.fromarray(distract_frame_rgb)
# pyre-fixme[6]: Expected `Optional[ImageFont._Font]` for 3rd param but
# got `Union[ImageFont.FreeTypeFont, ImageFont.ImageFont,
# ImageFont.TransposedFont]`.
ImageDraw.Draw(distract_frame_pil).text((x, y), text_str, font=font)
distract_frame = cv2.cvtColor(
np.array(distract_frame_pil), cv2.COLOR_RGB2BGR
Expand Down
1 change: 0 additions & 1 deletion augly/video/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,6 @@ def insert_in_background_multiple(
)
last_bkg_point = overall_bkg_needed_duration
dst_starts = bkg_insertion_points + np.concatenate(
# pyre-fixme[6]: For 1st argument expected `Union[_SupportsArray[dtype[typing...
(
[
0.0,
Expand Down

0 comments on commit d710e92

Please sign in to comment.