ddapi 0.14.0__tar.gz → 0.14.2__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.
Files changed (26) hide show
  1. {ddapi-0.14.0 → ddapi-0.14.2}/PKG-INFO +1 -1
  2. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/__init__.py +2 -1
  3. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/scheme/ddnet.py +5 -4
  4. ddapi-0.14.2/ddapi/ddapi/util.py +18 -0
  5. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi.egg-info/PKG-INFO +1 -1
  6. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi.egg-info/SOURCES.txt +1 -0
  7. {ddapi-0.14.0 → ddapi-0.14.2}/setup.cfg +1 -1
  8. {ddapi-0.14.0 → ddapi-0.14.2}/setup.py +1 -1
  9. {ddapi-0.14.0 → ddapi-0.14.2}/LICENSE +0 -0
  10. {ddapi-0.14.0 → ddapi-0.14.2}/README.md +0 -0
  11. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/_api.py +0 -0
  12. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/api/__init__.py +0 -0
  13. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/api/ddnet.py +0 -0
  14. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/api/ddstats.py +0 -0
  15. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/api/status.py +0 -0
  16. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/cache/__init__.py +0 -0
  17. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/cache/base.py +0 -0
  18. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/cache/empty.py +0 -0
  19. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/cache/memory.py +0 -0
  20. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/enum.py +0 -0
  21. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/scheme/__init__.py +0 -0
  22. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/scheme/ddstats_tw.py +0 -0
  23. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/scheme/status_tw.py +0 -0
  24. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi/types.py +0 -0
  25. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi.egg-info/dependency_links.txt +0 -0
  26. {ddapi-0.14.0 → ddapi-0.14.2}/ddapi/ddapi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ddapi
3
- Version: 0.14.0
3
+ Version: 0.14.2
4
4
  Summary: DDnet api
5
5
  Home-page: https://github.com/ByFox213/ddapi
6
6
  Author: ByFox
@@ -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.0"
9
+ __version__ = "0.14.2"
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.util 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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ddapi
3
- Version: 0.14.0
3
+ Version: 0.14.2
4
4
  Summary: DDnet api
5
5
  Home-page: https://github.com/ByFox213/ddapi
6
6
  Author: ByFox
@@ -6,6 +6,7 @@ ddapi/ddapi/__init__.py
6
6
  ddapi/ddapi/_api.py
7
7
  ddapi/ddapi/enum.py
8
8
  ddapi/ddapi/types.py
9
+ ddapi/ddapi/util.py
9
10
  ddapi/ddapi.egg-info/PKG-INFO
10
11
  ddapi/ddapi.egg-info/SOURCES.txt
11
12
  ddapi/ddapi.egg-info/dependency_links.txt
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = ddapi
3
- version = 0.14.0
3
+ version = 0.14.2
4
4
  author = ByFox
5
5
  description = DDnet api
6
6
  long_description = file: README.md
@@ -7,7 +7,7 @@ with Path.open(Path("README.md"), encoding="utf-8") as fh:
7
7
 
8
8
  setuptools.setup(
9
9
  name="ddapi",
10
- version="0.14.0",
10
+ version="0.14.2",
11
11
  author="ByFox",
12
12
  description="DDnet api",
13
13
  long_description=long_description,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes