unfinished work
This commit is contained in:
@@ -155,8 +155,12 @@ class Layer:
|
||||
Data is already in layer_data, so the API key is unrequired. Same goes for:
|
||||
* fetch_textual_uploads() - no arguments;
|
||||
* fetch_images() - no arguments.
|
||||
|
||||
Exception: returns {} (empty dictionary) if no uploads/attachments on Layer.
|
||||
"""
|
||||
# Remember: Layers are experiments, so we only need to look for attachments in the experiment endpoint.
|
||||
if self.uploads == []:
|
||||
return {}
|
||||
attachments = {
|
||||
attachment["id"]: {
|
||||
"filename": attachment["real_name"],
|
||||
@@ -180,7 +184,7 @@ class Layer:
|
||||
textual_uploads = {
|
||||
attachment: attachments[attachment]
|
||||
for attachment in attachments
|
||||
if attachments[attachments]["filename"][-4:] in (".txt", ".csv", ".tsv")
|
||||
if attachments[attachment]["filename"][-4:] in (".txt", ".csv", ".tsv")
|
||||
}
|
||||
return textual_uploads
|
||||
|
||||
@@ -195,12 +199,12 @@ class Layer:
|
||||
That's because the API (v5.3.11) doesn't provide MIME Type or similar metadata on the attachments, so the only way to know if an attachment is an image or not is through its filename.
|
||||
"""
|
||||
attachments = self.list_attachments()
|
||||
pictures = {
|
||||
images = {
|
||||
attachment: attachments[attachment]
|
||||
for attachment in attachments
|
||||
if attachments[attachments]["filename"][-4:] in (".png", ".bmp")
|
||||
if attachments[attachment]["filename"][-4:] in (".png", ".bmp")
|
||||
}
|
||||
return pictures
|
||||
return images
|
||||
|
||||
|
||||
class Entrypoint:
|
||||
|
||||
Reference in New Issue
Block a user