-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
thread_pool imap_unordered 결과값에 대한 타입 힌트를 추가했습니다.
- Loading branch information
Showing
2 changed files
with
37 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# results = ThreadPool(thread_count).imap_unordered(self.p_image_download, self.get_image_link(start_index, end_index)) | ||
# 해당 ThreadPool 에서 results 로 반환하는 값은 self.p_image_download 의 반환값이다. | ||
# self.p_image_download 의 반환 타입을 정의한다. | ||
|
||
from typing import List, NamedTuple | ||
|
||
# 이름을 가지는 튜플 타입 정의 | ||
|
||
|
||
class UrlPathTuple(NamedTuple): | ||
img_url: str = "" | ||
path: str = "" | ||
|
||
|
||
# type alias : 복잡한 타입을 간단하게 이름으로 대체하는 것 | ||
# 여기선 List[UrlPath] 를 UrlPathList 로 대체한다. | ||
UrlPathListResults = List[UrlPathTuple] |