summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorLucas Hoffmann <lucc@posteo.de>2019-11-04 08:00:10 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2019-11-06 10:54:00 +0000
commit414ca6c4b57752d139598e95e06009c55ff4543c (patch)
treea77d60aaf05f2c75224df95f7481f7328e414e7a /alot
parentbbb96525c08f0c6ee9fc93e0dd0ccb3abfd1dca8 (diff)
Remove unicode literals syntax from python2
Diffstat (limited to 'alot')
-rw-r--r--alot/account.py12
-rw-r--r--alot/buffers/thread.py2
-rw-r--r--alot/commands/envelope.py6
-rw-r--r--alot/commands/globals.py8
-rw-r--r--alot/commands/search.py2
-rw-r--r--alot/commands/thread.py2
-rw-r--r--alot/db/envelope.py4
-rw-r--r--alot/db/utils.py18
-rw-r--r--alot/helper.py24
-rw-r--r--alot/settings/manager.py2
-rw-r--r--alot/ui.py6
-rw-r--r--alot/widgets/globals.py2
12 files changed, 44 insertions, 44 deletions
diff --git a/alot/account.py b/alot/account.py
index 72b6cef0..a7e82690 100644
--- a/alot/account.py
+++ b/alot/account.py
@@ -201,7 +201,7 @@ class Account:
sent_box=None, sent_tags=None, draft_box=None,
draft_tags=None, replied_tags=None, passed_tags=None,
abook=None, sign_by_default=False,
- encrypt_by_default=u"none", encrypt_to_self=None,
+ encrypt_by_default="none", encrypt_to_self=None,
case_sensitive_username=False, **_):
self.address = Address.from_string(
address, case_sensitive=case_sensitive_username)
@@ -228,17 +228,17 @@ class Account:
encrypt_by_default = encrypt_by_default.lower()
msg = "Deprecation warning: The format for the encrypt_by_default " \
"option changed. Please use 'none', 'all' or 'trusted'."
- if encrypt_by_default in (u"true", u"yes", u"1"):
- encrypt_by_default = u"all"
+ if encrypt_by_default in ("true", "yes", "1"):
+ encrypt_by_default = "all"
logging.info(msg)
- elif encrypt_by_default in (u"false", u"no", u"0"):
- encrypt_by_default = u"none"
+ elif encrypt_by_default in ("false", "no", "0"):
+ encrypt_by_default = "none"
logging.info(msg)
self.encrypt_by_default = encrypt_by_default
# cache alias_regexp regexes
if self.alias_regexp != "":
self._alias_regexp = re.compile(
- u'^' + str(self.alias_regexp) + u'$',
+ '^' + str(self.alias_regexp) + '$',
flags=0 if case_sensitive_username else re.IGNORECASE)
def matches_address(self, address):
diff --git a/alot/buffers/thread.py b/alot/buffers/thread.py
index 01fac9a4..0314b772 100644
--- a/alot/buffers/thread.py
+++ b/alot/buffers/thread.py
@@ -84,7 +84,7 @@ class ThreadBuffer(Buffer):
heads_char = None
heads_att = None
if self._indent_width > 1:
- heads_char = u'\u27a4'
+ heads_char = '\u27a4'
heads_att = settings.get_theming_attribute('thread',
'arrow_heads')
A = ArrowTree(
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index 737a596f..26c2da49 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -236,7 +236,7 @@ class SendCommand(Command):
msg_position='left')) == 'no':
return
- clearme = ui.notify(u'constructing mail (GPG, attachments)\u2026',
+ clearme = ui.notify('constructing mail (GPG, attachments)\u2026',
timeout=-1)
try:
@@ -375,7 +375,7 @@ class EditCommand(Command):
ebuffer.rebuild()
# decode header
- headertext = u''
+ headertext = ''
for key in edit_headers:
vlist = self.envelope.get_all(key)
if not vlist:
@@ -664,7 +664,7 @@ class TagCommand(Command):
"""manipulate message tags"""
repeatable = True
- def __init__(self, tags=u'', action='add', **kwargs):
+ def __init__(self, tags='', action='add', **kwargs):
"""
:param tags: comma separated list of tagstrings to set
:type tags: str
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 718a4eba..9051d61b 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -727,8 +727,8 @@ class ComposeCommand(Command):
"""compose a new email"""
def __init__(
self,
- envelope=None, headers=None, template=None, sender=u'',
- tags=None, subject=u'', to=None, cc=None, bcc=None, attach=None,
+ envelope=None, headers=None, template=None, sender='',
+ tags=None, subject='', to=None, cc=None, bcc=None, attach=None,
omit_signature=False, spawn=None, rest=None, encrypt=False,
**kwargs):
"""
@@ -947,12 +947,12 @@ class ComposeCommand(Command):
async def _set_gpg_encrypt(self, ui):
account = self.envelope.account
- if self.encrypt or account.encrypt_by_default == u"all":
+ if self.encrypt or account.encrypt_by_default == "all":
logging.debug("Trying to encrypt message because encrypt=%s and "
"encrypt_by_default=%s", self.encrypt,
account.encrypt_by_default)
await update_keys(ui, self.envelope, block_error=self.encrypt)
- elif account.encrypt_by_default == u"trusted":
+ elif account.encrypt_by_default == "trusted":
logging.debug("Trying to encrypt message because "
"account.encrypt_by_default=%s",
account.encrypt_by_default)
diff --git a/alot/commands/search.py b/alot/commands/search.py
index dd052cfd..89012011 100644
--- a/alot/commands/search.py
+++ b/alot/commands/search.py
@@ -148,7 +148,7 @@ class TagCommand(Command):
"""manipulate message tags"""
repeatable = True
- def __init__(self, tags=u'', action='add', allmessages=False, flush=True,
+ def __init__(self, tags='', action='add', allmessages=False, flush=True,
**kwargs):
"""
:param tags: comma separated list of tagstrings to set
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 90f17bea..dbcfaa72 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -1080,7 +1080,7 @@ class TagCommand(Command):
"""manipulate message tags"""
repeatable = True
- def __init__(self, tags=u'', action='add', all=False, flush=True,
+ def __init__(self, tags='', action='add', all=False, flush=True,
**kwargs):
"""
:param tags: comma separated list of tagstrings to set
diff --git a/alot/db/envelope.py b/alot/db/envelope.py
index 35aa0fee..291ee849 100644
--- a/alot/db/envelope.py
+++ b/alot/db/envelope.py
@@ -78,7 +78,7 @@ class Envelope:
self.parse_template(template)
logging.debug('PARSED TEMPLATE: %s', template)
logging.debug('BODY: %s', self.body)
- self.body = bodytext or u''
+ self.body = bodytext or ''
# TODO: if this was as collections.defaultdict a number of methods
# could be simplified.
self.headers = headers or {}
@@ -100,7 +100,7 @@ class Envelope:
def __setitem__(self, name, val):
"""setter for header values. This allows adding header like so:
- envelope['Subject'] = u'sm\xf8rebr\xf8d'
+ envelope['Subject'] = 'sm\xf8rebr\xf8d'
"""
if name not in self.headers:
self.headers[name] = []
diff --git a/alot/db/utils.py b/alot/db/utils.py
index 194e726a..97406e3a 100644
--- a/alot/db/utils.py
+++ b/alot/db/utils.py
@@ -50,7 +50,7 @@ def add_signature_headers(mail, sigs, error_msg):
assert error_msg is None or isinstance(error_msg, str)
if not sigs:
- error_msg = error_msg or u'no signature found'
+ error_msg = error_msg or 'no signature found'
elif not error_msg:
try:
key = crypto.get_key(sigs[0].fpr)
@@ -112,19 +112,19 @@ def _handle_signatures(original, message, params):
"""
malformed = None
if len(message.get_payload()) != 2:
- malformed = u'expected exactly two messages, got {0}'.format(
+ malformed = 'expected exactly two messages, got {0}'.format(
len(message.get_payload()))
else:
ct = message.get_payload(1).get_content_type()
if ct != _APP_PGP_SIG:
- malformed = u'expected Content-Type: {0}, got: {1}'.format(
+ malformed = 'expected Content-Type: {0}, got: {1}'.format(
_APP_PGP_SIG, ct)
# TODO: RFC 3156 says the alg has to be lower case, but I've seen a message
# with 'PGP-'. maybe we should be more permissive here, or maybe not, this
# is crypto stuff...
if not params.get('micalg', 'nothing').startswith('pgp-'):
- malformed = u'expected micalg=pgp-..., got: {0}'.format(
+ malformed = 'expected micalg=pgp-..., got: {0}'.format(
params.get('micalg', 'nothing'))
sigs = []
@@ -161,13 +161,13 @@ def _handle_encrypted(original, message, session_keys=None):
ct = message.get_payload(0).get_content_type()
if ct != _APP_PGP_ENC:
- malformed = u'expected Content-Type: {0}, got: {1}'.format(
+ malformed = 'expected Content-Type: {0}, got: {1}'.format(
_APP_PGP_ENC, ct)
want = 'application/octet-stream'
ct = message.get_payload(1).get_content_type()
if ct != want:
- malformed = u'expected Content-Type: {0}, got: {1}'.format(want, ct)
+ malformed = 'expected Content-Type: {0}, got: {1}'.format(want, ct)
if not malformed:
# This should be safe because PGP uses US-ASCII characters only
@@ -209,7 +209,7 @@ def _handle_encrypted(original, message, session_keys=None):
add_signature_headers(original, sigs, '')
if malformed:
- msg = u'Malformed OpenPGP message: {0}'.format(malformed)
+ msg = 'Malformed OpenPGP message: {0}'.format(malformed)
content = email.message_from_string(msg,
_class=email.message.EmailMessage,
policy=email.policy.SMTP)
@@ -317,11 +317,11 @@ def extract_headers(mail, headers=None):
:param headers: headers to extract
:type headers: list of str
"""
- headertext = u''
+ headertext = ''
if headers is None:
headers = mail.keys()
for key in headers:
- value = u''
+ value = ''
if key in mail:
value = decode_header(mail.get(key, ''))
headertext += '%s: %s\n' % (key, value)
diff --git a/alot/helper.py b/alot/helper.py
index 7758dd52..2475bbcc 100644
--- a/alot/helper.py
+++ b/alot/helper.py
@@ -116,7 +116,7 @@ def string_decode(string, enc='ascii'):
def shorten(string, maxlen):
"""shortens string if longer than maxlen, appending ellipsis"""
if 1 < maxlen < len(string):
- string = string[:maxlen - 1] + u'…'
+ string = string[:maxlen - 1] + '…'
return string[:maxlen]
@@ -162,7 +162,7 @@ def shorten_author_string(authors_string, maxlength):
authors_chain = deque()
if len(authors) == 0:
- return u''
+ return ''
# reserve space for first author
first_au = shorten(authors.popleft(), maxlength)
@@ -179,7 +179,7 @@ def shorten_author_string(authors_string, maxlength):
au = authors.pop()
if len(au) > 1 and (remaining_length == 3 or (authors and
remaining_length < 7)):
- authors_chain.appendleft(u'\u2026')
+ authors_chain.appendleft('\u2026')
break
else:
if authors:
@@ -205,21 +205,21 @@ def pretty_datetime(d):
>>> now.strftime('%c')
'Sat 31 Mar 2012 14:47:26 '
>>> pretty_datetime(now)
- u'just now'
+ 'just now'
>>> pretty_datetime(now - timedelta(minutes=1))
- u'1min ago'
+ '1min ago'
>>> pretty_datetime(now - timedelta(hours=5))
- u'5h ago'
+ '5h ago'
>>> pretty_datetime(now - timedelta(hours=12))
- u'02:54am'
+ '02:54am'
>>> pretty_datetime(now - timedelta(days=1))
- u'yest 02pm'
+ 'yest 02pm'
>>> pretty_datetime(now - timedelta(days=2))
- u'Thu 02pm'
+ 'Thu 02pm'
>>> pretty_datetime(now - timedelta(days=7))
- u'Mar 24'
+ 'Mar 24'
>>> pretty_datetime(now - timedelta(days=356))
- u'Apr 2011'
+ 'Apr 2011'
"""
ampm = d.strftime('%p').lower()
if len(ampm):
@@ -551,7 +551,7 @@ def parse_mailto(mailto_str):
import urllib.parse
to_str, parms_str = mailto_str[7:].partition('?')[::2]
headers = {}
- body = u''
+ body = ''
to = urllib.parse.unquote(to_str)
if to:
diff --git a/alot/settings/manager.py b/alot/settings/manager.py
index 64167c37..d9fa724d 100644
--- a/alot/settings/manager.py
+++ b/alot/settings/manager.py
@@ -381,7 +381,7 @@ class SettingsManager:
return getattr(self.hooks, key, None)
return None
- def get_mapped_input_keysequences(self, mode='global', prefix=u''):
+ def get_mapped_input_keysequences(self, mode='global', prefix=''):
# get all bindings in this mode
globalmaps, modemaps = self.get_keybindings(mode)
candidates = list(globalmaps.keys()) + list(modemaps.keys())
diff --git a/alot/ui.py b/alot/ui.py
index b2cad776..afe12681 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -290,7 +290,7 @@ class UI:
self._unlock_callback = afterwards
self._locked = True
- def prompt(self, prefix, text=u'', completer=None, tab=0, history=None):
+ def prompt(self, prefix, text='', completer=None, tab=0, history=None):
"""
prompt for text input.
This returns a :class:`asyncio.Future`, which will have a string value
@@ -669,9 +669,9 @@ class UI:
info['pending_writes'] = len(self.dbman.writequeue)
info['input_queue'] = ' '.join(self.input_queue)
- lefttxt = righttxt = u''
+ lefttxt = righttxt = ''
if cb is not None:
- lefttxt, righttxt = settings.get(btype + '_statusbar', (u'', u''))
+ lefttxt, righttxt = settings.get(btype + '_statusbar', ('', ''))
lefttxt = string_decode(lefttxt, 'UTF-8')
lefttxt = lefttxt.format(**info)
righttxt = string_decode(righttxt, 'UTF-8')
diff --git a/alot/widgets/globals.py b/alot/widgets/globals.py
index f27e25b8..9de9cbbb 100644
--- a/alot/widgets/globals.py
+++ b/alot/widgets/globals.py
@@ -107,7 +107,7 @@ class CompleteEdit(urwid.Edit):
def __init__(self, completer, on_exit,
on_error=None,
- edit_text=u'',
+ edit_text='',
history=None,
**kwargs):
"""