txredisapi.pyi 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2020 The Matrix.org Foundation C.I.C.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. """Contains *incomplete* type hints for txredisapi.
  16. """
  17. from typing import List, Optional, Union, Type
  18. class RedisProtocol:
  19. def publish(self, channel: str, message: bytes): ...
  20. class SubscriberProtocol:
  21. def __init__(self, *args, **kwargs): ...
  22. password: Optional[str]
  23. def subscribe(self, channels: Union[str, List[str]]): ...
  24. def connectionMade(self): ...
  25. def connectionLost(self, reason): ...
  26. def lazyConnection(
  27. host: str = ...,
  28. port: int = ...,
  29. dbid: Optional[int] = ...,
  30. reconnect: bool = ...,
  31. charset: str = ...,
  32. password: Optional[str] = ...,
  33. connectTimeout: Optional[int] = ...,
  34. replyTimeout: Optional[int] = ...,
  35. convertNumbers: bool = ...,
  36. ) -> RedisProtocol: ...
  37. class SubscriberFactory:
  38. def buildProtocol(self, addr): ...
  39. class ConnectionHandler: ...
  40. class RedisFactory:
  41. continueTrying: bool
  42. handler: RedisProtocol
  43. def __init__(
  44. self,
  45. uuid: str,
  46. dbid: Optional[int],
  47. poolsize: int,
  48. isLazy: bool = False,
  49. handler: Type = ConnectionHandler,
  50. charset: str = "utf-8",
  51. password: Optional[str] = None,
  52. replyTimeout: Optional[int] = None,
  53. convertNumbers: Optional[int] = True,
  54. ): ...