MCPcopy Create free account
hub / github.com/Open-Bee/DataStudio / _get_resized

Method _get_resized

datastudio/datasets/data_loader.py:331–344  ·  view source on GitHub ↗

Get resized image, caching by (path, size) to avoid redundant work.

(path, resize_size)

Source from the content-addressed store, hash-verified

329 _resized_cache = {}
330
331 def _get_resized(path, resize_size):
332 """Get resized image, caching by (path, size) to avoid redundant work."""
333 cache_key = (path, resize_size)
334 if cache_key not in _resized_cache:
335 img_pil = img_pil_map.get(path)
336 if img_pil is None:
337 _resized_cache[cache_key] = None
338 elif self.resize_image:
339 _resized_cache[cache_key] = apply_resize_image_pil(
340 img_pil, resize_size
341 )
342 else:
343 _resized_cache[cache_key] = img_pil
344 return _resized_cache[cache_key]
345
346 # Step 6: Distribute to batch items (shared references, no copy)
347 for item in batch:

Callers

nothing calls this directly

Calls 2

apply_resize_image_pilFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected