1313from urllib .parse import quote_from_bytes as urlquote_from_bytes
1414
1515
16- supports_symlinks = True
1716if os .name == 'nt' :
18- import nt
19- if sys .getwindowsversion ()[:2 ] >= (6 , 0 ):
20- from nt import _getfinalpathname
21- else :
22- supports_symlinks = False
23- _getfinalpathname = None
17+ from nt import _getfinalpathname
2418else :
25- nt = None
19+ _getfinalpathname = None
2620
2721
2822__all__ = [
@@ -412,18 +406,17 @@ class _NormalAccessor(_Accessor):
412406 if hasattr (os , "lchmod" ):
413407 lchmod = os .lchmod
414408 else :
415- def lchmod (self , pathobj , mode ):
416- raise NotImplementedError ("lchmod() not available on this system" )
409+ def lchmod (self , path , mode ):
410+ raise NotImplementedError ("os. lchmod() not available on this system" )
417411
418412 mkdir = os .mkdir
419413
420414 unlink = os .unlink
421415
422416 if hasattr (os , "link" ):
423- link_to = os .link
417+ link = os .link
424418 else :
425- @staticmethod
426- def link_to (self , target ):
419+ def link (self , src , dst ):
427420 raise NotImplementedError ("os.link() not available on this system" )
428421
429422 rmdir = os .rmdir
@@ -432,23 +425,19 @@ def link_to(self, target):
432425
433426 replace = os .replace
434427
435- if nt :
436- if supports_symlinks :
437- symlink = os .symlink
438- else :
439- def symlink (a , b , target_is_directory ):
440- raise NotImplementedError ("symlink() not available on this system" )
428+ if hasattr (os , "symlink" ):
429+ symlink = os .symlink
441430 else :
442- # Under POSIX, os.symlink() takes two args
443- @staticmethod
444- def symlink (a , b , target_is_directory ):
445- return os .symlink (a , b )
431+ def symlink (self , src , dst , target_is_directory = False ):
432+ raise NotImplementedError ("os.symlink() not available on this system" )
446433
447434 utime = os .utime
448435
449- # Helper for resolve()
450- def readlink (self , path ):
451- return os .readlink (path )
436+ if hasattr (os , "readlink" ):
437+ readlink = os .readlink
438+ else :
439+ def readlink (self , path ):
440+ raise NotImplementedError ("os.readlink() not available on this system" )
452441
453442 def owner (self , path ):
454443 try :
@@ -1369,7 +1358,7 @@ def link_to(self, target):
13691358 """
13701359 Create a hard link pointing to a path named target.
13711360 """
1372- self ._accessor .link_to (self , target )
1361+ self ._accessor .link (self , target )
13731362
13741363 def rename (self , target ):
13751364 """
0 commit comments