Create a hard link. Create a hard link to a `target` node with the given `name` in `where` location. `target` can be a node object or a path string. If `createparents` is true, the intermediate groups required for reaching `where` are created (the default is not
(
self,
where: Node | str,
name: str,
target: Node | str,
createparents: bool = False,
)
| 1641 | return ptobj |
| 1642 | |
| 1643 | def create_hard_link( |
| 1644 | self, |
| 1645 | where: Node | str, |
| 1646 | name: str, |
| 1647 | target: Node | str, |
| 1648 | createparents: bool = False, |
| 1649 | ) -> Group | Leaf: |
| 1650 | """Create a hard link. |
| 1651 | |
| 1652 | Create a hard link to a `target` node with the given `name` in |
| 1653 | `where` location. `target` can be a node object or a path |
| 1654 | string. If `createparents` is true, the intermediate groups |
| 1655 | required for reaching `where` are created (the default is not |
| 1656 | doing so). |
| 1657 | |
| 1658 | The returned node is a regular `Group` or `Leaf` instance. |
| 1659 | |
| 1660 | """ |
| 1661 | targetnode = self.get_node(target) |
| 1662 | parentnode = self._get_or_create_path(where, createparents) |
| 1663 | linkextension._g_create_hard_link(parentnode, name, targetnode) |
| 1664 | # Refresh children names in link's parent node |
| 1665 | parentnode._g_add_children_names() |
| 1666 | # Return the target node |
| 1667 | return self.get_node(parentnode, name) |
| 1668 | |
| 1669 | def create_soft_link( |
| 1670 | self, |