Coverage for class_generator/constants.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.10.1, created at 2025-07-29 12:31 +0300

1"""Constants used throughout the class generator.""" 

2 

3import keyword 

4import os 

5 

6# String constants 

7SPEC_STR: str = "SPEC" 

8FIELDS_STR: str = "FIELDS" 

9 

10# Directory constants 

11TESTS_MANIFESTS_DIR: str = "class_generator/tests/manifests" 

12SCHEMA_DIR: str = "class_generator/schema" 

13RESOURCES_MAPPING_FILE: str = os.path.join(SCHEMA_DIR, "__resources-mappings.json") 

14 

15# Description constants 

16MISSING_DESCRIPTION_STR: str = "No field description from API" 

17 

18# Python keyword mappings for safe variable names 

19PYTHON_KEYWORD_MAPPINGS = { 

20 # Map Python keywords to safe alternatives by appending underscore 

21 kw: f"{kw}_" 

22 for kw in keyword.kwlist 

23} 

24 

25# Version priority for Kubernetes API versions 

26VERSION_PRIORITY = { 

27 "v2": 6, 

28 "v1": 5, 

29 "v1beta2": 4, 

30 "v1beta1": 3, 

31 "v1alpha2": 2, 

32 "v1alpha1": 1, 

33} 

34 

35# Generated code marker 

36END_OF_GENERATED_CODE = "# End of generated code" 

37GENERATED_USING_MARKER = "# Generated using"