|
43 | 43 | import math |
44 | 44 | import os.path |
45 | 45 | from copy import deepcopy |
46 | | -from functools import reduce |
| 46 | +from functools import reduce, partial |
47 | 47 | from urllib.parse import quote |
48 | 48 |
|
49 | 49 | import cython |
@@ -1571,36 +1571,45 @@ def same_species_lists(list1, list2, check_identical=False, only_check_label=Fal |
1571 | 1571 | Returns: |
1572 | 1572 | ``True`` if the lists are the same and ``False`` otherwise |
1573 | 1573 | """ |
| 1574 | + |
| 1575 | + same_object_passthrough = partial( |
| 1576 | + same_object, |
| 1577 | + _check_identical=check_identical, |
| 1578 | + _only_check_label=only_check_label, |
| 1579 | + _generate_intial_map=generate_initial_map, |
| 1580 | + _strict=strict, |
| 1581 | + _save_order=save_order, |
| 1582 | + ) |
1574 | 1583 |
|
1575 | 1584 | if len(list1) == len(list2) == 1: |
1576 | | - if same_object(list1[0], list2[0]): |
| 1585 | + if same_object_passthrough(list1[0], list2[0]): |
1577 | 1586 | return True |
1578 | 1587 | elif len(list1) == len(list2) == 2: |
1579 | | - if same_object(list1[0], list2[0]) and same_object(list1[1], list2[1]): |
| 1588 | + if same_object_passthrough(list1[0], list2[0]) and same_object_passthrough(list1[1], list2[1]): |
1580 | 1589 | return True |
1581 | | - elif same_object(list1[0], list2[1]) and same_object(list1[1], list2[0]): |
| 1590 | + elif same_object_passthrough(list1[0], list2[1]) and same_object_passthrough(list1[1], list2[0]): |
1582 | 1591 | return True |
1583 | 1592 | elif len(list1) == len(list2) == 3: |
1584 | | - if same_object(list1[0], list2[0]): |
1585 | | - if same_object(list1[1], list2[1]): |
1586 | | - if same_object(list1[2], list2[2]): |
| 1593 | + if same_object_passthrough(list1[0], list2[0]): |
| 1594 | + if same_object_passthrough(list1[1], list2[1]): |
| 1595 | + if same_object_passthrough(list1[2], list2[2]): |
1587 | 1596 | return True |
1588 | | - elif same_object(list1[1], list2[2]): |
1589 | | - if same_object(list1[2], list2[1]): |
| 1597 | + elif same_object_passthrough(list1[1], list2[2]): |
| 1598 | + if same_object_passthrough(list1[2], list2[1]): |
1590 | 1599 | return True |
1591 | | - elif same_object(list1[0], list2[1]): |
1592 | | - if same_object(list1[1], list2[0]): |
1593 | | - if same_object(list1[2], list2[2]): |
| 1600 | + elif same_object_passthrough(list1[0], list2[1]): |
| 1601 | + if same_object_passthrough(list1[1], list2[0]): |
| 1602 | + if same_object_passthrough(list1[2], list2[2]): |
1594 | 1603 | return True |
1595 | | - elif same_object(list1[1], list2[2]): |
1596 | | - if same_object(list1[2], list2[0]): |
| 1604 | + elif same_object_passthrough(list1[1], list2[2]): |
| 1605 | + if same_object_passthrough(list1[2], list2[0]): |
1597 | 1606 | return True |
1598 | | - elif same_object(list1[0], list2[2]): |
1599 | | - if same_object(list1[1], list2[0]): |
1600 | | - if same_object(list1[2], list2[1]): |
| 1607 | + elif same_object_passthrough(list1[0], list2[2]): |
| 1608 | + if same_object_passthrough(list1[1], list2[0]): |
| 1609 | + if same_object_passthrough(list1[2], list2[1]): |
1601 | 1610 | return True |
1602 | | - elif same_object(list1[1], list2[1]): |
1603 | | - if same_object(list1[2], list2[0]): |
| 1611 | + elif same_object_passthrough(list1[1], list2[1]): |
| 1612 | + if same_object_passthrough(list1[2], list2[0]): |
1604 | 1613 | return True |
1605 | 1614 | elif len(list1) == len(list2): |
1606 | 1615 | raise NotImplementedError("Can't check isomorphism of lists with {0} species/molecules".format(len(list1))) |
|
0 commit comments