MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _xaml_csharp_class_nodes

Function _xaml_csharp_class_nodes

graphify/extract.py:14668–14697  ·  view source on GitHub ↗
(path: Path)

Source from the content-addressed store, hash-verified

14666
14667
14668def _xaml_csharp_class_nodes(path: Path) -> dict[str, list[dict]]:
14669 from graphify.detect import _is_ignored, _is_noise_dir, _load_graphifyignore
14670 root = _xaml_project_root(path)
14671 cache_key = str(root.resolve()) if _XAML_ACTIVE_EXTRACT_ROOT is not None else None
14672 if cache_key and cache_key in _XAML_CSHARP_CLASS_CACHE:
14673 return _XAML_CSHARP_CLASS_CACHE[cache_key]
14674 classes: dict[str, list[dict]] = {}
14675 patterns = _load_graphifyignore(root)
14676 ignore_cache: dict[Path, bool] = {}
14677 try:
14678 cs_files = sorted(root.rglob("*.cs"))
14679 except OSError:
14680 return classes
14681 for cs_path in cs_files:
14682 if any(_is_noise_dir(part) for part in cs_path.parts):
14683 continue
14684 if patterns and _is_ignored(cs_path, root, patterns, _cache=ignore_cache):
14685 continue
14686 result = extract_csharp(cs_path)
14687 if result.get("error"):
14688 continue
14689 for node in result.get("nodes", []):
14690 label = str(node.get("label", ""))
14691 if not label.endswith("ViewModel") or not _XAML_IDENT_RE.fullmatch(label):
14692 continue
14693 if node.get("source_file"):
14694 classes.setdefault(label, []).append(node)
14695 if cache_key:
14696 _XAML_CSHARP_CLASS_CACHE[cache_key] = classes
14697 return classes
14698
14699
14700def _xaml_pascal_name(name: str) -> str | None:

Callers 1

extract_xamlFunction · 0.85

Calls 6

_load_graphifyignoreFunction · 0.90
_is_noise_dirFunction · 0.90
_is_ignoredFunction · 0.90
_xaml_project_rootFunction · 0.85
extract_csharpFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected