Module Expr Str Import alias Import alias ImportFrom alias ImportFrom alias identifier ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias identifier ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad Str NameLoad NameLoad NameLoad NameLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad Str Str body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Str Assign AttributeStore NameLoad attr BoolOpOr NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr BoolOpOr NameLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr BoolOpOr NameLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body If Call NameLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad orelse ImportFrom alias If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Str Expr Call NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpAdd Str NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Import alias Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Str Assign NameStore Call NameLoad NameLoad Assign AttributeStore NameLoad attr Call NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If Call NameLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad orelse Assign TupleStore NameStore NameStore SubscriptLoad NameLoad Index BoolOpOr NameLoad Str Assign NameStore BinOpAdd Str NameLoad Assign NameStore Call NameLoad Call NameLoad NameLoad NameLoad NameLoad ListLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Raise Call NameLoad Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Assign NameStore Call NameLoad NameLoad Str TryFinally body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad finalbody Expr Call AttributeLoad NameLoad attr Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str NameLoad If Call AttributeLoad NameLoad attr NameLoad body Assign NameStore BinOpAdd NameLoad Str If UnaryOpNot NameLoad body Assign NameStore Str orelse AugAssignAdd NameStore Str orelse Assign NameStore BinOpAdd NameLoad Str TryExcept body Assign NameStore Call NameLoad NameLoad Str handlers ExceptHandler type NameLoad body Raise Call AttributeLoad NameLoad attr BinOpMod Str NameLoad TryFinally body Assign NameStore Call AttributeLoad NameLoad attr NameLoad finalbody Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign SubscriptStore NameLoad Index Str BinOpAdd BinOpAdd NameLoad NameLoad SubscriptLoad NameLoad Index Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Dict Str Str Str Str Str NameLoad NameLoad NameLoad Str NameLoad Assign NameStore Dict Str Str Str Str Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str Str Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str NameLoad body Expr Str Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Str Str NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str If CompareIs NameLoad NameLoad body If AttributeLoad NameLoad attr body Assign NameStore Str orelse Raise Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index Str NameLoad If BoolOpAnd UnaryOpNot NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad If UnaryOpNot CompareLtELtE Num NameLoad Num body Raise Call NameLoad BinOpMod Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If UnaryOpNot NameLoad body Raise Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Dict If CompareNotEq AttributeLoad NameLoad attr Str body Assign NameStore ListLoad TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str For TupleStore NameStore NameStore NameLoad body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad BinOpAdd Str Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad If CompareNotEq AttributeLoad NameLoad attr Str body Assign NameStore ListLoad TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str For TupleStore NameStore NameStore NameLoad body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad BinOpAdd Str Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If NameLoad body Expr Call AttributeLoad NameLoad attr Dict Str Str Str NameLoad NameLoad NameLoad Return BinOpMod Str Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return BinOpMod Str Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Dict Str Str Str NameLoad NameLoad Str TryExcept body Assign NameStore SubscriptLoad Call NameLoad NameLoad keyword Str keyword NameLoad Index Str handlers ExceptHandler type NameLoad body Assign NameStore Call NameLoad NameLoad Return NameLoad decorator_list decorator_list
N/A N/A 
    sphinx.websupport
    ~~~~~~~~~~~~~~~~~

    Base Module for web support functions.

    :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
 N/A sys N/A posixpath os path six.moves cPickle pickle jinja2 Environment FileSystemLoader docutils.core publish_parts sphinx.application Sphinx sphinx.locale _ sphinx.util.osutil ensuredir sphinx.util.jsonimpl dumps dump_json sphinx.util.pycompat htmlescape sphinx.websupport errors sphinx.websupport.search BaseSearch SEARCH_ADAPTERS sphinx.websupport.storage StorageBackend WebSupport N/A object N/A N/A The main API class for the web support package. All interactions
    with the web support package should occur through this class.
     __init__ N/A N/A self srcdir builddir datadir staticdir doctreedir search storage status warning moderation_callback allow_anonymous_comments docroot staticroot N/A None None None None None None N/A sys stdout N/A sys stderr None True static N/A N/A N/A self srcdir srcdir N/A N/A self builddir builddir N/A N/A self outdir N/A N/A path join builddir data N/A N/A self datadir N/A datadir N/A self outdir N/A N/A self staticdir N/A staticdir N/A N/A path join N/A self builddir static N/A N/A self doctreedir N/A staticdir N/A N/A path join N/A self builddir doctrees N/A N/A self staticroot N/A N/A staticroot strip / N/A N/A self docroot N/A N/A docroot strip / N/A N/A self status status N/A N/A self warning warning N/A N/A self moderation_callback moderation_callback N/A N/A self allow_anonymous_comments allow_anonymous_comments N/A N/A N/A self _init_templating N/A N/A N/A self _init_search search N/A N/A N/A self _init_storage storage N/A N/A self _globalcontext None N/A N/A N/A self _make_base_comment_options N/A _init_storage N/A N/A self storage N/A N/A N/A N/A isinstance storage StorageBackend N/A N/A N/A self storage storage N/A sphinx.websupport.storage.sqlalchemystorage SQLAlchemyStorage N/A N/A storage N/A N/A db_path N/A N/A path join N/A self datadir db websupport.db N/A N/A ensuredir N/A N/A path dirname db_path N/A storage N/A sqlite:/// db_path N/A N/A self storage N/A SQLAlchemyStorage storage N/A _init_templating N/A N/A self N/A N/A N/A sphinx N/A template_path N/A N/A path join N/A sphinx package_dir themes basic N/A loader N/A FileSystemLoader template_path N/A N/A self template_env N/A Environment loader loader N/A _init_search N/A N/A self search N/A N/A N/A N/A isinstance search BaseSearch N/A N/A N/A self search search N/A N/A N/A mod cls N/A SEARCH_ADAPTERS N/A N/A search null N/A mod N/A sphinx.websupport.search. mod N/A SearchClass N/A getattr N/A __import__ mod None None N/A cls cls N/A search_path N/A N/A path join N/A self datadir search N/A N/A self search N/A SearchClass search_path N/A N/A self results_template N/A N/A N/A self template_env get_template searchresults.html N/A build N/A N/A self N/A N/A N/A Build the documentation. Places the data into the `outdir`
        directory. Use it like this::

            support = WebSupport(srcdir, builddir, search='xapian')
            support.build()

        This will read reStructured text files from `srcdir`. Then it will
        build the pickles and search index, placing them into `builddir`.
        It will also save node data to the database.
         N/A N/A N/A self srcdir N/A N/A N/A RuntimeError No srcdir associated with WebSupport object N/A app N/A Sphinx N/A self srcdir N/A self srcdir N/A self outdir N/A self doctreedir websupport status N/A self status warning N/A self warning N/A N/A N/A N/A app builder set_webinfo N/A self staticdir N/A self staticroot N/A self search N/A self storage N/A N/A N/A N/A self storage pre_build N/A N/A N/A app build N/A N/A N/A N/A self storage post_build N/A get_globalcontext N/A N/A self N/A N/A N/A Load and return the "global context" pickle. N/A N/A N/A self _globalcontext N/A N/A infilename N/A N/A path join N/A self datadir globalcontext.pickle N/A f N/A open infilename rb N/A N/A N/A N/A self _globalcontext N/A N/A pickle load f N/A N/A N/A N/A f close N/A N/A self _globalcontext N/A get_document N/A N/A self docname username moderator N/A False N/A N/A Load and return a document from a pickle. The document will
        be a dict object which can be used to render a template::

            support = WebSupport(datadir=datadir)
            support.get_document('index', username, moderator)

        In most cases `docname` will be taken from the request path and
        passed directly to this function. In Flask, that would be something
        like this::

            @app.route('/<path:docname>')
            def index(docname):
                username = g.user.name if g.user else ''
                moderator = g.user.moderator if g.user else False
                try:
                    document = support.get_document(docname, username,
                                                    moderator)
                except DocumentNotFoundError:
                    abort(404)
                render_template('doc.html', document=document)

        The document dict that is returned contains the following items
        to be used during template rendering.

        * **body**: The main body of the document as HTML
        * **sidebar**: The sidebar of the document as HTML
        * **relbar**: A div containing links to related documents
        * **title**: The title of the document
        * **css**: Links to css files used by Sphinx
        * **script**: Javascript containing comment options

        This raises :class:`~sphinx.websupport.errors.DocumentNotFoundError`
        if a document matching `docname` is not found.

        :param docname: the name of the document to load.
         N/A docpath N/A N/A path join N/A self datadir pickles docname N/A N/A N/A path isdir docpath N/A N/A infilename N/A docpath /index.fpickle N/A N/A docname N/A N/A docname index N/A N/A docname /index N/A N/A infilename N/A docpath .fpickle N/A N/A N/A f N/A open infilename rb N/A N/A N/A IOError N/A N/A N/A N/A errors DocumentNotFoundError N/A The document "%s" could not be found docname N/A N/A N/A document N/A N/A pickle load f N/A N/A N/A N/A f close N/A comment_opts N/A N/A self _make_comment_options username moderator N/A comment_meta N/A N/A self _make_metadata N/A N/A N/A self storage get_metadata docname moderator N/A N/A document N/A script N/A N/A comment_opts comment_meta N/A document N/A script N/A document N/A get_search_results N/A N/A self q N/A N/A N/A Perform a search for the query `q`, and create a set
        of search results. Then render the search results as html and
        return a context dict like the one created by
        :meth:`get_document`::

            document = support.get_search_results(q)

        :param q: the search query
         N/A results N/A N/A N/A self search query q N/A ctx N/A q search_performed search_results docroot _ q True results ../ _ N/A document N/A body title sidebar relbar N/A N/A N/A self results_template render ctx Search Results N/A document N/A get_data N/A N/A self node_id username moderator N/A None False N/A N/A Get the comments and source associated with `node_id`. If
        `username` is given vote information will be included with the
        returned comments. The default CommentBackend returns a dict with
        two keys, *source*, and *comments*. *source* is raw source of the
        node and is used as the starting point for proposals a user can
        add. *comments* is a list of dicts that represent a comment, each
        having the following items:

        ============= ======================================================
        Key           Contents
        ============= ======================================================
        text          The comment text.
        username      The username that was stored with the comment.
        id            The comment's unique identifier.
        rating        The comment's current rating.
        age           The time in seconds since the comment was added.
        time          A dict containing time information. It contains the
                      following keys: year, month, day, hour, minute, second,
                      iso, and delta. `iso` is the time formatted in ISO
                      8601 format. `delta` is a printable form of how old
                      the comment is (e.g. "3 hours ago").
        vote          If `user_id` was given, this will be an integer
                      representing the vote. 1 for an upvote, -1 for a
                      downvote, or 0 if unvoted.
        node          The id of the node that the comment is attached to.
                      If the comment's parent is another comment rather than
                      a node, this will be null.
        parent        The id of the comment that this comment is attached
                      to if it is not attached to a node.
        children      A list of all children, in this format.
        proposal_diff An HTML representation of the differences between the
                      the current source and the user's proposed source.
        ============= ======================================================

        :param node_id: the id of the node to get comments for.
        :param username: the username of the user viewing the comments.
        :param moderator: whether the user is a moderator.
         N/A N/A N/A N/A self storage get_data node_id username moderator N/A delete_comment N/A N/A self comment_id username moderator N/A False N/A N/A Delete a comment.

        If `moderator` is True, the comment and all descendants will be deleted
        from the database, and the function returns ``True``.

        If `moderator` is False, the comment will be marked as deleted (but not
        removed from the database so as not to leave any comments orphaned), but
        only if the `username` matches the `username` on the comment.  The
        username and text files are replaced with "[deleted]" .  In this case,
        the function returns ``False``.

        This raises :class:`~sphinx.websupport.errors.UserNotAuthorizedError`
        if moderator is False and `username` doesn't match username on the
        comment.

        :param comment_id: the id of the comment to delete.
        :param username: the username requesting the deletion.
        :param moderator: whether the requestor is a moderator.
         N/A N/A N/A N/A self storage delete_comment comment_id username moderator N/A add_comment N/A N/A self text node_id parent_id displayed username time proposal moderator N/A True None None None False N/A N/A Add a comment to a node or another comment. Returns the comment
        in the same format as :meth:`get_comments`. If the comment is being
        attached to a node, pass in the node's id (as a string) with the
        node keyword argument::

            comment = support.add_comment(text, node_id=node_id)

        If the comment is the child of another comment, provide the parent's
        id (as a string) with the parent keyword argument::

            comment = support.add_comment(text, parent_id=parent_id)

        If you would like to store a username with the comment, pass
        in the optional `username` keyword argument::

            comment = support.add_comment(text, node=node_id,
                                          username=username)

        :param parent_id: the prefixed id of the comment's parent.
        :param text: the text of the comment.
        :param displayed: for moderation purposes
        :param username: the username of the user making the comment.
        :param time: the time the comment was created, defaults to now.
         N/A N/A username None N/A N/A N/A self allow_anonymous_comments N/A N/A username Anonymous N/A N/A N/A N/A errors UserNotAuthorizedError N/A parsed N/A N/A self _parse_comment_text text N/A comment N/A N/A N/A self storage add_comment parsed displayed username time proposal node_id parent_id moderator N/A N/A comment N/A original_text text N/A N/A N/A displayed N/A self moderation_callback N/A N/A N/A N/A self moderation_callback comment N/A comment N/A process_vote N/A N/A self comment_id username value N/A N/A N/A Process a user's vote. The web support package relies
        on the API user to perform authentication. The API user will
        typically receive a comment_id and value from a form, and then
        make sure the user is authenticated. A unique username  must be
        passed in, which will also be used to retrieve the user's past
        voting data. An example, once again in Flask::

            @app.route('/docs/process_vote', methods=['POST'])
            def process_vote():
                if g.user is None:
                    abort(401)
                comment_id = request.form.get('comment_id')
                value = request.form.get('value')
                if value is None or comment_id is None:
                    abort(400)
                support.process_vote(comment_id, g.user.name, value)
                return "success"

        :param comment_id: the comment being voted on
        :param username: the unique username of the user voting
        :param value: 1 for an upvote, -1 for a downvote, 0 for an unvote.
         N/A value N/A int value N/A N/A N/A -1 value 1 N/A N/A N/A ValueError N/A vote value %s out of range (-1, 1) value N/A N/A N/A N/A self storage process_vote comment_id username value N/A update_username N/A N/A self old_username new_username N/A N/A N/A To remain decoupled from a webapp's authentication system, the
        web support package stores a user's username with each of their
        comments and votes. If the authentication system allows a user to
        change their username, this can lead to stagnate data in the web
        support system. To avoid this, each time a username is changed, this
        method should be called.

        :param old_username: The original username.
        :param new_username: The new username.
         N/A N/A N/A N/A self storage update_username old_username new_username N/A accept_comment N/A N/A self comment_id moderator N/A False N/A N/A Accept a comment that is pending moderation.

        This raises :class:`~sphinx.websupport.errors.UserNotAuthorizedError`
        if moderator is False.

        :param comment_id: The id of the comment that was accepted.
        :param moderator: Whether the user making the request is a moderator.
         N/A N/A moderator N/A N/A N/A N/A errors UserNotAuthorizedError N/A N/A N/A N/A self storage accept_comment comment_id N/A _make_base_comment_options N/A N/A self N/A N/A N/A Helper method to create the part of the COMMENT_OPTIONS javascript
        that remains the same throughout the lifetime of the
        :class:`~sphinx.websupport.WebSupport` object.
         N/A N/A self base_comment_opts N/A N/A N/A N/A self docroot N/A N/A comment_urls N/A N/A addCommentURL _add_comment N/A getCommentsURL _get_comments N/A processVoteURL _process_vote N/A acceptCommentURL _accept_comment N/A deleteCommentURL _delete_comment N/A N/A key value comment_urls N/A N/A N/A N/A self base_comment_opts N/A key N/A / N/A N/A posixpath join N/A self docroot value N/A N/A N/A self staticroot static N/A N/A static_urls N/A N/A commentImage comment.png N/A closeCommentImage comment-close.png N/A loadingImage ajax-loader.gif N/A commentBrightImage comment-bright.png N/A upArrow up.png N/A upArrowPressed up-pressed.png N/A downArrow down.png N/A downArrowPressed down-pressed.png N/A N/A key value static_urls N/A N/A N/A N/A self base_comment_opts N/A key N/A / N/A N/A posixpath join N/A self staticroot _static value N/A _make_comment_options N/A N/A self username moderator N/A N/A N/A Helper method to create the parts of the COMMENT_OPTIONS
        javascript that are unique to each request.

        :param username: The username of the user making the request.
        :param moderator: Whether the user making the request is a moderator.
         N/A rv N/A N/A N/A self base_comment_opts copy N/A username N/A N/A N/A N/A rv update N/A voting username moderator True username moderator N/A N/A         <script type="text/javascript">
        var COMMENT_OPTIONS = %s;
        </script>
         N/A dump_json rv N/A _make_metadata N/A N/A self data N/A N/A N/A N/A         <script type="text/javascript">
        var COMMENT_METADATA = %s;
        </script>
         N/A dump_json data N/A _parse_comment_text N/A N/A self text N/A N/A N/A settings N/A file_insertion_enabled raw_enabled output_encoding False False unicode N/A N/A N/A ret N/A N/A publish_parts text writer_name html settings_overrides settings N/A fragment N/A N/A N/A Exception N/A N/A ret N/A htmlescape text N/A ret N/A N/A