Skip to content

Commit 5bc8798

Browse files
Grant Nelsonclaude
authored andcommitted
Apply code formatting with black and isort
- Fix black formatting issues in load_image_from_url/v1.py - Fix import sorting in loader.py 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 60ad4a9 commit 5bc8798

File tree

2 files changed

+12
-13
lines changed
  • inference/core/workflows/core_steps

2 files changed

+12
-13
lines changed

inference/core/workflows/core_steps/loader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,6 @@
299299
from inference.core.workflows.core_steps.transformations.absolute_static_crop.v1 import (
300300
AbsoluteStaticCropBlockV1,
301301
)
302-
from inference.core.workflows.core_steps.transformations.load_image_from_url.v1 import (
303-
LoadImageFromUrlBlockV1,
304-
)
305302
from inference.core.workflows.core_steps.transformations.bounding_rect.v1 import (
306303
BoundingRectBlockV1,
307304
)
@@ -341,6 +338,9 @@
341338
from inference.core.workflows.core_steps.transformations.image_slicer.v2 import (
342339
ImageSlicerBlockV2,
343340
)
341+
from inference.core.workflows.core_steps.transformations.load_image_from_url.v1 import (
342+
LoadImageFromUrlBlockV1,
343+
)
344344
from inference.core.workflows.core_steps.transformations.perspective_correction.v1 import (
345345
PerspectiveCorrectionBlockV1,
346346
)

inference/core/workflows/core_steps/transformations/load_image_from_url/v1.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class BlockManifest(WorkflowBlockManifest):
3939
model_config = ConfigDict(
4040
json_schema_extra={
4141
"name": "Load Image From URL",
42-
"version": "v1",
42+
"version": "v1",
4343
"short_description": "Load an image from a URL.",
4444
"long_description": LONG_DESCRIPTION,
4545
"license": "Apache-2.0",
@@ -54,12 +54,12 @@ class BlockManifest(WorkflowBlockManifest):
5454
type: Literal["roboflow_core/load_image_from_url@v1"]
5555
url: Union[str, Selector(kind=[STRING_KIND])] = Field(
5656
description="URL of the image to load",
57-
examples=["https://example.com/image.jpg", "$inputs.image_url"]
57+
examples=["https://example.com/image.jpg", "$inputs.image_url"],
5858
)
5959
cache: Union[bool, Selector(kind=[BOOLEAN_KIND])] = Field(
6060
default=True,
6161
description="Whether to cache the downloaded image to avoid re-fetching",
62-
examples=[True, False, "$inputs.cache_image"]
62+
examples=[True, False, "$inputs.cache_image"],
6363
)
6464

6565
@classmethod
@@ -82,29 +82,28 @@ def run(self, url: str, cache: bool = True, **kwargs) -> BlockResult:
8282
try:
8383
# Generate cache key using URL hash (following common pattern)
8484
cache_key = hashlib.md5(url.encode("utf-8")).hexdigest()
85-
85+
8686
# Check cache if enabled
8787
if cache:
8888
cached_image = image_cache.get(cache_key)
8989
if cached_image is not None:
9090
return {"image": cached_image}
91-
91+
9292
# Load image using secure utility
9393
numpy_image = load_image_from_url(value=url)
94-
94+
9595
# Create proper parent metadata
9696
parent_metadata = ImageParentMetadata(parent_id=str(uuid4()))
97-
97+
9898
workflow_image = WorkflowImageData(
9999
parent_metadata=parent_metadata,
100100
numpy_image=numpy_image,
101101
)
102-
102+
103103
# Store in cache if enabled
104104
if cache:
105105
image_cache.set(cache_key, workflow_image)
106-
106+
107107
return {"image": workflow_image}
108108
except Exception as e:
109109
raise RuntimeError(f"Failed to load image from URL {url}: {str(e)}")
110-

0 commit comments

Comments
 (0)