MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / find_breaking_changes

Function find_breaking_changes

scripts/detect-breaking-changes.py:46–70  ·  view source on GitHub ↗
(
    new_obj: griffe.Object | griffe.Alias,
    old_obj: griffe.Object | griffe.Alias,
    *,
    path: list[str],
)

Source from the content-addressed store, hash-verified

44
45
46def find_breaking_changes(
47 new_obj: griffe.Object | griffe.Alias,
48 old_obj: griffe.Object | griffe.Alias,
49 *,
50 path: list[str],
51) -> Iterator[Text | str]:
52 new_members = public_members(new_obj)
53 old_members = public_members(old_obj)
54
55 for name, old_member in old_members.items():
56 if isinstance(old_member, griffe.Alias) and len(path) > 2:
57 # ignore imports in `/types/` for now, they're technically part of the public API
58 # but we don't have good preventative measures in place to prevent changing them
59 continue
60
61 new_member = new_members.get(name)
62 if new_member is None:
63 cls_name = old_member.__class__.__name__
64 yield Text(f"({cls_name})", style=Style(color="rgb(119, 119, 119)"))
65 yield from [" " for _ in range(10 - len(cls_name))]
66 yield f" {'.'.join(path)}.{name}"
67 yield "\n"
68 continue
69
70 yield from find_breaking_changes(new_member, old_member, path=[*path, name])
71
72
73def main() -> None:

Callers 1

mainFunction · 0.85

Calls 2

public_membersFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected