File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -691,14 +691,14 @@ For code that needs to work with different path types, use the type hints from
691691` upath.types ` to properly specify your requirements:
692692
693693``` python
694+ import os
694695from upath import UPath
695696from upath.types import (
696- JoinablePathLike,
697697 ReadablePathLike,
698698 WritablePathLike,
699699)
700700
701- def read_only_local_file (path : os.PathLike) -> None :
701+ def read_only_local_file (path : os.PathLike) -> str :
702702 """ Read a file on the local filesystem."""
703703 with open (path) as f:
704704 return f.read_text()
@@ -708,11 +708,11 @@ def write_only_local_file(path: os.PathLike) -> None:
708708 with open (path) as f:
709709 f.write_text(" hello world" )
710710
711- def read_any_file (path : WritablePathLike ) -> None :
712- """ Write a file on any filesystem."""
711+ def read_any_file (path : ReadablePathLike ) -> str :
712+ """ Read a file on any filesystem."""
713713 return UPath(path).read_text()
714714
715- def read_any_file (path : WritablePathLike) -> None :
715+ def write_any_file (path : WritablePathLike) -> None :
716716 """ Write a file on any filesystem."""
717717 UPath(path).write_text(" hello world" )
718718```
You can’t perform that action at this time.
0 commit comments