userver: /data/code/userver/testsuite/pytest_plugins/pytest_userver/plugins/ydb/discover.py Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
discover.py
1import pathlib
2from typing import List
3
4
5def find_schemas(schema_dirs: List[pathlib.Path]) -> List[pathlib.Path]:
6 result = []
7 for path in schema_dirs:
8 if not path.is_dir():
9 continue
10 result.extend(_scan_path(path))
11 return result
12
13
14def _scan_path(schema_path: pathlib.Path) -> List[pathlib.Path]:
15 result = []
16 for entry in schema_path.iterdir():
17 if entry.suffix == '.yaml' and entry.is_file():
18 result.append(entry)
19 elif entry.is_dir():
20 result.extend(_scan_path(entry))
21 return result