Coverage for src / ezcompiler / utils / validators / domain_validators.py: 100.00%
8 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-27 06:49 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-27 06:49 +0000
1# ///////////////////////////////////////////////////////////////
2# DOMAIN_VALIDATORS - Domain-specific validation utilities
3# Project: ezcompiler
4# ///////////////////////////////////////////////////////////////
6"""
7Domain validators - Validation utilities for project-specific domains.
9This module provides validation functions for project-specific data types
10like compiler names and upload structures.
11"""
13from __future__ import annotations
15# ///////////////////////////////////////////////////////////////
16# IMPORTS
17# ///////////////////////////////////////////////////////////////
18# Local imports
19from .value_validators import validate_choice
21# ///////////////////////////////////////////////////////////////
22# FUNCTIONS
23# ///////////////////////////////////////////////////////////////
26def validate_compiler_name(compiler: str) -> bool:
27 """
28 Validate a compiler name.
30 Args:
31 compiler: Compiler name to validate
33 Returns:
34 bool: True if compiler name is valid, False otherwise
36 Note:
37 Valid compilers: "auto", "Cx_Freeze", "PyInstaller", "Nuitka"
39 Example:
40 >>> validate_compiler_name("PyInstaller")
41 True
42 >>> validate_compiler_name("auto")
43 True
44 >>> validate_compiler_name("InvalidCompiler")
45 False
46 """
47 valid_compilers = ["auto", "Cx_Freeze", "PyInstaller", "Nuitka"]
48 return validate_choice(compiler, valid_compilers)
51def validate_upload_structure(structure: str) -> bool:
52 """
53 Validate an upload structure type.
55 Args:
56 structure: Upload structure to validate
58 Returns:
59 bool: True if upload structure is valid, False otherwise
61 Note:
62 Valid structures: "disk", "server"
64 Example:
65 >>> validate_upload_structure("disk")
66 True
67 >>> validate_upload_structure("server")
68 True
69 >>> validate_upload_structure("cloud")
70 False
71 """
72 valid_structures = ["disk", "server"]
73 return validate_choice(structure, valid_structures)