Skip to content

Commit

Permalink
* EDIT: Fixed linting errors.
Browse files Browse the repository at this point in the history
* Added image_details property to source.
* Allowed for the specification of additional file extension maps to MIME types, including support for no file extension.
* Modified filename_filter to be interpreted as a complete list of files to look for and include, preventing  glob of entire directory.
* Added error-checking for empty (no images included) UploadableSources.
  • Loading branch information
gsainsbury86 committed Jul 26, 2022
1 parent 2b391ad commit 51ddfb9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zegami_sdk/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def image_details(self):

return ims


class UploadableSource():

IMAGE_MIMES = {
Expand Down Expand Up @@ -129,7 +130,8 @@ class UploadableSource():
".json"
)

def __init__(self, name, image_dir, column_filename='__auto_join__', recursive_search=True, filename_filter=[], additional_mimes=None):
def __init__(self, name, image_dir, column_filename='__auto_join__', recursive_search=True, filename_filter=[],
additional_mimes=None):
"""
Used in conjunction with create_collection().
Expand All @@ -150,7 +152,6 @@ def __init__(self, name, image_dir, column_filename='__auto_join__', recursive_s
self._source = None
self._index = None


UploadableSource.IMAGE_MIMES = {**UploadableSource.IMAGE_MIMES, **additional_mimes}

# Check the directory exists
Expand Down Expand Up @@ -446,4 +447,4 @@ def _upload(self):
payload = json.dumps(upload_ims['imageset'])
r = c._auth_put(upload_ims_url, payload, return_response=True)

return r
return r

0 comments on commit 51ddfb9

Please sign in to comment.