mirror of
https://github.com/ldericher/fftcgtool
synced 2025-01-15 15:02:59 +00:00
Python3.9
This commit is contained in:
parent
418d8f823e
commit
8dda8db72f
8 changed files with 23 additions and 30 deletions
2
LICENSE
2
LICENSE
|
@ -407,7 +407,7 @@ the above requirements apply either way.
|
|||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
provided under this License. any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
|
2
Pipfile
2
Pipfile
|
@ -11,4 +11,4 @@ pillow = "*"
|
|||
roman = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.8"
|
||||
python_version = "3.9"
|
||||
|
|
4
Pipfile.lock
generated
4
Pipfile.lock
generated
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "fe611914a3a46d2834978ca4ab586c8273140df68e5fc593e585770f27e145ab"
|
||||
"sha256": "a2e1b3f733a9b7697e8f974449a04cf81e78f6959a67945afa0e78446d491690"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
"python_version": "3.8"
|
||||
"python_version": "3.9"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import logging
|
||||
from typing import List, Tuple, Any
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -7,7 +6,7 @@ from .cards import Cards
|
|||
from .imageloader import ImageLoader
|
||||
|
||||
|
||||
def chunks(whole: List[Any], chunk_size) -> List:
|
||||
def chunks(whole: list[any], chunk_size) -> list:
|
||||
# while there are elements
|
||||
while whole:
|
||||
# get a chunk
|
||||
|
@ -23,7 +22,7 @@ class Book:
|
|||
# Card back image by Aurik
|
||||
__BACK_URL = "http://cloud-3.steamusercontent.com/ugc/948455238665576576/85063172B8C340602E8D6C783A457122F53F7843/"
|
||||
|
||||
def __init__(self, cards: Cards, grid: Tuple[int, int], resolution: Tuple[int, int], language: str,
|
||||
def __init__(self, cards: Cards, grid: tuple[int, int], resolution: tuple[int, int], language: str,
|
||||
num_threads: int):
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import re
|
||||
|
||||
from typing import List, Dict, Any
|
||||
|
||||
|
||||
class Card:
|
||||
__ELEMENTS_MAP = {
|
||||
|
@ -15,7 +13,7 @@ class Card:
|
|||
'闇': "Darkness"
|
||||
}
|
||||
|
||||
def __init__(self, data: Dict[str, Any], language: str = "EN"):
|
||||
def __init__(self, data: dict[str, any], language: str = "EN"):
|
||||
if not data:
|
||||
self.__opus = "0"
|
||||
self.__serial = "000"
|
||||
|
@ -79,5 +77,5 @@ class Card:
|
|||
return self.__text
|
||||
|
||||
@property
|
||||
def elements(self) -> List[str]:
|
||||
def elements(self) -> list[str]:
|
||||
return self.__elements
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
from typing import Dict, Any, List
|
||||
|
||||
import requests
|
||||
|
||||
from .card import Card
|
||||
|
||||
|
||||
class Cards(List[Card]):
|
||||
class Cards(list[Card]):
|
||||
__API_URL = "https://fftcg.square-enix-games.com/de/get-cards"
|
||||
|
||||
def __init__(self, params: Dict[str, Any]):
|
||||
def __init__(self, params: dict[str, any]):
|
||||
list.__init__(self)
|
||||
|
||||
# required params:
|
||||
|
|
|
@ -2,14 +2,13 @@ import io
|
|||
import logging
|
||||
import queue
|
||||
import threading
|
||||
from typing import List, Tuple, Dict
|
||||
|
||||
import requests
|
||||
from PIL import Image
|
||||
|
||||
|
||||
class ImageLoader(threading.Thread):
|
||||
def __init__(self, url_queue: queue.Queue, resolution: Tuple[int, int], language: str):
|
||||
def __init__(self, url_queue: queue.Queue, resolution: tuple[int, int], language: str):
|
||||
threading.Thread.__init__(self)
|
||||
|
||||
self.__queue = url_queue
|
||||
|
@ -45,7 +44,7 @@ class ImageLoader(threading.Thread):
|
|||
self.__queue.task_done()
|
||||
|
||||
@classmethod
|
||||
def load(cls, urls: List[str], resolution: Tuple[int, int], language: str, num_threads: int) -> List[Image.Image]:
|
||||
def load(cls, urls: list[str], resolution: tuple[int, int], language: str, num_threads: int) -> list[Image.Image]:
|
||||
url_queue = queue.Queue()
|
||||
for url in urls:
|
||||
url_queue.put(url)
|
||||
|
@ -61,7 +60,7 @@ class ImageLoader(threading.Thread):
|
|||
# stitch all "images" dicts together
|
||||
images = {}
|
||||
for loader in loaders:
|
||||
images = {**images, **loader.images}
|
||||
images |= loader.images
|
||||
|
||||
# sort images to match the initial "urls" list
|
||||
images = [images[url] for url in urls]
|
||||
|
@ -69,5 +68,5 @@ class ImageLoader(threading.Thread):
|
|||
return images
|
||||
|
||||
@property
|
||||
def images(self) -> Dict[str, Image.Image]:
|
||||
def images(self) -> dict[str, Image.Image]:
|
||||
return self.__images
|
||||
|
|
|
@ -9,33 +9,32 @@ class Opus(Cards):
|
|||
def __init__(self, opus_id: str):
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
params: dict[str, any] = {
|
||||
"text": "",
|
||||
# "element": ["darkness"],
|
||||
}
|
||||
|
||||
if opus_id.isnumeric():
|
||||
roman_opus_id = roman.toRoman(int(opus_id))
|
||||
params_add = {"set": [f"Opus {roman_opus_id.upper()}"]}
|
||||
params |= {"set": [f"Opus {roman_opus_id.upper()}"]}
|
||||
self.__number = opus_id
|
||||
self.__name = f"opus_{opus_id}"
|
||||
|
||||
elif opus_id == "chaos":
|
||||
params_add = {"set": ["Boss Deck Chaos"]}
|
||||
params |= {"set": ["Boss Deck Chaos"]}
|
||||
self.__number = "B"
|
||||
self.__name = "boss_deck_chaos"
|
||||
|
||||
elif opus_id == "promo":
|
||||
params_add = {"rarity": ["pr"]}
|
||||
params |= {"rarity": ["pr"]}
|
||||
self.__number = "PR"
|
||||
self.__name = "promo"
|
||||
|
||||
else:
|
||||
params_add = {"set": ["?"]}
|
||||
params |= {"set": ["?"]}
|
||||
self.__number = "?"
|
||||
self.__name = "?"
|
||||
|
||||
params = {
|
||||
"text": "",
|
||||
# "element": ["darkness"],
|
||||
**params_add
|
||||
}
|
||||
|
||||
Cards.__init__(self, params)
|
||||
|
||||
# remove reprints
|
||||
|
|
Loading…
Reference in a new issue