55import logging
66import sys
77import warnings
8+ from collections .abc import Sequence
89from inspect import signature
910from pathlib import Path
1011from typing import Any
@@ -183,7 +184,9 @@ def load_data(self, data: dict[str, Any]) -> None:
183184 """
184185 self .data = data
185186
186- def _load_data_from_paths (self , input_paths : list [Path ]) -> dict [str , Any ]:
187+ def _load_data_from_paths (
188+ self , input_paths : Sequence [Path | str ]
189+ ) -> dict [str , Any ]:
187190 """Load and merge YAML data from file system paths.
188191
189192 Args:
@@ -192,6 +195,7 @@ def _load_data_from_paths(self, input_paths: list[Path]) -> dict[str, Any]:
192195 Returns:
193196 Merged YAML data dictionary
194197 """
198+ input_paths = [Path (p ) for p in input_paths ]
195199 logger .info ("Loading yaml files from %s" , input_paths )
196200 self .data = load_yaml_files (input_paths )
197201 return self .data
@@ -298,20 +302,23 @@ def _get_named_path(self, data: dict[str, Any], path: str) -> str:
298302
299303 def validate_syntax (
300304 self ,
301- input_paths : list [Path ] | None = None ,
305+ input_paths : Sequence [Path | str ] | None = None ,
302306 strict : bool = True ,
303307 rich_output : bool = True ,
304308 ) -> None :
305309 """Run syntactic validation"""
310+ resolved_paths : list [Path ] | None = (
311+ [Path (p ) for p in input_paths ] if input_paths is not None else None
312+ )
306313 self .errors .clear ()
307314 self .structured_syntax_errors .clear ()
308315 self .file_count = 0
309316
310317 if self .data is not None :
311318 if self .schema is not None :
312319 source = (
313- str (input_paths [0 ])
314- if input_paths and len (input_paths ) > 0
320+ str (resolved_paths [0 ])
321+ if resolved_paths and len (resolved_paths ) > 0
315322 else "<pre-loaded>"
316323 )
317324 try :
@@ -341,9 +348,9 @@ def validate_syntax(
341348 )
342349 )
343350 else :
344- if not input_paths :
351+ if not resolved_paths :
345352 return
346- for input_path in input_paths :
353+ for input_path in resolved_paths :
347354 if input_path .is_file ():
348355 self ._validate_syntax_file (input_path , strict )
349356 if input_path .suffix in YAML_SUFFIXES :
@@ -387,7 +394,10 @@ def _result_has_violations(self, result: list[Any]) -> bool:
387394 return self ._get_violation_count (result ) > 0
388395
389396 def validate_semantics (
390- self , input_paths : list [Path ], rich_output : bool = True , compact : bool = False
397+ self ,
398+ input_paths : Sequence [Path | str ],
399+ rich_output : bool = True ,
400+ compact : bool = False ,
391401 ) -> None :
392402 """Run semantic validation"""
393403 if not self .rules :
@@ -468,7 +478,7 @@ def print_success_summary(self) -> None:
468478 file = sys .stderr ,
469479 )
470480
471- def write_output (self , input_paths : list [Path ], path : Path ) -> None :
481+ def write_output (self , input_paths : Sequence [Path | str ], path : Path ) -> None :
472482 """Write loaded YAML data to output file."""
473483 if self .data is None :
474484 self ._load_data_from_paths (input_paths )
0 commit comments