| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
| |
This patch replaces a large number (but not all) unused arguments with
the standard ``_`` placeholder. This has the advantage of signaling that
these values are unused.
There are a number of places that I've chosen not to apply this, largely
in methods that have publicly define signatures that they inherit
(usually from urwid).
|
|
|
|
|
|
|
|
|
|
|
| |
It's pretty easy to get caught up using dict.keys (or iterkeys) when
one doesn't need to. This patch corrects two cases where it's not
needed, the first is the case of inclusion. ``x in mydict.keys()`` is
equivalent to ``x in mydict``, but without the need to generate a list
and walk it. The second case is when calling set() on a dict,
``set(mydict)`` will create a set object of the dict's keys, without the
need to create one in memory and is significantly faster than
``set(mydict.keys())`` or even ``set(mydict.iterkeys())``.
|
|
|
|
|
|
|
|
| |
This patch replaces a number of uses of dict.items, dict.values, and
dict.keys with their iterative siblings. The advantage of using the
iterator version is that they don't copy the keys, values, or items, but
simply return references. This reduces memory usage and may speed up the
these operations a bit.
|
| |
|
|
|
|
|
|
| |
This patch removes the need to create an intermediate dictionary while
calculating the authors of a thread, it does so by working directly with
the _authors list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently this function takes a list, splits into two lists based on
whether or not a function returns None, sorts the list that isn't None,
and then appends the list of None to the end. This creates 4 new
concrete lists on each method call, requires the use of 3 filter +
lambda pairs, and calls list.sort(). Pretty complicated and inefficient.
This patch replaces that with a single sorted() function call with a kay
function that replaces None with a value that is guaranteed to sort less
than what Message.get_date() will return, but will not cause a
comparison to None (which is an error in Python 3.x). This is all based
on iterators and avoids the need for filter or list concatenation. This
should result in only one new list being created.
|
|
|
|
|
|
|
|
| |
This had the advantage of being more readable to people without a
functional programming background, and it avoids the need to use lambdas
which are both slow and have many corners in python. In a few cases it
also allows us to use a generator expression instead of a materialized
list, which save some memory.
|
|
|
|
| |
This just adds the `r` prefix to a few strings.
|
| |
|
|
|
|
| |
This is needed by unittest that mock Thread.refresh.
|
|
|
|
|
|
|
|
| |
The safely_get helper is just a wrapper around try/except, and is used
twice in the whole code base, in the same function. It really doesn't
even end up saving code because to get around line wrapping a lambda is
assigned (which is not the greatest style wise), it ends up saving one
line of code when it's called, and the function itself is 16 lines long.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This uses open() as a context manager instead of calling close()
explicitly. This has the advantage of closing even in the event of an
exception, being easier to visually inspect for correctness, and being
the more modern idiom.
This does leave one case of file.close(), where FILE is opened in an if
tree.
|
|
|
|
| |
This is the default value.
|
|
|
|
|
|
|
| |
Instead of using set([l for l in list]) use {l for l in list} (which
shouldn't be confused with a dict comprehension which requires the ':'
in the first value}. This avoids creating a list before reducing it to a
set. This feature is new in 2.7 and 3.3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a number of cases of mutable keyword arguments (list and dict
in this case). Mutable keyword arguments are rather dangerous, since any
mutation of the default value is persistent, which will inevitably lead
to bugs.
For example, imagine this code:
def func(def=[]):
def.append('foo')
return def
>>> func()
['foo']
>>> func()
['foo', 'foo']
This is almost certainly not what was intended. This code generally uses
the idiom of setting the default value to None, and then assigning with
or `value = value or []` which will replace value with the empty list
(or dict) when value is falsey, like None or another empty list.
|
| |
|
|
|
|
|
|
| |
- use relative imports if possible
- group imports into standard library, third party, and alot modules
- sort imports alphabetically
|
| |
|
|
|
|
|
| |
`del` and `return` are keywords and not functions so the braces are not
needed.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Default value 'first_message' lists authors in the order they joined the
conversation. Value 'latest_message' order authors by their latest
message, which makes it easier to see which authors who wrote the most
recent messages.
Note that authors with duplicate emails were previously filtered. We now
keep all authors where name + email is unique. This is behavior is
desired for some email notification services. For example, Jira will
set the From header to "Joe User <jira@company.com>" meaning you will
only see one author if you only keep unique email addresses.
|
|\
| |
| | |
Allow specifing the mailcap field key for `pipeto`
|
| |
| |
| |
| |
| | |
When decoding the message, use the mailcap field specified for command
lookup.
|
|\ \
| | |
| | | |
Removed incorrect backslash-t substitution in envelope.
|
| | | |
|
|\ \ \
| |/ /
|/| | |
|
| | | |
|
| | | |
|
|/ / |
|
| | |
|
| | |
|
|/
|
|
| |
see also issue #794
|
|
|
|
| |
issue #539
|
|
|
|
|
|
|
|
| |
Some versions of AppleMail apparently send out attachements
with incorrect mimetypes "application/octetstream"
(instead of "application/octet-stream").
This patch makes alot use libmagic on the attachments content
to determine the actual content type.
|
| |
|
|
|
|
|
|
|
|
|
| |
The email_as_string function, and the related RFC3156_canonicalize
function, are now used by the ForwardCommand and are not specific
anymore to the crypto routine. So we move them to the global helper
module.
fix an import removal mistake while moving email_as_string function: StringIO was not only used by email_as_string
|
| |
|
| |
|
|
|
|
|
| |
This patch makes the use of unicode more consistent, and enforces the
UTF8 charset for the added payload in case of failure.
|
|
|
|
|
| |
This delays the encoding of special chars, if any, to the actual display
which is supposed to know into what it should be encoded.
|
|
|
|
| |
mostly automatically fixed
|
| |
|
| |
|
|
|
|
| |
i.e., one not below that of notmuch's root path
|
|
|
|
| |
this is used in the Database manager
|
|
|
|
|
|
|
|
|
| |
Formerly None was used as failobj, but None is not iterable and that
is all that get_params does. Use list() instead which is iterable.
Closes #626.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
|
|
|
|
|
|
|
|
|
| |
Formerly any SMIME signed mail triggered a malformed OpenPGP message
warning. Be more selective wrt what to interpret as OpenPGP data by
looking at the protocol parameter first. Includes minor stylistic
changes.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
|
|
|
|
|
|
|
| |
Fix detection of OpenPGP encrypted data and also check the 'protocol'
parameter.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
|
|
|
|
|
|
|
| |
Move the parameter extraction to its own function and generalize it so
it can be reused.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
|
|
|
|
|
|
|
| |
RFC 2045 specifies that parameter names are case-insensitive, so
normalize them by converting them to their lower case version.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
|