|
20 | 20 | ) |
21 | 21 | from .base import BaseMetaClass |
22 | 22 |
|
| 23 | + |
23 | 24 | def parse_location(html) -> list[Thumbnail] | None: |
24 | | - location = html.find("h5", string="Location").parent.find_all('a') |
| 25 | + location = html.find("h5", string="Location").parent.find_all("a") |
25 | 26 | if location is None: |
26 | 27 | return None |
27 | | - |
| 28 | + |
28 | 29 | return [ |
29 | 30 | Thumbnail( |
30 | | - type=ThumbnailType[location[x].string.lower()[:-1]], |
31 | | - url=location[x+1]["href"], |
32 | | - name=location[x+1].string, |
| 31 | + type=ThumbnailType[location[x].string.lower()[:-1]], |
| 32 | + url=location[x + 1]["href"], |
| 33 | + name=location[x + 1].string, |
33 | 34 | ) |
34 | | - for x in range(0, len(location)-1, 2) |
| 35 | + for x in range(0, len(location) - 1, 2) |
35 | 36 | ] |
36 | 37 |
|
| 38 | + |
37 | 39 | @concat_docs |
38 | 40 | class File(BaseMetaClass): |
39 | 41 | """An oject representing a file on ModDB, a file is something posted by the page owner which is directly linked |
@@ -100,7 +102,7 @@ class File(BaseMetaClass): |
100 | 102 | location: list[Thumbnail] |
101 | 103 | An ordered list detailing the hierarchy of entities the |
102 | 104 | file or addon sits under. The last one being the entity |
103 | | - directly attached to this file. |
| 105 | + directly attached to this file. |
104 | 106 | """ |
105 | 107 |
|
106 | 108 | def __init__(self, html: bs4.BeautifulSoup): |
@@ -166,7 +168,7 @@ def save(self, file_obj: BinaryIO, *, mirror=None, chunk_size: int = 10_000_000) |
166 | 168 | An optional mirror object to download the |
167 | 169 | file from a specific moddb mirror |
168 | 170 | chunk_size: int |
169 | | - The size of the chunks to stream the response |
| 171 | + The size of the chunks to stream the response |
170 | 172 | back in. 10MB by default |
171 | 173 | """ |
172 | 174 | if mirror is None: |
@@ -373,7 +375,7 @@ def save(self, file_obj: BinaryIO, *, chunk_size: int = 10_000_000): |
373 | 375 | The file obj to save the file to. The binary data |
374 | 376 | will be streamed to that object. |
375 | 377 | chunk_size: int |
376 | | - The size of the chunks to stream the response |
| 378 | + The size of the chunks to stream the response |
377 | 379 | back in. 10MB by default |
378 | 380 |
|
379 | 381 | """ |
|
0 commit comments