X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=bindings%2Fpython%2Fnotmuch%2Ffilenames.py;h=830618bf42581ae1f1d693f553880429e3f2c350;hb=0803603cdd0d2db0a0b073aba1ffd79077acba84;hp=232a9edae9e09cdc95148402b5fc67e1bcc41899;hpb=df0e1cf7884f93bbbf70786d0bffc45824ae01c1;p=obsolete%2Fnotmuch-old
diff --git a/bindings/python/notmuch/filenames.py b/bindings/python/notmuch/filenames.py
index 232a9eda..830618bf 100644
--- a/bindings/python/notmuch/filenames.py
+++ b/bindings/python/notmuch/filenames.py
@@ -14,45 +14,50 @@ for more details.
You should have received a copy of the GNU General Public License
along with notmuch. If not, see .
-Copyright 2010 Sebastian Spaeth '
+Copyright 2010 Sebastian Spaeth
"""
from ctypes import c_char_p
from notmuch.globals import (
nmlib,
- NullPointerError,
- NotInitializedError,
NotmuchMessageP,
NotmuchFilenamesP,
Python3StringMixIn,
)
+from .errors import (
+ NullPointerError,
+ NotInitializedError,
+)
class Filenames(Python3StringMixIn):
"""Represents a list of filenames as returned by notmuch
- This object contains the Filenames iterator. The main function is
- as_generator() which will return a generator so we can do a Filenamesth an
- iterator over a list of notmuch filenames. Do note that the underlying
- library only provides a one-time iterator (it cannot reset the iterator to
- the start). Thus iterating over the function will "exhaust" the list of
- tags, and a subsequent iteration attempt will raise a
- :exc:`NotInitializedError`. Also note, that any function that uses
- iteration (nearly all) will also exhaust the tags. So both::
+ Objects of this class implement the iterator protocol.
+
+ .. note::
- for name in filenames: print name
+ The underlying library only provides a one-time iterator (it
+ cannot reset the iterator to the start). Thus iterating over
+ the function will "exhaust" the list of tags, and a subsequent
+ iteration attempt will raise a
+ :exc:`NotInitializedError`. Also note, that any function that
+ uses iteration (nearly all) will also exhaust the tags. So
+ both::
- as well as::
+ for name in filenames: print name
- number_of_names = len(names)
+ as well as::
- and even a simple::
+ number_of_names = len(names)
- #str() iterates over all tags to construct a space separated list
- print(str(filenames))
+ and even a simple::
- will "exhaust" the Filenames. However, you can use
- :meth:`Message.get_filenames` repeatedly to get fresh Filenames
- objects to perform various actions on filenames.
+ #str() iterates over all tags to construct a space separated list
+ print(str(filenames))
+
+ will "exhaust" the Filenames. However, you can use
+ :meth:`Message.get_filenames` repeatedly to get fresh
+ Filenames objects to perform various actions on filenames.
"""
#notmuch_filenames_get
@@ -107,18 +112,6 @@ class Filenames(Python3StringMixIn):
return file_.decode('utf-8', 'ignore')
next = __next__ # python2.x iterator protocol compatibility
- def as_generator(self):
- """Return generator of Filenames
-
- This is the main function that will usually be used by the
- user.
-
- .. deprecated:: 0.12
- :class:`Filenames` objects implement the
- iterator protocol.
- """
- return self
-
def __unicode__(self):
"""Represent Filenames() as newline-separated list of full paths