Changeset 1716:208cec5f1797


Ignore:
Timestamp:
Dec 25, 2018, 11:05:14 PM (9 months ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
histedit_source:
11cfc2f98c21adea8ce3b9407ef189e8c561b2bf,0413bb6d5c9a453741738fe21242d768e389f8b9
Message:
Remove `socket_file_adapter.py`

This was only needed for Python 2 support, which will be removed with
ftputil 4.x.x.
Location:
ftputil
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • ftputil/file.py

    r1713 r1716  
    1111import ftputil.compat
    1212import ftputil.error
    13 import ftputil.socket_file_adapter
    1413
    1514
     
    5251        # pylint: disable=unused-argument
    5352        #
    54         # Python 3's `socket.makefile` supports the same interface as
    55         # the new `open` builtin, but Python 2 supports only a mode,
    56         # but doesn't return an object with the proper interface to
    57         # wrap it in `io.TextIOWrapper`.
    58         #
    59         # Therefore, to make the code work on Python 2 _and_ 3, use
    60         # `socket.makefile` to always create a binary file and under
    61         # Python 2 wrap it in an adapter class.
    62         #
    6353        # Check mode.
    6454        if "a" in mode:
     
    9585        # `BufferedReader` or `BufferedWriter` object.
    9686        fobj = self._conn.makefile(makefile_mode)
    97         if ftputil.compat.python_version == 2:
    98             BufferedIOAdapter = ftputil.socket_file_adapter.BufferedIOAdapter
    99             if is_read_mode:
    100                 fobj = BufferedIOAdapter(fobj, is_readable=True)
    101             else:
    102                 fobj = BufferedIOAdapter(fobj, is_writable=True)
    10387        if not is_binary_mode:
    10488            fobj = io.TextIOWrapper(fobj, encoding=encoding,
Note: See TracChangeset for help on using the changeset viewer.