Skip to content

Commit 67eff80

Browse files
committed
formating
1 parent 0eafc0f commit 67eff80

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

unstructured_inference/inference/elements.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,25 @@ class TextRegions:
216216
source: Source | None = None
217217
is_extracted_array: np.ndarray = field(default_factory=lambda: np.array([]))
218218
is_extracted: bool | None = None
219-
_optional_array_attributes: list[str] = field(init=False, default_factory=lambda: ["texts", "sources", "is_extracted_array"])
220-
_scalar_to_array_mappings: dict[str, str] = field(init=False, default_factory=lambda: {
221-
"source": "sources",
222-
"is_extracted": "is_extracted_array",
223-
})
219+
_optional_array_attributes: list[str] = field(
220+
init=False, default_factory=lambda: ["texts", "sources", "is_extracted_array"]
221+
)
222+
_scalar_to_array_mappings: dict[str, str] = field(
223+
init=False,
224+
default_factory=lambda: {
225+
"source": "sources",
226+
"is_extracted": "is_extracted_array",
227+
},
228+
)
224229

225230
def __post_init__(self):
226231
element_size = self.element_coords.shape[0]
227232
for scalar, array in self._scalar_to_array_mappings.items():
228-
if getattr(self, scalar) is not None and getattr(self, array).size == 0 and element_size:
233+
if (
234+
getattr(self, scalar) is not None
235+
and getattr(self, array).size == 0
236+
and element_size
237+
):
229238
setattr(self, array, np.array([getattr(self, scalar)] * element_size))
230239
elif getattr(self, scalar) is None and getattr(self, array).size > 0:
231240
setattr(self, scalar, getattr(self, array)[0])

0 commit comments

Comments
 (0)