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