Boyscouting modern python typing

CURA-8555
This commit is contained in:
c.lamboo 2022-06-15 13:27:47 +02:00
parent a7fcc15197
commit f67d086182
2 changed files with 5 additions and 5 deletions

View file

@ -39,8 +39,8 @@ class DFFileUploader:
:param on_error: The method to be called when an error occurs. :param on_error: The method to be called when an error occurs.
""" """
self._http = http # type: HttpRequestManager self._http: HttpRequestManager = http
self._df_file = df_file # type: Union[DFLibraryFileUploadResponse, DFPrintJobUploadResponse] self._df_file: Union[DFLibraryFileUploadResponse, DFPrintJobUploadResponse] = df_file
self._file_name = "" self._file_name = ""
if isinstance(self._df_file, DFLibraryFileUploadResponse): if isinstance(self._df_file, DFLibraryFileUploadResponse):
self._file_name = self._df_file.file_name self._file_name = self._df_file.file_name
@ -51,7 +51,7 @@ class DFFileUploader:
self._file_name = "" self._file_name = ""
else: else:
raise TypeError("Incorrect input type") raise TypeError("Incorrect input type")
self._data = data # type: bytes self._data: bytes = data
self._on_finished = on_finished self._on_finished = on_finished
self._on_success = on_success self._on_success = on_success

View file

@ -40,7 +40,7 @@ class DigitalFactoryApiClient:
DEFAULT_REQUEST_TIMEOUT = 10 # seconds DEFAULT_REQUEST_TIMEOUT = 10 # seconds
# In order to avoid garbage collection we keep the callbacks in this list. # In order to avoid garbage collection we keep the callbacks in this list.
_anti_gc_callbacks = [] # type: List[Callable[[Any], None]] _anti_gc_callbacks: List[Callable[[Any], None]] = []
def __init__(self, application: CuraApplication, on_error: Callable[[List[CloudError]], None], projects_limit_per_page: Optional[int] = None) -> None: def __init__(self, application: CuraApplication, on_error: Callable[[List[CloudError]], None], projects_limit_per_page: Optional[int] = None) -> None:
"""Initializes a new digital factory API client. """Initializes a new digital factory API client.
@ -54,7 +54,7 @@ class DigitalFactoryApiClient:
self._scope = JsonDecoratorScope(UltimakerCloudScope(application)) self._scope = JsonDecoratorScope(UltimakerCloudScope(application))
self._http = HttpRequestManager.getInstance() self._http = HttpRequestManager.getInstance()
self._on_error = on_error self._on_error = on_error
self._file_uploader = None # type: Optional[DFFileUploader] self._file_uploader: Optional[DFFileUploader] = None
self._library_max_private_projects: Optional[int] = None self._library_max_private_projects: Optional[int] = None
self._projects_pagination_mgr = PaginationManager(limit = projects_limit_per_page) if projects_limit_per_page else None # type: Optional[PaginationManager] self._projects_pagination_mgr = PaginationManager(limit = projects_limit_per_page) if projects_limit_per_page else None # type: Optional[PaginationManager]