Skip to content

Commit 5a42d0a

Browse files
committed
Remove use of six.iteritems
1 parent 0dfc034 commit 5a42d0a

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

bpython/autocomplete.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import os
3131
import re
3232
import rlcompleter
33-
from six import iteritems
3433
import builtins
3534

3635
from . import inspection
@@ -430,7 +429,7 @@ def matches(self, cursor_offset, line, **kwargs):
430429
if self.method_match(word, n, r.word):
431430
matches.add(word)
432431
for nspace in (builtins.__dict__, locals_):
433-
for word, val in iteritems(nspace):
432+
for word, val in nspace.items():
434433
# if identifier isn't ascii, don't complete (syntax error)
435434
if word is None:
436435
continue

bpython/config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
import locale
44
from itertools import chain
5-
from six import iterkeys, iteritems
5+
from six import iterkeys
66
from configparser import ConfigParser
77

88
from .autocomplete import SIMPLE as default_completion, ALL_MODES
@@ -47,7 +47,7 @@ def fill_config_with_default_values(config, default_values):
4747
if not config.has_section(section):
4848
config.add_section(section)
4949

50-
for (opt, val) in iteritems(default_values[section]):
50+
for (opt, val) in default_values[section].items():
5151
if not config.has_option(section, opt):
5252
config.set(section, opt, "%s" % (val,))
5353

@@ -122,9 +122,9 @@ def loadini(struct, configfile):
122122
"curtsies": {"list_above": False, "right_arrow_completion": True,},
123123
}
124124

125-
default_keys_to_commands = dict(
126-
(value, key) for (key, value) in iteritems(defaults["keyboard"])
127-
)
125+
default_keys_to_commands = {
126+
value: key for (key, value) in defaults["keyboard"].items()
127+
}
128128

129129
fill_config_with_default_values(config, defaults)
130130
try:
@@ -314,6 +314,6 @@ def load_theme(struct, path, colors, default_colors):
314314
colors[k] = theme.get("interface", k)
315315

316316
# Check against default theme to see if all values are defined
317-
for k, v in iteritems(default_colors):
317+
for k, v in default_colors.items():
318318
if k not in colors:
319319
colors[k] = v

bpython/curtsiesfrontend/interpreter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from six import iteritems, text_type
2+
from six import text_type
33

44
from pygments.token import Generic, Token, Keyword, Name, Comment, String
55
from pygments.token import Error, Literal, Number, Operator, Punctuation
@@ -45,7 +45,7 @@ class BPythonFormatter(Formatter):
4545

4646
def __init__(self, color_scheme, **options):
4747
self.f_strings = {}
48-
for k, v in iteritems(color_scheme):
48+
for k, v in color_scheme.items():
4949
self.f_strings[k] = "\x01%s" % (v,)
5050
super().__init__(**options)
5151

bpython/curtsiesfrontend/manual_readline.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from bpython.lazyre import LazyReCompile
88

99
import inspect
10-
from six import iteritems
1110

1211
INDENT = 4
1312

@@ -38,9 +37,9 @@ def add(self, key, func, overwrite=False):
3837
else:
3938
raise ValueError("key %r already has a mapping" % (key,))
4039
params = getargspec(func)
41-
args = dict(
42-
(k, v) for k, v in iteritems(self.default_kwargs) if k in params
43-
)
40+
args = {
41+
k: v for k, v in self.default_kwargs.items() if k in params
42+
}
4443
r = func(**args)
4544
if len(r) == 2:
4645
if hasattr(func, "kills"):

bpython/formatter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
Literal,
4040
Punctuation,
4141
)
42-
from six import iteritems
4342

4443
"""These format strings are pretty ugly.
4544
\x01 represents a colour marker, which
@@ -99,7 +98,7 @@ class BPythonFormatter(Formatter):
9998

10099
def __init__(self, color_scheme, **options):
101100
self.f_strings = {}
102-
for k, v in iteritems(theme_map):
101+
for k, v in theme_map.items():
103102
self.f_strings[k] = "\x01%s" % (color_scheme[v],)
104103
if k is Parenthesis:
105104
# FIXME: Find a way to make this the inverse of the current

bpython/urwid.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import locale
3939
import signal
4040
from optparse import Option
41-
from six import iteritems
4241

4342
from pygments.token import Token
4443

@@ -1188,7 +1187,7 @@ def main(args=None, locals_=None, banner=None):
11881187
"default",
11891188
"bold" if color.isupper() else "default",
11901189
)
1191-
for name, color in iteritems(config.color_scheme)
1190+
for name, color in config.color_scheme.items()
11921191
]
11931192
palette.extend(
11941193
[

0 commit comments

Comments
 (0)