Fix isinstance error with Union types

This commit is contained in:
Harry Callahan 2022-07-14 14:35:57 +01:00 committed by hcallahan-lowrisc
parent 7c8465f9c5
commit 261e9eb3b9
2 changed files with 3 additions and 1 deletions

View file

@ -11,6 +11,7 @@ import pickle
import pathlib3x as pathlib
from io import IOBase
from typing import Dict, TextIO, Optional, Union, List
from typing_utils import get_args
import dataclasses
from typeguard import typechecked
@ -232,7 +233,7 @@ def format_dict_to_printable_dict(arg: dict) -> dict:
def format_to_str(arg: any) -> str:
"""Format single arg to str or raise exception if unable."""
if isinstance(arg, _YAML_PRINTABLE_TYPES):
if isinstance(arg, get_args(_YAML_PRINTABLE_TYPES)):
return str(arg)
elif isinstance(arg, pathlib.Path):
return str(arg.resolve())

View file

@ -13,6 +13,7 @@ mako
junit-xml
# dataclass # needed for backports?
pathlib3x # Backports some useful features
typing-utils # Ditto
gitpython
typeguard
portalocker