Skip to content

Commit 08ffb2a

Browse files
committed
Merge branch 'master' into lib-tests-refac
2 parents e8221dd + b7938ab commit 08ffb2a

21 files changed

Lines changed: 92 additions & 102 deletions

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# format code with ruff
2+
1655999065f0d8bd6d26597a0f527a2242d5f11e

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414

1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v5
1818

1919
- name: Setup Python 3.9
20-
uses: actions/setup-python@v5
20+
uses: actions/setup-python@v6
2121
with:
2222
python-version: "3.9"
2323
cache: "pip" # Cache the pip packages to speed up the workflow

.github/workflows/lint.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [ opened, reopened, synchronize ]
7+
8+
jobs:
9+
ruff:
10+
permissions:
11+
contents: read
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v5
15+
16+
- name: Get Ruff Version
17+
id: ruff-version
18+
run: echo "version=$(grep -Po '(?<=ruff==)[0-9]+\.[0-9]+\.[0-9]+' pyproject.toml)" >> $GITHUB_OUTPUT
19+
20+
- uses: astral-sh/ruff-action@v3
21+
with:
22+
version: ${{ steps.ruff-version.outputs.version }}

.github/workflows/pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
id-token: write
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919

2020
- name: Setup Python 3.9
21-
uses: actions/setup-python@v5
21+
uses: actions/setup-python@v6
2222
with:
2323
python-version: "3.9"
2424

.github/workflows/test.yml

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This workflow will ensure that the pushed contents to the repo
2-
# are not majorly breaking, and they comply with black standards.
2+
# are not majorly breaking.
33

44
name: Pytests
55

@@ -16,10 +16,10 @@ jobs:
1616

1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v5
2020

2121
- name: Setup Python 3.9
22-
uses: actions/setup-python@v5
22+
uses: actions/setup-python@v6
2323
with:
2424
python-version: "3.9"
2525
cache: "pip" # Cache the pip packages to speed up the workflow
@@ -34,52 +34,4 @@ jobs:
3434
shell: bash
3535
env:
3636
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
37-
run: python -m pytest --cov=fortnite_api --import-mode=importlib -vs tests/
38-
39-
black:
40-
name: Black Formatting Check
41-
runs-on: ubuntu-latest
42-
43-
# Checkout the repository
44-
steps:
45-
- name: Checkout
46-
uses: actions/checkout@v4
47-
48-
- name: Setup Python 3.9
49-
uses: actions/setup-python@v5
50-
with:
51-
python-version: "3.9"
52-
cache: "pip" # Cache the pip packages to speed up the workflow
53-
54-
- name: Install Dependencies and Project
55-
run: |
56-
python -m pip install -U pip setuptools
57-
pip install -U -r requirements.txt
58-
pip install -e .[dev]
59-
60-
- name: Run Black Check
61-
run: black --check --diff --verbose fortnite_api
62-
63-
isort:
64-
name: Isort Formatting Check
65-
runs-on: ubuntu-latest
66-
67-
# Checkout the repository
68-
steps:
69-
- name: Checkout
70-
uses: actions/checkout@v4
71-
72-
- name: Setup Python 3.9
73-
uses: actions/setup-python@v5
74-
with:
75-
python-version: "3.9"
76-
cache: "pip" # Cache the pip packages to speed up the workflow
77-
78-
- name: Install Dependencies and Project
79-
run: |
80-
python -m pip install -U pip setuptools
81-
pip install -U -r requirements.txt
82-
pip install -e .[dev]
83-
84-
- name: Run Isort Check
85-
run: isort --check --diff fortnite_api
37+
run: python -m pytest --cov=fortnite_api --import-mode=importlib -vs tests/

.pre-commit-config.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# Black formatter pre commit hook
22
repos:
3-
- repo: https://github.com/psf/black
4-
rev: stable
3+
- repo: https://github.com/astral-sh/ruff-pre-commit
4+
rev: v0.13.2
55
hooks:
6-
- id: black
7-
8-
- repo: https://github.com/pycqa/isort
9-
rev: 5.13.2
10-
hooks:
11-
- id: isort
12-
name: isort (python)
6+
# Run the linter.
7+
- id: ruff-check
8+
args: [ --fix ]
9+
# Run the formatter.
10+
- id: ruff-format

docs/extensions/outdated_code_blocks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ class OutdatedCodeBlock(CodeBlock):
118118
}
119119

120120
def run(self) -> list[Node]:
121-
122121
# Create the main node that holds the code block and warning
123122
root = OutdatedCodeBlockNode()
124123

@@ -144,7 +143,8 @@ def setup(app: Sphinx):
144143
app.add_node(OutdatedCodeBlockNode, html=(visit_outdated_code_block_node, depart_outdated_code_block_node)) # type: ignore
145144
app.add_node(OutdatedCodeBlockWarning, html=(visit_outdated_code_block_warning, depart_outdated_code_block_warning)) # type: ignore
146145
app.add_node( # type: ignore
147-
OutdatedCodeBlockWarningText, html=(visit_outdated_code_block_warning_text, depart_outdated_code_block_warning_text)
146+
OutdatedCodeBlockWarningText,
147+
html=(visit_outdated_code_block_warning_text, depart_outdated_code_block_warning_text),
148148
)
149149

150150
app.add_directive('outdated-code-block', OutdatedCodeBlock)

fortnite_api/client.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@
3737
from .aes import Aes
3838
from .all import CosmeticsAll
3939
from .banner import Banner, BannerColor
40-
from .cosmetics import CosmeticBr, CosmeticCar, CosmeticInstrument, CosmeticLegoKit, CosmeticTrack, VariantBean, VariantLego
40+
from .cosmetics import (
41+
CosmeticBr,
42+
CosmeticCar,
43+
CosmeticInstrument,
44+
CosmeticLegoKit,
45+
CosmeticTrack,
46+
VariantBean,
47+
VariantLego,
48+
)
4149
from .creator_code import CreatorCode
4250
from .enums import *
4351
from .errors import BetaAccessNotEnabled, BetaUnknownException, MissingAPIKey
@@ -92,7 +100,7 @@ def beta_method(func: SyncFetchFunc[SyncClient_T, P, T]) -> SyncFetchFunc[SyncCl
92100

93101

94102
def beta_method(
95-
func: Union[FetchFunc[Client_T, P, T], SyncFetchFunc[SyncClient_T, P, T]]
103+
func: Union[FetchFunc[Client_T, P, T], SyncFetchFunc[SyncClient_T, P, T]],
96104
) -> Union[FetchFunc[Client_T, P, T], SyncFetchFunc[SyncClient_T, P, T]]:
97105
if inspect.iscoroutinefunction(func):
98106
# This is coroutine, so we need to wrap it in an async function

fortnite_api/cosmetics/track.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ def __init__(self, *, data: dict[str, Any], http: HTTPClientT) -> None:
152152
self.bpm: int = data['bpm']
153153
self.duration: int = data['duration']
154154

155-
self.difficulty: CosmeticTrackDifficulty[HTTPClientT] = CosmeticTrackDifficulty(data=data['difficulty'], http=http)
155+
self.difficulty: CosmeticTrackDifficulty[HTTPClientT] = CosmeticTrackDifficulty(
156+
data=data['difficulty'], http=http
157+
)
156158
self.gameplay_tags: list[str] = get_with_fallback(data, 'gameplayTags', list)
157159
self.genres: list[str] = get_with_fallback(data, 'genres', list)
158160
self.album_art: Asset[HTTPClientT] = Asset(http=http, url=data['albumArt'])

fortnite_api/cosmetics/variants/bean.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ def fetch_cosmetic_br(
8989
) -> Coroutine[Any, Any, CosmeticBr]: ...
9090

9191
@overload
92-
def fetch_cosmetic_br(self: VariantBean[SyncHTTPClient], *, language: Optional[GameLanguage] = None) -> CosmeticBr: ...
92+
def fetch_cosmetic_br(
93+
self: VariantBean[SyncHTTPClient], *, language: Optional[GameLanguage] = None
94+
) -> CosmeticBr: ...
9395

9496
def fetch_cosmetic_br(
9597
self, *, language: Optional[GameLanguage] = None

0 commit comments

Comments
 (0)