From 960060fbe6fef6f55cc8a9d19637adcd8d017fae Mon Sep 17 00:00:00 2001 From: "Mayr, Hannes" <hannes.mayr@stud.tu-darmstadt.de> Date: Wed, 14 Dec 2022 11:08:48 +0100 Subject: [PATCH] Remove TypedDicts and type all **kwargs as Any. --- plotid/tagplot.py | 14 ++------------ plotid/tagplot_image.py | 2 +- plotid/tagplot_matplotlib.py | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/plotid/tagplot.py b/plotid/tagplot.py index da6a334..2537332 100644 --- a/plotid/tagplot.py +++ b/plotid/tagplot.py @@ -11,7 +11,7 @@ Functions: """ import warnings -from typing import Literal, TypedDict +from typing import Any, Literal import matplotlib.pyplot as plt from PIL.Image import Image @@ -20,21 +20,11 @@ from plotid.tagplot_matplotlib import tagplot_matplotlib from plotid.tagplot_image import tagplot_image -kwargs_types = TypedDict( - "kwargs_types", - { - "prefix": str, - "id_method": Literal["time", "random"], - "qrcode": bool, - }, -) - - def tagplot( figs: plt.Figure | Image | list[plt.Figure | Image], engine: Literal["matplotlib", "image"], location: str = "east", - **kwargs: kwargs_types, + **kwargs: Any, ) -> PlotIDTransfer: """ Tag your figure/plot with an ID. diff --git a/plotid/tagplot_image.py b/plotid/tagplot_image.py index 545fad3..ca1b869 100644 --- a/plotid/tagplot_image.py +++ b/plotid/tagplot_image.py @@ -29,7 +29,7 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer: # Check if plotid_object is a valid instance of PlotOptions if not isinstance(plotid_object, PlotOptions): raise TypeError( - "The given options container is not an instance" "of PlotOptions." + "The given options container is not an instance of PlotOptions." ) # Check if figs is a list of files diff --git a/plotid/tagplot_matplotlib.py b/plotid/tagplot_matplotlib.py index 118b0a4..8d83baf 100644 --- a/plotid/tagplot_matplotlib.py +++ b/plotid/tagplot_matplotlib.py @@ -27,7 +27,7 @@ def tagplot_matplotlib(plotid_object: PlotOptions) -> PlotIDTransfer: # Check if plotid_object is a valid instance of PlotOptions if not isinstance(plotid_object, PlotOptions): raise TypeError( - "The given options container is not an instance" "of PlotOptions." + "The given options container is not an instance of PlotOptions." ) # Check if figs is a list of valid figures -- GitLab