@@ -66,7 +66,7 @@ def set_labels(self, labels):
6666
6767 Parameters
6868 ----------
69- labels : list[string ], optional
69+ labels : list[str ], optional
7070 labels on which the entries will be scoped, for example:
7171 ['time','complex']
7272
@@ -110,7 +110,7 @@ def _get_labels(self):
110110
111111 Returns
112112 -------
113- labels: list[string ]
113+ labels: list[str ]
114114 labels on which the entries are scoped, for example:
115115 ``['time', 'complex']``
116116 """
@@ -123,12 +123,13 @@ def has_label(self, label):
123123
124124 Parameters
125125 ----------
126- label: string
126+ label: str
127127 Labels that must be searched, for example ``'time'``.
128128
129129 Returns
130130 -------
131- bool: True if the specified value have been found in the collection.
131+ bool
132+ ``True`` if the specified value has been found in the collection.
132133
133134 Examples
134135 --------
@@ -137,25 +138,19 @@ def has_label(self, label):
137138 >>> coll.add_label('time')
138139 >>> coll.has_label('time')
139140 True
141+
140142 >>> coll.has_label('complex')
141143 False
142144
143145 """
144- result = False
145- labels = self .labels
146- i = 0
147- while i < len (labels ):
148- if labels [i ] == label :
149- result = True
150- i += 1
151- return result
146+ return label in self .labels
152147
153148 def _get_entries (self , label_space_or_index ):
154149 """Returns the entries at a requested index or label space
155150
156151 Parameters
157152 ----------
158- label_space_or_index : dict[string ,int]
153+ label_space_or_index : dict[str ,int]
159154 Label space of the requested entry, for example:
160155 ``{"time": 1, "complex": 0}`` or index of the field.
161156
@@ -199,7 +194,7 @@ def _get_entry(self, label_space_or_index):
199194
200195 Parameters
201196 ----------
202- label_space_or_index : dict[string ,int]
197+ label_space_or_index : dict[str ,int]
203198 Label space of the requested entry, for example:
204199 ``{"time": 1, "complex": 0}`` or index of the field.
205200
@@ -228,7 +223,7 @@ def get_label_space(self, index):
228223
229224 Returns
230225 -------
231- label_space : dict(string :int)
226+ label_space : dict(str :int)
232227 Scoping of the requested entry, for example:
233228 ``{"time": 1, "complex": 0}``
234229 """
@@ -320,7 +315,7 @@ def _add_entry(self, label_space, entry):
320315
321316 parameters
322317 ----------
323- label_space : list[string ,int]
318+ label_space : list[str ,int]
324319 label space of the requested fields, ex : {"time":1, "complex":0}
325320
326321 entry : Field or Scoping
0 commit comments