Skip to content
Snippets Groups Projects
Commit ded47eec authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

added ExceptionList

parent 9eee29c9
No related branches found
No related tags found
No related merge requests found
# v2.14.41
* added `ExceptionList`
* added `terminate_on` for `TerminableThread`
......@@ -16,6 +16,8 @@ They are as follows:
* `Predicate` - a callable that accepts a `T` and returns a bool
* `KVTuple` - a tuple of (K, V)
* `Comparable` - a class that allows comparison between it's instances
* `ExceptionList` - either a single exception type or a tuple of exception types.
As used by `except` statement and some satella functions.
You may use these generics in your classes, eg.
......
import typing as tp
from abc import ABCMeta, abstractmethod
__all__ = ['Iteratable', 'T', 'U', 'V', 'K', 'Number', 'ExceptionClassType',
'NoArgCallable', 'Appendable', 'Predicate', 'KVTuple',
'Comparable', 'ExceptionList']
NoneType = None.__class__
T = tp.TypeVar('T')
Iteratable = tp.Union[tp.Iterator[T], tp.Iterable[T]]
......@@ -13,6 +18,7 @@ NoArgCallable = tp.Callable[[], T]
Predicate = tp.Callable[[T], bool]
ExceptionClassType = tp.Type[Exception]
ExceptionList = tp.Union[ExceptionClassType, tp.Tuple[ExceptionClassType]]
class ClassComparable(metaclass=ABCMeta):
......@@ -42,6 +48,3 @@ class Appendable(Protocol[T]):
...
__all__ = ['Iteratable', 'T', 'U', 'V', 'K', 'Number', 'ExceptionClassType',
'NoArgCallable', 'Appendable', 'Predicate', 'KVTuple',
'Comparable']
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment