11from __future__ import annotations
22
3- import typing
43from collections .abc import Callable , Mapping
54
65from openfeature ._backports .strenum import StrEnum
@@ -25,9 +24,7 @@ class OpenFeatureError(Exception):
2524 the more specific exceptions extending this one should be used.
2625 """
2726
28- def __init__ (
29- self , error_code : ErrorCode , error_message : typing .Optional [str ] = None
30- ):
27+ def __init__ (self , error_code : ErrorCode , error_message : str | None = None ):
3128 """
3229 Constructor for the generic OpenFeatureError.
3330 @param error_message: an optional string message representing why the
@@ -43,7 +40,7 @@ class ProviderNotReadyError(OpenFeatureError):
4340 This exception should be raised when the provider is not ready to be used.
4441 """
4542
46- def __init__ (self , error_message : typing . Optional [ str ] = None ):
43+ def __init__ (self , error_message : str | None = None ):
4744 """
4845 Constructor for the ProviderNotReadyError. The error code for this type of
4946 exception is ErrorCode.PROVIDER_NOT_READY.
@@ -58,7 +55,7 @@ class ProviderFatalError(OpenFeatureError):
5855 This exception should be raised when the provider encounters a fatal error.
5956 """
6057
61- def __init__ (self , error_message : typing . Optional [ str ] = None ):
58+ def __init__ (self , error_message : str | None = None ):
6259 """
6360 Constructor for the ProviderFatalError. The error code for this type of
6461 exception is ErrorCode.PROVIDER_FATAL.
@@ -74,7 +71,7 @@ class FlagNotFoundError(OpenFeatureError):
7471 key provided by the user.
7572 """
7673
77- def __init__ (self , error_message : typing . Optional [ str ] = None ):
74+ def __init__ (self , error_message : str | None = None ):
7875 """
7976 Constructor for the FlagNotFoundError. The error code for
8077 this type of exception is ErrorCode.FLAG_NOT_FOUND.
@@ -90,7 +87,7 @@ class GeneralError(OpenFeatureError):
9087 feature python sdk.
9188 """
9289
93- def __init__ (self , error_message : typing . Optional [ str ] = None ):
90+ def __init__ (self , error_message : str | None = None ):
9491 """
9592 Constructor for the GeneralError. The error code for this type of exception
9693 is ErrorCode.GENERAL.
@@ -106,7 +103,7 @@ class ParseError(OpenFeatureError):
106103 be parsed into a FlagEvaluationDetails object.
107104 """
108105
109- def __init__ (self , error_message : typing . Optional [ str ] = None ):
106+ def __init__ (self , error_message : str | None = None ):
110107 """
111108 Constructor for the ParseError. The error code for this type of exception
112109 is ErrorCode.PARSE_ERROR.
@@ -122,7 +119,7 @@ class TypeMismatchError(OpenFeatureError):
122119 not match the type requested by the user.
123120 """
124121
125- def __init__ (self , error_message : typing . Optional [ str ] = None ):
122+ def __init__ (self , error_message : str | None = None ):
126123 """
127124 Constructor for the TypeMismatchError. The error code for this type of
128125 exception is ErrorCode.TYPE_MISMATCH.
@@ -138,7 +135,7 @@ class TargetingKeyMissingError(OpenFeatureError):
138135 but one was not provided in the evaluation context.
139136 """
140137
141- def __init__ (self , error_message : typing . Optional [ str ] = None ):
138+ def __init__ (self , error_message : str | None = None ):
142139 """
143140 Constructor for the TargetingKeyMissingError. The error code for this type of
144141 exception is ErrorCode.TARGETING_KEY_MISSING.
@@ -154,7 +151,7 @@ class InvalidContextError(OpenFeatureError):
154151 requirements.
155152 """
156153
157- def __init__ (self , error_message : typing . Optional [ str ] ):
154+ def __init__ (self , error_message : str | None ):
158155 """
159156 Constructor for the InvalidContextError. The error code for this type of
160157 exception is ErrorCode.INVALID_CONTEXT.
0 commit comments