SimpleArt / prettyformatter

Advanced pretty formatting for dataclasses and more using f-string style features.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NameError: name 'Union' is not defined

pederalm opened this issue · comments

commented

When I try to use prettyformatter I get this error

File "/home/almpez/work/thetoolbox/systemweaver/systemweaver.py", line 8, in <module> from prettyformatter import PrettyClass, PrettyDataclass File "/home/almpez/.local/lib/python3.8/site-packages/prettyformatter/__init__.py", line 195, in <module> from ._pretty_class import PrettyClass File "/home/almpez/.local/lib/python3.8/site-packages/prettyformatter/_pretty_class.py", line 12, in <module> class PrettyClass: File "/home/almpez/.local/lib/python3.8/site-packages/prettyformatter/_pretty_class.py", line 80, in PrettyClass specifier: Union[ NameError: name 'Union' is not defined

Addin Union in _pretty_class.py solved the problem
from typing import AbstractSet, Any, Dict, List, Tuple, TypeVar, Union

Thanks for pointing out the error, fixed in #9 along with the removal of deprecated type-hints for python >= 3.9. You can now download it with

$ pip install --upgrade prettyformatter