Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/flask_babel/speaklater.py: 43%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

53 statements  

1class LazyString(object): 

2 def __init__(self, func, *args, **kwargs): 

3 self._func = func 

4 self._args = args 

5 self._kwargs = kwargs 

6 

7 def __getattr__(self, attr): 

8 if attr == "__setstate__": 

9 raise AttributeError(attr) 

10 

11 string = str(self) 

12 if hasattr(string, attr): 

13 return getattr(string, attr) 

14 

15 raise AttributeError(attr) 

16 

17 def __repr__(self): 

18 return "l'{0}'".format(str(self)) 

19 

20 def __str__(self): 

21 return str(self._func(*self._args, **self._kwargs)) 

22 

23 def __len__(self): 

24 return len(str(self)) 

25 

26 def __getitem__(self, key): 

27 return str(self)[key] 

28 

29 def __iter__(self): 

30 return iter(str(self)) 

31 

32 def __contains__(self, item): 

33 return item in str(self) 

34 

35 def __add__(self, other): 

36 return str(self) + other 

37 

38 def __radd__(self, other): 

39 return other + str(self) 

40 

41 def __mul__(self, other): 

42 return str(self) * other 

43 

44 def __rmul__(self, other): 

45 return other * str(self) 

46 

47 def __lt__(self, other): 

48 return str(self) < other 

49 

50 def __le__(self, other): 

51 return str(self) <= other 

52 

53 def __eq__(self, other): 

54 return str(self) == other 

55 

56 def __ne__(self, other): 

57 return str(self) != other 

58 

59 def __gt__(self, other): 

60 return str(self) > other 

61 

62 def __ge__(self, other): 

63 return str(self) >= other 

64 

65 def __html__(self): 

66 return str(self) 

67 

68 def __hash__(self): 

69 return hash(str(self)) 

70 

71 def __mod__(self, other): 

72 return str(self) % other 

73 

74 def __rmod__(self, other): 

75 return other + str(self)