Skip to content
Snippets Groups Projects
Commit 960060fb authored by Mayr, Hannes's avatar Mayr, Hannes
Browse files

Remove TypedDicts and type all **kwargs as Any.

parent 8c2eace9
No related branches found
No related tags found
1 merge request!54Resolve "Type hints"
Pipeline #870864 passed
...@@ -11,7 +11,7 @@ Functions: ...@@ -11,7 +11,7 @@ Functions:
""" """
import warnings import warnings
from typing import Literal, TypedDict from typing import Any, Literal
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from PIL.Image import Image from PIL.Image import Image
...@@ -20,21 +20,11 @@ from plotid.tagplot_matplotlib import tagplot_matplotlib ...@@ -20,21 +20,11 @@ from plotid.tagplot_matplotlib import tagplot_matplotlib
from plotid.tagplot_image import tagplot_image from plotid.tagplot_image import tagplot_image
kwargs_types = TypedDict(
"kwargs_types",
{
"prefix": str,
"id_method": Literal["time", "random"],
"qrcode": bool,
},
)
def tagplot( def tagplot(
figs: plt.Figure | Image | list[plt.Figure | Image], figs: plt.Figure | Image | list[plt.Figure | Image],
engine: Literal["matplotlib", "image"], engine: Literal["matplotlib", "image"],
location: str = "east", location: str = "east",
**kwargs: kwargs_types, **kwargs: Any,
) -> PlotIDTransfer: ) -> PlotIDTransfer:
""" """
Tag your figure/plot with an ID. Tag your figure/plot with an ID.
......
...@@ -29,7 +29,7 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer: ...@@ -29,7 +29,7 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer:
# Check if plotid_object is a valid instance of PlotOptions # Check if plotid_object is a valid instance of PlotOptions
if not isinstance(plotid_object, PlotOptions): if not isinstance(plotid_object, PlotOptions):
raise TypeError( 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 # Check if figs is a list of files
......
...@@ -27,7 +27,7 @@ def tagplot_matplotlib(plotid_object: PlotOptions) -> PlotIDTransfer: ...@@ -27,7 +27,7 @@ def tagplot_matplotlib(plotid_object: PlotOptions) -> PlotIDTransfer:
# Check if plotid_object is a valid instance of PlotOptions # Check if plotid_object is a valid instance of PlotOptions
if not isinstance(plotid_object, PlotOptions): if not isinstance(plotid_object, PlotOptions):
raise TypeError( 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 # Check if figs is a list of valid figures
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment