From c2a781e5de7b60d2d0bc2813e7d689a2603ff342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alessandro=20Pezz=C3=A8?= Date: Mon, 8 Aug 2022 11:35:35 +0200 Subject: [PATCH 1/2] try: use env var --- data/v2/build.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/v2/build.py b/data/v2/build.py index 6ad05649..bae21f9a 100644 --- a/data/v2/build.py +++ b/data/v2/build.py @@ -30,7 +30,7 @@ DB_CURSOR = connection.cursor() DB_VENDOR = connection.vendor -MEDIA_DIR = "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/{0}" +MEDIA_DIR = "{prefix}{{file_name}}".format(prefix=os.environ.get("POKEAPI_SPRITES_PREFIX", "/media/sprites/")) IMAGE_DIR = os.getcwd() + "/data/v2/sprites/sprites/" RESOURCE_IMAGES = [] @@ -42,7 +42,7 @@ for root, dirs, files in os.walk(IMAGE_DIR): def file_path_or_none(file_name): - return MEDIA_DIR.format(file_name) if file_name in RESOURCE_IMAGES else None + return MEDIA_DIR.format(file_name=file_name) if file_name in RESOURCE_IMAGES else None def with_iter(context, iterable=None): From c9f49c95f589ff96430b345a5f61cdd7ac715898 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Mon, 8 Aug 2022 15:49:09 +0200 Subject: [PATCH 2/2] reformat: black --- data/v2/build.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data/v2/build.py b/data/v2/build.py index bae21f9a..62a0824a 100644 --- a/data/v2/build.py +++ b/data/v2/build.py @@ -30,7 +30,9 @@ DB_CURSOR = connection.cursor() DB_VENDOR = connection.vendor -MEDIA_DIR = "{prefix}{{file_name}}".format(prefix=os.environ.get("POKEAPI_SPRITES_PREFIX", "/media/sprites/")) +MEDIA_DIR = "{prefix}{{file_name}}".format( + prefix=os.environ.get("POKEAPI_SPRITES_PREFIX", "/media/sprites/") +) IMAGE_DIR = os.getcwd() + "/data/v2/sprites/sprites/" RESOURCE_IMAGES = [] @@ -42,7 +44,9 @@ for root, dirs, files in os.walk(IMAGE_DIR): def file_path_or_none(file_name): - return MEDIA_DIR.format(file_name=file_name) if file_name in RESOURCE_IMAGES else None + return ( + MEDIA_DIR.format(file_name=file_name) if file_name in RESOURCE_IMAGES else None + ) def with_iter(context, iterable=None):