rclone-api 1.0.9__tar.gz → 1.0.10__tar.gz

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.
Files changed (40) hide show
  1. rclone_api-1.0.10/.aiderignore +7 -0
  2. {rclone_api-1.0.9 → rclone_api-1.0.10}/.gitignore +3 -0
  3. {rclone_api-1.0.9/src/rclone_api.egg-info → rclone_api-1.0.10}/PKG-INFO +1 -1
  4. {rclone_api-1.0.9 → rclone_api-1.0.10}/pyproject.toml +1 -1
  5. rclone_api-1.0.10/src/rclone_api/dir.py +44 -0
  6. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/rclone.py +33 -1
  7. rclone_api-1.0.10/src/rclone_api/remote.py +12 -0
  8. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/walk.py +7 -2
  9. {rclone_api-1.0.9 → rclone_api-1.0.10/src/rclone_api.egg-info}/PKG-INFO +1 -1
  10. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api.egg-info/SOURCES.txt +1 -0
  11. rclone_api-1.0.9/src/rclone_api/dir.py +0 -25
  12. rclone_api-1.0.9/src/rclone_api/remote.py +0 -8
  13. {rclone_api-1.0.9 → rclone_api-1.0.10}/.pylintrc +0 -0
  14. {rclone_api-1.0.9 → rclone_api-1.0.10}/.vscode/launch.json +0 -0
  15. {rclone_api-1.0.9 → rclone_api-1.0.10}/.vscode/settings.json +0 -0
  16. {rclone_api-1.0.9 → rclone_api-1.0.10}/.vscode/tasks.json +0 -0
  17. {rclone_api-1.0.9 → rclone_api-1.0.10}/LICENSE +0 -0
  18. {rclone_api-1.0.9 → rclone_api-1.0.10}/MANIFEST.in +0 -0
  19. {rclone_api-1.0.9 → rclone_api-1.0.10}/README.md +0 -0
  20. {rclone_api-1.0.9 → rclone_api-1.0.10}/clean +0 -0
  21. {rclone_api-1.0.9 → rclone_api-1.0.10}/install +0 -0
  22. {rclone_api-1.0.9 → rclone_api-1.0.10}/lint +0 -0
  23. {rclone_api-1.0.9 → rclone_api-1.0.10}/requirements.testing.txt +0 -0
  24. {rclone_api-1.0.9 → rclone_api-1.0.10}/setup.cfg +0 -0
  25. {rclone_api-1.0.9 → rclone_api-1.0.10}/setup.py +0 -0
  26. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/__init__.py +0 -0
  27. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/assets/example.txt +0 -0
  28. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/cli.py +0 -0
  29. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/config.py +0 -0
  30. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/dir_listing.py +0 -0
  31. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/file.py +0 -0
  32. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/rpath.py +0 -0
  33. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/types.py +0 -0
  34. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api/util.py +0 -0
  35. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api.egg-info/dependency_links.txt +0 -0
  36. {rclone_api-1.0.9 → rclone_api-1.0.10}/src/rclone_api.egg-info/top_level.txt +0 -0
  37. {rclone_api-1.0.9 → rclone_api-1.0.10}/test +0 -0
  38. {rclone_api-1.0.9 → rclone_api-1.0.10}/tests/test_simple.py +0 -0
  39. {rclone_api-1.0.9 → rclone_api-1.0.10}/tox.ini +0 -0
  40. {rclone_api-1.0.9 → rclone_api-1.0.10}/upload_package.sh +0 -0
@@ -0,0 +1,7 @@
1
+ # Add files or directories to ignore here
2
+
3
+ run
4
+ lint
5
+ test
6
+ install
7
+ clean
@@ -140,3 +140,6 @@ activate
140
140
  **/.DS_Store
141
141
  uv.lock
142
142
  .aider*
143
+
144
+ !.aider.conf.yml
145
+ !.aiderignore
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.9
3
+ Version: 1.0.10
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  Maintainer: Zachary Vorhies
@@ -14,7 +14,7 @@ dependencies = [
14
14
 
15
15
  ]
16
16
  # Change this with the version number bump.
17
- version = "1.0.9"
17
+ version = "1.0.10"
18
18
 
19
19
  [tool.setuptools]
20
20
  package-dir = {"" = "src"}
@@ -0,0 +1,44 @@
1
+ from typing import Generator
2
+
3
+ from rclone_api.dir_listing import DirListing
4
+ from rclone_api.remote import Remote
5
+ from rclone_api.rpath import RPath
6
+ from rclone_api.walk import walk
7
+
8
+
9
+ class Dir:
10
+ """Remote file dataclass."""
11
+
12
+ def __init__(self, path: RPath | Remote) -> None:
13
+ """Initialize Dir with either an RPath or Remote.
14
+
15
+ Args:
16
+ path: Either an RPath object or a Remote object
17
+ """
18
+ if isinstance(path, Remote):
19
+ # Need to create an RPath for the Remote's root
20
+ self.path = RPath(
21
+ path=str(path),
22
+ name=str(path),
23
+ size=0,
24
+ mime_type="inode/directory",
25
+ mod_time="",
26
+ is_dir=True,
27
+ )
28
+ # Ensure the RPath has the same rclone instance as the Remote
29
+ self.path.set_rclone(path.rclone)
30
+ else:
31
+ self.path = path
32
+
33
+ def ls(self, max_depth: int = 0) -> DirListing:
34
+ """List files and directories in the given path."""
35
+ assert self.path.rclone is not None
36
+ return self.path.rclone.ls(self.path.path, max_depth=max_depth)
37
+
38
+ def walk(self, max_depth: int = -1) -> Generator[DirListing, None, None]:
39
+ """List files and directories in the given path."""
40
+ assert self.path.rclone is not None
41
+ return walk(self, max_depth=max_depth)
42
+
43
+ def __str__(self) -> str:
44
+ return str(self.path)
@@ -4,12 +4,15 @@ Unit test file.
4
4
 
5
5
  import subprocess
6
6
  from pathlib import Path
7
+ from typing import Generator
7
8
 
9
+ from rclone_api import Dir
8
10
  from rclone_api.dir_listing import DirListing
9
11
  from rclone_api.remote import Remote
10
12
  from rclone_api.rpath import RPath
11
13
  from rclone_api.types import Config, RcloneExec
12
14
  from rclone_api.util import get_rclone_exe
15
+ from rclone_api.walk import walk
13
16
 
14
17
 
15
18
  class Rclone:
@@ -54,5 +57,34 @@ class Rclone:
54
57
  tmp = [t.strip() for t in tmp]
55
58
  # strip out ":" from the end
56
59
  tmp = [t.replace(":", "") for t in tmp]
57
- out = [Remote(name=t) for t in tmp]
60
+ out = [Remote(name=t, rclone=self) for t in tmp]
58
61
  return out
62
+
63
+ def walk(
64
+ self, path: str | Remote, max_depth: int = -1
65
+ ) -> Generator[DirListing, None, None]:
66
+ """Walk through the given path recursively.
67
+
68
+ Args:
69
+ path: Remote path or Remote object to walk through
70
+ max_depth: Maximum depth to traverse (-1 for unlimited)
71
+
72
+ Yields:
73
+ DirListing: Directory listing for each directory encountered
74
+ """
75
+ if isinstance(path, str):
76
+ # Create a Remote object for the path
77
+ rpath = RPath(
78
+ path=path,
79
+ name=path,
80
+ size=0,
81
+ mime_type="inode/directory",
82
+ mod_time="",
83
+ is_dir=True,
84
+ )
85
+ rpath.set_rclone(self)
86
+ dir_obj = Dir(rpath)
87
+ else:
88
+ dir_obj = Dir(path)
89
+
90
+ yield from walk(dir_obj, max_depth=max_depth)
@@ -0,0 +1,12 @@
1
+ from rclone_api.rclone import Rclone
2
+
3
+
4
+ class Remote:
5
+ """Remote (root) directory."""
6
+
7
+ def __init__(self, name: str, rclone: Rclone) -> None:
8
+ self.name = name
9
+ self.rclone = rclone
10
+
11
+ def __str__(self) -> str:
12
+ return f"{self.name}:"
@@ -4,20 +4,25 @@ from typing import Generator
4
4
 
5
5
  from rclone_api import Dir
6
6
  from rclone_api.dir_listing import DirListing
7
+ from rclone_api.remote import Remote
7
8
 
8
9
 
9
10
  def walk(
10
- dir: Dir, max_depth: int = -1, max_workers: int = 4
11
+ dir: Dir | Remote, max_depth: int = -1, max_workers: int = 4
11
12
  ) -> Generator[DirListing, None, None]:
12
13
  """Walk through the given directory recursively.
13
14
 
14
15
  Args:
15
- dir: Directory to walk through
16
+ dir: Directory or Remote to walk through
16
17
  max_depth: Maximum depth to traverse (-1 for unlimited)
18
+ max_workers: Maximum number of concurrent workers
17
19
 
18
20
  Yields:
19
21
  DirListing: Directory listing for each directory encountered
20
22
  """
23
+ # Convert Remote to Dir if needed
24
+ if isinstance(dir, Remote):
25
+ dir = Dir(dir)
21
26
  pending: Queue[tuple[Dir | None, int]] = Queue()
22
27
  results: Queue[DirListing | Exception] = Queue()
23
28
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.9
3
+ Version: 1.0.10
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  Maintainer: Zachary Vorhies
@@ -1,3 +1,4 @@
1
+ .aiderignore
1
2
  .gitignore
2
3
  .pylintrc
3
4
  LICENSE
@@ -1,25 +0,0 @@
1
- from typing import Generator
2
-
3
- from rclone_api.dir_listing import DirListing
4
- from rclone_api.rpath import RPath
5
- from rclone_api.walk import walk
6
-
7
-
8
- class Dir:
9
- """Remote file dataclass."""
10
-
11
- def __init__(self, path: RPath) -> None:
12
- self.path = path
13
-
14
- def ls(self, max_depth: int = 0) -> DirListing:
15
- """List files and directories in the given path."""
16
- assert self.path.rclone is not None
17
- return self.path.rclone.ls(self.path.path, max_depth=max_depth)
18
-
19
- def walk(self, max_depth: int = -1) -> Generator[DirListing, None, None]:
20
- """List files and directories in the given path."""
21
- assert self.path.rclone is not None
22
- return walk(self, max_depth=max_depth)
23
-
24
- def __str__(self) -> str:
25
- return str(self.path)
@@ -1,8 +0,0 @@
1
- class Remote:
2
- """Remote dataclass."""
3
-
4
- def __init__(self, name: str) -> None:
5
- self.name = name
6
-
7
- def __str__(self) -> str:
8
- return f"{self.name}:"
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