mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(FastAPI): add aurweb.util.apply_all(iterable, fn)
A helper which allows us to apply a specific function to each item in an iterable. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
16d516c221
commit
c8d01cc5e8
1 changed files with 6 additions and 1 deletions
|
@ -7,7 +7,7 @@ import secrets
|
||||||
import string
|
import string
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Dict
|
from typing import Any, Callable, Dict, Iterable
|
||||||
from urllib.parse import urlencode, urlparse
|
from urllib.parse import urlencode, urlparse
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
|
@ -167,3 +167,8 @@ def add_samesite_fields(response: Response, value: str):
|
||||||
|
|
||||||
def get_ssh_fingerprints():
|
def get_ssh_fingerprints():
|
||||||
return aurweb.config.get_section("fingerprints") or {}
|
return aurweb.config.get_section("fingerprints") or {}
|
||||||
|
|
||||||
|
|
||||||
|
def apply_all(iterable: Iterable, fn: Callable):
|
||||||
|
for item in iterable:
|
||||||
|
fn(item)
|
||||||
|
|
Loading…
Add table
Reference in a new issue