Ignore:
Timestamp:
Aug 3, 2013, 9:25:34 PM (6 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
First go at revised I/O. `test_file.py` succeeds for Python 2 and 3.

On the other hand, currently lots of tests fail, including for
Python 2. These tests still expect the old I/O semantics.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ftputil/host.py

    r1302 r1318  
    156156        return None
    157157
    158     def file(self, path, mode='r'):
     158    def open(self, path, mode="r", buffering=None, encoding=None, errors=None,
     159             newline=None):
    159160        """
    160161        Return an open file(-like) object which is associated with
     
    187188                    "exist or has insufficient access rights".
    188189                    format(effective_dir))
    189         host._file._open(effective_file, mode)
    190         if 'w' in mode:
     190        host._file._open(effective_file, mode=mode, buffering=buffering,
     191                         encoding=encoding, errors=errors, newline=newline)
     192        if "w" in mode:
    191193            # Invalidate cache entry because size and timestamps will change.
    192194            self.stat_cache.invalidate(effective_path)
    193195        return host._file
    194196
    195     open = file
     197    file = open
    196198
    197199    def close(self):
Note: See TracChangeset for help on using the changeset viewer.