Ignore:
Timestamp:
Aug 3, 2013, 11:51:54 PM (6 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Removed no longer needed line ending conversion functions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ftputil/file.py

    r1323 r1324  
    1717# This module shouldn't be used by clients of the ftputil library.
    1818__all__ = []
    19 
    20 
    21 # Converter for `\r\n` line ends to normalized ones in Python. RFC 959
    22 # states that the server will send `\r\n` on text mode transfers, so
    23 # this conversion should be safe. I still use text mode transfers
    24 # (mode 'r', not 'rb') in `socket.makefile` (below) because the
    25 # server may do charset conversions on text transfers.
    26 #
    27 # Note that the "obvious" implementation of replacing "\r\n" with
    28 # "\n" would fail if "\r" (without "\n") occured at the end of the
    29 # string `text`.
    30 def _crlf_to_python_linesep(text):
    31     """
    32     Return `text` with ASCII line endings (CR/LF) converted to
    33     Python's internal representation (LF).
    34     """
    35     return text.replace('\r', '')
    36 
    37 
    38 # Converter for Python line ends to `\r\n`
    39 def _python_to_crlf_linesep(text):
    40     """
    41     Return `text` with Python's internal line ending representation
    42     (LF) converted to ASCII line endings (CR/LF).
    43     """
    44     return text.replace('\n', '\r\n')
    4519
    4620
Note: See TracChangeset for help on using the changeset viewer.