Skip to content

Commit

Permalink
Hammering on View. Small fix to collection limbs property.
Browse files Browse the repository at this point in the history
  • Loading branch information
dotsdl committed Mar 16, 2016
1 parent 9d9b6ef commit 1dce483
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
28 changes: 26 additions & 2 deletions docs/Views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ A **View** makes it possible to work with arbitrary Trees and Leaves as a
single logical unit. It is an ordered set of its members.


Building a View
===============
Building a View and selecting members
=====================================
Views can be built from a list of paths, existing or not. Taking our working
directory with ::

Expand All @@ -32,6 +32,30 @@ members, individual members can be accessed through indexing and slicing ::
>>> v[1:]
<View([<Tree: 'larry/'>, <Leaf: 'curly.txt'>])>

But we can also use fancy indexing (which can be useful for re-ordering
members) ::

>>> v[[2, 0]]
<View([<Leaf: 'curly.txt'>, <Tree: 'moe/'>])>

Or boolean indexing ::

>>> v[[True, False, True]]
<View([<Tree: 'moe/'>, <Leaf: 'curly.txt'>])>

As well as indexing by name ::

>>> v['curly.txt']
<View([<Leaf: 'curly.txt'>])>

Note that since the name of a file or directory need not be unique, this always
returns a View.


A View is an abstract Tree...kind of
====================================
A View



Views from a Tree
Expand Down
2 changes: 1 addition & 1 deletion src/datreant/core/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def limbs(self):
"""A set giving the names of this collection's attached limbs.
"""
return self._classlimbs | self._limbs
return self._classagglimbs | self._agglimbs


class View(CollectionMixin):
Expand Down

0 comments on commit 1dce483

Please sign in to comment.