MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / collect_classes

Function collect_classes

doc/conf.py:292–307  ·  view source on GitHub ↗
(types: set[str])

Source from the content-addressed store, hash-verified

290
291
292def collect_classes(types: set[str]) -> Iterable[tuple[str, str]]:
293 def get_base_classes(class_definition: str) -> Iterable[str]:
294 if "(" in class_definition and ")" in class_definition:
295 for base in class_definition[class_definition.index("(") + 1 : class_definition.index(")")].split(","):
296 yield base.strip()
297 else:
298 return []
299
300 for filename in sorted(glob.glob("../github/*.py")):
301 module = f"github.{filename[10:-3]}"
302 with open(filename) as r:
303 for line in r.readlines():
304 if line.startswith("class ") and any([base in types for base in get_base_classes(line)]):
305 class_name = re.match(r"class (\w+)[:(]", line).group(1)
306 if class_name not in types:
307 yield class_name, f"{module}"
308
309
310# get all classes derived from GithubObject classes directly

Callers 1

conf.pyFile · 0.85

Calls 1

get_base_classesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…