Skip to content

Commit a565987

Browse files
committed
refactor: Class syntax changed ages ago
1 parent e0c5ed1 commit a565987

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

bottle.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def makelist(data): # This is just too handy
162162
return []
163163

164164

165-
class DictProperty(object):
165+
class DictProperty:
166166
""" Property that maps to a key in a local dict-like attribute. """
167167

168168
def __init__(self, attr, key=None, read_only=False):
@@ -188,7 +188,7 @@ def __delete__(self, obj):
188188
del getattr(obj, self.attr)[self.key]
189189

190190

191-
class cached_property(object):
191+
class cached_property:
192192
""" A property that is only computed once per instance and then replaces
193193
itself with an ordinary attribute. Deleting the attribute resets the
194194
property. """
@@ -203,7 +203,7 @@ def __get__(self, obj, cls):
203203
return value
204204

205205

206-
class lazy_attribute(object):
206+
class lazy_attribute:
207207
""" A property that caches itself to the class object. """
208208

209209
def __init__(self, func):
@@ -255,7 +255,7 @@ def _re_flatten(p):
255255
len(m.group(1)) % 2 else m.group(1) + '(?:', p)
256256

257257

258-
class Router(object):
258+
class Router:
259259
""" A Router is an ordered collection of route->target pairs. It is used to
260260
efficiently match WSGI requests against a number of routes and return
261261
the first target that satisfies the request. The target may be anything,
@@ -458,7 +458,7 @@ def match(self, environ):
458458
raise HTTPError(404, "Not found: " + repr(path))
459459

460460

461-
class Route(object):
461+
class Route:
462462
""" This class wraps a route callback along with route specific metadata and
463463
configuration and applies Plugins on demand. It is also responsible for
464464
turning an URL path rule into a regular expression usable by the Router.
@@ -568,7 +568,7 @@ def __repr__(self):
568568
###############################################################################
569569

570570

571-
class Bottle(object):
571+
class Bottle:
572572
""" Each Bottle object represents a single, distinct web application and
573573
consists of routes, callbacks, plugins, resources and configuration.
574574
Instances are callable WSGI applications.
@@ -1099,7 +1099,7 @@ def __setattr__(self, name, value):
10991099
###############################################################################
11001100

11011101

1102-
class BaseRequest(object):
1102+
class BaseRequest:
11031103
""" A wrapper for WSGI environment dictionaries that adds a lot of
11041104
convenient access methods and properties. Most of them are read-only.
11051105
@@ -1564,7 +1564,7 @@ def _hval(value):
15641564
return value
15651565

15661566

1567-
class HeaderProperty(object):
1567+
class HeaderProperty:
15681568
def __init__(self, name, reader=None, writer=None, default=''):
15691569
self.name, self.default = name, default
15701570
self.reader, self.writer = reader, writer
@@ -1582,7 +1582,7 @@ def __delete__(self, obj):
15821582
del obj[self.name]
15831583

15841584

1585-
class BaseResponse(object):
1585+
class BaseResponse:
15861586
""" Storage class for a response body as well as headers and cookies.
15871587
15881588
This class does support dict-like case-insensitive item-access to
@@ -1942,7 +1942,7 @@ class PluginError(BottleException):
19421942
pass
19431943

19441944

1945-
class JSONPlugin(object):
1945+
class JSONPlugin:
19461946
name = 'json'
19471947
api = 2
19481948

@@ -1986,7 +1986,7 @@ def wrapper(*a, **ka):
19861986
return wrapper
19871987

19881988

1989-
class TemplatePlugin(object):
1989+
class TemplatePlugin:
19901990
""" This plugin applies the :func:`view` decorator to all routes with a
19911991
`template` config parameter. If the parameter is a tuple, the second
19921992
element must be a dict with additional options (e.g. `template_engine`)
@@ -2008,7 +2008,7 @@ def apply(self, callback, route):
20082008

20092009

20102010
#: Not a plugin, but part of the plugin API. TODO: Find a better place.
2011-
class _ImportRedirect(object):
2011+
class _ImportRedirect:
20122012
def __init__(self, name, impmask):
20132013
""" Create a virtual package that redirects imports (see PEP 302). """
20142014
self.name = name
@@ -2509,7 +2509,7 @@ def default(self):
25092509
return self.push()
25102510

25112511

2512-
class WSGIFileWrapper(object):
2512+
class WSGIFileWrapper:
25132513
def __init__(self, fp, buffer_size=1024 * 64):
25142514
self.fp, self.buffer_size = fp, buffer_size
25152515
for attr in 'fileno', 'close', 'read', 'readlines', 'tell', 'seek':
@@ -2523,7 +2523,7 @@ def __iter__(self):
25232523
part = read(buff)
25242524

25252525

2526-
class _closeiter(object):
2526+
class _closeiter:
25272527
""" This only exists to be able to attach a .close method to iterators that
25282528
do not support attribute assignment (most of itertools). """
25292529

@@ -2548,7 +2548,7 @@ def _try_close(obj):
25482548
pass
25492549

25502550

2551-
class ResourceManager(object):
2551+
class ResourceManager:
25522552
""" This class manages a list of search paths and helps to find and open
25532553
application-bound resources (files).
25542554
@@ -2634,7 +2634,7 @@ def open(self, name, mode='r', *args, **kwargs):
26342634
return self.opener(fname, mode=mode, *args, **kwargs)
26352635

26362636

2637-
class FileUpload(object):
2637+
class FileUpload:
26382638
def __init__(self, fileobj, name, filename, headers=None):
26392639
""" Wrapper for a single file uploaded via ``multipart/form-data``. """
26402640
#: Open file(-like) object (BytesIO buffer or temporary file)
@@ -3118,7 +3118,7 @@ def __init__(self, msg):
31183118
HTTPError.__init__(self, 400, "MultipartError: " + msg)
31193119

31203120

3121-
class _MultipartParser(object):
3121+
class _MultipartParser:
31223122
def __init__(
31233123
self,
31243124
stream,
@@ -3242,7 +3242,7 @@ def parse(self):
32423242
raise MultipartError("Unexpected end of multipart stream.")
32433243

32443244

3245-
class _MultipartPart(object):
3245+
class _MultipartPart:
32463246
def __init__(self, buffer_size=2 ** 16, memfile_limit=2 ** 18, charset="latin1"):
32473247
self.headerlist = []
32483248
self.headers = None
@@ -3361,7 +3361,7 @@ def close(self):
33613361
# - https://github.com/bottlepy/bottle/pull/647#issuecomment-60152870
33623362
# - https://github.com/bottlepy/bottle/pull/865#issuecomment-242795341
33633363

3364-
class ServerAdapter(object):
3364+
class ServerAdapter:
33653365
quiet = False
33663366

33673367
def __init__(self, host='127.0.0.1', port=8080, **options):
@@ -3942,7 +3942,7 @@ class TemplateError(BottleException):
39423942
pass
39433943

39443944

3945-
class BaseTemplate(object):
3945+
class BaseTemplate:
39463946
""" Base class and minimal API for template adapters """
39473947
extensions = ['tpl', 'html', 'thtml', 'stpl']
39483948
settings = {} # used in prepare()
@@ -4176,7 +4176,7 @@ class StplSyntaxError(TemplateError):
41764176
pass
41774177

41784178

4179-
class StplParser(object):
4179+
class StplParser:
41804180
""" Parser for stpl templates. """
41814181
_re_cache = {} #: Cache for compiled re patterns
41824182

0 commit comments

Comments
 (0)