Coverage for src/remedapy/piped.py: 100%

1 from collections.abc import Callable

2 from typing import Any, TypeVar, overload

3

4 from .pipe import pipe

5

6 A = TypeVar('A')

7 B = TypeVar('B')

8 C = TypeVar('C')

9 D = TypeVar('D')

10 E = TypeVar('E')

11 F = TypeVar('F')

12 G = TypeVar('G')

13 H = TypeVar('H')

14 I = TypeVar('I')

15 J = TypeVar('J')

16 K = TypeVar('K')

17 L = TypeVar('L')

18 M = TypeVar('M')

19 N = TypeVar('N')

20 O = TypeVar('O')

21 P = TypeVar('P')

22

23

24@overload

25 def piped(funcA: Callable[[A], B], /) -> Callable[[A], B]: ...

26

27

28@overload

29 def piped(funcA: Callable[[A], B], funcB: Callable[[B], C], /) -> Callable[[A], C]: ...

30

31

32@overload

33 def piped(funcA: Callable[[A], B], funcB: Callable[[B], C], funcC: Callable[[C], D], /) -> Callable[[A], D]: ...

34

35

36@overload

37 def piped(

38 funcA: Callable[[A], B],

39 funcB: Callable[[B], C],

40 funcC: Callable[[C], D],

41 funcD: Callable[[D], E],

42 /,

43) -> Callable[[A], E]: ...

44

45

46@overload

47 def piped(

48 funcA: Callable[[A], B],

49 funcB: Callable[[B], C],

50 funcC: Callable[[C], D],

51 funcD: Callable[[D], E],

52 funcE: Callable[[E], F],

53 /,

54) -> Callable[[A], F]: ...

55

56

57@overload

58 def piped(

59 funcA: Callable[[A], B],

60 funcB: Callable[[B], C],

61 funcC: Callable[[C], D],

62 funcD: Callable[[D], E],

63 funcE: Callable[[E], F],

64 funcF: Callable[[F], G],

65 /,

66) -> Callable[[A], G]: ...

67

68

69@overload

70 def piped(

71 funcA: Callable[[A], B],

72 funcB: Callable[[B], C],

73 funcC: Callable[[C], D],

74 funcD: Callable[[D], E],

75 funcE: Callable[[E], F],

76 funcF: Callable[[F], G],

77 funcG: Callable[[G], H],

78 /,

79) -> Callable[[A], H]: ...

80

81

82@overload

83 def piped(

84 funcA: Callable[[A], B],

85 funcB: Callable[[B], C],

86 funcC: Callable[[C], D],

87 funcD: Callable[[D], E],

88 funcE: Callable[[E], F],

89 funcF: Callable[[F], G],

90 funcG: Callable[[G], H],

91 funcH: Callable[[H], I],

92 /,

93) -> Callable[[A], I]: ...

94

95

96@overload

97 def piped(

98 funcA: Callable[[A], B],

99 funcB: Callable[[B], C],

100 funcC: Callable[[C], D],

101 funcD: Callable[[D], E],

102 funcE: Callable[[E], F],

103 funcF: Callable[[F], G],

104 funcG: Callable[[G], H],

105 funcH: Callable[[H], I],

106 funcI: Callable[[I], J],

107 /,

108) -> Callable[[A], J]: ...

109

110

111@overload

112 def piped(

113 funcA: Callable[[A], B],

114 funcB: Callable[[B], C],

115 funcC: Callable[[C], D],

116 funcD: Callable[[D], E],

117 funcE: Callable[[E], F],

118 funcF: Callable[[F], G],

119 funcG: Callable[[G], H],

120 funcH: Callable[[H], I],

121 funcI: Callable[[I], J],

122 funcJ: Callable[[J], K],

123 /,

124) -> Callable[[A], K]: ...

125

126

127@overload

128 def piped(

129 funcA: Callable[[A], B],

130 funcB: Callable[[B], C],

131 funcC: Callable[[C], D],

132 funcD: Callable[[D], E],

133 funcE: Callable[[E], F],

134 funcF: Callable[[F], G],

135 funcG: Callable[[G], H],

136 funcH: Callable[[H], I],

137 funcI: Callable[[I], J],

138 funcJ: Callable[[J], K],

139 funcK: Callable[[K], L],

140 /,

141) -> Callable[[A], L]: ...

142

143

144@overload

145 def piped(

146 funcA: Callable[[A], B],

147 funcB: Callable[[B], C],

148 funcC: Callable[[C], D],

149 funcD: Callable[[D], E],

150 funcE: Callable[[E], F],

151 funcF: Callable[[F], G],

152 funcG: Callable[[G], H],

153 funcH: Callable[[H], I],

154 funcI: Callable[[I], J],

155 funcJ: Callable[[J], K],

156 funcK: Callable[[K], L],

157 funcL: Callable[[L], M],

158 /,

159) -> Callable[[A], M]: ...

160

161

162@overload

163 def piped(

164 funcA: Callable[[A], B],

165 funcB: Callable[[B], C],

166 funcC: Callable[[C], D],

167 funcD: Callable[[D], E],

168 funcE: Callable[[E], F],

169 funcF: Callable[[F], G],

170 funcG: Callable[[G], H],

171 funcH: Callable[[H], I],

172 funcI: Callable[[I], J],

173 funcJ: Callable[[J], K],

174 funcK: Callable[[K], L],

175 funcL: Callable[[L], M],

176 funcM: Callable[[M], N],

177 /,

178) -> Callable[[A], N]: ...

179

180

181@overload

182 def piped(

183 funcA: Callable[[A], B],

184 funcB: Callable[[B], C],

185 funcC: Callable[[C], D],

186 funcD: Callable[[D], E],

187 funcE: Callable[[E], F],

188 funcF: Callable[[F], G],

189 funcG: Callable[[G], H],

190 funcH: Callable[[H], I],

191 funcI: Callable[[I], J],

192 funcJ: Callable[[J], K],

193 funcK: Callable[[K], L],

194 funcL: Callable[[L], M],

195 funcM: Callable[[M], N],

196 funcN: Callable[[N], O],

197 /,

198) -> Callable[[A], O]: ...

199

200

201@overload

202 def piped(

203 funcA: Callable[[A], B],

204 funcB: Callable[[B], C],

205 funcC: Callable[[C], D],

206 funcD: Callable[[D], E],

207 funcE: Callable[[E], F],

208 funcF: Callable[[F], G],

209 funcG: Callable[[G], H],

210 funcH: Callable[[H], I],

211 funcI: Callable[[I], J],

212 funcJ: Callable[[J], K],

213 funcK: Callable[[K], L],

214 funcL: Callable[[L], M],

215 funcM: Callable[[M], N],

216 funcN: Callable[[N], O],

217 funcO: Callable[[O], P],

218 /,

219) -> Callable[[A], P]: ...

220

221

222 def piped(*args: Any) -> Any:

223 return lambda x: pipe(x, *args) # pyright: ignore[reportUnknownVariableType, reportUnknownArgumentType, reportUnknownLambdaType]