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
X |
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
import pytest | |
from twisted.internet import defer | |
def successResultOf(d): | |
completed = [] | |
d.addCallback(completed.append) | |
assert completed, "{!r} not yet fired".format(d) |
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
diff --git a/src/twisted/internet/tcp.py b/src/twisted/internet/tcp.py | |
index dc798f08c..4550c0e03 100644 | |
--- a/src/twisted/internet/tcp.py | |
+++ b/src/twisted/internet/tcp.py | |
@@ -11,6 +11,9 @@ End users shouldn't use this module directly - use the reactor APIs instead. | |
from __future__ import division, absolute_import | |
# System Imports | |
+import traceback | |
+import weakref |
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
from twisted.logger import globalLogBeginner, textFileLogObserver, Logger | |
from twisted.internet.defer import inlineCallbacks | |
from twisted.internet.task import react | |
from twisted.python import failure | |
from twisted.internet import protocol, endpoints | |
import sys | |
import twisted | |
print "Twisted:", twisted.__version__ | |
log = Logger() |
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
from __future__ import print_function | |
import sys | |
import treq | |
from twisted.internet.task import react | |
def main(reactor, domain): |
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
import eliot | |
import sys | |
eliot.to_file(sys.stdout) | |
with eliot.start_action(action_type=u"task"): | |
eliot.Message.log(key=u"value") |
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
import asyncio | |
def adapt(the_future): | |
try: | |
print("*** result before") | |
the_future.result() | |
except: | |
print("*** exception before") | |
the_future.exception() |
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
client |
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
import sys | |
from twisted.protocols import basic | |
from twisted.internet import defer, endpoints, protocol, task | |
class GetFileProtocol(basic.LineReceiver): | |
delimiter = '\n' | |
def lineReceived(self, line): | |
parts = line.split(None, 1) |
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
import unittest | |
from hypothesis import given, strategies as st | |
class ComparisonTests(unittest.TestCase): | |
def assertNonesCauseTypeError(self, first, second): | |
try: | |
first > second |