Skip to content

Commit

Permalink
[GDrive] Add more type annotations to gdrive cache file
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmx81 committed Sep 12, 2024
1 parent 2de9ae3 commit 81e8f27
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gdrive/provider/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_cache_key(self, document_id: str) -> str:
return f"document_text_{document_id}"

@abstractmethod
def cache_document_text(self, document_id, text):
def cache_document_text(self, document_id: str, text: str) -> str:
pass

@abstractmethod
Expand All @@ -39,7 +39,7 @@ def cache_document_text(self, document_id: str, text: str) -> None:
cache_key = self.get_cache_key(document_id)
self.ttl_cache[cache_key] = text

def get_document_text(self, document_id: str):
def get_document_text(self, document_id: str) -> str:
cache_key = self.get_cache_key(document_id)
return self.ttl_cache.get(cache_key)

Expand Down Expand Up @@ -70,7 +70,7 @@ def get_document_text(self, document_id: str) -> str:
}


def init(type, config):
def init(type: str, config) -> None:
global backend

if not type:
Expand All @@ -80,7 +80,7 @@ def init(type, config):
backend = CACHE_BACKENDS[type](config)


def get_document_text(document_id) -> str:
def get_document_text(document_id: str) -> str:
assert backend, "Caching not configured"
return backend.get_document_text(document_id)

Expand Down

0 comments on commit 81e8f27

Please sign in to comment.