Path 1: 3 calls (0.38)

'a' (2) 0 (1)

list (3)

'a.ids.__len__.length' (1) '0.missing' (1) 'a.x' (1)

1def get_access_path(key: str | Literal[0], parts: list[tuple[bool, str]]) -> str:
2    """Given a list of format specifiers, returns
3    the final access path (e.g. a.b.c[0][1]).
4    """
5    path = []
6    for is_attribute, specifier in parts:
7        if is_attribute:
8            path.append(f".{specifier}")
9        else:
10            path.append(f"[{specifier!r}]")
11    return str(key) + "".join(path)
            

Path 2: 3 calls (0.38)

0 (2) 'a' (1)

list (3)

'0[0][1]' (1) '0[0][0]' (1) 'a[0]' (1)

1def get_access_path(key: str | Literal[0], parts: list[tuple[bool, str]]) -> str:
2    """Given a list of format specifiers, returns
3    the final access path (e.g. a.b.c[0][1]).
4    """
5    path = []
6    for is_attribute, specifier in parts:
7        if is_attribute:
8            path.append(f".{specifier}")
9        else:
10            path.append(f"[{specifier!r}]")
11    return str(key) + "".join(path)
            

Path 3: 2 calls (0.25)

'a' (2)

list (2)

'a.ids[3][400]' (1) 'a.ids[3]["\'string\'"]' (1)

1def get_access_path(key: str | Literal[0], parts: list[tuple[bool, str]]) -> str:
2    """Given a list of format specifiers, returns
3    the final access path (e.g. a.b.c[0][1]).
4    """
5    path = []
6    for is_attribute, specifier in parts:
7        if is_attribute:
8            path.append(f".{specifier}")
9        else:
10            path.append(f"[{specifier!r}]")
11    return str(key) + "".join(path)