MCPcopy
hub / github.com/redis/redis-py / DynamicPolicyResolver

Class DynamicPolicyResolver

redis/commands/policies.py:256–274  ·  view source on GitHub ↗

Resolves policy dynamically based on the COMMAND output.

Source from the content-addressed store, hash-verified

254
255
256class DynamicPolicyResolver(BasePolicyResolver):
257 """
258 Resolves policy dynamically based on the COMMAND output.
259 """
260
261 def __init__(
262 self, commands_parser: CommandsParser, fallback: Optional[PolicyResolver] = None
263 ) -> None:
264 """
265 Parameters:
266 commands_parser (CommandsParser): COMMAND output parser.
267 fallback (Optional[PolicyResolver]): An optional resolver to be used when the
268 primary policies cannot handle a specific request.
269 """
270 self._commands_parser = commands_parser
271 super().__init__(commands_parser.get_command_policies(), fallback)
272
273 def with_fallback(self, fallback: "PolicyResolver") -> "PolicyResolver":
274 return DynamicPolicyResolver(self._commands_parser, fallback)
275
276
277class StaticPolicyResolver(BasePolicyResolver):

Callers 2

test_resolveMethod · 0.90
with_fallbackMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_resolveMethod · 0.72