11"""OTEAPI strategy for parsing OPTIMADE structure resources to DLite instances."""
2+
23from __future__ import annotations
34
45import logging
@@ -127,16 +128,20 @@ def get(
127128 # Currently, only "structures" entries are supported and handled
128129 if isinstance (session .optimade_response_object , StructureResponseMany ):
129130 structures = [
130- Structure (entry )
131- if isinstance (entry , dict )
132- else Structure (entry .dict ())
131+ (
132+ Structure (entry )
133+ if isinstance (entry , dict )
134+ else Structure (entry .dict ())
135+ )
133136 for entry in session .optimade_response_object .data
134137 ]
135138 elif isinstance (session .optimade_response_object , StructureResponseOne ):
136139 structures = [
137- Structure (session .optimade_response_object .data )
138- if isinstance (session .optimade_response_object .data , dict )
139- else Structure (session .optimade_response_object .data .dict ())
140+ (
141+ Structure (session .optimade_response_object .data )
142+ if isinstance (session .optimade_response_object .data , dict )
143+ else Structure (session .optimade_response_object .data .dict ())
144+ )
140145 ]
141146 elif isinstance (session .optimade_response_object , Success ):
142147 if isinstance (session .optimade_response_object .data , dict ):
@@ -147,9 +152,11 @@ def get(
147152 ]
148153 elif isinstance (session .optimade_response_object .data , list ):
149154 structures = [
150- Structure (entry )
151- if isinstance (entry , dict )
152- else Structure (entry .dict ())
155+ (
156+ Structure (entry )
157+ if isinstance (entry , dict )
158+ else Structure (entry .dict ())
159+ )
153160 for entry in session .optimade_response_object .data
154161 ]
155162 else :
@@ -289,9 +296,11 @@ def get(
289296 "nelements" : structure .attributes .nelements or 0 ,
290297 "dimensionality" : 3 ,
291298 "nsites" : structure .attributes .nsites or 0 ,
292- "nspecies" : len (structure .attributes .species )
293- if structure .attributes .species
294- else 0 ,
299+ "nspecies" : (
300+ len (structure .attributes .species )
301+ if structure .attributes .species
302+ else 0
303+ ),
295304 "nstructure_features" : len (
296305 structure .attributes .structure_features
297306 ),
0 commit comments