Skip to content

Commit ced5ff1

Browse files
authored
Merge pull request #115 from singlestore-labs/copilot/sub-pr-110
Fix type safety and documentation issues in management API optimization
2 parents b37b287 + 8a5a79c commit ced5ff1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

singlestoredb/fusion/handlers/files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]:
3232
for x in file_space.listdir(
3333
params['at_path'] or '/',
3434
recursive=params['recursive'],
35-
return_meta=False,
35+
return_objects=False,
3636
):
3737
info = file_space.info(x)
3838
files.append(
@@ -48,7 +48,7 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]:
4848
res.set_rows([(x,) for x in file_space.listdir(
4949
params['at_path'] or '/',
5050
recursive=params['recursive'],
51-
return_meta=False,
51+
return_objects=False,
5252
)])
5353

5454
if params['like']:

singlestoredb/management/files.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ def is_file(self, path: PathLike) -> bool:
425425
pass
426426

427427
@overload
428-
@abstractmethod
429428
def listdir(
430429
self,
431430
path: PathLike = '/',
@@ -436,7 +435,6 @@ def listdir(
436435
pass
437436

438437
@overload
439-
@abstractmethod
440438
def listdir(
441439
self,
442440
path: PathLike = '/',
@@ -1028,7 +1026,7 @@ def listdir(
10281026
# Validate via listing GET; if response lacks 'content', it's not a directory
10291027
try:
10301028
out = self._listdir(path, recursive=recursive, return_objects=return_objects)
1031-
except Exception as exc:
1029+
except (ManagementError, KeyError) as exc:
10321030
# If the path doesn't exist or isn't a directory, _listdir will fail
10331031
raise NotADirectoryError(f'path is not a directory: {path}') from exc
10341032

singlestoredb/management/workspace.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ def listdir(
529529
----------
530530
stage_path : Path or str, optional
531531
Path to the stage location
532+
recursive : bool, optional
533+
If True, recursively list all files and folders
532534
return_objects : bool, optional
533535
If True, return list of FilesObject instances. Otherwise just paths.
534536

0 commit comments

Comments
 (0)