Coverage for src/appl/core/types/basic.py: 95%

20 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2024-11-22 15:39 -0800

1from __future__ import annotations 

2 

3import operator 

4import sys 

5from abc import ABC, abstractmethod 

6from argparse import Namespace 

7from concurrent.futures import Future, ProcessPoolExecutor, ThreadPoolExecutor 

8from dataclasses import dataclass 

9from threading import Event, Thread 

10from types import CodeType, FunctionType, TracebackType 

11from typing import ( 

12 IO, 

13 Any, 

14 Awaitable, 

15 Callable, 

16 ClassVar, 

17 Dict, 

18 Generic, 

19 Iterable, 

20 Iterator, 

21 List, 

22 Literal, 

23 Optional, 

24 Sequence, 

25 SupportsIndex, 

26 Tuple, 

27 Type, 

28 TypeVar, 

29 Union, 

30 overload, 

31) 

32 

33from pydantic import BaseModel, Field 

34 

35if sys.version_info < (3, 10): 

36 from typing_extensions import Concatenate, ParamSpec 

37else: 

38 from typing import Concatenate, ParamSpec 

39 

40from loguru import logger 

41 

42_T = TypeVar("_T") 

43# Type defs 

44OneOrMany = Union[_T, Sequence[_T]] 

45"""A type that can be either a single item or a sequence of items.""" 

46MaybeOneOrMany = Union[_T, Sequence[_T], None] 

47"""A type that can be either a single item, a sequence of items, or None."""