-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Description
Running mypy on the sdk codebase I found several errors. One of them stood out:
open_feature/open_feature_client.py:202: error: Argument 1 to "evaluate_flag_details" of "OpenFeatureClient" has incompatible type "<typing special form>"; expected "FlagType" [arg-type]
This corresponds to the following call:
python-sdk/open_feature/open_feature_client.py
Lines 204 to 210 in d31b531
| return self.evaluate_flag_details( | |
| FlagType.OBJECT, | |
| flag_key, | |
| default_value, | |
| evaluation_context, | |
| flag_evaluation_options, | |
| ) |
It appears that mypy has problems recognizing the value of FlagType.OBJECT as a member of FlagType.
class FlagType(Enum):
BOOLEAN = bool
STRING = str
OBJECT = typing.Union[dict, list]
FLOAT = float
INTEGER = intAs we can see, OBJECT is the only value that is not a standard type class.
Using types as enum values like this is not very common and has the potential to cause issues with other tools too. Moving to standard str or int enum values may avoid such problems. If there is consensus in this I can open a pull request with the necessary changes.
Metadata
Metadata
Assignees
Labels
No labels