[PATCH 13/17] Add beginnings of code documentation

Sebastian Spaeth Sebastian at SSpaeth.de
Mon Nov 29 16:02:21 GMT 2010


They mostly don't make sense yet, as they have been copied in from another project.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 docs/Makefile               |   88 ++++++++++++++
 docs/source/conf.py         |  200 +++++++++++++++++++++++++++++++
 docs/source/index.rst       |  275 +++++++++++++++++++++++++++++++++++++++++++
 docs/source/offlineimap.rst |   68 +++++++++++
 4 files changed, 631 insertions(+), 0 deletions(-)
 create mode 100644 docs/Makefile
 create mode 100644 docs/source/conf.py
 create mode 100644 docs/source/index.rst
 create mode 100644 docs/source/offlineimap.rst

diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 0000000..bd6de38
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,88 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+
+.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html      to make standalone HTML files"
+	@echo "  dirhtml   to make HTML files named index.html in directories"
+	@echo "  pickle    to make pickle files"
+	@echo "  json      to make JSON files"
+	@echo "  htmlhelp  to make HTML files and a HTML help project"
+	@echo "  qthelp    to make HTML files and a qthelp project"
+	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  changes   to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck to check all external links for integrity"
+	@echo "  doctest   to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf build/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) html
+	@echo
+	@echo "Build finished. The HTML pages are in html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) build/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in build/dirhtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) build/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in build/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in build/qthelp, like this:"
+	@echo "# qcollectiongenerator build/qthelp/pyDNS.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile build/qthelp/pyDNS.qhc"
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in build/latex."
+	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+	      "run these through (pdf)latex."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
+	@echo
+	@echo "The overview file is in build/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in build/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) build/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in build/doctest/output.txt."
diff --git a/docs/source/conf.py b/docs/source/conf.py
new file mode 100644
index 0000000..9269a51
--- /dev/null
+++ b/docs/source/conf.py
@@ -0,0 +1,200 @@
+# -*- coding: utf-8 -*-
+#
+# pyDNS documentation build configuration file, created by
+# sphinx-quickstart on Tue Feb  2 10:00:47 2010.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0,os.path.abspath('../..'))
+
+from offlineimap import __version__,__author__
+# -- General configuration -----------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo']
+autoclass_content = "both"
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'OfflineImap'
+copyright = u'2002-2010, ' + __author__
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = __version__
+# The full version, including alpha/beta/rc tags.
+release = __version__
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = []
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+add_module_names = False
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['../html']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+html_use_modindex = False
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'offlineimapdoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'offlineimap.tex', u'OfflineImap Documentation',
+   u'OfflineImap contributors', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/': None}
diff --git a/docs/source/index.rst b/docs/source/index.rst
new file mode 100644
index 0000000..457019c
--- /dev/null
+++ b/docs/source/index.rst
@@ -0,0 +1,275 @@
+.. OfflineImap documentation master file
+
+.. currentmodule:: offlineimap
+
+Welcome to :mod:`offlineimaps`'s documentation
+===========================================
+
+The :mod:`offlineimap` module provides an interface to the `notmuch <http://notmuchmail.org>`_ functionality, directly interfacing to a shared notmuch library.
+Within :mod:`notmuch`, the classes :class:`OfflineImap` provides the high-level functionality. :class:`Repository` provide most of the core functionality, returning :class:`Folder`.
+
+.. moduleauthor:: John Goerzen, Sebastian Spaeth <Sebastian at SSpaeth.de>
+
+:License: This module is covered under the GNU GPL v2 (or later).
+
+This page contains the main API overview of OfflineImap |release|. 
+
+Notmuch can be imported as::
+
+ import OfflineImap
+
+More information on specific topics can be found on the following pages:
+
+.. toctree::
+   :maxdepth: 1
+
+   offlineimap   
+
+:mod:`notmuch` -- The Notmuch interface
+=================================================
+
+.. automodule:: offlineimap
+
+:todo: Document nmlib,STATUS
+
+:class:`notmuch.Database` -- The underlying notmuch database
+---------------------------------------------------------------------
+
+.. autoclass:: notmuch.Database([path=None[, create=False[, mode=MODE.READ_ONLY]]])
+
+   .. automethod:: create
+
+   .. automethod:: open(path, status=MODE.READ_ONLY)
+
+   .. automethod:: get_path
+
+   .. automethod:: get_version
+
+   .. automethod:: needs_upgrade
+
+   .. automethod:: upgrade
+
+   .. automethod:: get_directory
+
+   .. automethod:: add_message
+
+   .. automethod:: remove_message
+
+   .. automethod:: find_message
+
+   .. automethod:: get_all_tags
+
+   .. automethod:: create_query
+
+   .. note:: :meth:`create_query` was broken in release
+             0.1 and is fixed since 0.1.1.
+
+   .. attribute:: Database.MODE
+
+     Defines constants that are used as the mode in which to open a database.
+
+     MODE.READ_ONLY
+       Open the database in read-only mode
+
+     MODE.READ_WRITE
+       Open the database in read-write mode
+
+   .. autoattribute:: db_p
+
+:class:`notmuch.Query` -- A search query
+-------------------------------------------------
+
+.. autoclass:: notmuch.Query
+
+   .. automethod:: create
+
+   .. attribute:: Query.SORT
+
+     Defines constants that are used as the mode in which to open a database.
+
+     SORT.OLDEST_FIRST
+       Sort by message date, oldest first.
+
+     SORT.NEWEST_FIRST
+       Sort by message date, newest first.
+
+     SORT.MESSAGE_ID
+       Sort by email message ID.
+
+     SORT.UNSORTED
+       Do not apply a special sort order (returns results in document id     
+       order). 
+
+   .. automethod:: set_sort
+
+   .. attribute::  sort
+
+      Instance attribute :attr:`sort` contains the sort order (see
+      :attr:`Query.SORT`) if explicitely specified via
+      :meth:`set_sort`. By default it is set to `None`.
+
+   .. automethod:: search_threads
+
+   .. automethod:: search_messages
+
+   .. automethod:: count_messages
+
+
+:class:`Messages` -- A bunch of messages
+----------------------------------------
+
+.. autoclass:: Messages
+
+   .. automethod:: collect_tags
+
+   .. automethod:: __len__
+
+:class:`Message` -- A single message
+----------------------------------------
+
+.. autoclass:: Message
+
+   .. automethod:: get_message_id
+
+   .. automethod:: get_thread_id
+
+   .. automethod:: get_replies
+
+   .. automethod:: get_filename
+
+   .. attribute:: FLAG
+
+        FLAG.MATCH 
+          This flag is automatically set by a
+	  Query.search_threads on those messages that match the
+	  query. This allows us to distinguish matches from the rest
+	  of the messages in that thread.
+
+  .. automethod:: get_flag
+
+   .. automethod:: set_flag
+   
+   .. automethod:: get_date
+
+   .. automethod:: get_header
+
+   .. automethod:: get_tags
+
+   .. automethod:: remove_tag
+
+   .. automethod:: add_tag
+
+   .. automethod:: remove_all_tags
+
+   .. automethod:: freeze
+
+   .. automethod:: thaw
+
+   .. automethod:: format_as_text
+
+   .. automethod:: __str__
+
+
+:class:`Tags` -- Notmuch tags
+-----------------------------
+
+.. autoclass:: Tags
+   :members:
+
+   .. automethod:: __len__
+
+   .. automethod:: __str__
+
+
+:class:`notmuch.Threads` -- Threads iterator
+-----------------------------------------------------
+
+.. autoclass:: notmuch.Threads
+
+   .. automethod:: __len__
+
+   .. automethod:: __str__
+
+:class:`Thread` -- A single thread
+------------------------------------
+
+.. autoclass:: Thread
+
+  .. automethod:: get_thread_id
+
+  .. automethod:: get_total_messages
+
+  .. automethod:: get_toplevel_messages
+
+  .. automethod:: get_matched_messages
+
+  .. automethod:: get_authors
+
+  .. automethod:: get_subject
+
+  .. automethod:: get_oldest_date
+
+  .. automethod:: get_newest_date
+
+  .. automethod:: get_tags
+
+  .. automethod:: __str__
+
+
+:class:`Filenames` -- An iterator over filenames
+------------------------------------------------
+
+.. autoclass:: notmuch.database.Filenames
+
+   .. automethod:: notmuch.database.Filenames.__len__
+
+:class:`notmuch.database.Directoy` -- A directory entry in the database
+------------------------------------------------------------------------
+
+.. autoclass:: notmuch.database.Directory
+
+   .. automethod:: notmuch.database.Directory.get_child_files
+
+   .. automethod:: notmuch.database.Directory.get_child_directories
+
+   .. automethod:: notmuch.database.Directory.get_mtime
+
+   .. automethod:: notmuch.database.Directory.set_mtime
+
+   .. autoattribute:: notmuch.database.Directory.mtime
+
+   .. autoattribute:: notmuch.database.Directory.path
+
+:exc:`NotmuchError` -- A Notmuch execution error
+------------------------------------------------
+.. autoexception:: NotmuchError
+   :members:
+
+   This execption inherits directly from :exc:`Exception` and is raised on errors during the notmuch execution.
+
+:class:`STATUS` -- Notmuch operation return status
+--------------------------------------------------
+
+.. data:: STATUS
+
+  STATUS is a class, whose attributes provide constants that serve as return indicators for notmuch functions. Currently the following ones are defined. For possible return values and specific meaning for each method, see the method description.
+
+  * SUCCESS
+  * OUT_OF_MEMORY
+  * READ_ONLY_DATABASE
+  * XAPIAN_EXCEPTION
+  * FILE_ERROR
+  * FILE_NOT_EMAIL
+  * DUPLICATE_MESSAGE_ID
+  * NULL_POINTER
+  * TAG_TOO_LONG
+  * UNBALANCED_FREEZE_THAW
+  * NOT_INITIALIZED
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`search`
+
diff --git a/docs/source/offlineimap.rst b/docs/source/offlineimap.rst
new file mode 100644
index 0000000..32e1783
--- /dev/null
+++ b/docs/source/offlineimap.rst
@@ -0,0 +1,68 @@
+The notmuch 'binary'
+====================
+
+The cnotmuch module provides *notmuch*, a python reimplementation of the standard notmuch binary for two purposes: first, to allow running the standard notmuch testsuite over the cnotmuch bindings (for correctness and performance testing) and second, to give some examples as to how to use cnotmuch. 'Notmuch' provides a command line interface to your mail database.
+
+A standard install via `easy_install cnotmuch` will not install the notmuch binary, however it is available in the `cnotmuch source code repository <http://bitbucket.org/spaetz/cnotmuch/src/>`_.
+
+
+It is invoked with the following pattern: `notmuch <command> [args...]`.
+
+Where <command> and [args...] are as follows:
+
+  **setup**	Interactively setup notmuch for first use.
+                This has not yet been implemented, and will probably not be
+		implemented unless someone puts in the effort.
+
+  **new**	[--verbose]
+		Find and import new messages to the notmuch database.
+
+		This has not been implemented yet. We cheat by calling
+		the regular "notmuch" binary (which must be in your path
+		somewhere).
+
+  **search** [options...] <search-terms> [...]  Search for messages matching the given search terms.
+
+		This has been implemented but for the `--format` and
+		`--sort` options.
+
+  **show**	<search-terms> [...]
+		Show all messages matching the search terms.
+
+		This has been partially implemented, we show a stub for each 
+		found message, but do not output the full message body yet.
+
+  **count**	<search-terms> [...]
+		Count messages matching the search terms.
+
+		This has been fully implemented.
+
+  **reply**	[options...] <search-terms> [...]
+		Construct a reply template for a set of messages.
+
+		This has not been implemented yet.
+
+  **tag**	+<tag>|-<tag> [...] [--] <search-terms> [...]
+		Add/remove tags for all messages matching the search terms.
+
+		This has been fully implemented.
+
+  **dump**	[<filename>]
+		Create a plain-text dump of the tags for each message.
+
+		This has been fully implemented.
+  **restore**	<filename>
+		Restore the tags from the given dump file (see 'dump').
+
+		This has been fully implemented.
+
+  **search-tags**	[<search-terms> [...] ]
+		List all tags found in the database or matching messages.
+
+		This has been fully implemented.
+
+  **help**	[<command>]
+		This message, or more detailed help for the named command.
+
+		The 'help' page has been implemented, help for single
+		commands are missing though. Patches are welcome.
-- 
1.7.1





More information about the OfflineIMAP-project mailing list