Skip to content

Commit 3f205f7

Browse files
kloczekCendioOssman
authored andcommitted
drop python<3.6 support
Filter all code over `pyupgrade --py36-plus` and update `classifiers`.
1 parent b6c02b1 commit 3f205f7

File tree

8 files changed

+22
-21
lines changed

8 files changed

+22
-21
lines changed

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
"Programming Language :: Python",
1515
"Programming Language :: Python :: 3",
1616
"Programming Language :: Python :: 3 :: Only",
17-
"Programming Language :: Python :: 3.4",
18-
"Programming Language :: Python :: 3.5",
1917
"Programming Language :: Python :: 3.6",
2018
"Programming Language :: Python :: 3.7",
2119
"Programming Language :: Python :: 3.8",
2220
"Programming Language :: Python :: 3.9",
21+
"Programming Language :: Python :: 3.10",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
2324
],
2425
keywords='noVNC websockify',
2526
license='LGPLv3',

tests/test_websocketproxy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from websockify import auth_plugins
3030

3131

32-
class FakeSocket(object):
32+
class FakeSocket:
3333
def __init__(self, data=b''):
3434
self._data = data
3535

@@ -47,7 +47,7 @@ def makefile(self, mode='r', buffsize=None):
4747
return StringIO(self._data.decode('latin_1'))
4848

4949

50-
class FakeServer(object):
50+
class FakeServer:
5151
class EClose(Exception):
5252
pass
5353

@@ -60,7 +60,7 @@ def __init__(self):
6060

6161
class ProxyRequestHandlerTestCase(unittest.TestCase):
6262
def setUp(self):
63-
super(ProxyRequestHandlerTestCase, self).setUp()
63+
super().setUp()
6464
self.handler = websocketproxy.ProxyRequestHandler(
6565
FakeSocket(), "127.0.0.1", FakeServer())
6666
self.handler.path = "https://localhost:6080/websockify?token=blah"
@@ -69,7 +69,7 @@ def setUp(self):
6969

7070
def tearDown(self):
7171
patch.stopall()
72-
super(ProxyRequestHandlerTestCase, self).tearDown()
72+
super().tearDown()
7373

7474
def test_get_target(self):
7575
class TestPlugin(token_plugins.BasePlugin):

tests/test_websockifyserver.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def raise_oserror(*args, **kwargs):
3939
raise OSError('fake error')
4040

4141

42-
class FakeSocket(object):
42+
class FakeSocket:
4343
def __init__(self, data=b''):
4444
self._data = data
4545

@@ -59,7 +59,7 @@ def makefile(self, mode='r', buffsize=None):
5959

6060
class WebSockifyRequestHandlerTestCase(unittest.TestCase):
6161
def setUp(self):
62-
super(WebSockifyRequestHandlerTestCase, self).setUp()
62+
super().setUp()
6363
self.tmpdir = tempfile.mkdtemp('-websockify-tests')
6464
# Mock this out cause it screws tests up
6565
patch('os.chdir').start()
@@ -68,7 +68,7 @@ def tearDown(self):
6868
"""Called automatically after each test."""
6969
patch.stopall()
7070
os.rmdir(self.tmpdir)
71-
super(WebSockifyRequestHandlerTestCase, self).tearDown()
71+
super().tearDown()
7272

7373
def _get_server(self, handler_class=websockifyserver.WebSockifyRequestHandler,
7474
**kwargs):
@@ -101,7 +101,7 @@ def test_list_dir_with_file_only_returns_error(self, send_error):
101101

102102
class WebSockifyServerTestCase(unittest.TestCase):
103103
def setUp(self):
104-
super(WebSockifyServerTestCase, self).setUp()
104+
super().setUp()
105105
self.tmpdir = tempfile.mkdtemp('-websockify-tests')
106106
# Mock this out cause it screws tests up
107107
patch('os.chdir').start()
@@ -110,7 +110,7 @@ def tearDown(self):
110110
"""Called automatically after each test."""
111111
patch.stopall()
112112
os.rmdir(self.tmpdir)
113-
super(WebSockifyServerTestCase, self).tearDown()
113+
super().tearDown()
114114

115115
def _get_server(self, handler_class=websockifyserver.WebSockifyRequestHandler,
116116
**kwargs):
@@ -181,7 +181,7 @@ def fake_select(rlist, wlist, xlist, timeout=None):
181181
sock, '127.0.0.1')
182182

183183
def test_do_handshake_no_ssl(self):
184-
class FakeHandler(object):
184+
class FakeHandler:
185185
CALLED = False
186186
def __init__(self, *args, **kwargs):
187187
type(self).CALLED = True
@@ -256,7 +256,7 @@ def wrap_socket(self, *args, **kwargs):
256256
def test_do_handshake_ssl_sets_ciphers(self):
257257
test_ciphers = 'TEST-CIPHERS-1:TEST-CIPHER-2'
258258

259-
class FakeHandler(object):
259+
class FakeHandler:
260260
def __init__(self, *args, **kwargs):
261261
pass
262262

@@ -291,7 +291,7 @@ def set_ciphers(self, ciphers_to_set):
291291
def test_do_handshake_ssl_sets_opions(self):
292292
test_options = 0xCAFEBEEF
293293

294-
class FakeHandler(object):
294+
class FakeHandler:
295295
def __init__(self, *args, **kwargs):
296296
pass
297297

@@ -302,7 +302,7 @@ def __init__(self, *args, **kwargs):
302302
def fake_select(rlist, wlist, xlist, timeout=None):
303303
return ([sock], [], [])
304304

305-
class fake_create_default_context(object):
305+
class fake_create_default_context:
306306
OPTIONS = 0
307307
def __init__(self, purpose):
308308
self.verify_mode = None

websockify/sysloghandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def emit(self, record):
102102
if self.unixsocket:
103103
try:
104104
self.socket.send(msg)
105-
except socket.error:
105+
except OSError:
106106
self._connect_unixsocket(self.address)
107107
self.socket.send(msg)
108108

websockify/token_plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _load_targets(self):
3737
for line in [l.strip() for l in open(f).readlines()]:
3838
if line and not line.startswith('#'):
3939
try:
40-
tok, target = re.split(':\s', line)
40+
tok, target = re.split(r':\s', line)
4141
self._targets[tok] = target.strip().rsplit(':', 1)
4242
except ValueError:
4343
logger.error("Syntax error in %s on line %d" % (self.source, index))

websockify/websocket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class WebSocketWantReadError(ssl.SSLWantReadError):
3636
class WebSocketWantWriteError(ssl.SSLWantWriteError):
3737
pass
3838

39-
class WebSocket(object):
39+
class WebSocket:
4040
"""WebSocket protocol socket like class.
4141
4242
This provides access to the WebSocket protocol by behaving much

websockify/websocketproxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def do_proxy(self, target):
198198
if cqueue or c_pend: wlist.append(self.request)
199199
try:
200200
ins, outs, excepts = select.select(rlist, wlist, [], 1)
201-
except (select.error, OSError):
201+
except OSError:
202202
exc = sys.exc_info()[1]
203203
if hasattr(exc, 'errno'):
204204
err = exc.errno

websockify/websockifyserver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ def send_close(self, code=1000, reason=''):
187187
""" Send a WebSocket orderly close frame. """
188188
self.request.shutdown(socket.SHUT_RDWR, code, reason)
189189

190-
def send_pong(self, data=''.encode('ascii')):
190+
def send_pong(self, data=b''):
191191
""" Send a WebSocket pong frame. """
192192
self.request.pong(data)
193193

194-
def send_ping(self, data=''.encode('ascii')):
194+
def send_ping(self, data=b''):
195195
""" Send a WebSocket ping frame. """
196196
self.request.ping(data)
197197

0 commit comments

Comments
 (0)