diff options
| author | exprmntr <[email protected]> | 2022-02-10 16:46:50 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:50 +0300 | 
| commit | a6396ea4e82c2605dcf9a11ebc4c289d0b1c734c (patch) | |
| tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/python/fs | |
| parent | 078ddb2fb76387cae14e8c3ceb5a896009a5a539 (diff) | |
Restoring authorship annotation for exprmntr <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/python/fs')
| -rw-r--r-- | library/python/fs/__init__.py | 36 | ||||
| -rw-r--r-- | library/python/fs/test/test_fs.py | 36 | 
2 files changed, 36 insertions, 36 deletions
diff --git a/library/python/fs/__init__.py b/library/python/fs/__init__.py index 15ee4852027..b1b7cde0799 100644 --- a/library/python/fs/__init__.py +++ b/library/python/fs/__init__.py @@ -10,9 +10,9 @@ import six  import stat  import sys -import library.python.func  -import library.python.strings  -import library.python.windows  +import library.python.func +import library.python.strings +import library.python.windows  logger = logging.getLogger(__name__) @@ -24,7 +24,7 @@ except NameError:  _diehard_win_tries = 10 -errorfix_win = library.python.windows.errorfix  +errorfix_win = library.python.windows.errorfix  class CustomFsError(OSError): @@ -69,7 +69,7 @@ def create_dirs(path):  #   if src is file and dst is dir - throws OSError (errno EISDIR)  # On Windows, if dst exists - throws OSError (errno EEXIST)  @errorfix_win [email protected](library.python.windows.RETRIABLE_FILE_ERRORS, tries=_diehard_win_tries)  [email protected](library.python.windows.RETRIABLE_FILE_ERRORS, tries=_diehard_win_tries)  def move(src, dst):      os.rename(src, dst) @@ -87,10 +87,10 @@ def move(src, dst):  #   if dst is file - replaces it  #   if dst is dir - throws OSError (errno EACCES)  @errorfix_win [email protected](library.python.windows.RETRIABLE_FILE_ERRORS, tries=_diehard_win_tries)  [email protected](library.python.windows.RETRIABLE_FILE_ERRORS, tries=_diehard_win_tries)  def replace_file(src, dst): -    if library.python.windows.on_win():  -        library.python.windows.replace_file(src, dst)  +    if library.python.windows.on_win(): +        library.python.windows.replace_file(src, dst)      else:          os.rename(src, dst) @@ -114,7 +114,7 @@ def replace(src, dst):  # Atomic file remove  # Throws OSError  @errorfix_win [email protected](library.python.windows.RETRIABLE_FILE_ERRORS, tries=_diehard_win_tries)  [email protected](library.python.windows.RETRIABLE_FILE_ERRORS, tries=_diehard_win_tries)  def remove_file(path):      os.remove(path) @@ -122,7 +122,7 @@ def remove_file(path):  # Atomic empty directory remove  # Throws OSError  @errorfix_win [email protected](library.python.windows.RETRIABLE_DIR_ERRORS, tries=_diehard_win_tries)  [email protected](library.python.windows.RETRIABLE_DIR_ERRORS, tries=_diehard_win_tries)  def remove_dir(path):      os.rmdir(path) @@ -136,10 +136,10 @@ def fix_path_encoding(path):  # Throws OSError, AssertionError  @errorfix_win  def remove_tree(path): -    @library.python.windows.diehard(library.python.windows.RETRIABLE_DIR_ERRORS, tries=_diehard_win_tries)  +    @library.python.windows.diehard(library.python.windows.RETRIABLE_DIR_ERRORS, tries=_diehard_win_tries)      def rmtree(path): -        if library.python.windows.on_win():  -            library.python.windows.rmtree(path)  +        if library.python.windows.on_win(): +            library.python.windows.rmtree(path)          else:              shutil.rmtree(fix_path_encoding(path)) @@ -190,8 +190,8 @@ def ensure_removed(path):  # If dst exists - throws OSError (errno EEXIST)  @errorfix_win  def hardlink(src, lnk): -    if library.python.windows.on_win():  -        library.python.windows.hardlink(src, lnk)  +    if library.python.windows.on_win(): +        library.python.windows.hardlink(src, lnk)      else:          os.link(src, lnk) @@ -228,8 +228,8 @@ def hardlink_or_copy(src, lnk):  # If dst exists - throws OSError (errno EEXIST)  @errorfix_win  def symlink(src, lnk): -    if library.python.windows.on_win():  -        library.python.windows.run_disabled(src, lnk)  +    if library.python.windows.on_win(): +        library.python.windows.run_disabled(src, lnk)      else:          os.symlink(src, lnk) @@ -306,7 +306,7 @@ def read_file_unicode(path, binary=True, enc='utf-8'):              with open(path, 'r', encoding=enc) as f:                  return f.read()      # codecs.open is always binary -    with codecs.open(path, 'r', encoding=enc, errors=library.python.strings.ENCODING_ERRORS_POLICY) as f:  +    with codecs.open(path, 'r', encoding=enc, errors=library.python.strings.ENCODING_ERRORS_POLICY) as f:          return f.read() diff --git a/library/python/fs/test/test_fs.py b/library/python/fs/test/test_fs.py index 38e27e4fc8a..9e2c70c0690 100644 --- a/library/python/fs/test/test_fs.py +++ b/library/python/fs/test/test_fs.py @@ -9,7 +9,7 @@ import six  import library.python.fs  import library.python.strings  import library.python.tmp -import library.python.windows  +import library.python.windows  import yatest.common @@ -62,7 +62,7 @@ def trees_equal(dir1, dir2):  def inodes_unsupported(): -    return library.python.windows.on_win()  +    return library.python.windows.on_win()  def inodes_equal(path1, path2): @@ -70,11 +70,11 @@ def inodes_equal(path1, path2):  def gen_error_access_denied(): -    if library.python.windows.on_win():  +    if library.python.windows.on_win():          err = WindowsError()          err.errno = errno.EACCES          err.strerror = '' -        err.winerror = library.python.windows.ERRORS['ACCESS_DENIED']  +        err.winerror = library.python.windows.ERRORS['ACCESS_DENIED']      else:          err = OSError()          err.errno = errno.EACCES @@ -166,7 +166,7 @@ def test_move_file_no_src(path):  def test_move_file_exists(path):      mkfile(path('src'), 'SRC')      mkfile(path('dst'), 'DST') -    if library.python.windows.on_win():  +    if library.python.windows.on_win():          # move is platform-dependent, use replace_file for dst replacement on all platforms          with pytest.raises(OSError) as errinfo:              library.python.fs.move(path('src'), path('dst')) @@ -222,7 +222,7 @@ def test_move_dir_exists_empty(path):      os.mkdir(path('src'))      mkfile(path('src/src_file'))      os.mkdir(path('dst')) -    if library.python.windows.on_win():  +    if library.python.windows.on_win():          # move is platform-dependent, use non-atomic replace for directory replacement          with pytest.raises(OSError) as errinfo:              library.python.fs.move(path('src'), path('dst')) @@ -553,7 +553,7 @@ def test_hardlink_dir(path):      assert not os.path.isdir(path('dst')) [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  @in_env  def test_symlink_file(path):      mkfile(path('src'), 'SRC') @@ -564,7 +564,7 @@ def test_symlink_file(path):      assert file_data(path('dst')) == 'SRC' [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  @in_env  def test_symlink_file_no_src(path):      library.python.fs.symlink(path('src'), path('dst')) @@ -573,7 +573,7 @@ def test_symlink_file_no_src(path):      assert os.path.islink(path('dst')) [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  @in_env  def test_symlink_file_exists(path):      mkfile(path('src'), 'SRC') @@ -587,7 +587,7 @@ def test_symlink_file_exists(path):      assert file_data(path('dst')) == 'DST' [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  @in_env  def test_symlink_file_exists_dir(path):      mkfile(path('src'), 'SRC') @@ -601,7 +601,7 @@ def test_symlink_file_exists_dir(path):      assert not os.path.isfile(path('dst/src')) [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  @in_env  def test_symlink_dir(path):      os.mkdir(path('src')) @@ -613,7 +613,7 @@ def test_symlink_dir(path):      assert os.path.isfile(path('dst/src_file')) [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  @in_env  def test_symlink_dir_no_src(path):      library.python.fs.symlink(path('src'), path('dst')) @@ -622,7 +622,7 @@ def test_symlink_dir_no_src(path):      assert os.path.islink(path('dst')) [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  @in_env  def test_symlink_dir_exists(path):      os.mkdir(path('src')) @@ -637,7 +637,7 @@ def test_symlink_dir_exists(path):      assert not os.path.isfile(path('dst/src_file')) [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  @in_env  def test_symlink_dir_exists_file(path):      os.mkdir(path('src')) @@ -908,7 +908,7 @@ def test_write_file_multiline(path):      library.python.fs.write_file(path('src'), 'SRC line 1\nSRC line 2\n')      assert file_data(path('src')) == 'SRC line 1\nSRC line 2\n'      library.python.fs.write_file(path('src2'), 'SRC line 1\nSRC line 2\n', binary=False) -    if library.python.windows.on_win():  +    if library.python.windows.on_win():          assert file_data(path('src2')) == 'SRC line 1\r\nSRC line 2\r\n'      else:          assert file_data(path('src2')) == 'SRC line 1\nSRC line 2\n' @@ -919,7 +919,7 @@ def test_write_file_multiline_crlf(path):      library.python.fs.write_file(path('src'), 'SRC line 1\r\nSRC line 2\r\n')      assert file_data(path('src')) == 'SRC line 1\r\nSRC line 2\r\n'      library.python.fs.write_file(path('src2'), 'SRC line 1\r\nSRC line 2\r\n', binary=False) -    if library.python.windows.on_win():  +    if library.python.windows.on_win():          assert file_data(path('src2')) == 'SRC line 1\r\r\nSRC line 2\r\r\n'      else:          assert file_data(path('src2')) == 'SRC line 1\r\nSRC line 2\r\n' @@ -947,7 +947,7 @@ def test_get_tree_size(path):      assert library.python.fs.get_tree_size(path(''), recursive=True) == 3 [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  [email protected](library.python.windows.on_win(), reason='Symlinks disabled on Windows')  @in_env  def test_get_tree_size_dangling_symlink(path):      os.makedirs(path('deeper')) @@ -959,7 +959,7 @@ def test_get_tree_size_dangling_symlink(path):      assert library.python.fs.get_tree_size(path(''), recursive=True) == 1 [email protected](not library.python.windows.on_win(), reason='Test hardlinks on windows')  [email protected](not library.python.windows.on_win(), reason='Test hardlinks on windows')  def test_hardlink_or_copy():      max_allowed_hard_links = 1023  | 
