-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Use of twisted in pika #9494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Use of twisted in pika #9494
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d6dd5c2
Use of twisted in pika
Avasam a0ce7c7
Shimmed twisted in pika
Avasam bacf275
Specify requirements-stubtest
Avasam 20daf8c
Apply suggestions from code review
Avasam 74b37eb
Update stubs/pika/@tests/stubtest_allowlist.txt
Avasam 9a1bb1f
Merge branch 'main' into twisted-in-pika
Avasam 3e0ffa2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b485b6c
Merge branch 'main' into twisted-in-pika
Avasam 5bb6334
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 29510ed
Update stubtest requiremetns location
Avasam 11ee72f
Merge branch 'main' into twisted-in-pika
Avasam b8c0e08
Merge branch 'main' of https://github.com/python/typeshed into twiste…
Avasam 12f0bcc
Try twisted in pika without shims
Avasam c35916b
Merge branch 'twisted-in-pika' of https://github.com/Avasam/typeshed …
Avasam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| twisted | ||
| tornado | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| from _typeshed import Incomplete, Self | ||
| from asyncio import AbstractEventLoop, Future | ||
| from collections.abc import Awaitable, Callable, Coroutine, Generator, Iterable, Mapping, Sequence | ||
| from enum import Enum | ||
| from typing import Any, Generic, NoReturn, Protocol as _TypingProtocol, TypeVar | ||
| from typing_extensions import Literal, TypeAlias | ||
|
|
||
| _T = TypeVar("_T") | ||
|
|
||
| # region twisted.python.failure | ||
| class Failure(BaseException): | ||
| pickled: int | ||
| stack: Incomplete | ||
| count: Incomplete | ||
| type: Incomplete | ||
| captureVars: Incomplete | ||
| value: Incomplete | ||
| tb: Incomplete | ||
| parents: Incomplete | ||
| def __init__( | ||
| self, | ||
| exc_value: Incomplete | None = ..., | ||
| exc_type: Incomplete | None = ..., | ||
| exc_tb: Incomplete | None = ..., | ||
| captureVars: bool = ..., | ||
| ) -> None: ... | ||
| def trap(self, *errorTypes): ... | ||
| def check(self, *errorTypes): ... | ||
| def raiseException(self) -> NoReturn: ... | ||
| def throwExceptionIntoGenerator(self, g): ... | ||
| __dict__: Incomplete | ||
| def cleanFailure(self) -> None: ... | ||
| def getTracebackObject(self): ... | ||
| def getErrorMessage(self) -> str: ... | ||
| def getBriefTraceback(self) -> str: ... | ||
| def getTraceback(self, elideFrameworkCode: int = ..., detail: str = ...) -> str: ... | ||
| def printTraceback(self, file: Incomplete | None = ..., elideFrameworkCode: bool = ..., detail: str = ...) -> None: ... | ||
| def printBriefTraceback(self, file: Incomplete | None = ..., elideFrameworkCode: int = ...) -> None: ... | ||
| def printDetailedTraceback(self, file: Incomplete | None = ..., elideFrameworkCode: int = ...) -> None: ... | ||
|
|
||
| # endregion | ||
|
|
||
| # region twisted.internet.interfaces | ||
|
|
||
| class Interface: # incomplete | ||
| def __init__(self, obj, alternate=...) -> None: ... | ||
|
|
||
| class _InterfaceProtocol(_TypingProtocol): # incomplete | ||
| def __init__(self, obj, alternate=...) -> None: ... | ||
|
|
||
| class IAddress(Interface): ... | ||
|
|
||
| class IDelayedCall(Interface): | ||
| def getTime(self) -> float: ... | ||
| def cancel(self) -> None: ... | ||
| def delay(self, secondsLater: float) -> None: ... | ||
| def reset(sself, econdsFromNow: float) -> None: ... | ||
| def active(self) -> bool: ... | ||
|
|
||
| class IReactorTime(_InterfaceProtocol): | ||
| def seconds(self) -> float: ... | ||
| def callLater(self, delay: float, callable: Callable[..., Any], *args: object, **kwargs: object) -> IDelayedCall: ... | ||
| def getDelayedCalls(self) -> Sequence[IDelayedCall]: ... | ||
|
|
||
| class ITransport(_InterfaceProtocol): | ||
| def write(self, data: bytes) -> None: ... | ||
| def writeSequence(self, data: Iterable[bytes]) -> None: ... | ||
| def loseConnection(self) -> None: ... | ||
| def getPeer(self) -> IAddress: ... | ||
| def getHost(self) -> IAddress: ... | ||
|
|
||
| # endregion | ||
|
|
||
| # region twisted.internet.base | ||
| class _Sentinel(Enum): | ||
| _NO_RESULT = object() | ||
| _CONTINUE = object() | ||
|
|
||
| DeferredCallback: TypeAlias = Callable[..., object] | ||
| DeferredErrback: TypeAlias = Callable[..., object] | ||
| _CallbackOrderedArguments: TypeAlias = tuple[object, ...] | ||
| _CallbackKeywordArguments: TypeAlias = Mapping[str, object] | ||
| _CallbackChain: TypeAlias = tuple[ | ||
| tuple[DeferredCallback | Literal[_Sentinel._CONTINUE], _CallbackOrderedArguments, _CallbackKeywordArguments], | ||
| tuple[ | ||
| DeferredErrback | DeferredCallback, Literal[_Sentinel._CONTINUE], _CallbackOrderedArguments, _CallbackKeywordArguments, | ||
| ], | ||
| ] | ||
| _DeferredResultT = TypeVar("_DeferredResultT", contravariant=True) | ||
| _NextDeferredResultT = TypeVar("_NextDeferredResultT", covariant=True) | ||
|
|
||
| class DelayedCall(_TypingProtocol): | ||
| debug: bool | ||
| creator: Sequence[str] | None | ||
| resetter: Incomplete | ||
| canceller: Incomplete | ||
| seconds: Incomplete | ||
| cancelled: int | ||
| delayed_time: float | ||
| def __init__( | ||
| self, | ||
| time: float, | ||
| func: Callable[..., Any], | ||
| args: Sequence[object], | ||
| kw: dict[str, object], | ||
| cancel: Callable[[DelayedCall], None], | ||
| reset: Callable[[DelayedCall], None], | ||
| seconds: Callable[[], float] = ..., | ||
| ) -> None: ... | ||
| def getTime(self) -> float: ... | ||
| def cancel(self) -> None: ... | ||
| time: Incomplete | ||
| def reset(self, secondsFromNow: float) -> None: ... | ||
| def delay(self, secondsLater: float) -> None: ... | ||
| def activate_delay(self) -> None: ... | ||
| def active(self) -> bool: ... | ||
| def __le__(self, other: object) -> bool: ... | ||
| def __lt__(self, other: object) -> bool: ... | ||
|
|
||
| # Variance: This is how it's typed in source | ||
| class Deferred(Awaitable[_DeferredResultT]): # type: ignore[type-var] # pyright: ignore[reportGeneralTypeIssues] | ||
| called: bool | ||
| paused: int | ||
| debug: bool | ||
| callbacks: list[_CallbackChain] | ||
| def __init__(self, canceller: Callable[[Deferred[Any]], None] | None = ...) -> None: ... | ||
| def addCallbacks( | ||
| self, | ||
| callback: Callable[..., _NextDeferredResultT | Deferred[_NextDeferredResultT]], | ||
| errback: Callable[..., Failure | _NextDeferredResultT | Deferred[_NextDeferredResultT]] = ..., | ||
| callbackArgs: _CallbackOrderedArguments = ..., | ||
| callbackKeywords: _CallbackKeywordArguments = ..., | ||
| errbackArgs: _CallbackOrderedArguments = ..., | ||
| errbackKeywords: _CallbackKeywordArguments = ..., | ||
| ) -> Deferred[_NextDeferredResultT]: ... | ||
| def addCallback( | ||
| self, callback: Callable[..., _NextDeferredResultT | Deferred[_NextDeferredResultT]], *args: object, **kwargs: object | ||
| ) -> Deferred[_NextDeferredResultT]: ... | ||
| def addErrback( | ||
| self, | ||
| errback: Callable[..., Failure | _NextDeferredResultT | Deferred[_NextDeferredResultT]], | ||
| *args: object, | ||
| **kwargs: object, | ||
| ) -> Deferred[_DeferredResultT | _NextDeferredResultT]: ... | ||
| def addBoth( | ||
| self, callback: Callable[..., _NextDeferredResultT | Deferred[_NextDeferredResultT]], *args: object, **kwargs: object | ||
| ) -> Deferred[_NextDeferredResultT]: ... | ||
| def addTimeout( | ||
| self, timeout: float, clock: IReactorTime, onTimeoutCancel: Callable[[object, float], object] | None = ... | ||
| ) -> Deferred[_DeferredResultT]: ... | ||
| def chainDeferred(self, d: Deferred[_DeferredResultT]) -> Deferred[None]: ... | ||
| def callback(self, result: _DeferredResultT | Failure) -> None: ... | ||
| def errback(self, fail: Failure | BaseException | None = ...) -> None: ... | ||
| def pause(self) -> None: ... | ||
| def unpause(self) -> None: ... | ||
| def cancel(self) -> None: ... | ||
| def __iter__(self) -> Deferred[_DeferredResultT]: ... | ||
| def send(self, value: object = ...) -> Deferred[_DeferredResultT]: ... | ||
| def __await__(self) -> Generator[Any, None, _DeferredResultT]: ... | ||
| __next__: Incomplete | ||
| def asFuture(self, loop: AbstractEventLoop) -> Future[_DeferredResultT]: ... | ||
| @classmethod | ||
| def fromFuture(cls, future: Future[Incomplete]) -> Deferred[Any]: ... | ||
| @classmethod | ||
| def fromCoroutine(cls, coro: Coroutine[Deferred[_T], Any, _T] | Generator[Deferred[_T], Any, _T]) -> Deferred[_T]: ... | ||
|
|
||
| class DeferredQueue(Generic[_T]): | ||
| waiting: list[Deferred[_T]] | ||
| pending: list[_T] | ||
| size: int | None | ||
| backlog: int | None | ||
| def __init__(self, size: int | None = ..., backlog: int | None = ...) -> None: ... | ||
| def put(self, obj: _T) -> None: ... | ||
| def get(self) -> Deferred[_T]: ... | ||
|
|
||
| # endregion | ||
|
|
||
| # region twisted.internet.protocol | ||
|
|
||
| class Factory: | ||
| protocol: Callable[[], Protocol] | None | ||
| numPorts: int | ||
| noisy: bool | ||
| @classmethod | ||
| def forProtocol(cls: type[Self], protocol: Protocol, *args, **kwargs) -> Self: ... | ||
| def logPrefix(self): ... | ||
| def doStart(self) -> None: ... | ||
| def doStop(self) -> None: ... | ||
| def startFactory(self) -> None: ... | ||
| def stopFactory(self) -> None: ... | ||
| def buildProtocol(self, addr: IAddress) -> Protocol | None: ... | ||
|
|
||
| class BaseProtocol: | ||
| connected: int | ||
| transport: ITransport | None | ||
| def makeConnection(self, transport) -> None: ... | ||
| def connectionMade(self) -> None: ... | ||
|
|
||
| class Protocol(BaseProtocol): | ||
| factory: Factory | None | ||
| def logPrefix(self): ... | ||
| def dataReceived(self, data: bytes): ... | ||
| def connectionLost(self, reason: BaseException = ...): ... | ||
|
|
||
| # endregion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.