-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
makes use of centrally-located DeferredRequest protocol
- Loading branch information
1 parent
71bc806
commit 20af921
Showing
11 changed files
with
56 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from enum import Enum | ||
|
||
from pokedex.api.request.implementations.default import PokeApiRequest | ||
from pokedex.api.request.implementations.cached import CachedPokeApiRequest | ||
from pokedex.api.request.protocol import DeferredRequest | ||
from pokedex.constants import API_REQUEST_IMPL | ||
|
||
|
||
class ApiRequest(Enum): | ||
DEFAULT: DeferredRequest = PokeApiRequest | ||
CACHED: DeferredRequest = CachedPokeApiRequest | ||
|
||
@staticmethod | ||
def type() -> type[DeferredRequest]: | ||
return ApiRequest[API_REQUEST_IMPL].value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +0,0 @@ | ||
from enum import Enum | ||
|
||
from pokedex.api.request.implementations.default import PokeApiRequest | ||
from pokedex.api.request.implementations.cached import CachedPokeApiRequest | ||
from pokedex.api.request.protocol import DeferredRequest | ||
|
||
|
||
class ApiRequest(Enum): | ||
DEFAULT: DeferredRequest = PokeApiRequest | ||
CACHED: DeferredRequest = CachedPokeApiRequest | ||
|
||
@property | ||
def type(self): | ||
return self.value | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
from pathlib import Path | ||
from os import environ | ||
|
||
|
||
PROJECTROOT = Path(__file__).parent.parent.absolute() | ||
DBROOT = PROJECTROOT / "pokedex" / "db" | ||
CACHEPATH = DBROOT / "cache" | ||
|
||
API_REQUEST_IMPL = environ.get("API_REQUEST_IMPL") or "DEFAULT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters