Coverage for /usr/local/lib/python3.10/site-packages/opal_common-0.0.0-py3.10.egg/opal_common/engine/paths.py: 67%

6 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 11:54 +0000

1from pathlib import Path 

2 

3from opal_common.config import opal_common_config 

4 

5 

6def is_data_module(path: Path) -> bool: 

7 """Only json files named `data.json` can be included in official OPA 

8 bundles as static data files. 

9 

10 checks if a given path points to such file. 

11 """ 

12 return path.name == "data.json" 

13 

14 

15def is_policy_module(path: Path) -> bool: 

16 """Checks if a given path points to a rego file (extension == .rego). 

17 

18 Only rego files are allowed in official OPA bundles as policy files. 

19 """ 

20 return path.suffix in opal_common_config.POLICY_REPO_POLICY_EXTENSIONS