MCPcopy Create free account
hub / github.com/numpy/numpy / format_array

Method format_array

numpy/core/arrayprint.py:1351–1364  ·  view source on GitHub ↗
(self, a)

Source from the content-addressed store, hash-verified

1349 return self.format_array(a)
1350
1351 def format_array(self, a):
1352 if np.ndim(a) == 0:
1353 return self.format_function(a)
1354
1355 if self.summary_insert and a.shape[0] > 2*self.edge_items:
1356 formatted = (
1357 [self.format_array(a_) for a_ in a[:self.edge_items]]
1358 + [self.summary_insert]
1359 + [self.format_array(a_) for a_ in a[-self.edge_items:]]
1360 )
1361 else:
1362 formatted = [self.format_array(a_) for a_ in a]
1363
1364 return "[" + ", ".join(formatted) + "]"
1365
1366
1367class StructuredVoidFormat:

Callers 1

__call__Method · 0.95

Calls 2

ndimMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected