From d710e9240893fc00028390378990587d8931905d Mon Sep 17 00:00:00 2001 From: generatedunixname89002005287564 Date: Wed, 20 Nov 2024 17:04:51 -0800 Subject: [PATCH] Clean up errors and remove unused ignores] [batch:39/688] [shard:2/N] Reviewed By: MaggieMoss Differential Revision: D66218033 fbshipit-source-id: 68c9dec75fa90b902d14d84eec057ba116953213 --- augly/image/functional.py | 14 +------------- augly/text/augmenters/insertion.py | 1 - augly/text/augmenters/utils.py | 1 - augly/video/augmenters/cv2/text.py | 3 --- augly/video/functional.py | 1 - 5 files changed, 1 insertion(+), 19 deletions(-) diff --git a/augly/image/functional.py b/augly/image/functional.py index b812db22..fbea3c01 100644 --- a/augly/image/functional.py +++ b/augly/image/functional.py @@ -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()) @@ -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", @@ -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)), @@ -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, ) @@ -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 @@ -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( diff --git a/augly/text/augmenters/insertion.py b/augly/text/augmenters/insertion.py index 3c522de9..059b9d91 100644 --- a/augly/text/augmenters/insertion.py +++ b/augly/text/augmenters/insertion.py @@ -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: diff --git a/augly/text/augmenters/utils.py b/augly/text/augmenters/utils.py index 6a285d6b..31297afd 100644 --- a/augly/text/augmenters/utils.py +++ b/augly/text/augmenters/utils.py @@ -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) diff --git a/augly/video/augmenters/cv2/text.py b/augly/video/augmenters/cv2/text.py index 723da90c..eeb43efc 100644 --- a/augly/video/augmenters/cv2/text.py +++ b/augly/video/augmenters/cv2/text.py @@ -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 diff --git a/augly/video/functional.py b/augly/video/functional.py index 32c3deda..b1ca5f47 100644 --- a/augly/video/functional.py +++ b/augly/video/functional.py @@ -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,