| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7064858 commit d513d3a
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,8 @@ | |||
| 5 | 5 | import sys | |
| 6 | 6 | import locale | |
| 7 | 7 | from itertools import chain | |
| 8 | + from six import iterkeys, iteritems | ||
| 9 | + | ||
| 8 | 10 | from bpython.keys import cli_key_dispatch as key_dispatch | |
| 9 | 11 | from bpython.autocomplete import SIMPLE as default_completion | |
| 10 | 12 | import bpython.autocomplete | |
@@ -48,11 +50,11 @@ def default_config_path(): | |||
| 48 | 50 | ||
| 49 | 51 | ||
| 50 | 52 | def fill_config_with_default_values(config, default_values): | |
| 51 | - for section in default_values.iterkeys(): | ||
| 53 | + for section in iterkeys(default_values): | ||
| 52 | 54 | if not config.has_section(section): | |
| 53 | 55 | config.add_section(section) | |
| 54 | 56 | ||
| 55 | - for (opt, val) in default_values[section].iteritems(): | ||
| 57 | + for (opt, val) in iteritems(default_values[section]): | ||
| 56 | 58 | if not config.has_option(section, opt): | |
| 57 | 59 | config.set(section, opt, str(val)) | |
| 58 | 60 | ||
@@ -130,7 +132,7 @@ def loadini(struct, configfile): | |||
| 130 | 132 | }} | |
| 131 | 133 | ||
| 132 | 134 | default_keys_to_commands = dict((value, key) for (key, value) | |
| 133 | - in defaults['keyboard'].iteritems()) | ||
| 135 | + in iteritems(defaults['keyboard'])) | ||
| 134 | 136 | ||
| 135 | 137 | fill_config_with_default_values(config, defaults) | |
| 136 | 138 | if not config.read(config_path): | |
@@ -307,6 +309,6 @@ def load_theme(struct, path, colors, default_colors): | |||
| 307 | 309 | colors[k] = theme.get('interface', k) | |
| 308 | 310 | ||
| 309 | 311 | # Check against default theme to see if all values are defined | |
| 310 | - for k, v in default_colors.iteritems(): | ||
| 312 | + for k, v in iteritems(default_colors): | ||
| 311 | 313 | if k not in colors: | |
| 312 | 314 | colors[k] = v | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,15 +1,17 @@ | |||
| 1 | 1 | import code | |
| 2 | 2 | import traceback | |
| 3 | 3 | import sys | |
| 4 | + from codeop import CommandCompiler | ||
| 5 | + from six import iteritems | ||
| 6 | + | ||
| 4 | 7 | from pygments.token import Generic, Token, Keyword, Name, Comment, String | |
| 5 | 8 | from pygments.token import Error, Literal, Number, Operator, Punctuation | |
| 6 | 9 | from pygments.token import Whitespace | |
| 7 | 10 | from pygments.formatter import Formatter | |
| 8 | - from bpython.curtsiesfrontend.parse import parse | ||
| 9 | - from bpython.repl import RuntimeTimer | ||
| 10 | - from codeop import CommandCompiler | ||
| 11 | 11 | from pygments.lexers import get_lexer_by_name | |
| 12 | 12 | ||
| 13 | + from bpython.curtsiesfrontend.parse import parse | ||
| 14 | + from bpython.repl import RuntimeTimer | ||
| 13 | 15 | ||
| 14 | 16 | default_colors = { | |
| 15 | 17 | Generic.Error:'R', | |
@@ -45,7 +47,7 @@ class BPythonFormatter(Formatter): | |||
| 45 | 47 | ||
| 46 | 48 | def __init__(self, color_scheme, **options): | |
| 47 | 49 | self.f_strings = {} | |
| 48 | - for k, v in color_scheme.iteritems(): | ||
| 50 | + for k, v in iteritems(color_scheme): | ||
| 49 | 51 | self.f_strings[k] = '\x01%s' % (v,) | |
| 50 | 52 | Formatter.__init__(self, **options) | |
| 51 | 53 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -723,7 +723,7 @@ def send_current_block_to_external_editor(self, filename=None): | |||
| 723 | 723 | ||
| 724 | 724 | def send_session_to_external_editor(self, filename=None): | |
| 725 | 725 | for_editor = u'### current bpython session - file will be reevaluated, ### lines will not be run\n' | |
| 726 | - for_editor += '\n'.join(line[len(self.ps1):] if line.startswith(self.ps1) else | ||
| 726 | + for_editor += u'\n'.join(line[len(self.ps1):] if line.startswith(self.ps1) else | ||
| 727 | 727 | (line[len(self.ps2):] if line.startswith(self.ps2) else | |
| 728 | 728 | '### '+line) | |
| 729 | 729 | for line in self.getstdout().split('\n')) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,7 @@ | |||
| 27 | 27 | from pygments.formatter import Formatter | |
| 28 | 28 | from pygments.token import Keyword, Name, Comment, String, Error, \ | |
| 29 | 29 | Number, Operator, Token, Whitespace, Literal, Punctuation | |
| 30 | + from six import iteritems | ||
| 30 | 31 | ||
| 31 | 32 | """These format strings are pretty ugly. | |
| 32 | 33 | \x01 represents a colour marker, which | |
@@ -85,7 +86,7 @@ class BPythonFormatter(Formatter): | |||
| 85 | 86 | ||
| 86 | 87 | def __init__(self, color_scheme, **options): | |
| 87 | 88 | self.f_strings = {} | |
| 88 | - for k, v in theme_map.iteritems(): | ||
| 89 | + for k, v in iteritems(theme_map): | ||
| 89 | 90 | self.f_strings[k] = '\x01%s' % (color_scheme[v],) | |
| 90 | 91 | if k is Parenthesis: | |
| 91 | 92 | # FIXME: Find a way to make this the inverse of the current | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,6 +40,7 @@ | |||
| 40 | 40 | from itertools import takewhile | |
| 41 | 41 | from locale import getpreferredencoding | |
| 42 | 42 | from string import Template | |
| 43 | + from six import itervalues | ||
| 43 | 44 | ||
| 44 | 45 | from pygments.token import Token | |
| 45 | 46 | ||
@@ -958,7 +959,7 @@ def tokenize(self, s, newline=False): | |||
| 958 | 959 | else: | |
| 959 | 960 | stack.append((line, len(line_tokens) - 1, | |
| 960 | 961 | line_tokens, value)) | |
| 961 | - elif value in parens.itervalues(): | ||
| 962 | + elif value in itervalues(parens): | ||
| 962 | 963 | saved_stack = list(stack) | |
| 963 | 964 | try: | |
| 964 | 965 | while True: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,6 +43,7 @@ | |||
| 43 | 43 | from types import ModuleType | |
| 44 | 44 | from optparse import Option | |
| 45 | 45 | from six.moves import range | |
| 46 | + from six import iteritems | ||
| 46 | 47 | ||
| 47 | 48 | from pygments.token import Token | |
| 48 | 49 | ||
@@ -1151,7 +1152,7 @@ def main(args=None, locals_=None, banner=None): | |||
| 1151 | 1152 | palette = [ | |
| 1152 | 1153 | (name, COLORMAP[color.lower()], 'default', | |
| 1153 | 1154 | 'bold' if color.isupper() else 'default') | |
| 1154 | - for name, color in config.color_scheme.iteritems()] | ||
| 1155 | + for name, color in iteritems(config.color_scheme)] | ||
| 1155 | 1156 | palette.extend([ | |
| 1156 | 1157 | ('bold ' + name, color + ',bold', background, monochrome) | |
| 1157 | 1158 | for name, color, background, monochrome in palette]) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments