ddapi 0.14.0__tar.gz → 0.14.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ddapi-0.14.0 → ddapi-0.14.1}/PKG-INFO +1 -1
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/__init__.py +2 -1
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/scheme/ddnet.py +5 -4
- ddapi-0.14.1/ddapi/ddapi/util.py +18 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi.egg-info/PKG-INFO +1 -1
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi.egg-info/SOURCES.txt +1 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/setup.cfg +1 -1
- {ddapi-0.14.0 → ddapi-0.14.1}/setup.py +1 -1
- {ddapi-0.14.0 → ddapi-0.14.1}/LICENSE +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/README.md +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/_api.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/api/__init__.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/api/ddnet.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/api/ddstats.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/api/status.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/cache/__init__.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/cache/base.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/cache/empty.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/cache/memory.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/enum.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/scheme/__init__.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/scheme/ddstats_tw.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/scheme/status_tw.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi/types.py +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi.egg-info/dependency_links.txt +0 -0
- {ddapi-0.14.0 → ddapi-0.14.1}/ddapi/ddapi.egg-info/top_level.txt +0 -0
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
from .api import DDnetApi, DDstats, Status
|
|
4
4
|
from .enum import MasterEnum
|
|
5
5
|
from .cache import CacheABC, EmptyCache, MemoryCache
|
|
6
|
+
from .util import slugify2
|
|
6
7
|
from .scheme import * # noqa: F403
|
|
7
8
|
|
|
8
|
-
__version__ = "0.14.
|
|
9
|
+
__version__ = "0.14.1"
|
|
9
10
|
__author__ = "ByFox"
|
|
10
11
|
__LICENSE__ = "MIT"
|
|
@@ -5,6 +5,7 @@ from urllib.parse import quote
|
|
|
5
5
|
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
+
from ddapi import slugify2
|
|
8
9
|
from ddapi.enum import MasterEnum
|
|
9
10
|
|
|
10
11
|
rm_list = ["DD-Persian", "/vDQMHSss8W", ""]
|
|
@@ -93,11 +94,11 @@ class DMap(BaseModel):
|
|
|
93
94
|
max_finishes: list[MaxFinishes]
|
|
94
95
|
|
|
95
96
|
def url(self) -> str:
|
|
96
|
-
return f"https://ddnet.org/maps/{self.name}"
|
|
97
|
+
return f"https://ddnet.org/maps/{quote(slugify2(self.name))}"
|
|
97
98
|
|
|
98
99
|
@staticmethod
|
|
99
100
|
def url_with_name(map_name: str) -> str:
|
|
100
|
-
return f"https://ddnet.org/maps/{map_name}"
|
|
101
|
+
return f"https://ddnet.org/maps/{quote(slugify2(map_name))}"
|
|
101
102
|
|
|
102
103
|
@staticmethod
|
|
103
104
|
def api(map_name: str) -> str:
|
|
@@ -149,11 +150,11 @@ class DDPlayer(BaseModel):
|
|
|
149
150
|
hours_played_past_365_days: int
|
|
150
151
|
|
|
151
152
|
def url(self) -> str:
|
|
152
|
-
return f"https://ddnet.org/players/{self.player}"
|
|
153
|
+
return f"https://ddnet.org/players/{quote(slugify2(self.player))}"
|
|
153
154
|
|
|
154
155
|
@staticmethod
|
|
155
156
|
def url_with_name(player: str) -> str:
|
|
156
|
-
return f"https://ddnet.org/players/{player}"
|
|
157
|
+
return f"https://ddnet.org/players/{quote(slugify2(player))}"
|
|
157
158
|
|
|
158
159
|
@staticmethod
|
|
159
160
|
def api(player: str) -> str:
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
__all__ = ("slugify2",)
|
|
2
|
+
|
|
3
|
+
slugify2_symbols = "[\t !\"#$%&'()*-/<=>?@[\\]^_`{|},.:]+"
|
|
4
|
+
NON_ASCII_CHARACTER_THRESHOLD = 128
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def slugify2(_nickname: str) -> str:
|
|
8
|
+
"""Needed for a link generator."""
|
|
9
|
+
string = ""
|
|
10
|
+
for symbol in _nickname:
|
|
11
|
+
string += (
|
|
12
|
+
f"-{ord(symbol)}-"
|
|
13
|
+
if symbol in slugify2_symbols
|
|
14
|
+
or ord(symbol) >= NON_ASCII_CHARACTER_THRESHOLD
|
|
15
|
+
else symbol
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
return string
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|