MCPcopy
hub / github.com/reflex-dev/reflex / _single_source_dir

Function _single_source_dir

scripts/check_min_deps.py:165–181  ·  view source on GitHub ↗

Return the lone module directory under a ``src/`` layout directory. Args: src: The ``src`` directory of a package. Returns: The single child directory (the importable package). Raises: ValueError: If ``src`` does not contain exactly one child directory.

(src: Path)

Source from the content-addressed store, hash-verified

163
164
165def _single_source_dir(src: Path) -> Path:
166 """Return the lone module directory under a ``src/`` layout directory.
167
168 Args:
169 src: The ``src`` directory of a package.
170
171 Returns:
172 The single child directory (the importable package).
173
174 Raises:
175 ValueError: If ``src`` does not contain exactly one child directory.
176 """
177 children = [child for child in src.iterdir() if child.is_dir()]
178 if len(children) != 1:
179 msg = f"expected exactly one module directory under {src}, found {children}"
180 raise ValueError(msg)
181 return children[0]
182
183
184def _workspace_pyprojects() -> Iterator[tuple[str, Path]]:

Callers 1

discover_packagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected