Fix mypy issues with the DigitalLibrary plugin

This commit is contained in:
Kostas Karmas 2021-04-22 15:00:42 +02:00
parent 83767764db
commit bc408a5a67
7 changed files with 43 additions and 30 deletions

View file

@ -24,6 +24,7 @@ from .DFLibraryFileUploadResponse import DFLibraryFileUploadResponse
from .DFPrintJobUploadRequest import DFPrintJobUploadRequest
from .DigitalFactoryFileResponse import DigitalFactoryFileResponse
from .DigitalFactoryProjectResponse import DigitalFactoryProjectResponse
from .PaginationLinks import PaginationLinks
from .PaginationManager import PaginationManager
CloudApiClientModel = TypeVar("CloudApiClientModel", bound=BaseModel)
@ -104,7 +105,7 @@ class DigitalFactoryApiClient:
"""
if self.hasMoreProjectsToLoad():
url = self._projects_pagination_mgr.links.next_page
url = cast(PaginationLinks, cast(PaginationManager, self._projects_pagination_mgr).links).next_page
self._http.get(url,
scope = self._scope,
callback = self._parseCallback(on_finished, DigitalFactoryProjectResponse, failed, pagination_manager = self._projects_pagination_mgr),
@ -119,7 +120,7 @@ class DigitalFactoryApiClient:
:return: Whether there are more pages in the projects list available to be retrieved from the API.
"""
return self._projects_pagination_mgr and self._projects_pagination_mgr.links and self._projects_pagination_mgr.links.next_page is not None
return self._projects_pagination_mgr is not None and self._projects_pagination_mgr.links is not None and self._projects_pagination_mgr.links.next_page is not None
def getListOfFilesInProject(self, library_project_id: str, on_finished: Callable[[List[DigitalFactoryFileResponse]], Any], failed: Callable) -> None:
"""Retrieves the list of files contained in the project with library_project_id from the Digital Factory Library.
@ -314,4 +315,5 @@ class DigitalFactoryApiClient:
timeout = self.DEFAULT_REQUEST_TIMEOUT)
def clear(self) -> None:
self._projects_pagination_mgr.reset()
if self._projects_pagination_mgr is not None:
self._projects_pagination_mgr.reset()