Ignore:
Timestamp:
Mar 31, 2013, 12:24:59 AM (6 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Use modern string formatting with `format` method.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ftputil/file.py

    r1194 r1196  
    6868            raise ftputil.error.FTPIOError("append mode not supported")
    6969        if mode not in ('r', 'rb', 'w', 'wb'):
    70             raise ftputil.error.FTPIOError("invalid mode '%s'" % mode)
     70            raise ftputil.error.FTPIOError("invalid mode '{0}'".format(mode))
    7171        # Remember convenience variables instead of the mode itself.
    7272        self._bin_mode = 'b' in mode
     
    7474        # Select ASCII or binary mode.
    7575        transfer_type = ('A', 'I')[self._bin_mode]
    76         command = 'TYPE %s' % transfer_type
     76        command = 'TYPE {0}'.format(transfer_type)
    7777        with ftputil.error.ftplib_error_to_ftp_io_error:
    7878            self._session.voidcmd(command)
    7979        # Make transfer command.
    8080        command_type = ('STOR', 'RETR')[self._read_mode]
    81         command = '%s %s' % (command_type, path)
     81        command = '{0} {1}'.format(command_type, path)
    8282        # Ensure we can process the raw line separators.
    8383        # Force to binary regardless of transfer type.
     
    212212            return getattr(self._fo, attr_name)
    213213        raise AttributeError(
    214               "'FTPFile' object has no attribute '%s'" % attr_name)
     214              "'FTPFile' object has no attribute '{0}'".format(attr_name))
    215215
    216216    # TODO: Implement `__dir__`? (See
Note: See TracChangeset for help on using the changeset viewer.