docstr: Creates a context for Generating Dummy Dataset. Useful for wrapping test functions.
  NOTE: for MVTec AD dataset it does not return a category.
  It is adviced to use a default parameter in the function
  
  Args:
      num_train (int, optional): Number of training images to generate. Defaults to 1000.
      num_test (int, optional): Number of testing images to generate per category. Defaults to 100.
      img_height (int, optional): Height of the image. Defaults to 128.
      img_width (int, optional): Width of the image. Defaults to 128.
      max_size (Optional[int], optional): Maximum size of the test shapes. Defaults to 10.
      train_shapes (List[str], optional): List of good shapes. Defaults to ["circle", "rectangle"].
      test_shapes (List[str], optional): List of anomalous shapes. Defaults to ["triangle", "ellipse"].
      path (Union[str, Path], optional): Path to MVTec AD dataset. Defaults to "./datasets/MVTec".
      use_mvtec (bool, optional): Use MVTec AD dataset or dummy dataset. Defaults to False.
      seed (int, optional): Fixes seed if any number greater than 0 is provided. 0 means no seed. Defaults to 0.
  
  Example:
      >>> @TestDataset
      >>> def test_some_function(path, category="leather"):
      >>>     do something
docstr_tok: ["Creates","a","context","for","Generating","Dummy","Dataset",".","Useful","for","wrapping","test","functions",".","NOTE",":","for","MVTec","AD","dataset","it","does","not","return","a","category",".","It","is","adviced","to","use","a","default","parameter","in","the","function","Args",":","num_train","(","int",",","optional",")",":","Number","of","training","images","to","generate",".","Defaults","to","1000.","num_test","(","int",",","optional",")",":","Number","of","testing","images","to","generate","per","category",".","Defaults","to","100.","img_height","(","int",",","optional",")",":","Height","of","the","image",".","Defaults","to","128.","img_width","(","int",",","optional",")",":","Width","of","the","image",".","Defaults","to","128.","max_size","(","Optional","[","int","]",",","optional",")",":","Maximum","size","of","the","test","shapes",".","Defaults","to","10.","train_shapes","(","List","[","str","]",",","optional",")",":","List","of","good","shapes",".","Defaults","to","[","``","circle","''",",","``","rectangle","''","]",".","test_shapes","(","List","[","str","]",",","optional",")",":","List","of","anomalous","shapes",".","Defaults","to","[","``","triangle","''",",","``","ellipse","''","]",".","path","(","Union","[","str",",","Path","]",",","optional",")",":","Path","to","MVTec","AD","dataset",".","Defaults","to","``",".\/datasets\/MVTec","''",".","use_mvtec","(","bool",",","optional",")",":","Use","MVTec","AD","dataset","or","dummy","dataset",".","Defaults","to","False",".","seed","(","int",",","optional",")",":","Fixes","seed","if","any","number","greater","than","0","is","provided",".","0","means","no","seed",".","Defaults","to","0",".","Example",":",">",">",">","@","TestDataset",">",">",">","def","test_some_function","(","path",",","category=","''","leather","''",")",":",">",">",">","do","something"]
code: def __init__(
      self,
      num_train: int = 1000,
      num_test: int = 100,
      img_height: int = 128,
      img_width: int = 128,
      max_size: int = 10,
      train_shapes: List[str] = ["triangle", "rectangle"],
      test_shapes: List[str] = ["hexagon", "star"],
      path: Union[str, Path] = "./datasets/MVTec",
      use_mvtec: bool = False,
      seed: int = 0,
  ) -> None:
      """Creates a context for Generating Dummy Dataset. Useful for wrapping test functions.
      NOTE: for MVTec AD dataset it does not return a category.
      It is adviced to use a default parameter in the function
  
      Args:
          num_train (int, optional): Number of training images to generate. Defaults to 1000.
          num_test (int, optional): Number of testing images to generate per category. Defaults to 100.
          img_height (int, optional): Height of the image. Defaults to 128.
          img_width (int, optional): Width of the image. Defaults to 128.
          max_size (Optional[int], optional): Maximum size of the test shapes. Defaults to 10.
          train_shapes (List[str], optional): List of good shapes. Defaults to ["circle", "rectangle"].
          test_shapes (List[str], optional): List of anomalous shapes. Defaults to ["triangle", "ellipse"].
          path (Union[str, Path], optional): Path to MVTec AD dataset. Defaults to "./datasets/MVTec".
          use_mvtec (bool, optional): Use MVTec AD dataset or dummy dataset. Defaults to False.
          seed (int, optional): Fixes seed if any number greater than 0 is provided. 0 means no seed. Defaults to 0.
  
      Example:
          >>> @TestDataset
          >>> def test_some_function(path, category="leather"):
          >>>     do something
      """
      self.num_train = num_train
      self.num_test = num_test
      self.img_height = img_height
      self.img_width = img_width
      self.max_size = max_size
      self.train_shapes = train_shapes
      self.test_shapes = test_shapes
      self.path = path
      self.use_mvtec = use_mvtec
      self.seed = seed
  
imports: import os
  import shutil
  from contextlib import ContextDecorator
  from functools import wraps
  from pathlib import Path
  from tempfile import mkdtemp
  from typing import Dict, List, Optional, Union
  import numpy
  from skimage.io import imsave
  from .shapes import random_shapes
label_desc: Use image node_id 1 to create a new TestDataset object  with example: obj = TestDataset(num_train, num_test, img_height, img_width, max_size, train_shapes, test_shapes, path, use_mvtec, seed)