replace 'result' with 'results' for lists
more consistent names
This commit is contained in:
@@ -880,15 +880,15 @@ class Dispatch():
|
|||||||
elif isinstance(include, str):
|
elif isinstance(include, str):
|
||||||
include = include.replace(" ", "").split(",")
|
include = include.replace(" ", "").split(",")
|
||||||
|
|
||||||
result = [(Message.Version, 1)]
|
results = [(Message.Version, 1)]
|
||||||
for category in include:
|
for category in include:
|
||||||
try:
|
try:
|
||||||
extr, url = extractors[category]
|
extr, url = extractors[category]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.log.warning("Invalid include '%s'", category)
|
self.log.warning("Invalid include '%s'", category)
|
||||||
else:
|
else:
|
||||||
result.append((Message.Queue, url, {"_extractor": extr}))
|
results.append((Message.Queue, url, {"_extractor": extr}))
|
||||||
return iter(result)
|
return iter(results)
|
||||||
|
|
||||||
|
|
||||||
class AsynchronousMixin():
|
class AsynchronousMixin():
|
||||||
|
|||||||
@@ -1882,9 +1882,7 @@ class DeviantartOAuthAPI():
|
|||||||
params["offset"] = int(params["offset"]) + len(results)
|
params["offset"] = int(params["offset"]) + len(results)
|
||||||
|
|
||||||
def _pagination_list(self, endpoint, params, key="results"):
|
def _pagination_list(self, endpoint, params, key="results"):
|
||||||
result = []
|
return list(self._pagination(endpoint, params, False, key=key))
|
||||||
result.extend(self._pagination(endpoint, params, False, key=key))
|
|
||||||
return result
|
|
||||||
|
|
||||||
def _shared_content(self, results):
|
def _shared_content(self, results):
|
||||||
"""Return an iterable of shared deviations in 'results'"""
|
"""Return an iterable of shared deviations in 'results'"""
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class HitomiGalleryExtractor(HitomiExtractor, GalleryExtractor):
|
|||||||
fmt = ext = self.config("format") or "webp"
|
fmt = ext = self.config("format") or "webp"
|
||||||
check = (fmt != "webp")
|
check = (fmt != "webp")
|
||||||
|
|
||||||
result = []
|
results = []
|
||||||
for image in self.info["files"]:
|
for image in self.info["files"]:
|
||||||
if check:
|
if check:
|
||||||
ext = fmt if image.get("has" + fmt) else "webp"
|
ext = fmt if image.get("has" + fmt) else "webp"
|
||||||
@@ -93,8 +93,8 @@ class HitomiGalleryExtractor(HitomiExtractor, GalleryExtractor):
|
|||||||
inum = int(ihash[-1] + ihash[-3:-1], 16)
|
inum = int(ihash[-1] + ihash[-3:-1], 16)
|
||||||
url = (f"https://{ext[0]}{gg_m.get(inum, gg_default) + 1}."
|
url = (f"https://{ext[0]}{gg_m.get(inum, gg_default) + 1}."
|
||||||
f"{self.domain}/{gg_b}/{inum}/{ihash}.{ext}")
|
f"{self.domain}/{gg_b}/{inum}/{ihash}.{ext}")
|
||||||
result.append((url, idata))
|
results.append((url, idata))
|
||||||
return result
|
return results
|
||||||
|
|
||||||
|
|
||||||
class HitomiTagExtractor(HitomiExtractor):
|
class HitomiTagExtractor(HitomiExtractor):
|
||||||
|
|||||||
@@ -63,14 +63,14 @@ class MangareadMangaExtractor(MangareadBase, MangaExtractor):
|
|||||||
if 'class="error404' in page:
|
if 'class="error404' in page:
|
||||||
raise exception.NotFoundError("manga")
|
raise exception.NotFoundError("manga")
|
||||||
data = self.metadata(page)
|
data = self.metadata(page)
|
||||||
result = []
|
results = []
|
||||||
for chapter in text.extract_iter(
|
for chapter in text.extract_iter(
|
||||||
page, '<li class="wp-manga-chapter', "</li>"):
|
page, '<li class="wp-manga-chapter', "</li>"):
|
||||||
url , pos = text.extract(chapter, '<a href="', '"')
|
url , pos = text.extract(chapter, '<a href="', '"')
|
||||||
info, _ = text.extract(chapter, ">", "</a>", pos)
|
info, _ = text.extract(chapter, ">", "</a>", pos)
|
||||||
self.parse_chapter_string(info, data)
|
self.parse_chapter_string(info, data)
|
||||||
result.append((url, data.copy()))
|
results.append((url, data.copy()))
|
||||||
return result
|
return results
|
||||||
|
|
||||||
def metadata(self, page):
|
def metadata(self, page):
|
||||||
extr = text.extract_from(text.extr(
|
extr = text.extract_from(text.extr(
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class TelegraphGalleryExtractor(GalleryExtractor):
|
|||||||
num_zeroes = len(str(len(figures)))
|
num_zeroes = len(str(len(figures)))
|
||||||
num = 0
|
num = 0
|
||||||
|
|
||||||
result = []
|
results = []
|
||||||
for figure in figures:
|
for figure in figures:
|
||||||
url, pos = text.extract(figure, 'src="', '"')
|
url, pos = text.extract(figure, 'src="', '"')
|
||||||
if url.startswith("/embed/"):
|
if url.startswith("/embed/"):
|
||||||
@@ -54,10 +54,10 @@ class TelegraphGalleryExtractor(GalleryExtractor):
|
|||||||
caption, pos = text.extract(figure, "<figcaption>", "<", pos)
|
caption, pos = text.extract(figure, "<figcaption>", "<", pos)
|
||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
result.append((url, {
|
results.append((url, {
|
||||||
"url" : url,
|
"url" : url,
|
||||||
"caption" : text.unescape(caption) if caption else "",
|
"caption" : text.unescape(caption) if caption else "",
|
||||||
"num" : num,
|
"num" : num,
|
||||||
"num_formatted": str(num).zfill(num_zeroes),
|
"num_formatted": str(num).zfill(num_zeroes),
|
||||||
}))
|
}))
|
||||||
return result
|
return results
|
||||||
|
|||||||
Reference in New Issue
Block a user