MCPcopy Index your code
hub / github.com/numpy/numpy / __init__

Method __init__

numpy/lib/_iotools.py:169–196  ·  view source on GitHub ↗
(self, delimiter=None, comments='#', autostrip=True,
                 encoding=None)

Source from the content-addressed store, hash-verified

167 return lambda input: [_.strip() for _ in method(input)]
168
169 def __init__(self, delimiter=None, comments='#', autostrip=True,
170 encoding=None):
171 delimiter = _decode_line(delimiter)
172 comments = _decode_line(comments)
173
174 self.comments = comments
175
176 # Delimiter is a character
177 if (delimiter is None) or isinstance(delimiter, str):
178 delimiter = delimiter or None
179 _handyman = self._delimited_splitter
180 # Delimiter is a list of field widths
181 elif hasattr(delimiter, '__iter__'):
182 _handyman = self._variablewidth_splitter
183 idx = np.cumsum([0] + list(delimiter))
184 delimiter = [slice(i, j) for (i, j) in itertools.pairwise(idx)]
185 # Delimiter is a single integer
186 elif int(delimiter):
187 (_handyman, delimiter) = (
188 self._fixedwidth_splitter, int(delimiter))
189 else:
190 (_handyman, delimiter) = (self._delimited_splitter, None)
191 self.delimiter = delimiter
192 if autostrip:
193 self._handyman = self.autostrip(_handyman)
194 else:
195 self._handyman = _handyman
196 self.encoding = encoding
197
198 def _delimited_splitter(self, line):
199 """Chop off comments, strip, and split at delimiter. """

Callers

nothing calls this directly

Calls 4

autostripMethod · 0.95
_decode_lineFunction · 0.85
sliceFunction · 0.85
cumsumMethod · 0.80

Tested by

no test coverage detected