Pyzotero: a Python client for the Zotero API pyzotero.readthedocs.io
zotero

Use dict comprehension instead of dict() with list comprehension

+3 -7
+3 -7
src/pyzotero/_client.py
··· 224 224 # this item's been retrieved from the API, we only need the 'data' entry 225 225 if to_clean.keys() == ["links", "library", "version", "meta", "key", "data"]: 226 226 to_clean = to_clean["data"] 227 - return dict( 228 - [ 229 - [k, v] 230 - for k, v in list(to_clean.items()) 231 - if (k in allow or k not in self.temp_keys) 232 - ], 233 - ) 227 + return { 228 + k: v for k, v in to_clean.items() if k in allow or k not in self.temp_keys 229 + } 234 230 235 231 def _retrieve_data(self, request: str | None = None, params=None): 236 232 """Retrieve Zotero items via the API.