@@ -204,9 +204,7 @@ def from_file_path(cls, file_path: Path | str) -> ResourcePath:
204204 if path :
205205 return path
206206 else :
207- raise ValueError (
208- "Path {!r} does not correspond to any resource path." .format (file_path )
209- )
207+ raise ValueError (f"Path { file_path !r} does not correspond to any resource path." )
210208
211209 def __init__ (self , * pathsegments : object ):
212210 """
@@ -234,7 +232,7 @@ def __hash__(self) -> int:
234232 return hash (self .parts )
235233
236234 def __repr__ (self ) -> str :
237- return "{}({!r})" . format ( self .__class__ .__name__ , str ( self ))
235+ return f" { self .__class__ .__name__ } ( { self !s } )"
238236
239237 def __str__ (self ) -> str :
240238 return '/' .join (self .parts )
@@ -365,7 +363,7 @@ def relative_to(self, *other: object) -> tuple[str, ...]:
365363 if other_path .parts == self ._parts [:other_len ]:
366364 return self ._parts [other_len :]
367365 else :
368- raise ValueError ("{ !s} does not start with {!s}". format ( self , other_path ) )
366+ raise ValueError (f" { self !s} does not start with { other_path !s} " )
369367
370368 def with_name (self , name : str ) -> ResourcePath :
371369 """
@@ -422,7 +420,7 @@ def remove_suffix(
422420 if new_name is not None :
423421 return self .with_name (new_name )
424422 elif must_remove :
425- raise ValueError (' Cannot remove suffix {!r} from {!r}.' . format ( suffix , self ) )
423+ raise ValueError (f" Cannot remove suffix { suffix !r} from { self !r} ." )
426424 else :
427425 return self
428426
@@ -455,7 +453,7 @@ def file_path(self) -> Path:
455453 except ValueError :
456454 continue
457455
458- raise ValueError ("Can't find a filesystem path for {!r}." . format ( self . root ) ) from None
456+ raise ValueError (f "Can't find a filesystem path for { self . root !r} ." ) from None
459457
460458 def exists (self ) -> bool :
461459 """
0 commit comments