17
17
18
18
19
19
def _slice_to_str (key , repr_func = str ):
20
- """
20
+ r """
21
21
Converts a slice to a string
22
22
23
23
Examples
@@ -40,7 +40,7 @@ def _slice_to_str(key, repr_func=str):
40
40
41
41
42
42
def irange (start , stop , step = None ):
43
- """Create a range, with inclusive stop bound and automatic sign for step.
43
+ r """Create a range, with inclusive stop bound and automatic sign for step.
44
44
45
45
Parameters
46
46
----------
@@ -81,7 +81,7 @@ def irange(start, stop, step=None):
81
81
82
82
83
83
def generalized_range (start , stop , step = 1 ):
84
- """Create a range, with inclusive stop bound and automatic sign for step. Bounds can be strings.
84
+ r """Create a range, with inclusive stop bound and automatic sign for step. Bounds can be strings.
85
85
86
86
Parameters
87
87
----------
@@ -199,7 +199,7 @@ def generalized_range(start, stop, step=1):
199
199
200
200
201
201
def _range_str_to_range (s , stack_depth = 1 ):
202
- """
202
+ r """
203
203
Converts a range string to a range (of values).
204
204
The end point is included.
205
205
@@ -247,7 +247,7 @@ def _range_str_to_range(s, stack_depth=1):
247
247
248
248
249
249
def _range_to_slice (seq , length = None ):
250
- """
250
+ r """
251
251
Returns a slice if possible (including for sequences of 1 element) otherwise returns the input sequence itself
252
252
253
253
Parameters
@@ -331,7 +331,7 @@ def _seq_group_to_name(seq):
331
331
332
332
333
333
def _to_tick (v ):
334
- """
334
+ r """
335
335
Converts any value to a tick (ie makes it hashable, and acceptable as an ndarray element)
336
336
337
337
scalar -> not modified
@@ -374,7 +374,7 @@ def _to_tick(v):
374
374
375
375
# TODO: remove the conversion to list in doctests once Python 2 is dropped
376
376
def _to_ticks (s , parse_single_int = False ):
377
- """
377
+ r """
378
378
Makes a (list of) value(s) usable as the collection of labels for an Axis (ie hashable).
379
379
380
380
Strip strings, split them on ',' and translate "range strings" to list of values **including the end point** !
@@ -438,7 +438,7 @@ def _to_ticks(s, parse_single_int=False):
438
438
439
439
440
440
def _seq_str_to_seq (s , stack_depth = 1 , parse_single_int = False ):
441
- """
441
+ r """
442
442
Converts a sequence string to its sequence (or scalar)
443
443
444
444
Parameters
@@ -481,7 +481,7 @@ def to_seq(b, stack_depth=1):
481
481
482
482
483
483
def _to_key (v , stack_depth = 1 , parse_single_int = False ):
484
- """
484
+ r """
485
485
Converts a value to a key usable for indexing (slice object, list of values,...).
486
486
Strings are split on ',' and stripped. Colons (:) are interpreted as slices.
487
487
@@ -584,7 +584,7 @@ def _to_key(v, stack_depth=1, parse_single_int=False):
584
584
585
585
586
586
def _to_keys (value , stack_depth = 1 ):
587
- """
587
+ r """
588
588
Converts a (collection of) group(s) to a structure usable for indexing.
589
589
590
590
'label' or ['l1', 'l2'] or [['l1', 'l2'], ['l3']]
@@ -670,7 +670,7 @@ def _translate_group_key_hdf(key):
670
670
# TODO: kill this function
671
671
def union (* args ):
672
672
# TODO: add support for LGroup and lists
673
- """
673
+ r """
674
674
Returns the union of several "value strings" as a list.
675
675
676
676
Parameters
@@ -694,7 +694,7 @@ def union(*args):
694
694
695
695
696
696
class IGroupMaker (object ):
697
- """
697
+ r """
698
698
Generates a new instance of IGroup for a given axis and key.
699
699
700
700
Attributes
@@ -786,7 +786,7 @@ def __str__(self):
786
786
787
787
# TODO: rename to "to_positional"
788
788
def translate (self , bound = None , stop = False ):
789
- """
789
+ r """
790
790
Translate key to a position if it is not already
791
791
792
792
Parameters
@@ -801,7 +801,7 @@ def translate(self, bound=None, stop=False):
801
801
raise NotImplementedError ()
802
802
803
803
def eval (self ):
804
- """
804
+ r """
805
805
Translate key to labels, if it is not already, expanding slices in the process.
806
806
807
807
Returns
@@ -811,7 +811,7 @@ def eval(self):
811
811
raise NotImplementedError ()
812
812
813
813
def to_label (self ):
814
- """
814
+ r """
815
815
Translate key to labels, if it is not already
816
816
817
817
Returns
@@ -821,7 +821,7 @@ def to_label(self):
821
821
raise NotImplementedError ()
822
822
823
823
def retarget_to (self , target_axis ):
824
- """Retarget group to another axis.
824
+ r """Retarget group to another axis.
825
825
826
826
It will be translated to an LGroup using its former axis, if necessary.
827
827
@@ -877,7 +877,7 @@ def __iter__(self):
877
877
return iter ([LGroup (v , axis = axis ) for v in self .eval ()])
878
878
879
879
def named (self , name ):
880
- """Returns group with a different name.
880
+ r """Returns group with a different name.
881
881
882
882
Parameters
883
883
----------
@@ -892,7 +892,7 @@ def named(self, name):
892
892
__rshift__ = named
893
893
894
894
def with_axis (self , axis ):
895
- """Returns group with a different axis.
895
+ r """Returns group with a different axis.
896
896
897
897
Parameters
898
898
----------
@@ -906,7 +906,7 @@ def with_axis(self, axis):
906
906
return self .__class__ (self .key , self .name , axis )
907
907
908
908
def by (self , length , step = None , template = None ):
909
- """Split group into several groups of specified length.
909
+ r """Split group into several groups of specified length.
910
910
911
911
Parameters
912
912
----------
@@ -964,7 +964,7 @@ def make_group(start, length, name_template):
964
964
# IGroup.i[] => IGroup
965
965
# LGroup.i[] => IGroup
966
966
def __getitem__ (self , key ):
967
- """
967
+ r """
968
968
969
969
Parameters
970
970
----------
@@ -1083,7 +1083,7 @@ def opmethod(self, other):
1083
1083
__eq__ = _binop ('eq' )
1084
1084
1085
1085
def equals (self , other ):
1086
- """
1086
+ r """
1087
1087
Checks if this group is equal to another group.
1088
1088
Two groups are equal if they have the same group and axis names and correspond to the same labels.
1089
1089
@@ -1146,7 +1146,7 @@ def equals(self, other):
1146
1146
return res if isinstance (res , bool ) else all (res )
1147
1147
1148
1148
def set (self ):
1149
- """Creates LSet from this group
1149
+ r """Creates LSet from this group
1150
1150
1151
1151
Returns
1152
1152
-------
@@ -1155,7 +1155,7 @@ def set(self):
1155
1155
return LSet (self .eval (), self .name , self .axis )
1156
1156
1157
1157
def union (self , other ):
1158
- """Returns (set) union of this label group and other.
1158
+ r """Returns (set) union of this label group and other.
1159
1159
1160
1160
Labels relative order will be kept intact, but only unique labels will be returned. Labels from this group will
1161
1161
be before labels from other.
@@ -1183,7 +1183,7 @@ def union(self, other):
1183
1183
return self .set ().union (other )
1184
1184
1185
1185
def intersection (self , other ):
1186
- """Returns (set) intersection of this label group and other.
1186
+ r """Returns (set) intersection of this label group and other.
1187
1187
1188
1188
In other words, this will return labels from this group which are also in other. Labels relative order will be
1189
1189
kept intact, but only unique labels will be returned.
@@ -1211,7 +1211,7 @@ def intersection(self, other):
1211
1211
return self .set ().intersection (other )
1212
1212
1213
1213
def difference (self , other ):
1214
- """Returns (set) difference of this label group and other.
1214
+ r """Returns (set) difference of this label group and other.
1215
1215
1216
1216
In other words, this will return labels from this group without those in other. Labels relative order will be
1217
1217
kept intact, but only unique labels will be returned.
@@ -1244,7 +1244,7 @@ def __contains__(self, item):
1244
1244
return item in self .eval ()
1245
1245
1246
1246
def startingwith (self , prefix ):
1247
- """
1247
+ r """
1248
1248
Returns a group with the labels starting with the specified string.
1249
1249
1250
1250
Parameters
@@ -1272,7 +1272,7 @@ def startingwith(self, prefix):
1272
1272
return LGroup ([v for v in self .eval () if v .startswith (prefix )], axis = self .axis )
1273
1273
1274
1274
def endingwith (self , suffix ):
1275
- """
1275
+ r """
1276
1276
Returns a group with the labels ending with the specified string.
1277
1277
1278
1278
Parameters
@@ -1300,7 +1300,7 @@ def endingwith(self, suffix):
1300
1300
return LGroup ([v for v in self .eval () if v .endswith (suffix )], axis = self .axis )
1301
1301
1302
1302
def matching (self , deprecated = None , pattern = None , regex = None ):
1303
- """
1303
+ r """
1304
1304
Returns a group with all the labels matching the specified pattern or regular expression.
1305
1305
1306
1306
Parameters
@@ -1369,7 +1369,7 @@ def matching(self, deprecated=None, pattern=None, regex=None):
1369
1369
return LGroup ([v for v in self .eval () if match (v )], axis = self .axis )
1370
1370
1371
1371
def containing (self , substring ):
1372
- """
1372
+ r """
1373
1373
Returns a group with all the labels containing the specified substring.
1374
1374
1375
1375
Parameters
@@ -1397,7 +1397,7 @@ def containing(self, substring):
1397
1397
return LGroup ([v for v in self .eval () if substring in v ], axis = self .axis )
1398
1398
1399
1399
def to_hdf (self , filepath , key = None , axis_key = None ):
1400
- """
1400
+ r """
1401
1401
Writes group to a HDF file.
1402
1402
1403
1403
A HDF file can contain multiple groups.
@@ -1542,7 +1542,7 @@ def remove_nested_groups(key):
1542
1542
1543
1543
1544
1544
class LGroup (Group ):
1545
- """Label group.
1545
+ r """Label group.
1546
1546
1547
1547
Represents a subset of labels of an axis.
1548
1548
@@ -1575,7 +1575,7 @@ def __init__(self, key, name=None, axis=None):
1575
1575
1576
1576
# XXX: return IGroup instead?
1577
1577
def translate (self , bound = None , stop = False ):
1578
- """
1578
+ r """
1579
1579
compute position(s) of group
1580
1580
"""
1581
1581
if bound is None :
@@ -1603,7 +1603,7 @@ def eval(self):
1603
1603
1604
1604
1605
1605
class LSet (LGroup ):
1606
- """Label set.
1606
+ r """Label set.
1607
1607
1608
1608
Represents a set of (unique) labels of an axis.
1609
1609
@@ -1675,7 +1675,7 @@ def opmethod(self, other):
1675
1675
1676
1676
1677
1677
class IGroup (Group ):
1678
- """Index Group.
1678
+ r """Index Group.
1679
1679
1680
1680
Represents a subset of indices of an axis.
1681
1681
@@ -1693,7 +1693,7 @@ class IGroup(Group):
1693
1693
format_string = "{axis}.i[{key}]"
1694
1694
1695
1695
def translate (self , bound = None , stop = False ):
1696
- """
1696
+ r """
1697
1697
compute position(s) of group
1698
1698
"""
1699
1699
if bound is not None :
0 commit comments