diff options
Diffstat (limited to '')
-rw-r--r-- | src/hircine/db/ops.py | 10 | ||||
-rw-r--r-- | src/hircine/scraper/__init__.py | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/hircine/db/ops.py b/src/hircine/db/ops.py index c164cd2..e61c5ad 100644 --- a/src/hircine/db/ops.py +++ b/src/hircine/db/ops.py @@ -124,7 +124,10 @@ def lookup_identity(session, model, ids): return objects, satisfied -async def get_all(session, model, ids, options=[], use_identity_map=False): +async def get_all(session, model, ids, options=None, use_identity_map=False): + if not options: + options = [] + objects = [] ids = set(ids) @@ -146,7 +149,10 @@ async def get_all(session, model, ids, options=[], use_identity_map=False): return objects, missing -async def get_all_names(session, model, names, options=[]): +async def get_all_names(session, model, names, options=None): + if not options: + options = [] + names = set(names) sql = select(model).where(model.name.in_(names)).options(*options) diff --git a/src/hircine/scraper/__init__.py b/src/hircine/scraper/__init__.py index c04265a..bc83436 100644 --- a/src/hircine/scraper/__init__.py +++ b/src/hircine/scraper/__init__.py @@ -81,7 +81,10 @@ class Scraper(ABC): """ pass - def collect(self, transformers=[]): + def collect(self, transformers=None): + if transformers is None: + transformers = [] + def generator(): for result in self.scrape(): if callable(result): |