rclone-api 1.0.42__tar.gz → 1.0.43__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rclone-api might be problematic. Click here for more details.
- {rclone_api-1.0.42 → rclone_api-1.0.43}/PKG-INFO +1 -1
- {rclone_api-1.0.42 → rclone_api-1.0.43}/pyproject.toml +1 -1
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/group_files.py +24 -22
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api.egg-info/PKG-INFO +1 -1
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_group_files.py +20 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/.aiderignore +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/.github/workflows/lint.yml +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/.github/workflows/push_macos.yml +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/.github/workflows/push_ubuntu.yml +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/.github/workflows/push_win.yml +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/.gitignore +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/.pylintrc +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/.vscode/launch.json +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/.vscode/settings.json +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/.vscode/tasks.json +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/LICENSE +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/MANIFEST.in +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/README.md +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/clean +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/install +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/lint +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/requirements.testing.txt +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/setup.cfg +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/setup.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/__init__.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/assets/example.txt +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/cli.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/cmd/list_files.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/completed_process.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/config.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/convert.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/deprecated.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/diff.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/dir.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/dir_listing.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/exec.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/file.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/filelist.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/process.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/rclone.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/remote.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/rpath.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/util.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api/walk.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api.egg-info/SOURCES.txt +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api.egg-info/dependency_links.txt +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api.egg-info/entry_points.txt +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api.egg-info/requires.txt +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/src/rclone_api.egg-info/top_level.txt +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/test +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_cmd_list_files.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_copy.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_diff.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_is_synced.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_ls.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_mount.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_mount_s3.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_mount_webdav.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_obscure.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_remotes.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_serve_webdav.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tests/test_walk.py +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/tox.ini +0 -0
- {rclone_api-1.0.42 → rclone_api-1.0.43}/upload_package.sh +0 -0
@@ -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)
|
@@ -76,6 +76,26 @@ class GroupFilestest(unittest.TestCase):
|
|
76
76
|
self.assertIn(expected_files[1], groups["dst:Bucket/subdir2"])
|
77
77
|
print("done")
|
78
78
|
|
79
|
+
def test_two_fine_grained(self) -> None:
|
80
|
+
files = [
|
81
|
+
"dst:TorrentBooks/libgenrs_nonfiction/204000/a2b20b2c89240ce81dec16091e18113e",
|
82
|
+
"dst:TorrentBooks/libgenrs_nonfiction/208000/155fe185bc03048b003a8e145ed097c8",
|
83
|
+
"dst:TorrentBooks/libgenrs_nonfiction/208001/155fe185bc03048b003a8e145ed097c8",
|
84
|
+
"dst:TorrentBooks/libgenrs_nonfiction/208002/155fe185bc03048b003a8e145ed097c8",
|
85
|
+
"dst:TorrentBooks/libgenrs_nonfiction/2080054/155fe185bc03048b003a8e145ed097c4",
|
86
|
+
]
|
87
|
+
# expect that this all goes under the same parent
|
88
|
+
groups: dict[str, list[str]] = group_files(files)
|
89
|
+
self.assertEqual(len(groups), 1)
|
90
|
+
# dst:/Bucket/subdir should be the key
|
91
|
+
self.assertIn("dst:TorrentBooks/libgenrs_nonfiction", groups)
|
92
|
+
self.assertEqual(len(groups["dst:TorrentBooks/libgenrs_nonfiction"]), 5)
|
93
|
+
expected_files = [
|
94
|
+
"204000/a2b20b2c89240ce81dec16091e18113e",
|
95
|
+
"208000/155fe185bc03048b003a8e145ed097c8",
|
96
|
+
]
|
97
|
+
self.assertIn(expected_files[0], groups["dst:TorrentBooks/libgenrs_nonfiction"])
|
98
|
+
|
79
99
|
|
80
100
|
if __name__ == "__main__":
|
81
101
|
unittest.main()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|