Skip to content

Commit

Permalink
#111 Addressing linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed Apr 15, 2024
1 parent d0a4c86 commit b7764c3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions exasol/bucketfs/pathlike.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from typing import Protocol, ByteString, BinaryIO, Iterable, Generator


Expand Down
1 change: 1 addition & 0 deletions exasol/bucketfs/saas_file_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from typing import Protocol, Literal, Iterable, ByteString, BinaryIO
from datetime import datetime

Expand Down
13 changes: 6 additions & 7 deletions exasol/bucketfs/saas_path.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from typing import ByteString, BinaryIO, Iterable, Optional, Generator
from pathlib import PurePath
import errno
Expand Down Expand Up @@ -54,8 +55,7 @@ def _walk_node(node: SaasFile, path: Pathlike, top_down: bool) -> \
if node.children:
for child in node.children:
if not _is_file(child):
for paths, dirs, files in _walk_node(child, path / child.name, top_down):
yield paths, dirs, files
yield from _walk_node(child, path / child.name, top_down)
if not top_down:
yield path, dir_list, file_list

Expand Down Expand Up @@ -146,17 +146,17 @@ def rm(self):
current_node = self._navigate()
if current_node is None:
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), str(self._path))
elif not _is_file(current_node):
if not _is_file(current_node):
raise IsADirectoryError(errno.EISDIR, os.strerror(errno.EISDIR), str(self._path))
self._saas_file_api.delete_file(str(self._path))

def rmdir(self, recursive: bool = False):
current_node = self._navigate()
if current_node is None:
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), str(self._path))
elif _is_file(current_node):
if _is_file(current_node):
raise NotADirectoryError(errno.ENOTDIR, os.strerror(errno.ENOTDIR), str(self._path))
elif not current_node.children:
if not current_node.children:
self._saas_file_api.delete_folder(str(self._path))
elif recursive:
self._rmdir_recursive(current_node)
Expand Down Expand Up @@ -185,8 +185,7 @@ def walk(self, top_down: bool = True) -> Generator[tuple[Pathlike, list[str], li
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), str(self._path))

if not _is_file(current_node):
for output in _walk_node(current_node, self, top_down):
yield output
yield from _walk_node(current_node, self, top_down)

def iterdir(self) -> Generator[Pathlike, None, None]:
current_node = self._navigate()
Expand Down
1 change: 1 addition & 0 deletions test/unit/saas_file_mock.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from typing import Iterable, ByteString, BinaryIO
from datetime import datetime
import os
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_saas_path.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path
import pytest
from itertools import chain
import pytest
from exasol.bucketfs.saas_path import SaaSBucketPath
from test.unit.saas_file_mock import SaasFileApiMock

Expand Down

0 comments on commit b7764c3

Please sign in to comment.