-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
chore: validate files with Ruff
1 parent
34b0da8
commit 299a00a
Showing
19 changed files
with
178 additions
and
331 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# This permission is needed for private repositories. | ||
contents: read | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install PDM | ||
uses: pdm-project/setup-pdm@v4 | ||
|
||
- name: Build & Publish package to PyPI | ||
run: pdm publish |
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,7 +1,8 @@ | ||
|
||
[project] | ||
name = "tcgdex-sdk" | ||
version = "0.10.0" | ||
# version = "0.0.0" | ||
dynamic = ["version"] | ||
description = "" | ||
authors = [{ name = "Avior", email = "[email protected]" }, { name = "HellLord77" }] | ||
dependencies = ["dacite>=1.8.1"] | ||
|
@@ -10,17 +11,17 @@ readme = "README.md" | |
license = { text = "MIT" } | ||
maintainers = [{ name = "Avior", email = "[email protected]" }] | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"Operating System :: OS Independent", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"Operating System :: OS Independent", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3 :: Only", | ||
] | ||
|
||
[project.urls] | ||
|
@@ -34,6 +35,9 @@ documentation = "https://tcgdex.dev" | |
requires = ["pdm-backend"] | ||
build-backend = "pdm.backend" | ||
|
||
####### | ||
# PDM # | ||
####### | ||
[tool.pdm] | ||
distribution = true | ||
|
||
|
@@ -48,13 +52,34 @@ test = "python -m unittest discover -s tests" | |
[tool.pdm.build] | ||
includes = ["src/tcgdexsdk"] | ||
|
||
# [tool.pdm.version] | ||
# source = "scm" | ||
# fallback_version = "0.0.0" | ||
# write_to = "tcgdexsdk/version.py" | ||
# write_template = "__version__ = '{}'" | ||
|
||
[tool.pdm.version] | ||
source = "file" | ||
path = "src/tcgdexsdk/__init__.py" | ||
|
||
######## | ||
# Ruff # | ||
######## | ||
[tool.ruff] | ||
line-length = 120 | ||
# exclude = ["build/", "docs/"] | ||
line-length = 80 | ||
respect-gitignore = true | ||
include = ["src/**/*.py"] | ||
|
||
[tool.ruff.lint] | ||
select = ["E", "F", "UP", "B", "SIM", "I"] | ||
|
||
[tool.ruff.format] | ||
docstring-code-format = true | ||
line-ending = "lf" | ||
|
||
########### | ||
# Pyright # | ||
########### | ||
[tool.pyright] | ||
exclude = [".venv"] | ||
venvPath = "." | ||
|
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# Todo when min is 3.11 | ||
# Move to StringEnum and auto | ||
|
||
|
||
class Language(Enum): | ||
EN = "en" | ||
"""English""" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from dataclasses import dataclass, field | ||
from typing import Any | ||
|
||
|
||
@dataclass | ||
class Model: | ||
sdk: Any = field(init=False, default=None) | ||
sdk: Any = field(init=False, default=None) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,232 +1 @@ | ||
# @dataclass | ||
# class CardResume(Model): | ||
# """Card Resume class, contains basic information about a specific card | ||
# to get the full card you can use the `get_full_card()` function""" | ||
|
||
# id: str | ||
# """Globally unique card ID based on the set ID and the cards ID within the set""" | ||
# localId: str | ||
# """ID indexing this card within its set, usually just its number""" | ||
# name: str | ||
# """Card name""" | ||
# image: Optional[str] | ||
# """Card image url without the extension and quality""" | ||
|
||
# def get_image_url( | ||
# self, quality: str | Quality, extension: str | Extension | ||
# ) -> Optional[str]: | ||
# """ | ||
# the Card Image full URL | ||
# @param quality: the quality you want your image to be in | ||
# @param extension: extension you want you image to be | ||
# @return: the full card URL with the extension and quality | ||
# """ | ||
# if self.image: | ||
# return f"{self.image}/{quality}.{extension}" | ||
|
||
# # noinspection PyShadowingBuiltins | ||
# def get_image( | ||
# self, quality: str | Quality, format: str | Extension | ||
# ) -> Optional[HTTPResponse]: | ||
# """ | ||
# Get image buffer | ||
# @param quality: the quality you want your image to be in | ||
# @param format: extension you want you image to be | ||
# @return: the full card Buffer in the format you want | ||
# """ | ||
# if url := self.get_image_url(quality, format): | ||
# return utils.download_image(url) | ||
|
||
# def get_full_card(self) -> Optional[Card]: | ||
# """ | ||
# Get the full Card | ||
# @return: the full card if available | ||
# """ | ||
# return self.tcgdex.fetch_card(self.id) | ||
|
||
|
||
# @dataclass | ||
# class Card(CardResume): | ||
# """Pokémon TCG Card, It contains every information about a specific card""" | ||
|
||
# illustrator: Optional[str] | ||
# """Card illustrator""" | ||
# rarity: str | ||
# """Card rarity""" | ||
# category: str | ||
# """Card category""" | ||
# variants: CardVariants | ||
# """The card possible variants""" | ||
# set: SetResume | ||
# """Resume of the set the card belongs to""" | ||
# dexIDs: Optional[list[int]] | ||
# """the Pokémon Pokédex IDs (multiple if multiple pokémon appears on the card)""" | ||
# hp: Optional[int] | ||
# """HP of the pokemon""" | ||
# types: Optional[list[str]] | ||
# """Types of the pokemon (multiple because some have multiple in the older sets)""" | ||
# evolvesFrom: Optional[str] | ||
# """Name of the pokemon this one evolves from""" | ||
# description: Optional[str] | ||
# """the Pokémon Pokédex like description""" | ||
# level: Optional[str] | ||
# """the Pokémon Level (can be "X" if the card is of level X)""" | ||
# stage: Optional[str] | ||
# """the Pokémon Stage (changes depending on the API language)""" | ||
# suffix: Optional[str] | ||
# """the Pokémon Suffix (changes depending on the API language)""" | ||
# item: Optional[CardItem] | ||
# """the Item the Pokémon have""" | ||
# abilities: Optional[list[CardAbility]] | ||
# """the Card abilities (some cards have multiple abilities)""" | ||
# attacks: Optional[list[CardAttack]] | ||
# """the Card Attacks""" | ||
# weaknesses: Optional[list[CardWeakRes]] | ||
# """the Pokémon Weaknesses""" | ||
# resistances: Optional[list[CardWeakRes]] | ||
# """the Pokémon Resistances""" | ||
# retreat: Optional[int] | ||
# """the Pokémon retreat Cost""" | ||
# effect: Optional[str] | ||
# """effect the Card Effect (Trainer/Energy only)""" | ||
# trainerType: Optional[str] | ||
# """the trainer sub type (changes depending on the API language)""" | ||
# energyType: Optional[str] | ||
# """the energy sub type (changes depending on the API language)""" | ||
# regulationMark: Optional[str] | ||
# """the Card Regulation mark""" | ||
# legal: Legal | ||
# """the card ability to be played in tournaments""" | ||
|
||
|
||
# @dataclass | ||
# class SerieResume(Model): | ||
# """Serie Resume""" | ||
|
||
# id: str | ||
# """the Serie unique ID""" | ||
# name: str | ||
# """the Serie name""" | ||
# logo: Optional[str] | ||
# """the Serie Logo (basically also the first set logo)""" | ||
|
||
# def get_logo_url(self, extension: str | Extension) -> Optional[str]: | ||
# """ | ||
# Get the logo full url | ||
# @param extension: the file extension you want to use | ||
# @return: the full URL of the logo | ||
# """ | ||
# if self.logo: | ||
# return f"{self.logo}.{extension}" | ||
|
||
# # noinspection PyShadowingBuiltins | ||
# def get_logo(self, format: str | Extension) -> Optional[HTTPResponse]: | ||
# """ | ||
# Get the logo buffer | ||
# @param format: the image format | ||
# @return: a buffer containing the image | ||
# """ | ||
# if url := self.get_logo_url(format): | ||
# return utils.download_image(url) | ||
|
||
# def get_full_series(self) -> Optional[Serie]: | ||
# """ | ||
# Get the full Serie | ||
# @return: the full serie if available | ||
# """ | ||
# return self.tcgdex.fetch_serie(self.id) | ||
|
||
|
||
# @dataclass | ||
# class Serie(SerieResume): | ||
# """Pokémon TCG Serie""" | ||
|
||
# sets: list[SetResume] | ||
# """the list of sets the Serie contains""" | ||
|
||
|
||
# @dataclass | ||
# class SetResume(Model): | ||
# """Set resume""" | ||
|
||
# id: str | ||
# """Globally unique set ID""" | ||
# name: str | ||
# """the Set mame""" | ||
# logo: Optional[str] | ||
# """the Set Logo incomplete URL (use get_logo_url/get_logo)""" | ||
# symbol: Optional[str] | ||
# """the Set Symbol incomplete URL (use get_symbol_url/get_symbol)""" | ||
# cardCount: SetCardCountResume | ||
# """the number of card in the set""" | ||
|
||
# def get_logo_url(self, extension: str | Extension) -> Optional[str]: | ||
# """ | ||
# Get the logo full url | ||
# @param extension: the file extension you want to use | ||
# @return: the full URL of the logo | ||
# """ | ||
# if self.logo: | ||
# return f"{self.logo}.{extension}" | ||
|
||
# # noinspection PyShadowingBuiltins | ||
# def get_logo(self, format: str | Extension) -> Optional[HTTPResponse]: | ||
# """ | ||
# Get the logo buffer | ||
# @param format: the image format | ||
# @return: a buffer containing the image | ||
# """ | ||
# if url := self.get_logo_url(format): | ||
# return utils.download_image(url) | ||
|
||
# def get_symbol_url(self, extension: str | Extension) -> Optional[str]: | ||
# """ | ||
# Get the symbol full url | ||
# @param extension: the file extension you want to use | ||
# @return: the full URL of the logo | ||
# """ | ||
# if self.symbol: | ||
# return f"{self.symbol}.{extension}" | ||
|
||
# # noinspection PyShadowingBuiltins | ||
# def get_symbol(self, format: str | Extension) -> Optional[HTTPResponse]: | ||
# """ | ||
# Get the symbol buffer | ||
# @param format: the image format | ||
# @return: a buffer containing the image | ||
# """ | ||
# if url := self.get_symbol_url(format): | ||
# return utils.download_image(url) | ||
|
||
# def get_full_set(self) -> Optional[Set]: | ||
# """ | ||
# Get the full set | ||
# @return: the full set if available | ||
# """ | ||
# return self.tcgdex.fetch_set(self.id) | ||
|
||
|
||
# @dataclass | ||
# class Set(SetResume): | ||
# """Pokémon TCG Set class""" | ||
|
||
# serie: SerieResume | ||
# """the serie this set is a part of""" | ||
# tcgOnline: Optional[str] | ||
# """the TCG Online Code""" | ||
# releaseDate: str | ||
# """the Set release date as yyyy-mm-dd""" | ||
# legal: Legal | ||
# """the set legality (won't indicate if a card is banned)""" | ||
# cards: list[CardResume] | ||
# """the cards contained in this set""" | ||
|
||
|
||
# @dataclass | ||
# class StringEndpoint(Model): | ||
# """Generic class that handle a lot of Endpoints""" | ||
|
||
# name: str | ||
# """the endpoint value""" | ||
# cards: list[CardResume] | ||
# """the cards that contain `name` in them""" |
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