Skip to content

Commit

Permalink
pass linting, ignore overrides mypy and callable line
Browse files Browse the repository at this point in the history
  • Loading branch information
leohoare committed Nov 19, 2024
1 parent 17acf42 commit 6740235
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 36 deletions.
28 changes: 13 additions & 15 deletions openfeature/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ async def get_boolean_value(
default_value: bool,
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[typing.Any, typing.Any, bool]:
) -> bool:
details = await self.get_boolean_details(
flag_key,
default_value,
Expand All @@ -488,7 +488,7 @@ async def get_boolean_details(
default_value: bool,
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagEvaluationDetails[bool]]:
) -> FlagEvaluationDetails[bool]:
return await self.evaluate_flag_details(
FlagType.BOOLEAN,
flag_key,
Expand All @@ -503,7 +503,7 @@ async def get_string_value(
default_value: str,
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[typing.Any, typing.Any, str]:
) -> str:
details = await self.get_string_details(
flag_key,
default_value,
Expand All @@ -518,7 +518,7 @@ async def get_string_details(
default_value: str,
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagEvaluationDetails[str]]:
) -> FlagEvaluationDetails[str]:
return await self.evaluate_flag_details(
FlagType.STRING,
flag_key,
Expand All @@ -533,7 +533,7 @@ async def get_integer_value(
default_value: int,
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[typing.Any, typing.Any, int]:
) -> int:
details = await self.get_integer_details(
flag_key,
default_value,
Expand All @@ -548,7 +548,7 @@ async def get_integer_details(
default_value: int,
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagEvaluationDetails[int]]:
) -> FlagEvaluationDetails[int]:
return await self.evaluate_flag_details(
FlagType.INTEGER,
flag_key,
Expand All @@ -563,7 +563,7 @@ async def get_float_value(
default_value: float,
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[typing.Any, typing.Any, float]:
) -> float:
details = await self.get_float_details(
flag_key,
default_value,
Expand All @@ -578,7 +578,7 @@ async def get_float_details(
default_value: float,
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagEvaluationDetails[float]]:
) -> FlagEvaluationDetails[float]:
return await self.evaluate_flag_details(
FlagType.FLOAT,
flag_key,
Expand All @@ -593,7 +593,7 @@ async def get_object_value(
default_value: typing.Union[dict, list],
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[typing.Any, typing.Any, typing.Union[dict, list]]:
) -> typing.Union[dict, list]:
details = await self.get_object_details(
flag_key,
default_value,
Expand All @@ -608,9 +608,7 @@ async def get_object_details(
default_value: typing.Union[dict, list],
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[
typing.Any, typing.Any, FlagEvaluationDetails[typing.Union[dict, list]]
]:
) -> FlagEvaluationDetails[typing.Union[dict, list]]:
return await self.evaluate_flag_details(
FlagType.OBJECT,
flag_key,
Expand All @@ -626,7 +624,7 @@ async def evaluate_flag_details( # noqa: PLR0915
default_value: typing.Any,
evaluation_context: typing.Optional[EvaluationContext] = None,
flag_evaluation_options: typing.Optional[FlagEvaluationOptions] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagEvaluationDetails[typing.Any]]:
) -> FlagEvaluationDetails[typing.Any]:
"""
Evaluate the flag requested by the user from the clients provider.
Expand Down Expand Up @@ -772,7 +770,7 @@ async def _create_provider_evaluation(
flag_key: str,
default_value: typing.Any,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagEvaluationDetails[typing.Any]]:
) -> FlagEvaluationDetails[typing.Any]:
"""
Asynchronous encapsulated method to create a FlagEvaluationDetail from a specific provider.
Expand Down Expand Up @@ -801,7 +799,7 @@ async def _create_provider_evaluation(
if not get_details_callable:
raise GeneralError(error_message="Unknown flag type")

resolution = await get_details_callable(*args)
resolution = await get_details_callable(*args) # type: ignore[misc]
resolution.raise_for_error()

# we need to check the get_args to be compatible with union types.
Expand Down
12 changes: 5 additions & 7 deletions openfeature/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ async def resolve_boolean_details(
flag_key: str,
default_value: bool,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[bool]]:
) -> FlagResolutionDetails[bool]:
raise NotImplementedError("Method not implemented")

@abstractmethod
Expand All @@ -182,7 +182,7 @@ async def resolve_string_details(
flag_key: str,
default_value: str,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[str]]:
) -> FlagResolutionDetails[str]:
raise NotImplementedError("Method not implemented")

@abstractmethod
Expand All @@ -191,7 +191,7 @@ async def resolve_integer_details(
flag_key: str,
default_value: int,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[int]]:
) -> FlagResolutionDetails[int]:
raise NotImplementedError("Method not implemented")

@abstractmethod
Expand All @@ -200,7 +200,7 @@ async def resolve_float_details(
flag_key: str,
default_value: float,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[float]]:
) -> FlagResolutionDetails[float]:
raise NotImplementedError("Method not implemented")

@abstractmethod
Expand All @@ -209,7 +209,5 @@ async def resolve_object_details(
flag_key: str,
default_value: typing.Union[dict, list],
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[
typing.Any, typing.Any, FlagResolutionDetails[typing.Union[dict, list]]
]:
) -> FlagResolutionDetails[typing.Union[dict, list]]:
raise NotImplementedError("Method not implemented")
12 changes: 5 additions & 7 deletions openfeature/provider/in_memory_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,39 +136,37 @@ async def resolve_boolean_details(
flag_key: str,
default_value: bool,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[bool]]:
) -> FlagResolutionDetails[bool]:
return self._resolve(flag_key, evaluation_context)

async def resolve_string_details(
self,
flag_key: str,
default_value: str,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[str]]:
) -> FlagResolutionDetails[str]:
return self._resolve(flag_key, evaluation_context)

async def resolve_integer_details(
self,
flag_key: str,
default_value: int,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[int]]:
) -> FlagResolutionDetails[int]:
return self._resolve(flag_key, evaluation_context)

async def resolve_float_details(
self,
flag_key: str,
default_value: float,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[float]]:
) -> FlagResolutionDetails[float]:
return self._resolve(flag_key, evaluation_context)

async def resolve_object_details(
self,
flag_key: str,
default_value: typing.Union[dict, list],
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[
typing.Any, typing.Any, FlagResolutionDetails[typing.Union[dict, list]]
]:
) -> FlagResolutionDetails[typing.Union[dict, list]]:
return self._resolve(flag_key, evaluation_context)
12 changes: 5 additions & 7 deletions openfeature/provider/no_op_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def resolve_boolean_details(
flag_key: str,
default_value: bool,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[bool]]:
) -> FlagResolutionDetails[bool]:
return FlagResolutionDetails(
value=default_value,
reason=Reason.DEFAULT,
Expand All @@ -98,7 +98,7 @@ async def resolve_string_details(
flag_key: str,
default_value: str,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[str]]:
) -> FlagResolutionDetails[str]:
return FlagResolutionDetails(
value=default_value,
reason=Reason.DEFAULT,
Expand All @@ -110,7 +110,7 @@ async def resolve_integer_details(
flag_key: str,
default_value: int,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[int]]:
) -> FlagResolutionDetails[int]:
return FlagResolutionDetails(
value=default_value,
reason=Reason.DEFAULT,
Expand All @@ -122,7 +122,7 @@ async def resolve_float_details(
flag_key: str,
default_value: float,
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[typing.Any, typing.Any, FlagResolutionDetails[float]]:
) -> FlagResolutionDetails[float]:
return FlagResolutionDetails(
value=default_value,
reason=Reason.DEFAULT,
Expand All @@ -134,9 +134,7 @@ async def resolve_object_details(
flag_key: str,
default_value: typing.Union[dict, list],
evaluation_context: typing.Optional[EvaluationContext] = None,
) -> typing.Coroutine[
typing.Any, typing.Any, FlagResolutionDetails[typing.Union[dict, list]]
]:
) -> FlagResolutionDetails[typing.Union[dict, list]]:
return FlagResolutionDetails(
value=default_value,
reason=Reason.DEFAULT,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ local_partial_types = true # will become the new default from version 2
pretty = true
strict = true
disallow_any_generics = false
disable_error_code = ["override"]

[tool.ruff]
exclude = [
Expand Down

0 comments on commit 6740235

Please sign in to comment.