diff --git a/examples/Makefile b/examples/Makefile index 4f615b3b..e4638e25 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -16,7 +16,8 @@ autopep8: # This will run pep8, pyflakes and can skip lines that end with # noqa flake8: - flake8 --ignore=E501,E901,F401,F403,F811,F821,F841 . + flake8 --ignore=E501,E901 . +# flake8 --ignore=E501,E901,F401,F403,F811,F821,F841 . pylint: pylint -d line-too-long,invalid-name . diff --git a/examples/asciinema-autobahn-demo.py b/examples/asciinema-autobahn-demo.py index 69a897e2..e0b1590f 100755 --- a/examples/asciinema-autobahn-demo.py +++ b/examples/asciinema-autobahn-demo.py @@ -19,7 +19,6 @@ import sys import time import random import colors -import subprocess prompt = 'user@machine:~/autobahn-python$ ' diff --git a/examples/asyncio/wamp/pubsub/tls/backend_selfsigned.py b/examples/asyncio/wamp/pubsub/tls/backend_selfsigned.py index c678af3e..6f42f357 100644 --- a/examples/asyncio/wamp/pubsub/tls/backend_selfsigned.py +++ b/examples/asyncio/wamp/pubsub/tls/backend_selfsigned.py @@ -60,7 +60,7 @@ if __name__ == '__main__': options = ssl.create_default_context(cadata=open(cert_path, 'r').read()) # ...which we pass as "ssl=" to ApplicationRunner (passed to loop.create_connection) runner = ApplicationRunner( - environ.get("AUTOBAHN_DEMO_ROUTER", "wss://127.0.0.1:8083/ws"), + environ.get("AUTOBAHN_DEMO_ROUTER", u"wss://127.0.0.1:8083/ws"), u"crossbardemo", ssl=options, # try removing this, but still use self-signed cert debug_wamp=False, # optional; log many WAMP details diff --git a/examples/run-all-examples.py b/examples/run-all-examples.py index 1c7c08fe..344649d8 100755 --- a/examples/run-all-examples.py +++ b/examples/run-all-examples.py @@ -25,7 +25,6 @@ from colorama import Fore from twisted.internet.protocol import ProcessProtocol from twisted.internet.defer import inlineCallbacks, Deferred, returnValue from twisted.internet.error import ProcessExitedAlready -from twisted.python.failure import Failure from twisted.internet import reactor from twisted.internet.task import react @@ -102,8 +101,7 @@ def start_crossbar(): env = environ.copy() env["PYTHONUNBUFFERED"] = "1" - transport = reactor.spawnProcess( - protocol, exe, args, path='.', env=env) + reactor.spawnProcess(protocol, exe, args, path='.', env=env) yield launched returnValue(protocol) @@ -119,7 +117,7 @@ def start_example(py_fname, color, prefix='', exe=sys.executable): env = environ.copy() env["PYTHONUNBUFFERED"] = "1" - transport = reactor.spawnProcess(protocol, exe, args, path='.', env=env) + reactor.spawnProcess(protocol, exe, args, path='.', env=env) yield launched returnValue(protocol) diff --git a/examples/twisted/wamp/app/dbus/bridge.py b/examples/twisted/wamp/app/dbus/bridge.py index 4dab02ab..2d0a02c0 100644 --- a/examples/twisted/wamp/app/dbus/bridge.py +++ b/examples/twisted/wamp/app/dbus/bridge.py @@ -116,7 +116,7 @@ if __name__ == '__main__': # run WAMP application component ## from autobahn.twisted.wamp import ApplicationRunner - router = args.router or 'ws://127.0.0.1:9000' + router = args.router or u'ws://127.0.0.1:9000' runner = ApplicationRunner(router, u"realm1", standalone=not args.router, debug=False, # low-level logging diff --git a/examples/twisted/wamp/pubsub/tls/backend_selfsigned.py b/examples/twisted/wamp/pubsub/tls/backend_selfsigned.py index 619887b0..08485143 100644 --- a/examples/twisted/wamp/pubsub/tls/backend_selfsigned.py +++ b/examples/twisted/wamp/pubsub/tls/backend_selfsigned.py @@ -63,7 +63,7 @@ if __name__ == '__main__': ) # ...which we pass as "ssl=" to ApplicationRunner (passed to SSL4ClientEndpoint) runner = ApplicationRunner( - environ.get("AUTOBAHN_DEMO_ROUTER", "wss://127.0.0.1:8083/ws"), + environ.get("AUTOBAHN_DEMO_ROUTER", u"wss://127.0.0.1:8083/ws"), u"crossbardemo", ssl=options, # try removing this, but still use self-signed cert debug_wamp=False, # optional; log many WAMP details diff --git a/examples/twisted/websocket/echo_endpoints/client.py b/examples/twisted/websocket/echo_endpoints/client.py index 819699ca..321cd48b 100644 --- a/examples/twisted/websocket/echo_endpoints/client.py +++ b/examples/twisted/websocket/echo_endpoints/client.py @@ -75,8 +75,8 @@ if __name__ == '__main__': parser.add_argument("--websocket", default="tcp:127.0.0.1:9000", help='WebSocket client Twisted endpoint descriptor, e.g. "tcp:127.0.0.1:9000" or "unix:/tmp/mywebsocket".') - parser.add_argument("--wsurl", default="ws://127.0.0.1:9000", - help='WebSocket URL (must suit the endpoint), e.g. "ws://127.0.0.1:9000".') + parser.add_argument("--wsurl", default=u"ws://127.0.0.1:9000", + help='WebSocket URL (must suit the endpoint), e.g. ws://127.0.0.1:9000.') args = parser.parse_args() diff --git a/examples/twisted/websocket/echo_endpoints/server.py b/examples/twisted/websocket/echo_endpoints/server.py index af8a4aef..5a897c11 100644 --- a/examples/twisted/websocket/echo_endpoints/server.py +++ b/examples/twisted/websocket/echo_endpoints/server.py @@ -70,8 +70,8 @@ if __name__ == '__main__': parser.add_argument("--websocket", default="tcp:9000", help='WebSocket server Twisted endpoint descriptor, e.g. "tcp:9000" or "unix:/tmp/mywebsocket".') - parser.add_argument("--wsurl", default="ws://127.0.0.1:9000", - help='WebSocket URL (must suit the endpoint), e.g. "ws://127.0.0.1:9000".') + parser.add_argument("--wsurl", default=u"ws://127.0.0.1:9000", + help='WebSocket URL (must suit the endpoint), e.g. ws://127.0.0.1:9000.') parser.add_argument("--web", default="tcp:8080", help='Web server endpoint descriptor, e.g. "tcp:8080".') diff --git a/examples/twisted/websocket/echo_multicore/server.py b/examples/twisted/websocket/echo_multicore/server.py index 88312c12..db62edab 100644 --- a/examples/twisted/websocket/echo_multicore/server.py +++ b/examples/twisted/websocket/echo_multicore/server.py @@ -355,7 +355,7 @@ if __name__ == '__main__': DEFAULT_WORKERS = psutil.NUM_CPUS parser = argparse.ArgumentParser(description='Autobahn WebSocket Echo Multicore Server') - parser.add_argument('--wsuri', dest='wsuri', type=str, default='ws://127.0.0.1:9000', help='The WebSocket URI the server is listening on, e.g. ws://localhost:9000.') + parser.add_argument('--wsuri', dest='wsuri', type=str, default=u'ws://127.0.0.1:9000', help='The WebSocket URI the server is listening on, e.g. ws://localhost:9000.') parser.add_argument('--port', dest='port', type=int, default=8080, help='Port to listen on for embedded Web server. Set to 0 to disable.') parser.add_argument('--workers', dest='workers', type=int, default=DEFAULT_WORKERS, help='Number of workers to spawn - should fit the number of (physical) CPU cores.') parser.add_argument('--noaffinity', dest='noaffinity', action="store_true", default=False, help='Do not set worker/CPU affinity.') diff --git a/examples/twisted/websocket/echo_multicore/server_reuseport.py b/examples/twisted/websocket/echo_multicore/server_reuseport.py index a9664c03..478c0735 100644 --- a/examples/twisted/websocket/echo_multicore/server_reuseport.py +++ b/examples/twisted/websocket/echo_multicore/server_reuseport.py @@ -85,8 +85,6 @@ class MyServerProtocol(WebSocketServerProtocol): if __name__ == '__main__': - import sys - from twisted.python import log from twisted.internet import reactor diff --git a/examples/twisted/websocket/streaming/frame_based_client.py b/examples/twisted/websocket/streaming/frame_based_client.py index 3a30e4b9..181c60e3 100644 --- a/examples/twisted/websocket/streaming/frame_based_client.py +++ b/examples/twisted/websocket/streaming/frame_based_client.py @@ -25,7 +25,6 @@ ############################################################################### import hashlib -from pprint import pprint from ranstring import randomByteString from twisted.internet import reactor @@ -66,7 +65,6 @@ class FrameBasedHashClientProtocol(WebSocketClientProtocol): def onMessage(self, payload, isBinary): print("Digest for frame {} computed by server: {}".format(self.count, payload.decode('utf8'))) - # pprint(self.trafficStats.__json__()) self.count += 1 if self.count < FRAME_COUNT: diff --git a/examples/twisted/websocket/testee/testee_server.py b/examples/twisted/websocket/testee/testee_server.py index 47cc081a..1ea1eb9b 100644 --- a/examples/twisted/websocket/testee/testee_server.py +++ b/examples/twisted/websocket/testee/testee_server.py @@ -29,8 +29,8 @@ import autobahn from autobahn.twisted.websocket import WebSocketServerProtocol, \ WebSocketServerFactory -from autobahn.websocket.protocol import WebSocketProtocol -from autobahn.websocket.compress import * +from autobahn.websocket.compress import PerMessageDeflateOffer, \ + PerMessageDeflateOfferAccept USE_STREAMING_TESTEE = False diff --git a/examples/twisted/websocket/wrapping/client.py b/examples/twisted/websocket/wrapping/client.py index a0883ffa..6238d34e 100644 --- a/examples/twisted/websocket/wrapping/client.py +++ b/examples/twisted/websocket/wrapping/client.py @@ -51,7 +51,7 @@ if __name__ == '__main__': wrappedFactory = Factory.forProtocol(HelloClientProtocol) factory = WrappingWebSocketClientFactory(wrappedFactory, - "ws://127.0.0.1:9000", + u"ws://127.0.0.1:9000", debug=False, enableCompression=False, autoFragmentSize=1024) diff --git a/examples/twisted/websocket/wrapping/server.py b/examples/twisted/websocket/wrapping/server.py index 1c6dd741..9071e15c 100644 --- a/examples/twisted/websocket/wrapping/server.py +++ b/examples/twisted/websocket/wrapping/server.py @@ -51,7 +51,7 @@ if __name__ == '__main__': wrappedFactory = Factory.forProtocol(HelloServerProtocol) factory = WrappingWebSocketServerFactory(wrappedFactory, - "ws://127.0.0.1:9000", + u"ws://127.0.0.1:9000", debug=False, enableCompression=False, autoFragmentSize=1024)