Module Expr Str ImportFrom alias alias alias ImportFrom alias ImportFrom alias alias Import alias Import alias ImportFrom alias ImportFrom alias alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad ClassDef bases NameLoad body Expr Str Assign NameStore Str FunctionDef arguments args NameParam defaults body Expr Str If CompareIs NameLoad NameLoad body Return NameLoad orelse Return Call AttributeLoad NameLoad attr Str Str decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str If CompareIs NameLoad NameLoad body Return NameLoad orelse Return Call AttributeLoad NameLoad attr Str Str decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad Str attr ListLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Str Str NameLoad Str orelse Assign NameStore Call AttributeLoad Str attr ListLoad Str NameLoad Str Expr Call AttributeLoad NameLoad attr Str NameLoad Return Call NameLoad Lambda arguments args NameParam defaults SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index Str Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad body Raise Call NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return Call NameLoad GeneratorExp Call AttributeLoad NameLoad attr NameLoad comprehension NameStore NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr Str body Continue Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq SubscriptLoad NameLoad Index Str NameLoad body Continue Expr Yield TupleLoad SubscriptLoad NameLoad Index Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore TupleLoad NameLoad NameLoad If CompareIs Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad body Raise Call NameLoad NameLoad For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Yield TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad body Expr Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad TupleLoad NameLoad Call NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad body Raise Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return IfExp CompareIs NameLoad NameLoad AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If BoolOpOr CompareIn Str NameLoad CompareIn Str NameLoad body Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Str Assign NameStore IfExp CompareGt Call NameLoad NameLoad Num ListLoad NameLoad ListLoad Expr Call AttributeLoad NameLoad attr ListLoad Str Call AttributeLoad NameLoad attr NameLoad keyword Str Call AttributeLoad NameLoad attr NameLoad keyword Str Return Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str If CompareEq Call NameLoad NameLoad Num body Assign TupleStore NameStore NameStore NameStore NameLoad orelse Assign TupleStore NameStore NameStore NameStore NameStore NameLoad Return Dict Str Str Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return NameLoad decorator_list decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad For NameStore NameLoad body Assign NameStore Call NameLoad NameLoad If CompareIn NameLoad NameLoad body Continue Expr Call AttributeLoad NameLoad attr NameLoad Expr Yield NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str For TupleStore NameStore NameStore Call NameLoad NameLoad body For NameStore NameLoad body Expr Yield NameLoad Break decorator_list FunctionDef arguments args NameParam defaults body Expr Str If BoolOpAnd Call NameLoad NameLoad NameLoad CompareEq Call NameLoad NameLoad Num body Return TupleLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num orelse Return TupleLoad NameLoad NameLoad decorator_list
N/A N/A 
Foldering support using :mod:`dossier.store` and :mod:`dossier.label`
=====================================================================

.. This software is released under an MIT/X11 open source license.
   Copyright 2012-2015 Diffeo, Inc.

.. autoclass:: Folders

N.B. This is deprecated and should not be used.
 __future__ absolute_import division print_function collections defaultdict itertools groupby imap N/A logging N/A urllib dossier.fc FeatureCollection dossier.label CorefValue Label N/A logger N/A N/A logging getLogger __name__ Folders N/A object N/A N/A Provides basic foldering support by using labels.

    :class:`Folders` implements a simple abstraction for
    storing folders in a :class:`dossier.fc.Store` and a
    :class:`dossier.label.LabelStore`. A fixed hierarchy of three
    levels is supported: folders contain subfolders and subfolders
    contain items.

    Folders and subfolders each have an identifier and its name is
    derived from that identifier. The identifier scheme is similar to
    what MediaWiki uses. If `The_Id` is the identifier, then `The Id`
    is the name (and vice versa). Note that the ASCII space character
    (``0x20``) and the ASCII slash character (``0x2F``) are not allowed
    in folder identifiers.

    Folders may be empty. Subfolders *cannot* be empty.

    Items in a subfolder are pairs of `(content_id, subtopic_id)`.
    The precise form of `content_id` and `subtopic_id` is not
    specified (it is application specific).

    Folders cannot be deleted or modified.

    .. automethod:: id_to_name
    .. automethod:: name_to_id
    .. automethod:: __init__
    .. automethod:: add_folder
    .. automethod:: add_item
    .. automethod:: folders
    .. automethod:: subfolders
    .. automethod:: items
    .. automethod:: parent_subfolders
     N/A DEFAULT_ANNOTATOR_ID unknown id_to_name N/A N/A ident N/A N/A N/A Converts a folder id to a folder name. N/A N/A ident None N/A N/A ident N/A N/A N/A N/A ident replace _ N/A staticmethod name_to_id N/A N/A name N/A N/A N/A Converts a folder name to a folder id. N/A N/A name None N/A N/A name N/A N/A N/A N/A name replace _ N/A staticmethod __init__ N/A N/A self store label_store prefix N/A N/A N/A Create a new :class:`Folders` instance.

        :param store: An FC store
        :type store: :class:`dossier.store.Store`
        :param label_store: A label store
        :type label_store: :class:`dossier.label.LabelStore`
        :param prefix: A folder id prefix
        :type prefix: unicode
        :rtype: :class:`Folders`
         N/A N/A self store store N/A N/A self label_store label_store N/A N/A self prefix N/A N/A prefix encode utf-8 N/A folders N/A N/A self ann_id N/A None N/A N/A Yields an unordered generator for all available folders.

        By default (with ``ann_id=None``), folders are shown for all
        anonymous users. Optionally, ``ann_id`` can be set to a username,
        which restricts the list to only folders owned by that user.

        :param str ann_id: Username
        :rtype: generator of folder_id
         N/A ann_id N/A N/A self _annotator ann_id N/A N/A N/A len N/A self prefix 0 N/A N/A prefix N/A N/A | join N/A N/A N/A urllib quote N/A self prefix safe ~ topic ann_id N/A N/A prefix N/A N/A | join N/A topic ann_id N/A N/A N/A logger info Scanning for folders with prefix %r prefix N/A N/A imap N/A N/A N/A id N/A N/A N/A N/A self unwrap_folder_content_id id N/A folder_id N/A N/A N/A self store scan_prefix_ids prefix N/A subfolders N/A N/A self folder_id ann_id N/A None N/A N/A Yields an unodered generator of subfolders in a folder.

        By default (with ``ann_id=None``), subfolders are shown for all
        anonymous users. Optionally, ``ann_id`` can be set to a username,
        which restricts the list to only subfolders owned by that user.

        :param str folder_id: Folder id
        :param str ann_id: Username
        :rtype: generator of subfolder_id
         N/A N/A N/A self assert_valid_folder_id folder_id N/A ann_id N/A N/A self _annotator ann_id N/A folder_cid N/A N/A self wrap_folder_content_id ann_id folder_id N/A N/A N/A N/A N/A self store get folder_cid None N/A N/A N/A KeyError folder_id N/A all_labels N/A N/A N/A self label_store directly_connected folder_cid N/A N/A nub N/A N/A N/A la subtopic_for folder_cid N/A la all_labels N/A parent_subfolders N/A N/A self ident ann_id N/A None N/A N/A An unordered generator of parent subfolders for ``ident``.

        ``ident`` can either be a ``content_id`` or a tuple of
        ``(content_id, subtopic_id)``.

        Parent subfolders are limited to the annotator id given.

        :param ident: identifier
        :type ident: ``str`` or ``(str, str)``
        :param str ann_id: Username
        :rtype: generator of ``(folder_id, subfolder_id)``
         N/A ann_id N/A N/A self _annotator ann_id N/A N/A cid _ N/A normalize_ident ident N/A lab N/A N/A N/A self label_store directly_connected ident N/A N/A folder_cid N/A N/A lab other cid N/A subfolder_sid N/A N/A lab subtopic_for folder_cid N/A N/A N/A N/A folder_cid startswith topic| N/A N/A N/A folder N/A N/A self unwrap_folder_content_id folder_cid N/A subfolder N/A N/A self unwrap_subfolder_subtopic_id subfolder_sid N/A N/A N/A folder N/A annotator_id ann_id N/A N/A N/A N/A N/A N/A folder N/A folder_id subfolder N/A items N/A N/A self folder_id subfolder_id ann_id N/A None N/A N/A Yields an unodered generator of items in a subfolder.

        The generator yields items, which are represented by a tuple
        of ``content_id`` and ``subtopic_id``. The format of these
        identifiers is unspecified.

        By default (with ``ann_id=None``), subfolders are shown for all
        anonymous users. Optionally, ``ann_id`` can be set to a username,
        which restricts the list to only subfolders owned by that user.

        :param str folder_id: Folder id
        :param str subfolder_id: Subfolder id
        :param str ann_id: Username
        :rtype: generator of ``(content_id, subtopic_id)``
         N/A N/A N/A self assert_valid_folder_id folder_id N/A N/A N/A self assert_valid_folder_id subfolder_id N/A ann_id N/A N/A self _annotator ann_id N/A folder_cid N/A N/A self wrap_folder_content_id ann_id folder_id N/A subfolder_sid N/A N/A self wrap_subfolder_subtopic_id subfolder_id N/A ident N/A folder_cid subfolder_sid N/A N/A N/A N/A N/A self store get folder_cid None N/A N/A N/A KeyError folder_id N/A lab N/A N/A N/A self label_store directly_connected ident N/A N/A cid N/A N/A lab other folder_cid N/A subid N/A N/A lab subtopic_for cid N/A N/A N/A cid subid N/A grouped_items N/A N/A self folder_id subfolder_id ann_id N/A None N/A N/A Returns a dictionary from content ids to subtopic ids.

        Namely, the mapping is ``content_id |--> list of subtopic id``.

        By default (with ``ann_id=None``), subfolders are shown for all
        anonymous users. Optionally, ``ann_id`` can be set to a username,
        which restricts the list to only subfolders owned by that user.

        :param str folder_id: Folder id
        :param str subfolder_id: Subfolder id
        :param str ann_id: Username
        :rtype: ``dict`` of ``content_id |--> [subtopic_id]``
         N/A d N/A defaultdict list N/A N/A cid subid N/A N/A self items folder_id subfolder_id ann_id ann_id N/A N/A N/A N/A N/A d N/A cid append subid N/A d N/A add_folder N/A N/A self folder_id ann_id N/A None N/A N/A Add a folder.

        If ``ann_id`` is set, then the folder is owned by the given user.
        Otherwise, the folder is owned and viewable by all anonymous
        users.

        :param str folder_id: Folder id
        :param str ann_id: Username
         N/A N/A N/A self assert_valid_folder_id folder_id N/A ann_id N/A N/A self _annotator ann_id N/A cid N/A N/A self wrap_folder_content_id ann_id folder_id N/A N/A N/A N/A self store put N/A N/A cid N/A FeatureCollection N/A N/A N/A logger info Added folder %r with content id %r folder_id cid N/A add_item N/A N/A self folder_id subfolder_id content_id subtopic_id ann_id N/A None None N/A N/A Add an item to a subfolder.

        The format of ``content_id`` and ``subtopic_id`` is
        unspecified. It is application specific.

        If ``ann_id`` is set, then the item is owned by the given user.
        Otherwise, the item is owned and viewable by all anonymous
        users.

        :param str folder_id: Folder id
        :param str subfolder_id: Folder id
        :param str content_id: content identifier
        :param str subtopic_id: subtopic identifier
        :param str ann_id: Username
         N/A N/A N/A self assert_valid_folder_id folder_id N/A N/A N/A self assert_valid_folder_id subfolder_id N/A ann_id N/A N/A self _annotator ann_id N/A folder_cid N/A N/A self wrap_folder_content_id ann_id folder_id N/A subfolder_sid N/A N/A self wrap_subfolder_subtopic_id subfolder_id N/A N/A N/A N/A N/A self store get folder_cid None N/A N/A N/A KeyError folder_id N/A lab N/A Label folder_cid content_id ann_id N/A CorefValue Positive subtopic_id1 subfolder_sid subtopic_id2 subtopic_id N/A N/A N/A N/A self label_store put lab N/A N/A N/A logger info Added subfolder item: %r lab N/A _annotator N/A N/A self ann_id N/A N/A N/A Returns the default annotator iff ``ann_id is None``. N/A N/A N/A ann_id None N/A self DEFAULT_ANNOTATOR_ID ann_id N/A assert_valid_folder_id N/A N/A self ident N/A N/A N/A N/A N/A ident N/A / ident N/A N/A N/A ValueError Folder ids cannot contain spaces or '/' characters. N/A wrap_folder_content_id N/A N/A self annotator_id fid N/A N/A N/A prefix N/A N/A urllib quote N/A self prefix safe ~ N/A parts N/A N/A N/A len prefix 0 N/A prefix N/A N/A N/A N/A parts extend N/A topic N/A N/A urllib quote annotator_id safe ~ N/A N/A urllib quote fid safe ~ N/A N/A N/A | join parts N/A unwrap_folder_content_id N/A N/A self cid N/A N/A N/A parts N/A N/A cid split | N/A N/A N/A len parts 3 N/A N/A N/A _ annotator_id fid parts N/A N/A N/A _ _ annotator_id fid parts N/A N/A annotator_id folder_id N/A N/A urllib unquote annotator_id N/A N/A urllib unquote fid N/A wrap_subfolder_subtopic_id N/A N/A self sfid N/A N/A N/A sfid N/A unwrap_subfolder_subtopic_id N/A N/A self subtopic_id N/A N/A N/A subtopic_id N/A N/A nub N/A N/A it N/A N/A N/A Dedups an iterable in arbitrary order.

    Uses memory proportional to the number of unique items in ``it``.
     N/A seen N/A set N/A v it N/A N/A h N/A hash v N/A N/A h seen N/A N/A N/A N/A N/A seen add h N/A N/A v N/A dedup N/A N/A it N/A N/A N/A Dedups a sorted iterable in constant memory. N/A N/A _ group N/A groupby it N/A N/A lab group N/A N/A N/A lab N/A N/A normalize_ident N/A N/A ident N/A N/A N/A Splits a generic identifier.

    If ``ident`` is a tuple, then ``(ident[0], ident[1])`` is returned.
    Otherwise, ``(ident[0], None)`` is returned.
     N/A N/A N/A isinstance ident tuple N/A N/A len ident 2 N/A N/A N/A N/A ident N/A 0 N/A ident N/A 1 N/A N/A N/A ident None N/A