Skip to content

Commit

Permalink
fix:tuple type(#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guovin committed Dec 11, 2024
1 parent a748bb2 commit bd6a7c6
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions utils/speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,16 @@ def sort_urls_by_speed_and_resolution(name, data, logger=None):
"""
filter_data = []
for url, date, resolution, origin in data:
result = {
"url": url,
"date": date,
"delay": None,
"speed": None,
"resolution": resolution,
"origin": origin
}
if origin == "important":
filter_data.append((url, date, resolution, origin))
filter_data.append(result)
continue
cache_key_match = re.search(r"cache:(.*)", url.partition("$")[2])
cache_key = cache_key_match.group(1) if cache_key_match else None
Expand All @@ -267,16 +275,10 @@ def sort_urls_by_speed_and_resolution(name, data, logger=None):
)
except Exception as e:
print(e)
filter_data.append(
{
"url": url,
"date": date,
"delay": delay,
"speed": speed,
"resolution": resolution,
"origin": origin
}
)
result["delay"] = delay
result["speed"] = speed
result["resolution"] = resolution
filter_data.append(result)

def combined_key(item):
speed, delay, resolution, origin = item["speed"], item["delay"], item["resolution"], item["origin"]
Expand Down

0 comments on commit bd6a7c6

Please sign in to comment.