Skip to content

Commit 04696c5

Browse files
authored
Remove more traces of Python2 (GH-280)
1 parent 0d382c4 commit 04696c5

File tree

6 files changed

+21
-36
lines changed

6 files changed

+21
-36
lines changed

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ setter function implementations for a ``LuaRuntime``:
935935
... raise AttributeError(
936936
... 'not allowed to write attribute "%s"' % attr_name)
937937
938-
>>> class X(object):
938+
>>> class X:
939939
... yes = 123
940940
... put = 'abc'
941941
... noway = 2.1

lupa/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
31
from contextlib import contextmanager as _contextmanager
42

53
# Find the implementation with the latest Lua version available.

lupa/_lupa.pyx

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
A fast Python wrapper around Lua and LuaJIT2.
55
"""
66

7-
from __future__ import absolute_import
8-
97
cimport cython
108

119
from libc.string cimport strlen, strchr

lupa/tests/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
31
import unittest
42
import doctest
53
import os

lupa/tests/test.py

+20-27
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _next(o):
2727
return o.next()
2828

2929

30-
class SetupLuaRuntimeMixin(object):
30+
class SetupLuaRuntimeMixin:
3131
lua_runtime_kwargs = {}
3232

3333
def setUp(self):
@@ -262,10 +262,7 @@ def test_none(self):
262262

263263
def test_pybuiltins(self):
264264
function = self.lua.eval('function() return python.builtins end')
265-
try:
266-
import __builtin__ as builtins
267-
except ImportError:
268-
import builtins
265+
import builtins
269266
self.assertEqual(builtins, function())
270267

271268
def test_pybuiltins_disabled(self):
@@ -290,7 +287,7 @@ def test_call_str_py(self):
290287

291288
def test_call_str_class(self):
292289
called = [False]
293-
class test(object):
290+
class test:
294291
def __str__(self):
295292
called[0] = True
296293
return 'STR!!'
@@ -837,14 +834,14 @@ def test_pysetitem(self):
837834

838835
def test_pygetattr(self):
839836
lua_func = self.lua.eval('function(x) return x.ATTR end')
840-
class test(object):
837+
class test:
841838
def __init__(self):
842839
self.ATTR = 5
843840
self.assertEqual(test().ATTR, lua_func(test()))
844841

845842
def test_pysetattr(self):
846843
lua_func = self.lua.eval('function(x) x.ATTR = 123 end')
847-
class test(object):
844+
class test:
848845
def __init__(self):
849846
self.ATTR = 5
850847
t = test()
@@ -943,7 +940,7 @@ def attr_filter(obj, name, setting):
943940

944941
lua = self.lupa.LuaRuntime(attribute_filter=attr_filter)
945942
function = lua.eval('function(obj) return obj.__name__ end')
946-
class X(object):
943+
class X:
947944
a = 0
948945
a1 = 1
949946
_a = 2
@@ -1049,14 +1046,14 @@ def test_pysetitem(self):
10491046

10501047
def test_pygetattr(self):
10511048
lua_func = self.lua.eval('function(x) return x.ATTR end')
1052-
class test(object):
1049+
class test:
10531050
def __init__(self):
10541051
self.ATTR = 5
10551052
self.assertEqual(test().ATTR, lua_func(test()))
10561053

10571054
def test_pysetattr(self):
10581055
lua_func = self.lua.eval('function(x) x.ATTR = 123 end')
1059-
class test(object):
1056+
class test:
10601057
def __init__(self):
10611058
self.ATTR = 5
10621059
t = test()
@@ -1078,7 +1075,7 @@ def test_call_str_py(self):
10781075

10791076
def test_call_str_class(self):
10801077
called = [False]
1081-
class test(object):
1078+
class test:
10821079
def __str__(self):
10831080
called[0] = True
10841081
return 'STR!!'
@@ -1100,13 +1097,13 @@ def tearDown(self):
11001097
self.lua = None
11011098
gc.collect()
11021099

1103-
class X(object):
1100+
class X:
11041101
a = 0
11051102
a1 = 1
11061103
_a = 2
11071104
__a = 3
11081105

1109-
class Y(object):
1106+
class Y:
11101107
a = 0
11111108
a1 = 1
11121109
_a = 2
@@ -1282,7 +1279,7 @@ def test_pyobject_wrapping_callable(self):
12821279
lua_type = self.lua.eval('type')
12831280
lua_get_call = self.lua.eval('function(obj) return getmetatable(obj).__call end')
12841281

1285-
class Callable(object):
1282+
class Callable:
12861283
def __call__(self): pass
12871284
def __getitem__(self, item): pass
12881285

@@ -1293,7 +1290,7 @@ def test_pyobject_wrapping_getitem(self):
12931290
lua_type = self.lua.eval('type')
12941291
lua_get_index = self.lua.eval('function(obj) return getmetatable(obj).__index end')
12951292

1296-
class GetItem(object):
1293+
class GetItem:
12971294
def __getitem__(self, item): pass
12981295

12991296
self.assertEqual('userdata', lua_type(GetItem()))
@@ -1303,7 +1300,7 @@ def test_pyobject_wrapping_getattr(self):
13031300
lua_type = self.lua.eval('type')
13041301
lua_get_index = self.lua.eval('function(obj) return getmetatable(obj).__index end')
13051302

1306-
class GetAttr(object):
1303+
class GetAttr:
13071304
pass
13081305

13091306
self.assertEqual('userdata', lua_type(GetAttr()))
@@ -2234,7 +2231,7 @@ def setUp(self):
22342231

22352232
self.lua = self.lupa.LuaRuntime(unpack_returned_tuples=True)
22362233

2237-
class C(object):
2234+
class C:
22382235
def __init__(self, x):
22392236
self.x = int(x)
22402237

@@ -2364,19 +2361,19 @@ def func_3(x, y, z='default'):
23642361
return ("x=%s, y=%s, z=%s" % (x, y, z))
23652362

23662363

2367-
class MyCls_1(object):
2364+
class MyCls_1:
23682365
@lupa.unpacks_lua_table_method
23692366
def meth(self, x):
23702367
return ("x=%s" % (x,))
23712368

23722369

2373-
class MyCls_2(object):
2370+
class MyCls_2:
23742371
@lupa.unpacks_lua_table_method
23752372
def meth(self, x, y):
23762373
return ("x=%s, y=%s" % (x, y))
23772374

23782375

2379-
class MyCls_3(object):
2376+
class MyCls_3:
23802377
@lupa.unpacks_lua_table_method
23812378
def meth(self, x, y, z='default'):
23822379
return ("x=%s, y=%s, z=%s" % (x, y, z))
@@ -2520,11 +2517,7 @@ class NoEncodingMethodKwargsDecoratorTest(MethodKwargsDecoratorTest):
25202517
################################################################################
25212518
# tests for the FastRLock implementation
25222519

2523-
try:
2524-
from thread import start_new_thread, get_ident
2525-
except ImportError:
2526-
# Python 3?
2527-
from _thread import start_new_thread, get_ident
2520+
from _thread import start_new_thread, get_ident
25282521

25292522

25302523
def _wait():
@@ -2552,7 +2545,7 @@ def setUp(self):
25522545
def tearDown(self):
25532546
gc.collect()
25542547

2555-
class Bunch(object):
2548+
class Bunch:
25562549
"""
25572550
A bunch of threads.
25582551
"""

setup.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
31
import glob
42
import os
53
import os.path

0 commit comments

Comments
 (0)