Skip to content

Commit 8f03ee2

Browse files
committed
Update use of super and class definitions
1 parent b4424a3 commit 8f03ee2

32 files changed

+79
-79
lines changed

bpython/_internal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
pydoc.pager = page
88

99

10-
class _Helper(object):
10+
class _Helper:
1111
def __init__(self):
1212
if hasattr(pydoc.Helper, "output"):
1313
# See issue #228

bpython/autocomplete.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def method_match_fuzzy(word, size, text):
149149
}
150150

151151

152-
class BaseCompletionType(object):
152+
class BaseCompletionType:
153153
"""Describes different completion types"""
154154

155155
def __init__(self, shown_before_tab=True, mode=SIMPLE):
@@ -209,7 +209,7 @@ def __init__(self, completers, mode=SIMPLE):
209209
)
210210
self._completers = completers
211211

212-
super(CumulativeCompleter, self).__init__(True, mode)
212+
super().__init__(True, mode)
213213

214214
def locate(self, current_offset, line):
215215
return self._completers[0].locate(current_offset, line)
@@ -244,7 +244,7 @@ def format(self, word):
244244

245245
class FilenameCompletion(BaseCompletionType):
246246
def __init__(self, mode=SIMPLE):
247-
super(FilenameCompletion, self).__init__(False, mode)
247+
super().__init__(False, mode)
248248

249249
def safe_glob(self, pathname):
250250
return glob.iglob(glob.escape(pathname) + "*")
@@ -567,7 +567,7 @@ def matches(self, cursor_offset, line, **kwargs):
567567
cursor_offset,
568568
line,
569569
)
570-
results = super(MultilineJediCompletion, self).matches(
570+
results = super().matches(
571571
cursor_offset, line, history=history
572572
)
573573
return results

bpython/cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def newfunc(self, *args, **kwargs):
121121
return newfunc
122122

123123

124-
class FakeStream(object):
124+
class FakeStream:
125125
"""Provide a fake file object which calls functions on the interface
126126
provided."""
127127

@@ -147,7 +147,7 @@ def flush(self):
147147
self.interface.flush()
148148

149149

150-
class FakeStdin(object):
150+
class FakeStdin:
151151
"""Provide a fake stdin type for things like raw_input() etc."""
152152

153153
def __init__(self, interface):
@@ -303,7 +303,7 @@ def make_colors(config):
303303

304304
class CLIInteraction(repl.Interaction):
305305
def __init__(self, config, statusbar=None):
306-
super(CLIInteraction, self).__init__(config, statusbar)
306+
super().__init__(config, statusbar)
307307

308308
def confirm(self, q):
309309
"""Ask for yes or no and return boolean"""
@@ -323,7 +323,7 @@ def file_prompt(self, s):
323323

324324
class CLIRepl(repl.Repl):
325325
def __init__(self, scr, interp, statusbar, config, idle=None):
326-
super(CLIRepl, self).__init__(interp, config)
326+
super().__init__(interp, config)
327327
self.interp.writetb = self.writetb
328328
self.scr = scr
329329
self.stdout_hist = "" # native str (bytes in Py2, unicode in Py3)
@@ -1527,7 +1527,7 @@ def send_current_line_to_editor(self):
15271527
return ""
15281528

15291529

1530-
class Statusbar(object):
1530+
class Statusbar:
15311531
"""This class provides the status bar at the bottom of the screen.
15321532
It has message() and prompt() methods for user interactivity, as
15331533
well as settext() and clear() methods for changing its appearance.
@@ -1821,7 +1821,7 @@ def do_resize(caller):
18211821
# The list win resizes itself every time it appears so no need to do it here.
18221822

18231823

1824-
class FakeDict(object):
1824+
class FakeDict:
18251825
"""Very simple dict-alike that returns a constant value for any key -
18261826
used as a hacky solution to using a colours dict containing colour codes if
18271827
colour initialisation fails."""

bpython/clipboard.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CopyFailed(Exception):
3131
pass
3232

3333

34-
class XClipboard(object):
34+
class XClipboard:
3535
"""Manage clipboard with xclip."""
3636

3737
def copy(self, content):
@@ -43,7 +43,7 @@ def copy(self, content):
4343
raise CopyFailed()
4444

4545

46-
class OSXClipboard(object):
46+
class OSXClipboard:
4747
"""Manage clipboard with pbcopy."""
4848

4949
def copy(self, content):

bpython/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .autocomplete import SIMPLE as default_completion, ALL_MODES
99

1010

11-
class Struct(object):
11+
class Struct:
1212
"""Simple class for instantiating objects we can add arbitrary attributes
1313
to and use for various arbitrary things."""
1414

bpython/curtsies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, config, locals_, banner, interp=None):
5959
with self.input_generator:
6060
pass # temp hack to get .original_stty
6161

62-
super(FullCurtsiesRepl, self).__init__(
62+
super().__init__(
6363
locals_=locals_,
6464
config=config,
6565
banner=banner,

bpython/curtsiesfrontend/_internal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from bpython.repl import getpreferredencoding
2727

2828

29-
class NopPydocPager(object):
29+
class NopPydocPager:
3030
def __enter__(self):
3131
self._orig_pager = pydoc.pager
3232
pydoc.pager = self
@@ -43,17 +43,17 @@ def __init__(self, repl=None):
4343
self._repl = repl
4444
pydoc.pager = self.pager
4545

46-
super(_Helper, self).__init__()
46+
super().__init__()
4747

4848
def pager(self, output):
4949
self._repl.pager(output)
5050

5151
def __call__(self, *args, **kwargs):
5252
if self._repl.reevaluating:
5353
with NopPydocPager():
54-
return super(_Helper, self).__call__(*args, **kwargs)
54+
return super().__call__(*args, **kwargs)
5555
else:
56-
return super(_Helper, self).__call__(*args, **kwargs)
56+
return super().__call__(*args, **kwargs)
5757

5858

5959
# vim: sw=4 ts=4 sts=4 ai et

bpython/curtsiesfrontend/coderunner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def is_main_thread():
2525
return threading.main_thread() == threading.current_thread()
2626

2727

28-
class SigintHappened(object):
28+
class SigintHappened:
2929
"""If this class is returned, a SIGINT happened while the main greenlet"""
3030

3131

@@ -34,7 +34,7 @@ class SystemExitFromCodeRunner(SystemExit):
3434
greenlet"""
3535

3636

37-
class RequestFromCodeRunner(object):
37+
class RequestFromCodeRunner:
3838
"""Message from the code runner"""
3939

4040

@@ -61,7 +61,7 @@ def __init__(self, args):
6161
self.args = args
6262

6363

64-
class CodeRunner(object):
64+
class CodeRunner:
6565
"""Runs user code in an interpreter.
6666
6767
Running code requests a refresh by calling
@@ -206,7 +206,7 @@ def request_from_main_context(self, force_refresh=False):
206206
return value
207207

208208

209-
class FakeOutput(object):
209+
class FakeOutput:
210210
def __init__(self, coderunner, on_write, real_fileobj):
211211
"""Fakes sys.stdout or sys.stderr
212212

bpython/curtsiesfrontend/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ScheduledRefreshRequestEvent(curtsies.events.ScheduledEvent):
2828
for a few seconds"""
2929

3030
def __init__(self, when):
31-
super(ScheduledRefreshRequestEvent, self).__init__(when)
31+
super().__init__(when)
3232

3333
def __repr__(self):
3434
return "<RefreshRequestEvent for %s seconds from now>" % (

bpython/curtsiesfrontend/interaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(
4747
self.request_refresh = request_refresh
4848
self.schedule_refresh = schedule_refresh
4949

50-
super(StatusBar, self).__init__(config)
50+
super().__init__(config)
5151

5252
def push_permanent_message(self, msg):
5353
self._message = ""

0 commit comments

Comments
 (0)