


"""simple docstring"""







import os
from glob import glob

import imageio
import torch
import torchvision
import wandb
from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan
from loaders import load_vqgan
from PIL import Image
from torch import nn

from transformers import CLIPModel, CLIPTokenizerFast
from utils import get_device, get_timestamp, show_pil


class 				SCREAMING_SNAKE_CASE__    :
       """simple docstring"""


       def __init__(						self		,					snake_case__ = "cpu"		,					snake_case__ = "openai/clip-vit-large-patch14"						):






         """simple docstring"""





         lowerCAmelCase					:					List[str]								=							device
         lowerCAmelCase					:					int								=							CLIPTokenizerFast.from_pretrained(snake_case__						)
         lowerCAmelCase					:					Tuple								=							[0.48145466, 0.4578275, 0.40821073]
         lowerCAmelCase					:					str								=							[0.26862954, 0.26130258, 0.27577711]
         lowerCAmelCase					:					Tuple								=							torchvision.transforms.Normalize(self.image_mean		,					self.image_std						)
         lowerCAmelCase					:					List[Any]								=							torchvision.transforms.Resize(224						)
         lowerCAmelCase					:					Optional[Any]								=							torchvision.transforms.CenterCrop(224						)

       def 	lowercase__							(						self		,					snake_case__						):






         """simple docstring"""





         lowerCAmelCase					:					Optional[int]								=							self.resize(snake_case__						)
         lowerCAmelCase					:					List[Any]								=							self.center_crop(snake_case__						)
         lowerCAmelCase					:					int								=							self.normalize(snake_case__						)
         return images







       def __call__(						self		,					snake_case__=None		,					snake_case__=None		,					**snake_case__						):






         """simple docstring"""





         lowerCAmelCase					:					Optional[Any]								=							self.tokenizer(text=snake_case__		,					**snake_case__						)
         lowerCAmelCase					:					List[str]								=							self.preprocess_img(snake_case__						)
         lowerCAmelCase					:					Optional[Any]								=							{key: value.to(self.device						) for (key, value) in encoding.items()}
         return encoding


class 				SCREAMING_SNAKE_CASE__    (		nn.Module    ):
       """simple docstring"""


       def __init__(						self		,					snake_case__=10		,					snake_case__=0.01		,					snake_case__=None		,					snake_case__=None		,					snake_case__=None		,					snake_case__=None		,					snake_case__=None		,					snake_case__=None		,					snake_case__=False		,					snake_case__=True		,					snake_case__="image"		,					snake_case__=True		,					snake_case__=False		,					snake_case__=False		,					snake_case__=False		,					):






         """simple docstring"""





         super().__init__()
         lowerCAmelCase					:					List[Any]								=							None
         lowerCAmelCase					:					List[str]								=							device if device else get_device()
         if vqgan:
           lowerCAmelCase					:					Tuple								=							vqgan
         else:
           lowerCAmelCase					:					Any								=							load_vqgan(self.device		,					conf_path=snake_case__		,					ckpt_path=snake_case__						)
         self.vqgan.eval()
         if clip:
           lowerCAmelCase					:					List[str]								=							clip
         else:
           lowerCAmelCase					:					Optional[Any]								=							CLIPModel.from_pretrained("openai/clip-vit-base-patch32"						)
         self.clip.to(self.device						)
         lowerCAmelCase					:					Union[str, Any]								=							ProcessorGradientFlow(device=self.device						)

         lowerCAmelCase					:					int								=							iterations
         lowerCAmelCase					:					List[str]								=							lr
         lowerCAmelCase					:					List[str]								=							log
         lowerCAmelCase					:					Optional[Any]								=							make_grid
         lowerCAmelCase					:					int								=							return_val
         lowerCAmelCase					:					str								=							quantize
         lowerCAmelCase					:					Optional[int]								=							self.vqgan.decoder.z_shape

       def 	lowercase__							(						self		,					snake_case__=None		,					snake_case__=None		,					snake_case__=5		,					snake_case__=True						):






         """simple docstring"""





         lowerCAmelCase					:					Tuple								=							[]
         if output_path is None:
           lowerCAmelCase					:					List[str]								=							"./animation.gif"
         if input_path is None:
           lowerCAmelCase					:					Any								=							self.save_path
         lowerCAmelCase					:					Any								=							sorted(glob(input_path + "/*"						)						)
         if not len(snake_case__						):
           raise ValueError(
               "No images found in save path, aborting (did you pass save_intermediate=True to the generate"
               " function?)"						)
         if len(snake_case__						) == 1:
           print("Only one image found in save path, (did you pass save_intermediate=True to the generate function?)"						)
         lowerCAmelCase					:					int								=							total_duration / len(snake_case__						)
         lowerCAmelCase					:					List[str]								=							[frame_duration] * len(snake_case__						)
         if extend_frames:
           lowerCAmelCase					:					Any								=							1.5
           lowerCAmelCase					:					List[str]								=							3
         for file_name in paths:
           if file_name.endswith(".png"						):
             images.append(imageio.imread(snake_case__						)						)
         imageio.mimsave(snake_case__		,					snake_case__		,					duration=snake_case__						)
         print(f"""gif saved to {output_path}"""						)

       def 	lowercase__							(						self		,					snake_case__=None		,					snake_case__=None						):






         """simple docstring"""





         if not (path or img):
           raise ValueError("Input either path or tensor"						)
         if img is not None:
           raise NotImplementedError
         lowerCAmelCase					:					Optional[Any]								=							preprocess(Image.open(snake_case__						)		,					target_image_size=256						).to(self.device						)
         lowerCAmelCase					:					List[Any]								=							preprocess_vqgan(snake_case__						)
         lowerCAmelCase						,  *lowerCAmelCase					:					str								=							self.vqgan.encode(snake_case__						)
         return z

       def 	lowercase__							(						self		,					snake_case__						):






         """simple docstring"""





         lowerCAmelCase					:					str								=							self.latent.detach().requires_grad_()
         lowerCAmelCase					:					str								=							base_latent + transform_vector
         if self.quantize:
           lowerCAmelCase						,  *lowerCAmelCase					:					int								=							self.vqgan.quantize(snake_case__						)
         else:
           lowerCAmelCase					:					List[str]								=							trans_latent
         return self.vqgan.decode(snake_case__						)

       def 	lowercase__							(						self		,					snake_case__		,					snake_case__		,					snake_case__=None						):






         """simple docstring"""





         lowerCAmelCase					:					int								=							self.clip_preprocessor(text=snake_case__		,					images=snake_case__		,					return_tensors="pt"		,					padding=snake_case__						)
         lowerCAmelCase					:					List[str]								=							self.clip(**snake_case__						)
         lowerCAmelCase					:					List[Any]								=							clip_outputs.logits_per_image
         if weights is not None:
           lowerCAmelCase					:					Tuple								=							similarity_logits * weights
         return similarity_logits.sum()

       def 	lowercase__							(						self		,					snake_case__		,					snake_case__		,					snake_case__						):






         """simple docstring"""





         lowerCAmelCase					:					List[str]								=							self._get_clip_similarity(pos_prompts["prompts"]		,					snake_case__		,					weights=(1 / pos_prompts["weights"])						)
         if neg_prompts:
           lowerCAmelCase					:					List[str]								=							self._get_clip_similarity(neg_prompts["prompts"]		,					snake_case__		,					weights=neg_prompts["weights"]						)
         else:
           lowerCAmelCase					:					Any								=							torch.tensor([1]		,					device=self.device						)
         lowerCAmelCase					:					Optional[int]								=							-torch.log(snake_case__						) + torch.log(snake_case__						)
         return loss

       def 	lowercase__							(						self		,					snake_case__		,					snake_case__		,					snake_case__						):






         """simple docstring"""





         lowerCAmelCase					:					Dict								=							torch.randn_like(self.latent		,					requires_grad=snake_case__		,					device=self.device						)
         lowerCAmelCase					:					Dict								=							torch.optim.Adam([vector]		,					lr=self.lr						)

         for i in range(self.iterations						):
           optim.zero_grad()
           lowerCAmelCase					:					List[Any]								=							self._add_vector(snake_case__						)
           lowerCAmelCase					:					Optional[int]								=							loop_post_process(snake_case__						)
           lowerCAmelCase					:					int								=							self._get_CLIP_loss(snake_case__		,					snake_case__		,					snake_case__						)
           print("CLIP loss"		,					snake_case__						)
           if self.log:
             wandb.log({"CLIP Loss": clip_loss}						)
           clip_loss.backward(retain_graph=snake_case__						)
           optim.step()
           if self.return_val == "image":
             yield custom_to_pil(transformed_img[0]						)
           else:
             yield vector

       def 	lowercase__							(						self		,					snake_case__		,					snake_case__		,					snake_case__						):






         """simple docstring"""





         wandb.init(reinit=snake_case__		,					project="face-editor"						)
         wandb.config.update({"Positive Prompts": positive_prompts}						)
         wandb.config.update({"Negative Prompts": negative_prompts}						)
         wandb.config.update({"lr": self.lr, "iterations": self.iterations}						)
         if image_path:
           lowerCAmelCase					:					Dict								=							Image.open(snake_case__						)
           lowerCAmelCase					:					Union[str, Any]								=							image.resize((256, 256)						)
           wandb.log("Original Image"		,					wandb.Image(snake_case__						)						)

       def 	lowercase__							(						self		,					snake_case__						):






         """simple docstring"""





         if not prompts:
           return []
         lowerCAmelCase					:					Dict								=							[]
         lowerCAmelCase					:					str								=							[]
         if isinstance(snake_case__		,					snake_case__						):
           lowerCAmelCase					:					Tuple								=							[prompt.strip() for prompt in prompts.split("|"						)]
         for prompt in prompts:
           if isinstance(snake_case__		,					(tuple, list)						):
             lowerCAmelCase					:					Optional[int]								=							prompt[0]
             lowerCAmelCase					:					Tuple								=							float(prompt[1]						)
           elif ":" in prompt:
             lowerCAmelCase						,  lowerCAmelCase					:					Union[str, Any]								=							prompt.split(":"						)
             lowerCAmelCase					:					List[Any]								=							float(snake_case__						)
           else:
             lowerCAmelCase					:					Dict								=							prompt
             lowerCAmelCase					:					Any								=							1.0
           processed_prompts.append(snake_case__						)
           weights.append(snake_case__						)
         return {
             "prompts": processed_prompts,
             "weights": torch.tensor(snake_case__		,					device=self.device						),
         }







       def 	lowercase__							(						self		,					snake_case__		,					snake_case__=None		,					snake_case__=None		,					snake_case__=True		,					snake_case__=False		,					snake_case__=True		,					snake_case__=True		,					snake_case__=None		,					):






         """simple docstring"""





         if image_path:
           lowerCAmelCase					:					Dict								=							self._get_latent(snake_case__						)
         else:
           lowerCAmelCase					:					Tuple								=							torch.randn(self.latent_dim		,					device=self.device						)
         if self.log:
           self._init_logging(snake_case__		,					snake_case__		,					snake_case__						)

         assert pos_prompts, "You must provide at least one positive prompt."
         lowerCAmelCase					:					List[Any]								=							self.process_prompts(snake_case__						)
         lowerCAmelCase					:					int								=							self.process_prompts(snake_case__						)
         if save_final and save_path is None:
           lowerCAmelCase					:					int								=							os.path.join("./outputs/"		,					"_".join(pos_prompts["prompts"]						)						)
         if not os.path.exists(snake_case__						):
           os.makedirs(snake_case__						)
         else:
           lowerCAmelCase					:					Union[str, Any]								=							save_path + "_" + get_timestamp()
           os.makedirs(snake_case__						)
         lowerCAmelCase					:					Dict								=							save_path

         lowerCAmelCase					:					str								=							self.vqgan.decode(self.latent						)[0]
         if show_intermediate:
           print("Original Image"						)
           show_pil(custom_to_pil(snake_case__						)						)

         lowerCAmelCase					:					Optional[Any]								=							loop_post_process(snake_case__						)
         for iter, transformed_img in enumerate(self._optimize_CLIP(snake_case__		,					snake_case__		,					snake_case__						)						):
           if show_intermediate:
             show_pil(snake_case__						)
           if save_intermediate:
             transformed_img.save(os.path.join(self.save_path		,					f"""iter_{iter:03d}.png"""						)						)
           if self.log:
             wandb.log({"Image": wandb.Image(snake_case__						)}						)
         if show_final:
           show_pil(snake_case__						)
         if save_final:
           transformed_img.save(os.path.join(self.save_path		,					f"""iter_{iter:03d}_final.png"""						)						)









"""simple docstring"""







import pyarrow.parquet as pq
import pytest

from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config
from datasets.features.image import Image
from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size

from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases
def  a__      (    SCREAMING_SNAKE_CASE   :   str    ,				SCREAMING_SNAKE_CASE   :   Any    ):


  '''simple docstring'''







  assert isinstance(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    )
  assert dataset.num_rows == 4
  assert dataset.num_columns == 3
  assert dataset.column_names == ["col_1", "col_2", "col_3"]
  for feature, expected_dtype in expected_features.items():
    assert dataset.features[feature].dtype == expected_dtype
@pytest.mark.parametrize("keep_in_memory"    ,				[False, True]    )
def  a__      (    SCREAMING_SNAKE_CASE   :   Any    ,				SCREAMING_SNAKE_CASE   :   List[str]    ,				SCREAMING_SNAKE_CASE   :   int    ):


  '''simple docstring'''







  lowerCAmelCase					:					List[Any]								=							tmp_path / "cache"
  lowerCAmelCase					:					Optional[int]								=							{"col_1": "string", "col_2": "int64", "col_3": "float64"}
  with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
    lowerCAmelCase					:					str								=							ParquetDatasetReader(SCREAMING_SNAKE_CASE    ,				cache_dir=SCREAMING_SNAKE_CASE    ,				keep_in_memory=SCREAMING_SNAKE_CASE    ).read()
  _check_parquet_dataset(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    )
@pytest.mark.parametrize(
    "features"    ,				[
        None,
        {"col_1": "string", "col_2": "int64", "col_3": "float64"},
        {"col_1": "string", "col_2": "string", "col_3": "string"},
        {"col_1": "int32", "col_2": "int32", "col_3": "int32"},
        {"col_1": "float32", "col_2": "float32", "col_3": "float32"},
    ]    ,				)
def  a__      (    SCREAMING_SNAKE_CASE   :   Tuple    ,				SCREAMING_SNAKE_CASE   :   Optional[Any]    ,				SCREAMING_SNAKE_CASE   :   Tuple    ):


  '''simple docstring'''







  lowerCAmelCase					:					Optional[int]								=							tmp_path / "cache"
  lowerCAmelCase					:					Optional[Any]								=							{"col_1": "string", "col_2": "int64", "col_3": "float64"}
  lowerCAmelCase					:					Tuple								=							features.copy() if features else default_expected_features
  lowerCAmelCase					:					List[str]								=							(
      Features({feature: Value(SCREAMING_SNAKE_CASE    ) for feature, dtype in features.items()}    ) if features is not None else None
  )
  lowerCAmelCase					:					List[str]								=							ParquetDatasetReader(SCREAMING_SNAKE_CASE    ,				features=SCREAMING_SNAKE_CASE    ,				cache_dir=SCREAMING_SNAKE_CASE    ).read()
  _check_parquet_dataset(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    )
@pytest.mark.parametrize("split"    ,				[None, NamedSplit("train"    ), "train", "test"]    )
def  a__      (    SCREAMING_SNAKE_CASE   :   Union[str, Any]    ,				SCREAMING_SNAKE_CASE   :   Union[str, Any]    ,				SCREAMING_SNAKE_CASE   :   Optional[int]    ):


  '''simple docstring'''







  lowerCAmelCase					:					List[Any]								=							tmp_path / "cache"
  lowerCAmelCase					:					int								=							{"col_1": "string", "col_2": "int64", "col_3": "float64"}
  lowerCAmelCase					:					Tuple								=							ParquetDatasetReader(SCREAMING_SNAKE_CASE    ,				cache_dir=SCREAMING_SNAKE_CASE    ,				split=SCREAMING_SNAKE_CASE    ).read()
  _check_parquet_dataset(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    )
  assert dataset.split == split if split else "train"
@pytest.mark.parametrize("path_type"    ,				[str, list]    )
def  a__      (    SCREAMING_SNAKE_CASE   :   List[Any]    ,				SCREAMING_SNAKE_CASE   :   Dict    ,				SCREAMING_SNAKE_CASE   :   List[str]    ):


  '''simple docstring'''







  if issubclass(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    ):
    lowerCAmelCase					:					Optional[Any]								=							parquet_path
  elif issubclass(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    ):
    lowerCAmelCase					:					Dict								=							[parquet_path]
  lowerCAmelCase					:					Optional[Any]								=							tmp_path / "cache"
  lowerCAmelCase					:					Any								=							{"col_1": "string", "col_2": "int64", "col_3": "float64"}
  lowerCAmelCase					:					Optional[Any]								=							ParquetDatasetReader(SCREAMING_SNAKE_CASE    ,				cache_dir=SCREAMING_SNAKE_CASE    ).read()
  _check_parquet_dataset(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    )
def  a__      (    SCREAMING_SNAKE_CASE   :   Dict    ,				SCREAMING_SNAKE_CASE   :   List[str]    ,				SCREAMING_SNAKE_CASE   :   Tuple=("train",)    ):


  '''simple docstring'''







  assert isinstance(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    )
  for split in splits:
    lowerCAmelCase					:					List[Any]								=							dataset_dict[split]
    assert dataset.num_rows == 4
    assert dataset.num_columns == 3
    assert dataset.column_names == ["col_1", "col_2", "col_3"]
    for feature, expected_dtype in expected_features.items():
      assert dataset.features[feature].dtype == expected_dtype
@pytest.mark.parametrize("keep_in_memory"    ,				[False, True]    )
def  a__      (    SCREAMING_SNAKE_CASE   :   Optional[int]    ,				SCREAMING_SNAKE_CASE   :   Tuple    ,				SCREAMING_SNAKE_CASE   :   Tuple    ):


  '''simple docstring'''







  lowerCAmelCase					:					Tuple								=							tmp_path / "cache"
  lowerCAmelCase					:					List[Any]								=							{"col_1": "string", "col_2": "int64", "col_3": "float64"}
  with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
    lowerCAmelCase					:					Optional[Any]								=							ParquetDatasetReader(
        {"train": parquet_path}    ,				cache_dir=SCREAMING_SNAKE_CASE    ,				keep_in_memory=SCREAMING_SNAKE_CASE    ).read()
  _check_parquet_datasetdict(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    )
@pytest.mark.parametrize(
    "features"    ,				[
        None,
        {"col_1": "string", "col_2": "int64", "col_3": "float64"},
        {"col_1": "string", "col_2": "string", "col_3": "string"},
        {"col_1": "int32", "col_2": "int32", "col_3": "int32"},
        {"col_1": "float32", "col_2": "float32", "col_3": "float32"},
    ]    ,				)
def  a__      (    SCREAMING_SNAKE_CASE   :   Optional[int]    ,				SCREAMING_SNAKE_CASE   :   Dict    ,				SCREAMING_SNAKE_CASE   :   Optional[int]    ):


  '''simple docstring'''







  lowerCAmelCase					:					Any								=							tmp_path / "cache"
  lowerCAmelCase					:					Union[str, Any]								=							{"col_1": "string", "col_2": "int64", "col_3": "float64"}
  lowerCAmelCase					:					List[Any]								=							features.copy() if features else default_expected_features
  lowerCAmelCase					:					List[Any]								=							(
      Features({feature: Value(SCREAMING_SNAKE_CASE    ) for feature, dtype in features.items()}    ) if features is not None else None
  )
  lowerCAmelCase					:					Optional[int]								=							ParquetDatasetReader({"train": parquet_path}    ,				features=SCREAMING_SNAKE_CASE    ,				cache_dir=SCREAMING_SNAKE_CASE    ).read()
  _check_parquet_datasetdict(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    )
@pytest.mark.parametrize("split"    ,				[None, NamedSplit("train"    ), "train", "test"]    )
def  a__      (    SCREAMING_SNAKE_CASE   :   str    ,				SCREAMING_SNAKE_CASE   :   Dict    ,				SCREAMING_SNAKE_CASE   :   List[str]    ):


  '''simple docstring'''







  if split:
    lowerCAmelCase					:					List[str]								=							{split: parquet_path}
  else:
    lowerCAmelCase					:					List[str]								=							"train"
    lowerCAmelCase					:					str								=							{"train": parquet_path, "test": parquet_path}
  lowerCAmelCase					:					Optional[int]								=							tmp_path / "cache"
  lowerCAmelCase					:					List[Any]								=							{"col_1": "string", "col_2": "int64", "col_3": "float64"}
  lowerCAmelCase					:					List[str]								=							ParquetDatasetReader(SCREAMING_SNAKE_CASE    ,				cache_dir=SCREAMING_SNAKE_CASE    ).read()
  _check_parquet_datasetdict(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE    ,				splits=list(path.keys()    )    )
  assert all(dataset[split].split == split for split in path.keys()    )
def  a__      (    SCREAMING_SNAKE_CASE   :   Optional[Any]    ,				SCREAMING_SNAKE_CASE   :   Any    ):


  '''simple docstring'''







  lowerCAmelCase					:					Optional[int]								=							ParquetDatasetWriter(SCREAMING_SNAKE_CASE    ,				tmp_path / "foo.parquet"    )
  assert writer.write() > 0
  lowerCAmelCase					:					List[str]								=							pq.ParquetFile(tmp_path / "foo.parquet"    )
  lowerCAmelCase					:					Union[str, Any]								=							pf.read()
  assert dataset.data.table == output_table
def  a__      (    SCREAMING_SNAKE_CASE   :   List[Any]    ,				SCREAMING_SNAKE_CASE   :   List[str]    ):


  '''simple docstring'''







  lowerCAmelCase					:					str								=							str(shared_datadir / "test_image_rgb.jpg"    )
  lowerCAmelCase					:					List[str]								=							{"image": [image_path]}
  lowerCAmelCase					:					str								=							Features({"image": Image()}    )
  lowerCAmelCase					:					Optional[Any]								=							Dataset.from_dict(SCREAMING_SNAKE_CASE    ,				features=SCREAMING_SNAKE_CASE    )
  lowerCAmelCase					:					List[Any]								=							ParquetDatasetWriter(SCREAMING_SNAKE_CASE    ,				tmp_path / "foo.parquet"    )
  assert writer.write() > 0

  lowerCAmelCase					:					Any								=							Dataset.from_parquet(str(tmp_path / "foo.parquet"    )    )
  assert dataset.features == reloaded_dataset.features

  lowerCAmelCase					:					Optional[int]								=							ParquetDatasetReader(str(tmp_path / "foo.parquet"    )    ,				streaming=SCREAMING_SNAKE_CASE    ).read()
  assert dataset.features == reloaded_iterable_dataset.features





@pytest.mark.parametrize(
    "feature, expected"    ,				[
        (Features({"foo": Value("int32"    )}    ), None),
        (Features({"image": Image(), "foo": Value("int32"    )}    ), config.PARQUET_ROW_GROUP_SIZE_FOR_IMAGE_DATASETS),
        (Features({"nested": Sequence(Audio()    )}    ), config.PARQUET_ROW_GROUP_SIZE_FOR_AUDIO_DATASETS),
    ]    ,				)
def  a__      (    SCREAMING_SNAKE_CASE   :   str    ,				SCREAMING_SNAKE_CASE   :   List[str]    ):


  '''simple docstring'''







  assert get_writer_batch_size(SCREAMING_SNAKE_CASE    ) == expected





