@@ -1076,11 +1076,9 @@ def readlink(self):
1076
1076
"""
1077
1077
Return the path to which the symbolic link points.
1078
1078
"""
1079
- if hasattr (os , "readlink" ):
1080
- path = os .readlink (self )
1081
- else :
1079
+ if not hasattr (os , "readlink" ):
1082
1080
raise NotImplementedError ("os.readlink() not available on this system" )
1083
- return self ._from_parts ((path ,))
1081
+ return self ._from_parts ((os . readlink ( self ) ,))
1084
1082
1085
1083
def touch (self , mode = 0o666 , exist_ok = True ):
1086
1084
"""
@@ -1189,21 +1187,19 @@ def symlink_to(self, target, target_is_directory=False):
1189
1187
Make this path a symlink pointing to the target path.
1190
1188
Note the order of arguments (link, target) is the reverse of os.symlink.
1191
1189
"""
1192
- if hasattr (os , "symlink" ):
1193
- os .symlink (target , self , target_is_directory )
1194
- else :
1190
+ if not hasattr (os , "symlink" ):
1195
1191
raise NotImplementedError ("os.symlink() not available on this system" )
1192
+ os .symlink (target , self , target_is_directory )
1196
1193
1197
1194
def hardlink_to (self , target ):
1198
1195
"""
1199
1196
Make this path a hard link pointing to the same file as *target*.
1200
1197
1201
1198
Note the order of arguments (self, target) is the reverse of os.link's.
1202
1199
"""
1203
- if hasattr (os , "link" ):
1204
- os .link (target , self )
1205
- else :
1200
+ if not hasattr (os , "link" ):
1206
1201
raise NotImplementedError ("os.link() not available on this system" )
1202
+ os .link (target , self )
1207
1203
1208
1204
def link_to (self , target ):
1209
1205
"""
0 commit comments