-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix typechecking with twisted trunk #16121
Changes from all commits
f880e80
de25f6a
91602de
78a94d5
2dd794c
95b0dab
0b63e34
22dfa69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Attempt to fix the twisted trunk job. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -470,7 +470,7 @@ def __init__(self) -> None: | |
| def deferred(self, key: KT) -> "defer.Deferred[VT]": | ||
| if not self._deferred: | ||
| self._deferred = ObservableDeferred(defer.Deferred(), consumeErrors=True) | ||
| return self._deferred.observe().addCallback(lambda res: res.get(key)) | ||
| return self._deferred.observe().addCallback(lambda res: res[key]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the point is that this lookup never fails---but please double check.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm very not-confident about this change. I think you're correct, but I'm very lost in how this is used.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright. I took another look at this and I agree that if this is not true then the internal machinery is broken. It'll raise errors anyway, so I think this is OK. (Otherwise you'd get back an unexpected |
||
|
|
||
| def add_invalidation_callback( | ||
| self, key: KT, callback: Optional[Callable[[], None]] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,11 +60,9 @@ def check_called_first(res: int) -> int: | |
| observer1.addBoth(check_called_first) | ||
|
|
||
| # store the results | ||
| results: List[Optional[ObservableDeferred[int]]] = [None, None] | ||
| results: List[Optional[int]] = [None, None] | ||
|
|
||
| def check_val( | ||
| res: ObservableDeferred[int], idx: int | ||
| ) -> ObservableDeferred[int]: | ||
| def check_val(res: int, idx: int) -> int: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked this was correct by running the test with |
||
| results[idx] = res | ||
| return res | ||
|
|
||
|
|
@@ -93,14 +91,14 @@ def check_called_first(res: int) -> int: | |
| observer1.addBoth(check_called_first) | ||
|
|
||
| # store the results | ||
| results: List[Optional[ObservableDeferred[str]]] = [None, None] | ||
| results: List[Optional[Failure]] = [None, None] | ||
|
|
||
| def check_val(res: ObservableDeferred[str], idx: int) -> None: | ||
| def check_failure(res: Failure, idx: int) -> None: | ||
| results[idx] = res | ||
| return None | ||
|
|
||
| observer1.addErrback(check_val, 0) | ||
| observer2.addErrback(check_val, 1) | ||
| observer1.addErrback(check_failure, 0) | ||
| observer2.addErrback(check_failure, 1) | ||
|
|
||
| try: | ||
| raise Exception("gah!") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.