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

Function find_breaking_changes

scripts/detect-breaking-changes.py:23–47  ·  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

21
22
23def find_breaking_changes(
24 new_obj: griffe.Object | griffe.Alias,
25 old_obj: griffe.Object | griffe.Alias,
26 *,
27 path: list[str],
28) -> Iterator[Text | str]:
29 new_members = public_members(new_obj)
30 old_members = public_members(old_obj)
31
32 for name, old_member in old_members.items():
33 if isinstance(old_member, griffe.Alias) and len(path) > 2:
34 # ignore imports in `/types/` for now, they're technically part of the public API
35 # but we don't have good preventative measures in place to prevent changing them
36 continue
37
38 new_member = new_members.get(name)
39 if new_member is None:
40 cls_name = old_member.__class__.__name__
41 yield Text(f"({cls_name})", style=Style(color="rgb(119, 119, 119)"))
42 yield from [" " for _ in range(10 - len(cls_name))]
43 yield f" {'.'.join(path)}.{name}"
44 yield "\n"
45 continue
46
47 yield from find_breaking_changes(new_member, old_member, path=[*path, name])
48
49
50def main() -> None:

Callers 1

mainFunction · 0.85

Calls 2

public_membersFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected