MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / _get_repo_root

Function _get_repo_root

samples/compute/noxfile.py:258–273  ·  view source on GitHub ↗

Returns the root folder of the project.

()

Source from the content-addressed store, hash-verified

256
257
258def _get_repo_root() -> Optional[str]:
259 """Returns the root folder of the project."""
260 # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
261 p = Path(os.getcwd())
262 for i in range(10):
263 if p is None:
264 break
265 if Path(p / ".git").exists():
266 return str(p)
267 # .git is not available in repos cloned via Cloud Build
268 # setup.py is always in the library's root, so use that instead
269 # https://github.com/googleapis/synthtool/issues/792
270 if Path(p / "setup.py").exists():
271 return str(p)
272 p = p.parent
273 raise Exception("Unable to detect repository root.")
274
275
276GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")])

Callers 2

_session_testsFunction · 0.85
readmegenFunction · 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…