Add from __future__ import unicode_literals, issue #37

This commit is contained in:
Roberto Rosario
2015-01-19 04:06:40 -04:00
parent efbac7300c
commit d59ea3ede2
334 changed files with 2452 additions and 2268 deletions

View File

@@ -1,4 +1,4 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import os
@@ -37,7 +37,7 @@ class Key(object):
if exclude:
excluded_id = exclude.key_id
else:
excluded_id = u''
excluded_id = ''
for key in keys:
if not key['keyid'] in excluded_id:
key_instance = Key(
@@ -89,10 +89,10 @@ class Key(object):
@property
def user_ids(self):
return u', '.join(self.uids)
return ', '.join(self.uids)
def __str__(self):
return '%s "%s" (%s)' % (self.key_id, self.user_ids, KEY_TYPES.get(self.type, _(u'Unknown')))
return '%s "%s" (%s)' % (self.key_id, self.user_ids, KEY_TYPES.get(self.type, _('Unknown')))
def __unicode__(self):
return unicode(self.__str__())
@@ -129,7 +129,7 @@ class GPG(object):
try:
self.gpg = gnupg.GPG(**kwargs)
except Exception as exception:
raise GPGException(u'ERROR: GPG initialization error; %s' % exception)
raise GPGException('ERROR: GPG initialization error; %s' % exception)
def verify_file(self, file_input, detached_signature=None, fetch_key=False):
"""
@@ -242,7 +242,7 @@ class GPG(object):
return result
def create_key(self, *args, **kwargs):
if kwargs.get('passphrase') == u'':
if kwargs.get('passphrase') == '':
kwargs.pop('passphrase')
input_data = self.gpg.gen_key_input(**kwargs)
@@ -271,7 +271,7 @@ class GPG(object):
def query(self, term):
results = {}
for keyserver in self.keyservers:
url = u'http://%s' % keyserver
url = 'http://%s' % keyserver
server = KeyServer(url)
try:
key_list = server.search(term)