diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2017-12-15 10:01:27 -0500 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.com> | 2018-03-27 15:22:29 -0400 |
commit | 029a2a8d3b7e2024941792ac94d03d5dcb55a406 (patch) | |
tree | e7ac7296ef9776680407626b9ec663ac9979b482 /tools | |
parent | 3c9de69112c8158877e4b0060ef0ab89c083f376 (diff) |
python3: Run 2to3 script to conver the whole codebase
This is only the raw output of the script, no manual editing. The code
is now python3 only.
https://bugzilla.gnome.org/show_bug.cgi?id=733067
Diffstat (limited to 'tools')
-rw-r--r-- | tools/certdata2pem.py | 16 | ||||
-rw-r--r-- | tools/show-coverage.py | 13 |
2 files changed, 14 insertions, 15 deletions
diff --git a/tools/certdata2pem.py b/tools/certdata2pem.py index 5cc8f4cc..fa8246ba 100644 --- a/tools/certdata2pem.py +++ b/tools/certdata2pem.py @@ -70,13 +70,13 @@ for line in open('certdata.txt', 'r'): field, type = line_parts value = None else: - raise NotImplementedError, 'line_parts < 2 not supported.' + raise NotImplementedError('line_parts < 2 not supported.') if type == 'MULTILINE_OCTAL': in_multiline = True value = "" continue obj[field] = value -if len(obj.items()) > 0: +if len(list(obj.items())) > 0: objects.append(obj) # Read blacklist. @@ -95,7 +95,7 @@ for obj in objects: if obj['CKA_CLASS'] not in ('CKO_NETSCAPE_TRUST', 'CKO_NSS_TRUST'): continue if obj['CKA_LABEL'] in blacklist: - print "Certificate %s blacklisted, ignoring." % obj['CKA_LABEL'] + print("Certificate %s blacklisted, ignoring." % obj['CKA_LABEL']) elif obj['CKA_TRUST_SERVER_AUTH'] in ('CKT_NETSCAPE_TRUSTED_DELEGATOR', 'CKT_NSS_TRUSTED_DELEGATOR'): trust[obj['CKA_LABEL']] = True @@ -104,13 +104,13 @@ for obj in objects: trust[obj['CKA_LABEL']] = True elif obj['CKA_TRUST_SERVER_AUTH'] in ('CKT_NETSCAPE_UNTRUSTED', 'CKT_NSS_NOT_TRUSTED'): - print '!'*74 - print "UNTRUSTED BUT NOT BLACKLISTED CERTIFICATE FOUND: %s" % obj['CKA_LABEL'] - print '!'*74 + print('!'*74) + print("UNTRUSTED BUT NOT BLACKLISTED CERTIFICATE FOUND: %s" % obj['CKA_LABEL']) + print('!'*74) else: - print "Ignoring certificate %s. SAUTH=%s, EPROT=%s" % \ + print("Ignoring certificate %s. SAUTH=%s, EPROT=%s" % \ (obj['CKA_LABEL'], obj['CKA_TRUST_SERVER_AUTH'], - obj['CKA_TRUST_EMAIL_PROTECTION']) + obj['CKA_TRUST_EMAIL_PROTECTION'])) for obj in objects: if obj['CKA_CLASS'] == 'CKO_CERTIFICATE': diff --git a/tools/show-coverage.py b/tools/show-coverage.py index 2e89ff42..28cf4c4e 100644 --- a/tools/show-coverage.py +++ b/tools/show-coverage.py @@ -17,7 +17,7 @@ class Presentation: def show(self, maxlen=20): format = '%%-%ds %%3d %%%% (%%4d / %%4d)' % maxlen - print format % (self.name, self.percent, self.covered, self.lines) + print(format % (self.name, self.percent, self.covered, self.lines)) class Coverage: @@ -46,20 +46,19 @@ class Coverage: def show_results(self): if not hasattr(self, 'files'): - print 'No coverage data' + print('No coverage data') return if self.files: - self.maxlen = max(map(lambda f: len(self._strip_filename(f)), - self.files)) + self.maxlen = max([len(self._strip_filename(f)) for f in self.files]) else: self.maxlen = 0 - print 'Coverage report:' - print '-' * (self.maxlen + 23) + print('Coverage report:') + print('-' * (self.maxlen + 23)) for file in self.files: self.show_one(file) - print '-' * (self.maxlen + 23) + print('-' * (self.maxlen + 23)) p = Presentation('Total', self.total_lines, self.total_covered) p.show(self.maxlen) |