Skip to content

Commit e8c74c6

Browse files
committed
resolve pylint issues
1 parent 7d94611 commit e8c74c6

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

cterasdk/asynchronous/core/files/browser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,15 @@ async def download_many(self, target, objects, destination=None):
5757
"""
5858
return await DownloadMany(io.handle_many, self._core, self.normalize(target), objects, destination).a_execute()
5959

60-
def listdir(self, path=None, depth=None, include_deleted=False):
60+
async def listdir(self, path=None, depth=None, include_deleted=False):
6161
"""
6262
List Directory
6363
6464
:param str,optional path: Path, defaults to the Cloud Drive root
6565
:param bool,optional include_deleted: Include deleted files, defaults to False
6666
"""
67-
return ResourceIterator(query.iterator, self._core, self.normalize(path), depth, include_deleted, None, None).execute()
67+
async for o in ResourceIterator(query.iterator, self._core, self.normalize(path), depth, include_deleted, None, None).a_execute():
68+
yield o
6869

6970
async def exists(self, path):
7071
"""

cterasdk/cio/core.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,16 @@ class ResourceIterator(ListDirectory):
623623

624624
def execute(self):
625625
try:
626-
yield from super().execute():
626+
yield from super().execute()
627627
except FetchResourcesError as e:
628-
return self._handle_exception(e)
628+
self._fetch_resources_error(e)
629+
630+
async def a_execute(self):
631+
try:
632+
async for o in self._execute():
633+
yield o
634+
except FetchResourcesError as e:
635+
self._fetch_resources_error(e)
629636

630637
def _fetch_resources(self):
631638
return self._function(self._receiver, '', self.get_parameter(), 'fetchResources', callback_response=FetchResourcesResponse)
@@ -634,9 +641,10 @@ def _execute(self):
634641
with self.trace_execution():
635642
return self._fetch_resources()
636643

637-
def _handle_exception(self, e):
644+
def _fetch_resources_error(self, e):
638645
if e.error == ResourceError.DestinationNotExists:
639646
raise exceptions.io.core.FolderNotFoundError(self.path.relative) from e
647+
raise exceptions.io.core.ListDirectoryError(self.path.relative)
640648

641649

642650
class GetMetadata(ListDirectory):

0 commit comments

Comments
 (0)