Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions imgparse/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ def __init__(self, image_path: Path | str | S3Path, s3_role: str | None = None):
"""Initialize metadata parser."""
if isinstance(image_path, str):
if image_path[:5] == "s3://":
image_path = S3Path.from_uri(image_path)
self.image_path = S3Path.from_uri(image_path)
else:
image_path = Path(image_path)
self.image_path = Path(image_path)
else:
self.image_path = image_path

self.image_path = image_path
self.s3_role = s3_role

# Lazily load exif and xmp data
Expand Down
2 changes: 1 addition & 1 deletion imgparse/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def from_uri(cls, image_path: str) -> S3PathStub:
from s3path import S3Path
except ImportError:
# Use the stub class as a fallback
S3Path = S3PathStub
S3Path = S3PathStub # type: ignore


def s3_resource(role_arn: str | None = None) -> S3ServiceResource:
Expand Down
Loading