Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Commit

Permalink
Remove old method
Browse files Browse the repository at this point in the history
  • Loading branch information
Krystle Salazar committed Mar 24, 2023
1 parent 8c7a2b3 commit 36fdb1d
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions openverse_catalog/dags/providers/provider_api_scripts/phylopic.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,38 +63,6 @@ def get_should_continue(self, response_json):
def get_batch_data(self, response_json):
return response_json.get("_embedded", {}).get("items", [])

@staticmethod
def _get_image_info(
result: dict, uid: str
) -> tuple[str | None, int | None, int | None]:
img_url = None
width = None
height = None

image_info = result.get("pngFiles")
if image_info:
images = list(
filter(lambda x: (int(str(x.get("width", "0"))) >= 257), image_info)
)
if images:
image = sorted(images, key=lambda x: x["width"], reverse=True)[0]
img_url = image.get("url")
if not img_url:
logging.warning(
"Image not detected in url: "
f"{PhylopicDataIngester._image_url(uid)}"
)
else:
img_url = f"{PhylopicDataIngester.host}{img_url}"
width = image.get("width")
height = image.get("height")

return img_url, width, height

@staticmethod
def _image_url(uid: str) -> str:
return f"{PhylopicDataIngester.host}/image/{uid}"

@staticmethod
def _get_image_sizes(data: dict) -> tuple[int | None, int | None]:
width, height = None, None
Expand Down

0 comments on commit 36fdb1d

Please sign in to comment.