Skip to content

Commit 0d0ba43

Browse files
committed
prepare 2025
1 parent c1b95c6 commit 0d0ba43

File tree

5 files changed

+84
-170
lines changed

5 files changed

+84
-170
lines changed

documentation/reference/sigstickers/caching.md

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@
1313

1414
## _get_verify_function
1515

16-
[Show source in caching.py:96](../../../sigstickers/caching.py#L96)
16+
[Show source in caching.py:79](../../../sigstickers/caching.py#L79)
1717

1818
Get the appropriate cache verification function based on version.
1919

2020
#### Arguments
2121

22-
----
23-
- `version` *int* - Cache version
22+
- `version` *int* - Cache version
2423

2524
#### Returns
2625

27-
-------
28-
Callable[[dict[str, Any]], bool]: Cache verification function
26+
Type: *Callable[[dict[str, Any]], bool]*
27+
Cache verification function
2928

3029
#### Signature
3130

@@ -37,19 +36,16 @@ def _get_verify_function(version: int) -> Callable[[dict[str, Any]], bool]: ...
3736

3837
## _verify_converted_v1
3938

40-
[Show source in caching.py:40](../../../sigstickers/caching.py#L40)
39+
[Show source in caching.py:35](../../../sigstickers/caching.py#L35)
4140

4241
Verify the cache for a packName using cache data.
4342

44-
#### Arguments
45-
46-
----
47-
data (dict[Path, Any]): packName cache data to verify
43+
:param dict[Path, Any] data: packName cache data to verify
4844

4945
#### Returns
5046

51-
-------
52-
- `bool` - if the converted cache has been verified
47+
Type: *bool*
48+
if the converted cache has been verified
5349

5450
#### Signature
5551

@@ -61,19 +57,16 @@ def _verify_converted_v1(data: dict[str, Any]) -> bool: ...
6157

6258
## _verify_converted_v2
6359

64-
[Show source in caching.py:59](../../../sigstickers/caching.py#L59)
60+
[Show source in caching.py:49](../../../sigstickers/caching.py#L49)
6561

6662
Verify the cache for a packName using cache data.
6763

68-
#### Arguments
69-
70-
----
71-
data (dict[Path, Any]): packName cache data to verify
64+
:param dict[Path, Any] data: packName cache data to verify
7265

7366
#### Returns
7467

75-
-------
76-
- `bool` - if the converted cache has been verified
68+
Type: *bool*
69+
if the converted cache has been verified
7770

7871
#### Signature
7972

@@ -85,15 +78,14 @@ def _verify_converted_v2(data: dict[str, Any]) -> bool: ...
8578

8679
## create_converted
8780

88-
[Show source in caching.py:83](../../../sigstickers/caching.py#L83)
81+
[Show source in caching.py:68](../../../sigstickers/caching.py#L68)
8982

9083
Write cache data to a file identified by packName.
9184

9285
#### Arguments
9386

94-
----
95-
- `pack_name` *Path* - name of the sticker pack eg. "DonutTheDog"
96-
- `data` *dict* - packName cache data to write to cache
87+
- `pack_name` *Path* - name of the sticker pack eg. "DonutTheDog"
88+
- `data` *dict* - packName cache data to write to cache
9789

9890
#### Signature
9991

@@ -112,13 +104,12 @@ to call the verify function for that version.
112104

113105
#### Arguments
114106

115-
----
116-
- `pack_name` *Path* - name of the sticker pack eg. "DonutTheDog"
107+
- `pack_name` *Path* - name of the sticker pack eg. "DonutTheDog"
117108

118109
#### Returns
119110

120-
-------
121-
- `bool` - if the converted cache has been verified
111+
Type: *bool*
112+
if the converted cache has been verified
122113

123114
#### Signature
124115

documentation/reference/sigstickers/downloader.md

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,46 @@
55
> Auto-generated documentation for [sigstickers.downloader](../../../sigstickers/downloader.py) module.
66
77
- [Downloader](#downloader)
8-
- [assure_dir_exists](#assure_dir_exists)
8+
- [convertWithPIL](#convertwithpil)
99
- [convert_pack](#convert_pack)
10-
- [convert_with_pil](#convert_with_pil)
1110
- [download_pack](#download_pack)
1211
- [save_sticker](#save_sticker)
1312

14-
## assure_dir_exists
13+
## convertWithPIL
1514

16-
[Show source in downloader.py:23](../../../sigstickers/downloader.py#L23)
15+
[Show source in downloader.py:83](../../../sigstickers/downloader.py#L83)
1716

18-
Make the directory if it does not exist.
17+
Convert a webp file to png and gif.
1918

2019
#### Arguments
2120

22-
----
23-
- `parts` *Path* - path parts
21+
- `input_path` *Path* - path to the input image/ sticker
22+
:param set[str] formats: set of formats
2423

2524
#### Returns
2625

27-
-------
28-
- `Path` - the full path
26+
Type: *list[str]*
27+
paths (as strings) of converted files
2928

3029
#### Signature
3130

3231
```python
33-
def assure_dir_exists(*parts: Path | str) -> Path: ...
32+
def convertWithPIL(input_path: Path) -> list[str]: ...
3433
```
3534

3635

3736

3837
## convert_pack
3938

40-
[Show source in downloader.py:140](../../../sigstickers/downloader.py#L140)
39+
[Show source in downloader.py:112](../../../sigstickers/downloader.py#L112)
4140

4241
Convert the webp images into png and gif images.
4342

4443
#### Arguments
4544

46-
----
47-
- `swd` *Path* - name of the directory to convert
48-
- `pack_name` *Path* - name of the sticker pack (for cache + logging)
49-
- `no_cache` *bool, optional* - set to true to disable cache. Defaults to False.
45+
- `swd` *Path* - name of the directory to convert
46+
- `pack_name` *Path* - name of the sticker pack (for cache + logging)
47+
:param bool, optional no_cache: set to true to disable cache. Defaults to False.
5048

5149
#### Signature
5250

@@ -56,48 +54,23 @@ async def convert_pack(swd: Path, pack_name: Path, no_cache: bool = False) -> No
5654

5755

5856

59-
## convert_with_pil
60-
61-
[Show source in downloader.py:106](../../../sigstickers/downloader.py#L106)
62-
63-
Convert the webp file to png.
64-
65-
#### Arguments
66-
67-
----
68-
- `input_path` *Path* - path to input file
69-
70-
#### Returns
71-
72-
-------
73-
- `Path` - path to input file
74-
75-
#### Signature
76-
77-
```python
78-
def convert_with_pil(input_path: Path) -> list[str]: ...
79-
```
80-
81-
82-
8357
## download_pack
8458

85-
[Show source in downloader.py:66](../../../sigstickers/downloader.py#L66)
59+
[Show source in downloader.py:45](../../../sigstickers/downloader.py#L45)
8660

8761
Download a sticker pack.
8862

8963
#### Arguments
9064

91-
----
92-
- `pack_id` *Path* - pack_id from url param. eg b676ec334ee2f771cadff5d095971e8c
93-
- `pack_key` *Path* - pack_key from url param. eg
65+
- `pack_id` *Path* - pack_id from url param. eg b676ec334ee2f771cadff5d095971e8c
66+
- `pack_key` *Path* - pack_key from url param. eg
9467
c957a57000626a2dc3cb69bf0e79c91c6b196b74d4d6ca1cbb830d3ad0ad4e36
95-
- `cwd` *Path, optional* - set the current working directory
68+
:param Path, optional cwd: set the current working directory
9669

9770
#### Returns
9871

99-
-------
100-
- `tuple[Path,` *Path]* - sticker working directory and pack title
72+
Type: *tuple[Path, Path]*
73+
sticker working directory and pack title
10174

10275
#### Signature
10376

@@ -115,20 +88,19 @@ async def download_pack(
11588

11689
## save_sticker
11790

118-
[Show source in downloader.py:40](../../../sigstickers/downloader.py#L40)
91+
[Show source in downloader.py:23](../../../sigstickers/downloader.py#L23)
11992

12093
Save a sticker.
12194

12295
#### Arguments
12396

124-
----
125-
- `sticker` *Sticker* - the sticker object
126-
- `path` *Path* - the path to write to
97+
- `sticker` *Sticker* - the sticker object
98+
- `path` *Path* - the path to write to
12799

128100
#### Returns
129101

130-
-------
131-
- `Path` - the filepath the file was written to
102+
Type: *Path*
103+
the filepath the file was written to
132104

133105
#### Signature
134106

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ignore = [
6161
fixable = ["ALL"]
6262

6363
[tool.ruff.lint.per-file-ignores]
64-
"**/{tests,docs,tools}/*" = ["D", "S101", "E402"]
64+
"**/{tests,docs,tools}/*" = ["D", "S101", "E402", "PLR2004"]
6565

6666
[tool.ruff.lint.flake8-tidy-imports]
6767
ban-relative-imports = "all" # Disallow all relative imports.

sigstickers/caching.py

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@ def verify_converted(pack_name: Path) -> bool:
1717
"""Verify the cache for a packName eg. "DonutTheDog". Uses the cache "version"
1818
to call the verify function for that version.
1919
20-
Args:
21-
----
22-
pack_name (Path): name of the sticker pack eg. "DonutTheDog"
23-
24-
Returns:
25-
-------
26-
bool: if the converted cache has been verified
20+
:param Path pack_name: name of the sticker pack eg. "DonutTheDog"
21+
:return bool: if the converted cache has been verified
2722
2823
"""
2924
cache = CACHE_DIR / pack_name
@@ -40,13 +35,8 @@ def verify_converted(pack_name: Path) -> bool:
4035
def _verify_converted_v1(data: dict[str, Any]) -> bool:
4136
"""Verify the cache for a packName using cache data.
4237
43-
Args:
44-
----
45-
data (dict[Path, Any]): packName cache data to verify
46-
47-
Returns:
48-
-------
49-
bool: if the converted cache has been verified
38+
:param dict[Path, Any] data: packName cache data to verify
39+
:return bool: if the converted cache has been verified
5040
5141
"""
5242
swd = data.get("info", {}).get("swd")
@@ -59,13 +49,8 @@ def _verify_converted_v1(data: dict[str, Any]) -> bool:
5949
def _verify_converted_v2(data: dict[str, Any]) -> bool:
6050
"""Verify the cache for a packName using cache data.
6151
62-
Args:
63-
----
64-
data (dict[Path, Any]): packName cache data to verify
65-
66-
Returns:
67-
-------
68-
bool: if the converted cache has been verified
52+
:param dict[Path, Any] data: packName cache data to verify
53+
:return bool: if the converted cache has been verified
6954
7055
"""
7156
webp_files: list[str] = data.get("webp_files", [])
@@ -83,10 +68,8 @@ def _verify_converted_v2(data: dict[str, Any]) -> bool:
8368
def create_converted(pack_name: Path, data: dict) -> None:
8469
"""Write cache data to a file identified by packName.
8570
86-
Args:
87-
----
88-
pack_name (Path): name of the sticker pack eg. "DonutTheDog"
89-
data (dict): packName cache data to write to cache
71+
:param Path pack_name: name of the sticker pack eg. "DonutTheDog"
72+
:param dict data: packName cache data to write to cache
9073
9174
"""
9275
cache = CACHE_DIR / pack_name
@@ -96,13 +79,8 @@ def create_converted(pack_name: Path, data: dict) -> None:
9679
def _get_verify_function(version: int) -> Callable[[dict[str, Any]], bool]:
9780
"""Get the appropriate cache verification function based on version.
9881
99-
Args:
100-
----
101-
version (int): Cache version
102-
103-
Returns:
104-
-------
105-
Callable[[dict[str, Any]], bool]: Cache verification function
82+
:param int version: Cache version
83+
:return Callable[[dict[str, Any]], bool]: Cache verification function
10684
10785
"""
10886
return {

0 commit comments

Comments
 (0)