@@ -16,7 +16,7 @@ def __init__(self, path: Union[str, pathlib.Path]) -> None:
1616 elif isinstance (path , pathlib .Path ):
1717 self .path = path
1818 else :
19- raise ValueError ("Unexpected type of 'path': {}" . format ( type (path )) )
19+ raise ValueError (f "Unexpected type of 'path': { type (path )} " )
2020
2121 def __enter__ (self ) -> pathlib .Path :
2222 """Give back the path that will be removed."""
@@ -75,7 +75,7 @@ def __init__(self,
7575 elif isinstance (base_tmp_dir , str ):
7676 self .base_tmp_dir = pathlib .Path (base_tmp_dir )
7777 else :
78- raise ValueError ("Unexpected type of 'base_tmp_dir': {}" . format ( type (base_tmp_dir )) )
78+ raise ValueError (f "Unexpected type of 'base_tmp_dir': { type (base_tmp_dir )} " )
7979
8080 self ._path = None # type: Optional[pathlib.Path]
8181
@@ -86,7 +86,7 @@ def __init__(self,
8686 elif isinstance (path , pathlib .Path ):
8787 self ._path = path
8888 else :
89- raise ValueError ("Unexpected type for the argument `path`: {}" . format ( type (path )) )
89+ raise ValueError (f "Unexpected type for the argument `path`: { type (path )} " )
9090
9191 self .dont_delete = dont_delete_tmp_dir
9292
@@ -102,7 +102,7 @@ def path(self) -> pathlib.Path:
102102 """Get the underlying path or raise if the path has not been set."""
103103 if self ._path is None :
104104 raise RuntimeError ("The _path has not been set. "
105- "Are you using {} outside of the context management?" . format ( self . __class__ . __name__ ) )
105+ f "Are you using { self . __class__ . __name__ } outside of the context management?" )
106106
107107 return self ._path
108108
@@ -156,7 +156,7 @@ def __init__(self,
156156 elif isinstance (base_tmp_dir , str ):
157157 self .base_tmp_dir = pathlib .Path (base_tmp_dir )
158158 else :
159- raise ValueError ("Unexpected type of 'base_tmp_dir': {}" . format ( type (base_tmp_dir )) )
159+ raise ValueError (f "Unexpected type of 'base_tmp_dir': { type (base_tmp_dir )} " )
160160
161161 self .prefix = prefix
162162 self .dont_delete = dont_delete
@@ -176,7 +176,7 @@ def path(self) -> pathlib.Path:
176176 """Get the underlying path or raise if the path has not been set."""
177177 if self ._path is None :
178178 raise RuntimeError ("The _path has not been set. "
179- "Are you using {} outside of the context management?" . format ( self . __class__ . __name__ ) )
179+ f "Are you using { self . __class__ . __name__ } outside of the context management?" )
180180
181181 return self ._path
182182
@@ -231,6 +231,7 @@ def __init__(
231231
232232 :param delete: whether the file is deleted on close (default True).
233233 """
234+ # pylint: disable=consider-using-with
234235 self .__tmpfile = tempfile .NamedTemporaryFile (
235236 mode = mode ,
236237 buffering = buffering ,
@@ -243,7 +244,7 @@ def __init__(
243244
244245 self .path = pathlib .Path (self .__tmpfile .name )
245246
246- file = self .__tmpfile .file # type: ignore
247+ file = self .__tmpfile .file
247248 self .file = file # type: IO[Any]
248249 self .delete = delete
249250
0 commit comments