INNER CODE UNIT · Python
_discover_loobin_files
infosecB/LOOBins · src/pyloobins/util.py:14
def _discover_loobin_files() -> list[pathlib.Path]:
"""Locate the LOOBin YAML corpus for the default (no-path) case.
Prefers a copy bundled inside the installed package (see the wheel
``force-include`` in ``pyproject.toml``), then falls back to walking up
from the package directory to find a sibling ``LOOBins/`` folder, which
covers editable installs and running from a source checkout.
"""
package_dir = pathlib.Path(pyloobins.__file__).parent
bundled = list((package_dir / "LOOBins").glob("**/*.yml"))
if bundled:
return bundled
for parent in package_dir.parents[:5]:
candidate = list((parent / "LOOBins").glob("**/*.yml"))
if candidate:
return candidate
return []