rclone-api 1.0.42__py2.py3-none-any.whl → 1.0.43__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rclone_api/group_files.py +24 -22
- {rclone_api-1.0.42.dist-info → rclone_api-1.0.43.dist-info}/METADATA +1 -1
- {rclone_api-1.0.42.dist-info → rclone_api-1.0.43.dist-info}/RECORD +7 -7
- {rclone_api-1.0.42.dist-info → rclone_api-1.0.43.dist-info}/LICENSE +0 -0
- {rclone_api-1.0.42.dist-info → rclone_api-1.0.43.dist-info}/WHEEL +0 -0
- {rclone_api-1.0.42.dist-info → rclone_api-1.0.43.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.0.42.dist-info → rclone_api-1.0.43.dist-info}/top_level.txt +0 -0
rclone_api/group_files.py
CHANGED
@@ -80,14 +80,10 @@ class TreeNode:
|
|
80
80
|
|
81
81
|
def _merge(node: TreeNode, parent_path: str, out: dict[str, list[str]]) -> None:
|
82
82
|
parent_path = parent_path + "/" + node.name
|
83
|
-
this_count = node.count
|
84
|
-
child_count = 0
|
85
|
-
children_has_files = False
|
86
83
|
if not node.child_nodes and not node.files:
|
87
84
|
return # done
|
88
|
-
|
89
85
|
if node.files:
|
90
|
-
|
86
|
+
# we saw files, to don't try to go any deeper.
|
91
87
|
filelist = out.setdefault(parent_path, [])
|
92
88
|
# for file in node.files:
|
93
89
|
# filelist.append(file)
|
@@ -98,28 +94,28 @@ def _merge(node: TreeNode, parent_path: str, out: dict[str, list[str]]) -> None:
|
|
98
94
|
out[parent_path] = filelist
|
99
95
|
return
|
100
96
|
|
101
|
-
|
102
|
-
child_count += child.count
|
103
|
-
child_count += len(node.files)
|
104
|
-
for file in node.files:
|
105
|
-
child_count += 1
|
97
|
+
n_child_nodes = len(node.child_nodes)
|
106
98
|
|
107
|
-
if
|
108
|
-
#
|
109
|
-
#
|
110
|
-
#
|
111
|
-
filelist = out.setdefault(parent_path, [])
|
112
|
-
for child in node.child_nodes.values():
|
113
|
-
subpaths = child.get_child_subpaths()
|
114
|
-
filelist.extend(subpaths)
|
115
|
-
out[parent_path] = filelist
|
116
|
-
else:
|
99
|
+
if n_child_nodes < 4:
|
100
|
+
# child = list(node.child_nodes.values())[0]
|
101
|
+
# _merge(child, parent_path, out)
|
102
|
+
# return
|
117
103
|
for child in node.child_nodes.values():
|
118
104
|
_merge(child, parent_path, out)
|
105
|
+
return
|
119
106
|
|
107
|
+
filelist = out.setdefault(parent_path, [])
|
108
|
+
# for file in node.files:
|
109
|
+
# filelist.append(file)
|
110
|
+
# out[parent_path] = filelist
|
111
|
+
paths = node.get_child_subpaths()
|
112
|
+
for path in paths:
|
113
|
+
filelist.append(path)
|
114
|
+
out[parent_path] = filelist
|
115
|
+
return
|
120
116
|
|
121
|
-
|
122
|
-
|
117
|
+
|
118
|
+
def _make_tree(files: list[str]) -> dict[str, TreeNode]:
|
123
119
|
tree: dict[str, TreeNode] = {}
|
124
120
|
for file in files:
|
125
121
|
parts = parse_file(file)
|
@@ -131,6 +127,12 @@ def group_files(files: list[str]) -> dict[str, list[str]]:
|
|
131
127
|
if is_last:
|
132
128
|
node.files.append(parts.name)
|
133
129
|
node.add_count()
|
130
|
+
return tree
|
131
|
+
|
132
|
+
|
133
|
+
def group_files(files: list[str]) -> dict[str, list[str]]:
|
134
|
+
"""split between filename and parent directory path"""
|
135
|
+
tree: dict[str, TreeNode] = _make_tree(files)
|
134
136
|
outpaths: dict[str, list[str]] = {}
|
135
137
|
for _, node in tree.items():
|
136
138
|
_merge(node, "", outpaths)
|
@@ -10,7 +10,7 @@ rclone_api/dir_listing.py,sha256=9Qqf2SUswrOEkyqmaH23V51I18X6ePiXb9B1vUwRF5o,157
|
|
10
10
|
rclone_api/exec.py,sha256=HWmnU2Jwb-3EttSbAJSaLloYA7YI2mHTzRJ5VEri9aM,941
|
11
11
|
rclone_api/file.py,sha256=D02iHJW1LhfOiM_R_yPHP8_ApnDiYrkuraVcrV8-qkw,1246
|
12
12
|
rclone_api/filelist.py,sha256=xbiusvNgaB_b_kQOZoHMJJxn6TWGtPrWd2J042BI28o,767
|
13
|
-
rclone_api/group_files.py,sha256=
|
13
|
+
rclone_api/group_files.py,sha256=FK9-DQV2rpl_EQSI6Y1NqcEA2WVkhBwLY5oP43bnp3k,4690
|
14
14
|
rclone_api/process.py,sha256=RrMfTe0bndmJ6gBK67ioqNvCstJ8aTC8RlGX1XBLlcw,4191
|
15
15
|
rclone_api/rclone.py,sha256=zKLlHykEs43kt-FB3_YFvwPmRcHY2a3-fShMfGEjYH0,21004
|
16
16
|
rclone_api/remote.py,sha256=c9hlRKBCg1BFB9MCINaQIoCg10qyAkeqiS4brl8ce-8,343
|
@@ -19,9 +19,9 @@ rclone_api/util.py,sha256=sUjH5NmsawmNbPMY7V6hD8vFJXCwbl44XM1kuij3tA0,3918
|
|
19
19
|
rclone_api/walk.py,sha256=kca0t1GAnF6FLclN01G8NG__Qe-ggodLtAbQSHyVPng,2968
|
20
20
|
rclone_api/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
|
21
21
|
rclone_api/cmd/list_files.py,sha256=x8FHODEilwKqwdiU1jdkeJbLwOqUkUQuDWPo2u_zpf0,741
|
22
|
-
rclone_api-1.0.
|
23
|
-
rclone_api-1.0.
|
24
|
-
rclone_api-1.0.
|
25
|
-
rclone_api-1.0.
|
26
|
-
rclone_api-1.0.
|
27
|
-
rclone_api-1.0.
|
22
|
+
rclone_api-1.0.43.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
23
|
+
rclone_api-1.0.43.dist-info/METADATA,sha256=De892IJwCIjjb710T9a4SvaBBYIjaf20D1JU_0cUwfM,4489
|
24
|
+
rclone_api-1.0.43.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
|
25
|
+
rclone_api-1.0.43.dist-info/entry_points.txt,sha256=XUoTX3m7CWxdj2VAKhEuO0NMOfX2qf-OcEDFwdyk9ZE,72
|
26
|
+
rclone_api-1.0.43.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
|
27
|
+
rclone_api-1.0.43.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|