(points, i: int)
| 1384 | n_points = len(points) |
| 1385 | |
| 1386 | def find_smallest_cell(points, i: int): |
| 1387 | if i == n_points - 1: |
| 1388 | return None |
| 1389 | pt = points[i] |
| 1390 | rest = points[i + 1 :] |
| 1391 | # Get all the points directly below and directly right |
| 1392 | below = [x for x in rest if x[0] == pt[0]] |
| 1393 | right = [x for x in rest if x[1] == pt[1]] |
| 1394 | for below_pt in below: |
| 1395 | if not edge_connects(pt, below_pt): |
| 1396 | continue |
| 1397 | |
| 1398 | for right_pt in right: |
| 1399 | if not edge_connects(pt, right_pt): |
| 1400 | continue |
| 1401 | |
| 1402 | bottom_right = (right_pt[0], below_pt[1]) |
| 1403 | |
| 1404 | if ( |
| 1405 | (bottom_right in intersections) |
| 1406 | and edge_connects(bottom_right, right_pt) |
| 1407 | and edge_connects(bottom_right, below_pt) |
| 1408 | ): |
| 1409 | return (pt[0], pt[1], bottom_right[0], bottom_right[1]) |
| 1410 | return None |
| 1411 | |
| 1412 | cell_gen = (find_smallest_cell(points, i) for i in range(len(points))) |
| 1413 | return list(filter(None, cell_gen)) |
no test coverage detected
searching dependent graphs…