@@ -141,7 +141,7 @@ def __init__(self, pattern=None, rangeset=None, copy_rangeset=True,
141141 self ._autostep = autostep
142142 self ._length = 0
143143 self ._patterns = {}
144- self .fold_axis = fold_axis
144+ self .fold_axis = fold_axis #: iterable over nD 0-indexed axis
145145 if pattern :
146146 self ._add (pattern , rangeset , copy_rangeset )
147147 elif rangeset :
@@ -568,7 +568,7 @@ def clear(self):
568568
569569 def __ior__ (self , other ):
570570 """
571- Implements the |= operator. So s |= t returns nodeset s with
571+ Implements the |= operator. So `` s |= t`` returns nodeset s with
572572 elements added from t. (Python version 2.5+ required)
573573 """
574574 self ._binary_sanity_check (other )
@@ -586,7 +586,7 @@ def intersection(self, other):
586586
587587 def __and__ (self , other ):
588588 """
589- Implements the & operator. So s & t returns a new nodeset with
589+ Implements the & operator. So `` s & t`` returns a new nodeset with
590590 elements common to s and t.
591591 """
592592 if not isinstance (other , NodeSet ):
@@ -595,7 +595,7 @@ def __and__(self, other):
595595
596596 def intersection_update (self , other ):
597597 """
598- s.intersection_update(t) returns nodeset s keeping only
598+ `` s.intersection_update(t)`` returns nodeset s keeping only
599599 elements also found in t.
600600 """
601601 if other is self :
@@ -619,7 +619,7 @@ def intersection_update(self, other):
619619
620620 def __iand__ (self , other ):
621621 """
622- Implements the &= operator. So s &= t returns nodeset s keeping
622+ Implements the &= operator. So `` s &= t`` returns nodeset s keeping
623623 only elements also found in t. (Python version 2.5+ required)
624624 """
625625 self ._binary_sanity_check (other )
@@ -628,7 +628,7 @@ def __iand__(self, other):
628628
629629 def difference (self , other ):
630630 """
631- s.difference(t) returns a new NodeSet with elements in s but not
631+ `` s.difference(t)`` returns a new NodeSet with elements in s but not
632632 in t.
633633 """
634634 self_copy = self .copy ()
@@ -637,7 +637,7 @@ def difference(self, other):
637637
638638 def __sub__ (self , other ):
639639 """
640- Implement the - operator. So s - t returns a new nodeset with
640+ Implement the - operator. So `` s - t`` returns a new nodeset with
641641 elements in s but not in t.
642642 """
643643 if not isinstance (other , NodeSetBase ):
@@ -646,9 +646,11 @@ def __sub__(self, other):
646646
647647 def difference_update (self , other , strict = False ):
648648 """
649- s.difference_update(t) returns nodeset s after removing
650- elements found in t. If strict is True, raise KeyError
651- if an element cannot be removed.
649+ ``s.difference_update(t)`` returns nodeset s after removing
650+ elements found in t.
651+
652+ :raises KeyError: an element cannot be removed (only if strict is
653+ True)
652654 """
653655 # the purge of each empty pattern is done afterward to allow self = ns
654656 purge_patterns = []
@@ -676,7 +678,7 @@ def difference_update(self, other, strict=False):
676678
677679 def __isub__ (self , other ):
678680 """
679- Implement the -= operator. So s -= t returns nodeset s after
681+ Implement the -= operator. So `` s -= t`` returns nodeset s after
680682 removing elements found in t. (Python version 2.5+ required)
681683 """
682684 self ._binary_sanity_check (other )
@@ -687,12 +689,14 @@ def remove(self, elem):
687689 """
688690 Remove element elem from the nodeset. Raise KeyError if elem
689691 is not contained in the nodeset.
692+
693+ :raises KeyError: elem is not contained in the nodeset
690694 """
691695 self .difference_update (elem , True )
692696
693697 def symmetric_difference (self , other ):
694698 """
695- s.symmetric_difference(t) returns the symmetric difference of
699+ `` s.symmetric_difference(t)`` returns the symmetric difference of
696700 two nodesets as a new NodeSet.
697701
698702 (ie. all nodes that are in exactly one of the nodesets.)
@@ -703,7 +707,7 @@ def symmetric_difference(self, other):
703707
704708 def __xor__ (self , other ):
705709 """
706- Implement the ^ operator. So s ^ t returns a new NodeSet with
710+ Implement the ^ operator. So `` s ^ t`` returns a new NodeSet with
707711 nodes that are in exactly one of the nodesets.
708712 """
709713 if not isinstance (other , NodeSet ):
@@ -712,7 +716,7 @@ def __xor__(self, other):
712716
713717 def symmetric_difference_update (self , other ):
714718 """
715- s.symmetric_difference_update(t) returns nodeset s keeping all
719+ `` s.symmetric_difference_update(t)`` returns nodeset s keeping all
716720 nodes that are in exactly one of the nodesets.
717721 """
718722 purge_patterns = []
@@ -743,7 +747,7 @@ def symmetric_difference_update(self, other):
743747
744748 def __ixor__ (self , other ):
745749 """
746- Implement the ^= operator. So s ^= t returns nodeset s after
750+ Implement the ^= operator. So `` s ^= t`` returns nodeset s after
747751 keeping all nodes that are in exactly one of the nodesets.
748752 (Python version 2.5+ required)
749753 """
@@ -1139,6 +1143,7 @@ class NodeSet(NodeSetBase):
11391143 Iterable class of nodes with node ranges support.
11401144
11411145 NodeSet creation examples:
1146+
11421147 >>> nodeset = NodeSet() # empty NodeSet
11431148 >>> nodeset = NodeSet("cluster3") # contains only cluster3
11441149 >>> nodeset = NodeSet("cluster[5,10-42]")
@@ -1151,6 +1156,7 @@ class NodeSet(NodeSetBase):
11511156 so strict for convenience, and understands NodeSet instance or
11521157 NodeSet string as argument. Also, there is no strict definition of
11531158 one element, for example, it IS allowed to do:
1159+
11541160 >>> nodeset = NodeSet("blue[1-50]")
11551161 >>> nodeset.remove("blue[36-40]")
11561162 >>> print nodeset
@@ -1163,6 +1169,7 @@ class NodeSet(NodeSetBase):
11631169 proceeding any character operators accordinately.
11641170
11651171 Extended string pattern usage examples:
1172+
11661173 >>> nodeset = NodeSet("node[0-10],node[14-16]") # union
11671174 >>> nodeset = NodeSet("node[0-10]!node[8-10]") # difference
11681175 >>> nodeset = NodeSet("node[0-10]&node[5-13]") # intersection
0 commit comments