Coverage for src \ syriantaxes \ types.py: 100%

21 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-12 14:00 +0200

1from collections.abc import Iterable 

2from decimal import Decimal 

3from typing import ClassVar, Literal, Protocol, TypeAlias, TypedDict 

4 

5Method: TypeAlias = Literal["floor", "ceil"] 

6Number: TypeAlias = int | float | Decimal | str 

7 

8 

9class Rounder(Protocol): 

10 def round(self, number: Number) -> Decimal: ... 

11 

12 

13class SocialSecurity(Protocol): 

14 def calculate_deduction(self, salary: Number) -> Decimal: ... 

15 

16 

17class BracketWithProps(Protocol): 

18 @property 

19 def min(self) -> Number: ... 

20 

21 @property 

22 def max(self) -> Number: ... 

23 

24 @property 

25 def rate(self) -> Number: ... 

26 

27 

28class BracketWithVars(Protocol): 

29 min: Number 

30 max: Number 

31 rate: Number 

32 

33 

34class BracketWithClassVars(Protocol): 

35 min: ClassVar[Number] 

36 max: ClassVar[Number] 

37 rate: ClassVar[Number] 

38 

39 

40class BracketDict(TypedDict): 

41 min: Number 

42 max: Number 

43 rate: Number 

44 

45 

46Brackets: TypeAlias = ( 

47 Iterable[BracketWithProps] 

48 | Iterable[BracketWithVars] 

49 | Iterable[BracketWithClassVars] 

50 | Iterable[BracketDict] 

51)