File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 44import pathlib
55import typing as t
66
7- class PrivatePath (type (pathlib .Path ())):
7+ if t .TYPE_CHECKING :
8+ PrivatePathBase = pathlib .Path
9+ else :
10+ PrivatePathBase = type (pathlib .Path ())
11+
12+
13+ class PrivatePath (PrivatePathBase ):
814 """Path subclass that hides the user's home directory in textual output.
915
1016 The class behaves like :class:`pathlib.Path`, but normalizes string and
@@ -22,14 +28,14 @@ class PrivatePath(type(pathlib.Path())):
2228 PrivatePath('~/projects/vcspull')
2329 >>> str(PrivatePath("/tmp/example"))
2430 '/tmp/example'
25- >>> f\" build dir: {PrivatePath(home / ' build')} \"
31+ >>> f' build dir: {PrivatePath(home / " build")}'
2632 'build dir: ~/build'
27- >>> \" {} \" .format(PrivatePath(home / 'notes.txt'))
33+ >>> '{}' .format(PrivatePath(home / 'notes.txt'))
2834 '~/notes.txt'
2935 """
3036
3137 def __new__ (cls , * args : t .Any , ** kwargs : t .Any ) -> PrivatePath :
32- return t . cast ( PrivatePath , super ().__new__ (cls , * args , ** kwargs ) )
38+ return super ().__new__ (cls , * args , ** kwargs )
3339
3440 @classmethod
3541 def _collapse_home (cls , value : str ) -> str :
You can’t perform that action at this time.
0 commit comments