Skip to content

Commit

Permalink
drop six dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
branchvincent committed Dec 28, 2023
1 parent 65a5d09 commit c1ab78b
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 19 deletions.
4 changes: 1 addition & 3 deletions anytree/exporter/dotexporter.py
Expand Up @@ -6,8 +6,6 @@
from subprocess import check_call
from tempfile import NamedTemporaryFile

import six

from anytree import PreOrderIter

_RE_ESC = re.compile(r'["\\]')
Expand Down Expand Up @@ -315,7 +313,7 @@ def to_picture(self, filename):
@staticmethod
def esc(value):
"""Escape Strings."""
return _RE_ESC.sub(lambda m: r"\%s" % m.group(0), six.text_type(value))
return _RE_ESC.sub(lambda m: r"\%s" % m.group(0), str(value))


class UniqueDotExporter(DotExporter):
Expand Down
4 changes: 1 addition & 3 deletions anytree/exporter/mermaidexporter.py
Expand Up @@ -2,8 +2,6 @@
import itertools
import re

import six

from anytree import PreOrderIter

_RE_ESC = re.compile(r'["\\]')
Expand Down Expand Up @@ -242,4 +240,4 @@ def to_file(self, filename):
@staticmethod
def esc(value):
"""Escape Strings."""
return _RE_ESC.sub(lambda m: r"\%s" % m.group(0), six.text_type(value))
return _RE_ESC.sub(lambda m: r"\%s" % m.group(0), str(value))
5 changes: 1 addition & 4 deletions anytree/iterators/abstractiter.py
@@ -1,7 +1,4 @@
import six


class AbstractIter(six.Iterator):
class AbstractIter:
# pylint: disable=R0205
"""
Iterate over tree starting at `node`.
Expand Down
3 changes: 0 additions & 3 deletions anytree/render.py
Expand Up @@ -11,8 +11,6 @@

import collections

import six

from .config import ASSERTIONS

Row = collections.namedtuple("Row", ("pre", "fill", "node"))
Expand Down Expand Up @@ -146,7 +144,6 @@ def __init__(self):
super(DoubleStyle, self).__init__("\u2551 ", "\u2560\u2550\u2550 ", "\u255a\u2550\u2550 ")


@six.python_2_unicode_compatible
class RenderTree:
"""
Render tree starting at `node`.
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Expand Up @@ -33,7 +33,6 @@ classifiers = [

[tool.poetry.dependencies]
python = ">= 3.7.2, < 4"
six = '*'

[tool.poetry.group.test.dependencies]
black = '^22.3.0'
Expand Down
2 changes: 0 additions & 2 deletions tests/helper.py
@@ -1,8 +1,6 @@
"""Helper Methods for testing."""
from contextlib import contextmanager

import six


def eq_(one, other):
assert one == other, "{one} != {other}".format(one=one, other=other)
Expand Down
5 changes: 4 additions & 1 deletion tests/test_dotexport.py
@@ -1,7 +1,9 @@
from filecmp import cmp
from os import makedirs
from os.path import dirname, exists, join
from shutil import rmtree
from shutil import rmtree, which

import pytest

from anytree import Node
from anytree.dotexport import RenderTreeGraph
Expand Down Expand Up @@ -71,6 +73,7 @@ def edgeattrfunc(node, child):
assert cmp(join(GENPATH, "tree2.dot"), join(REFPATH, "tree2.dot"))


@pytest.mark.skipif(which("dot") is None, reason="requires graphviz`s `dot` command")
@with_setup(setup, teardown)
def test_tree_png():
"""Tree to png."""
Expand Down
2 changes: 0 additions & 2 deletions tests/test_node_sep.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
"""Test custom node separator."""

import six

import anytree as at

from .helper import assert_raises, eq_
Expand Down

0 comments on commit c1ab78b

Please sign in to comment.