@@ -36,9 +36,7 @@ def _ensure_int(item: Any, item_name: Optional[str] = None) -> int:
3636 item = int (operator .index (item ))
3737 except TypeError :
3838 item_name = "Item" if item_name is None else "'%s'" % item_name
39- raise TypeError (
40- f"{ item_name } must be an integer, got { type (item )} instead."
41- )
39+ raise TypeError (f"{ item_name } must be an integer, got { type (item )} instead." )
4240
4341 return item
4442
@@ -68,9 +66,7 @@ def __instancecheck__(cls, other: Any) -> bool:
6866}
6967
7068
71- def check_type (
72- item : Any , types : tuple , item_name : Optional [str ] = None
73- ) -> None :
69+ def check_type (item : Any , types : tuple , item_name : Optional [str ] = None ) -> None :
7470 """Check that item is an instance of types.
7571
7672 Parameters
@@ -169,9 +165,7 @@ def check_value(
169165 options += ", " .join ([f"{ repr (v )} " for v in allowed_values [:- 1 ]])
170166 options += f", and { repr (allowed_values [- 1 ])} "
171167 raise ValueError (
172- msg .format (
173- item_name = item_name , extra = extra , options = options , item = item
174- )
168+ msg .format (item_name = item_name , extra = extra , options = options , item = item )
175169 )
176170
177171
@@ -248,7 +242,5 @@ def ensure_path(item: Any, must_exist: bool) -> Path:
248242 f"not { type (item )} ."
249243 )
250244 if must_exist and not item .exists ():
251- raise FileNotFoundError (
252- f"The provided path '{ str (item )} ' does not exist."
253- )
245+ raise FileNotFoundError (f"The provided path '{ str (item )} ' does not exist." )
254246 return item
0 commit comments