@@ -21,8 +21,9 @@ class EvaluationContextLocalFileHandler:
2121 """
2222
2323 def __init__ (self , file_path : str ) -> None :
24- with Path (file_path ).open ("r" , encoding = "utf-8" ) as f :
25- self .evaluation_context : EvaluationContext = json .load (f )
24+ self .evaluation_context : EvaluationContext = json .loads (
25+ Path (file_path ).read_text (),
26+ )
2627
2728 def get_evaluation_context (self ) -> EvaluationContext :
2829 return self .evaluation_context
@@ -38,13 +39,18 @@ class EnvironmentDocumentLocalFileHandler:
3839 """
3940
4041 def __init__ (self , file_path : str ) -> None :
41- with Path (file_path ).open ("r" , encoding = "utf-8" ) as f :
42- self .evaluation_context : EvaluationContext = (
43- map_environment_document_to_context (json .load (f ))
42+ self .evaluation_context : EvaluationContext = (
43+ map_environment_document_to_context (
44+ json .loads (
45+ Path (file_path ).read_text (),
46+ ),
4447 )
48+ )
4549
4650 def get_evaluation_context (self ) -> EvaluationContext :
4751 return self .evaluation_context
4852
4953
54+ # For backward compatibility, use the old class name for
55+ # the local file handler implementation dependant on the environment document.
5056LocalFileHandler = EnvironmentDocumentLocalFileHandler
0 commit comments