Skip to content

Commit

Permalink
removing unused code; fixing python version dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
travishathaway committed Mar 26, 2023
1 parent d6b35d4 commit d8d139e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.
38 changes: 1 addition & 37 deletions latz/image.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import NamedTuple, Protocol
from typing import NamedTuple


class ImageSearchResult(NamedTuple):
Expand All @@ -22,39 +22,3 @@ class ImageSearchResultSet(NamedTuple):
results: tuple[ImageSearchResult, ...]
total_number_results: int | None
search_backend: str


class ImageAPIContextManager(Protocol):
"""
Protocol class used to help plugin authors create compatible context managers.
In latz, we rely on context managers to perform setup and tear-down operations
for the connections t
We use a class-based approach here to make sure that plugin authors appropriately
implement the type of context manager the application needs (i.e. one that returns
an implementation of [`ImageAPI`][latz.image.ImageAPI]).
"""

def __enter__(self) -> ImageAPI:
"""
This must return an implementation of the below [`ImageAPI`][latz.image.ImageAPI] class
"""

def __exit__(self, exc_type, exc_val, exc_tb) -> None:
"""Used to ensure the context manager protocol has been implemented"""


class ImageAPI(Protocol):
"""
Protocol class for the image API plugin. This is used to make sure that
objects being returned implement at least the methods defined below with the appropriate
return types.
"""

def search(self, query: str) -> ImageSearchResultSet:
"""
Used to search for an image via a search term and then return a single result set.
See [`ImageSearchResultSet`][latz.image.ImageSearchResultSet] for more information
about the return type.
"""
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ packages = [
]

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.8"
pydantic = "^1.10.2"
httpx = "^0.23.1"
Pillow = "^9.3.0"
Expand Down

0 comments on commit d8d139e

Please sign in to comment.