Fixed usage of some old style string formattings.

Wed, 04 Nov 2015 16:40:08 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 04 Nov 2015 16:40:08 +0100
changeset 4544
5145cf800bb0
parent 4543
2e6a880670e9
child 4545
436736340877

Fixed usage of some old style string formattings.

Plugins/CheckerPlugins/SyntaxChecker/pyflakes/messages.py file | annotate | diff | comparison | revisions
Utilities/BackgroundService.py file | annotate | diff | comparison | revisions
Utilities/binplistlib.py file | annotate | diff | comparison | revisions
Utilities/crypto/py3AES.py file | annotate | diff | comparison | revisions
--- a/Plugins/CheckerPlugins/SyntaxChecker/pyflakes/messages.py	Wed Nov 04 16:25:25 2015 +0100
+++ b/Plugins/CheckerPlugins/SyntaxChecker/pyflakes/messages.py	Wed Nov 04 16:40:08 2015 +0100
@@ -39,7 +39,7 @@
         
         @return string representation of the object (string)
         """
-        return '%s:%s: %s' % (
+        return '{0}:{1}: {2}'.format(
             self.filename, self.lineno, self.message % self.message_args)
     
     def getMessageData(self):
--- a/Utilities/BackgroundService.py	Wed Nov 04 16:25:25 2015 +0100
+++ b/Utilities/BackgroundService.py	Wed Nov 04 16:40:08 2015 +0100
@@ -60,7 +60,7 @@
         
         port = self.serverPort()
         ## Note: Need the port if started external in debugger:
-        print('BackgroundService listening on: %i' % port)
+        print('BackgroundService listening on: {0:d}'.format(port))
         for pyName in ['Python', 'Python3']:
             interpreter = Preferences.getDebugger(
                 pyName + "Interpreter")
--- a/Utilities/binplistlib.py	Wed Nov 04 16:25:25 2015 +0100
+++ b/Utilities/binplistlib.py	Wed Nov 04 16:40:08 2015 +0100
@@ -119,7 +119,7 @@
         
         @return object representation (string)
         """
-        return "Uid(%d)" % self
+        return "Uid({0:d})".format(self)
 
 
 class Data(bytes):
@@ -527,7 +527,6 @@
         actual_length = length * 2
         data = self.contents[
             self.currentOffset:self.currentOffset + actual_length]
-        # unpack not needed?!! data = unpack(">%ds" % (actual_length), data)[0]
         self.currentOffset += actual_length
         return data.decode('utf_16_be')
     
@@ -610,7 +609,7 @@
         
         @return object representation (string)
         """
-        return "<HashableWrapper: %s>" % [self.value]
+        return "<HashableWrapper: {0}>".format([self.value])
 
 
 class BoolWrapper(object):
@@ -631,7 +630,7 @@
         
         @return object representation (string)
         """
-        return "<BoolWrapper: %s>" % self.value
+        return "<BoolWrapper: {0}>".format(self.value)
 
 
 class PlistWriter(object):
--- a/Utilities/crypto/py3AES.py	Wed Nov 04 16:25:25 2015 +0100
+++ b/Utilities/crypto/py3AES.py	Wed Nov 04 16:40:08 2015 +0100
@@ -1,4 +1,5 @@
-#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+
 #
 # aes.py: implements AES - Advanced Encryption Standard
 # from the SlowAES project, http://code.google.com/p/slowaes/
@@ -667,7 +668,6 @@
                 if end > len(input):
                     end = len(input)
                 plaintext = self.__extractBytes(input, start, end, mode)
-                # print 'PT@%s:%s' % (j, plaintext)
                 if mode == self.ModeOfOperation["CFB"]:
                     if firstRound:
                         output = self.aes.encrypt(IV, key, size)
@@ -710,7 +710,6 @@
                             iput[i] = plaintext[i] ^ IV[i]
                         else:
                             iput[i] = plaintext[i] ^ ciphertext[i]
-                    # print 'IP@%s:%s' % (j, iput)
                     firstRound = False
                     ciphertext = self.aes.encrypt(iput, key, size)
                     # always 16 bytes because of the padding for CBC
@@ -851,7 +850,8 @@
     """
     key = bytearray(key)
     keysize = len(key)
-    assert keysize in AES.KeySize.values(), 'invalid key size: %s' % keysize
+    assert keysize in AES.KeySize.values(), \
+        'invalid key size: {0}'.format(keysize)
     # iv is first 16 bytes
     iv = bytearray(data[:16])
     data = bytearray(data[16:])

eric ide

mercurial