projects/guix·blob java-team · refs

129 lines · 3.7 KiB

1From: Alexandre Detiste <[email protected]>, [email protected]
2
3diff --git a/pyproject.toml b/pyproject.toml
4index 98b5603..7b192a8 100644
5--- a/pyproject.toml
6+++ b/pyproject.toml
7@@ -35,7 +35,6 @@ include = [
8
9 [tool.poetry.dependencies]
10 python = "^3.7"
11-six = ">=1.13.0"
12
13 [tool.poetry.group.dev.dependencies]
14 # Testing dependencies - pytest for all Python versions
15diff --git a/treelib/__init__.py b/treelib/__init__.py
16index bed89cc..f164208 100644
17--- a/treelib/__init__.py
18+++ b/treelib/__init__.py
19@@ -57,15 +57,6 @@ Common Use Cases:
20 - Abstract syntax trees
21 - Family trees and genealogy
22
23-Compatibility Note:
24- To ensure string compatibility between Python 2.x and 3.x, treelib follows
25- Python 3.x string handling conventions. All strings are handled as unicode.
26-
27- For Python 2.x users with non-ASCII characters, enable unicode literals:
28-
29- .. code-block:: python
30-
31- from __future__ import unicode_literals
32 """
33
34 from .node import Node # noqa: F401
35diff --git a/treelib/node.py b/treelib/node.py
36index cb79a01..64547f7 100644
37--- a/treelib/node.py
38+++ b/treelib/node.py
39@@ -22,8 +22,6 @@ Note:
40 directly instantiated, as the Tree class manages the parent-child
41 relationships automatically.
42 """
43-from __future__ import unicode_literals
44-
45 import copy
46 import sys
47 import uuid
48@@ -40,7 +38,7 @@ else:
49 StrList = List[str] # Python 3.8 and earlier
50
51
52-class Node(object):
53+class Node:
54 """
55 Elementary node object stored in Tree structures.
56
57diff --git a/treelib/tree.py b/treelib/tree.py
58index 39bbdb5..8042175 100644
59--- a/treelib/tree.py
60+++ b/treelib/tree.py
61@@ -26,26 +26,13 @@ Key Features:
62 - Subtree operations and filtering
63 - Tree metrics and analysis tools
64 """
65-from __future__ import print_function, unicode_literals
66-
67-try:
68- from builtins import str as text
69-except ImportError:
70- from __builtin__ import str as text # type: ignore
71-
72 import codecs
73 import json
74 import sys
75 import uuid
76 from copy import deepcopy
77 from typing import Any, Callable, List, Optional, Union, cast
78-
79-from six import iteritems, python_2_unicode_compatible
80-
81-try:
82- from StringIO import StringIO # type: ignore
83-except ImportError:
84- from io import StringIO
85+from io import StringIO
86
87 from .exceptions import (
88 DuplicatedNodeIdError,
89@@ -70,8 +57,7 @@ else:
90 __author__ = "chenxm"
91
92
93-@python_2_unicode_compatible
94-class Tree(object):
95+class Tree():
96 """
97 Hierarchical tree data structure.
98
99@@ -220,7 +206,7 @@ class Tree(object):
100
101 if tree is not None:
102 self.root = tree.root
103- for nid, node in iteritems(tree.nodes):
104+ for nid, node in tree.nodes.items():
105 new_node = deepcopy(node) if deep else node
106 self._nodes[nid] = new_node
107 if tree.identifier != self._identifier:
108@@ -1540,9 +1526,9 @@ class Tree(object):
109
110 set_joint = set(new_tree._nodes) & set(self._nodes) # joint keys
111 if set_joint:
112- raise ValueError("Duplicated nodes %s exists." % list(map(text, set_joint)))
113+ raise ValueError("Duplicated nodes %s exists." % list(map(str, set_joint)))
114
115- for cid, node in iteritems(new_tree.nodes):
116+ for cid, node in new_tree.nodes.items():
117 if deep:
118 node = deepcopy(new_tree[node])
119 self._nodes.update({cid: node})
120@@ -1909,7 +1895,7 @@ class Tree(object):
121 :return: None
122 """
123 cn = self[nid]
124- for attr, val in iteritems(attrs):
125+ for attr, val in attrs.items():
126 if attr == "identifier":
127 # Updating node id meets following contraints:
128 # * Update node identifier property
129