ominfra 0.0.0.dev128__py3-none-any.whl → 0.0.0.dev129__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -189,6 +189,30 @@ def check_not_equal(l: T, r: T) -> T:
189
189
  return l
190
190
 
191
191
 
192
+ def check_is(l: T, r: T) -> T:
193
+ if l is not r:
194
+ raise ValueError(l, r)
195
+ return l
196
+
197
+
198
+ def check_is_not(l: T, r: ta.Any) -> T:
199
+ if l is r:
200
+ raise ValueError(l, r)
201
+ return l
202
+
203
+
204
+ def check_in(v: T, c: ta.Container[T]) -> T:
205
+ if v not in c:
206
+ raise ValueError(v, c)
207
+ return v
208
+
209
+
210
+ def check_not_in(v: T, c: ta.Container[T]) -> T:
211
+ if v in c:
212
+ raise ValueError(v, c)
213
+ return v
214
+
215
+
192
216
  def check_single(vs: ta.Iterable[T]) -> T:
193
217
  [v] = vs
194
218
  return v
@@ -272,6 +272,30 @@ def check_not_equal(l: T, r: T) -> T:
272
272
  return l
273
273
 
274
274
 
275
+ def check_is(l: T, r: T) -> T:
276
+ if l is not r:
277
+ raise ValueError(l, r)
278
+ return l
279
+
280
+
281
+ def check_is_not(l: T, r: ta.Any) -> T:
282
+ if l is r:
283
+ raise ValueError(l, r)
284
+ return l
285
+
286
+
287
+ def check_in(v: T, c: ta.Container[T]) -> T:
288
+ if v not in c:
289
+ raise ValueError(v, c)
290
+ return v
291
+
292
+
293
+ def check_not_in(v: T, c: ta.Container[T]) -> T:
294
+ if v in c:
295
+ raise ValueError(v, c)
296
+ return v
297
+
298
+
275
299
  def check_single(vs: ta.Iterable[T]) -> T:
276
300
  [v] = vs
277
301
  return v
@@ -968,6 +968,30 @@ def check_not_equal(l: T, r: T) -> T:
968
968
  return l
969
969
 
970
970
 
971
+ def check_is(l: T, r: T) -> T:
972
+ if l is not r:
973
+ raise ValueError(l, r)
974
+ return l
975
+
976
+
977
+ def check_is_not(l: T, r: ta.Any) -> T:
978
+ if l is r:
979
+ raise ValueError(l, r)
980
+ return l
981
+
982
+
983
+ def check_in(v: T, c: ta.Container[T]) -> T:
984
+ if v not in c:
985
+ raise ValueError(v, c)
986
+ return v
987
+
988
+
989
+ def check_not_in(v: T, c: ta.Container[T]) -> T:
990
+ if v in c:
991
+ raise ValueError(v, c)
992
+ return v
993
+
994
+
971
995
  def check_single(vs: ta.Iterable[T]) -> T:
972
996
  [v] = vs
973
997
  return v