(results)
| 1268 | |
| 1269 | |
| 1270 | def finalize(results): |
| 1271 | if not results: |
| 1272 | return concatenate3(results) |
| 1273 | results2 = results |
| 1274 | while isinstance(results2, (tuple, list)): |
| 1275 | if len(results2) > 1: |
| 1276 | return concatenate3(results) |
| 1277 | else: |
| 1278 | results2 = results2[0] |
| 1279 | |
| 1280 | results = unpack_singleton(results) |
| 1281 | # Single chunk. There is a risk that the result holds a buffer stored in the |
| 1282 | # graph or on a process-local Worker. Deep copy to make sure that nothing can |
| 1283 | # accidentally write back to it. |
| 1284 | try: |
| 1285 | return results.copy() # numpy, sparse, scipy.sparse (any version) |
| 1286 | except AttributeError: |
| 1287 | # Not an Array API object |
| 1288 | return results |
| 1289 | |
| 1290 | |
| 1291 | CHUNKS_NONE_ERROR_MESSAGE = """ |
nothing calls this directly
no test coverage detected
searching dependent graphs…