153 lines
4.4 KiB
Diff
153 lines
4.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Branch Vincent <branchevincent@gmail.com>
|
|
Date: Wed, 27 Dec 2023 22:17:27 -0800
|
|
Subject: [PATCH] drop six dependency
|
|
|
|
---
|
|
anytree/exporter/dotexporter.py | 4 +---
|
|
anytree/exporter/mermaidexporter.py | 4 +---
|
|
anytree/iterators/abstractiter.py | 5 +----
|
|
anytree/render.py | 3 ---
|
|
pyproject.toml | 1 -
|
|
tests/helper.py | 2 --
|
|
tests/test_dotexport.py | 5 ++++-
|
|
tests/test_node_sep.py | 2 --
|
|
8 files changed, 7 insertions(+), 19 deletions(-)
|
|
|
|
diff --git a/anytree/exporter/dotexporter.py b/anytree/exporter/dotexporter.py
|
|
index 5e689271a55c..10425f7dbd55 100644
|
|
--- a/anytree/exporter/dotexporter.py
|
|
+++ b/anytree/exporter/dotexporter.py
|
|
@@ -6,8 +6,6 @@ from os import path, remove
|
|
from subprocess import check_call
|
|
from tempfile import NamedTemporaryFile
|
|
|
|
-import six
|
|
-
|
|
from anytree import PreOrderIter
|
|
|
|
_RE_ESC = re.compile(r'["\\]')
|
|
@@ -315,7 +313,7 @@ class DotExporter:
|
|
@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):
|
|
diff --git a/anytree/exporter/mermaidexporter.py b/anytree/exporter/mermaidexporter.py
|
|
index bfb725a8909e..17f1addd4fd9 100644
|
|
--- a/anytree/exporter/mermaidexporter.py
|
|
+++ b/anytree/exporter/mermaidexporter.py
|
|
@@ -2,8 +2,6 @@ import codecs
|
|
import itertools
|
|
import re
|
|
|
|
-import six
|
|
-
|
|
from anytree import PreOrderIter
|
|
|
|
_RE_ESC = re.compile(r'["\\]')
|
|
@@ -242,4 +240,4 @@ class MermaidExporter:
|
|
@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))
|
|
diff --git a/anytree/iterators/abstractiter.py b/anytree/iterators/abstractiter.py
|
|
index 055cecdc6d8c..6b8b75e0d56f 100644
|
|
--- a/anytree/iterators/abstractiter.py
|
|
+++ b/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`.
|
|
diff --git a/anytree/render.py b/anytree/render.py
|
|
index 8152c462eff2..7b38d8d742e8 100644
|
|
--- a/anytree/render.py
|
|
+++ b/anytree/render.py
|
|
@@ -11,8 +11,6 @@ Tree Rendering.
|
|
|
|
import collections
|
|
|
|
-import six
|
|
-
|
|
from .config import ASSERTIONS
|
|
|
|
Row = collections.namedtuple("Row", ("pre", "fill", "node"))
|
|
@@ -146,7 +144,6 @@ class DoubleStyle(AbstractStyle):
|
|
super(DoubleStyle, self).__init__("\u2551 ", "\u2560\u2550\u2550 ", "\u255a\u2550\u2550 ")
|
|
|
|
|
|
-@six.python_2_unicode_compatible
|
|
class RenderTree:
|
|
"""
|
|
Render tree starting at `node`.
|
|
diff --git a/pyproject.toml b/pyproject.toml
|
|
index d329ac9eb329..a937784327c5 100644
|
|
--- a/pyproject.toml
|
|
+++ b/pyproject.toml
|
|
@@ -33,7 +33,6 @@ classifiers = [
|
|
|
|
[tool.poetry.dependencies]
|
|
python = ">= 3.7.2, < 4"
|
|
-six = '*'
|
|
|
|
[tool.poetry.group.test.dependencies]
|
|
black = '^22.3.0'
|
|
diff --git a/tests/helper.py b/tests/helper.py
|
|
index 3e943a31ddc2..e112cdad6c39 100644
|
|
--- a/tests/helper.py
|
|
+++ b/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)
|
|
diff --git a/tests/test_dotexport.py b/tests/test_dotexport.py
|
|
index 9883e902e5c7..7061d1a762dc 100644
|
|
--- a/tests/test_dotexport.py
|
|
+++ b/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
|
|
@@ -71,6 +73,7 @@ def test_tree2():
|
|
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."""
|
|
diff --git a/tests/test_node_sep.py b/tests/test_node_sep.py
|
|
index ecfe859a442f..f335348e4993 100644
|
|
--- a/tests/test_node_sep.py
|
|
+++ b/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_
|