Coverage for src/csv_schema_validator/core/types.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-23 15:34 +0100

1""" 

2Type definitions for CSV schema core. 

3 

4This module provides type aliases and protocols for better type safety 

5and code documentation in the core schema package. 

6""" 

7from __future__ import annotations 

8 

9from typing import Any, Protocol 

10 

11# Type aliases for better readability 

12ValidationResult = dict[str, Any] 

13SchemaDict = dict[str, Any] 

14FieldDict = dict[str, Any] 

15 

16 

17class SchemaValidatorProtocol(Protocol): 

18 """Protocol for schema validation functions.""" 

19 

20 def __call__(self, schema: SchemaDict) -> ValidationResult: 

21 """Validate a schema and return validation result.""" 

22 ... 

23 

24 

25# Constants for supported field types 

26SUPPORTED_FIELD_TYPES = frozenset({"string", "number", "integer", "boolean"}) 

27NUMERIC_FIELD_TYPES = frozenset({"number", "integer"}) 

28BOOLEAN_VALUES = ["true", "false"]