MCPcopy Index your code
hub / github.com/huggingface/diffusers / read_source_classes

Function read_source_classes

utils/check_support_list.py:39–51  ·  view source on GitHub ↗

Reads class names from a source file using a regex that captures class definitions. Optionally exclude classes based on a list of conditions (functions that take class name and return bool).

(src_path, class_regex, exclude_conditions=None)

Source from the content-addressed store, hash-verified

37
38
39def read_source_classes(src_path, class_regex, exclude_conditions=None):
40 """
41 Reads class names from a source file using a regex that captures class definitions.
42 Optionally exclude classes based on a list of conditions (functions that take class name and return bool).
43 """
44 if exclude_conditions is None:
45 exclude_conditions = []
46 with open(os.path.join(REPO_PATH, src_path), "r") as f:
47 doctext = f.read()
48 classes = re.findall(class_regex, doctext)
49 # Filter out classes that meet any of the exclude conditions
50 filtered_classes = [c for c in classes if not any(cond(c) for cond in exclude_conditions)]
51 return filtered_classes
52
53
54def check_documentation(doc_path, src_path, doc_regex, src_regex, exclude_conditions=None):

Callers 1

check_documentationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…