Skip to content

Commit

Permalink
Drop Python 2 support, remove six
Browse files Browse the repository at this point in the history
  • Loading branch information
stianjensen committed Jan 23, 2022
1 parent 6d7f108 commit b5913b1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions click_repl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import os
import shlex
import sys
import six
from .exceptions import InternalCommandException, ExitReplException # noqa

# Handle backwards compatibility between Click 7.0 and 8.0
Expand Down Expand Up @@ -42,7 +41,7 @@ def _register_internal_command(names, target, description=None):
if not hasattr(target, "__call__"):
raise ValueError("Internal command must be a callable")

if isinstance(names, six.string_types):
if isinstance(names, str):
names = [names]
elif not isinstance(names, (list, tuple)):
raise ValueError('"names" must be a string or a list / tuple')
Expand Down Expand Up @@ -71,14 +70,14 @@ def _help_internal():
with formatter.section("Internal Commands"):
formatter.write_text('prefix internal commands with ":"')
info_table = defaultdict(list)
for mnemonic, target_info in six.iteritems(_internal_commands):
for mnemonic, target_info in _internal_commands.items():
info_table[target_info[1]].append(mnemonic)
formatter.write_dl(
(
", ".join((":{0}".format(mnemonic) for mnemonic in sorted(mnemonics))),
description,
)
for description, mnemonics in six.iteritems(info_table)
for description, mnemonics in info_table.items()
)
return formatter.getvalue()

Expand Down Expand Up @@ -242,7 +241,7 @@ def get_command():
if allow_internal_commands:
try:
result = handle_internal_commands(command)
if isinstance(result, six.string_types):
if isinstance(result, str):
click.echo(result)
continue
except ExitReplException:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
url="https://github.com/untitaker/click-repl",
license="MIT",
packages=["click_repl"],
install_requires=["click", "prompt_toolkit", "six"],
install_requires=["click", "prompt_toolkit"],
)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{27,py,34,35,36,37}
py{py,34,35,36,37}
linters

[testenv]
Expand Down

0 comments on commit b5913b1

Please sign in to comment.