osu.py 2.2.2__tar.gz → 2.2.3__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 (50) hide show
  1. {osu_py-2.2.2/osu.py.egg-info → osu_py-2.2.3}/PKG-INFO +1 -1
  2. {osu_py-2.2.2 → osu_py-2.2.3}/osu/__init__.py +1 -1
  3. {osu_py-2.2.2 → osu_py-2.2.3}/osu/asyncio/client.py +16 -0
  4. {osu_py-2.2.2 → osu_py-2.2.3}/osu/client.py +17 -3
  5. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/score.py +12 -5
  6. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/user.py +5 -0
  7. {osu_py-2.2.2 → osu_py-2.2.3}/osu/path.py +4 -0
  8. {osu_py-2.2.2 → osu_py-2.2.3/osu.py.egg-info}/PKG-INFO +1 -1
  9. {osu_py-2.2.2 → osu_py-2.2.3}/LICENSE +0 -0
  10. {osu_py-2.2.2 → osu_py-2.2.3}/MANIFEST.in +0 -0
  11. {osu_py-2.2.2 → osu_py-2.2.3}/README.rst +0 -0
  12. {osu_py-2.2.2 → osu_py-2.2.3}/osu/asyncio/__init__.py +0 -0
  13. {osu_py-2.2.2 → osu_py-2.2.3}/osu/asyncio/http.py +0 -0
  14. {osu_py-2.2.2 → osu_py-2.2.3}/osu/auth.py +0 -0
  15. {osu_py-2.2.2 → osu_py-2.2.3}/osu/constants.py +0 -0
  16. {osu_py-2.2.2 → osu_py-2.2.3}/osu/enums.py +0 -0
  17. {osu_py-2.2.2 → osu_py-2.2.3}/osu/exceptions.py +0 -0
  18. {osu_py-2.2.2 → osu_py-2.2.3}/osu/http.py +0 -0
  19. {osu_py-2.2.2 → osu_py-2.2.3}/osu/notification.py +0 -0
  20. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/__init__.py +0 -0
  21. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/achievement.py +0 -0
  22. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/beatmap.py +0 -0
  23. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/beatmapset_event.py +0 -0
  24. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/build.py +0 -0
  25. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/chat.py +0 -0
  26. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/comment.py +0 -0
  27. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/current_user_attributes.py +0 -0
  28. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/discussion.py +0 -0
  29. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/event.py +0 -0
  30. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/forum.py +0 -0
  31. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/group.py +0 -0
  32. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/kudosu.py +0 -0
  33. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/match.py +0 -0
  34. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/multiplayer.py +0 -0
  35. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/news.py +0 -0
  36. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/notification.py +0 -0
  37. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/ranking.py +0 -0
  38. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/scope.py +0 -0
  39. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/seasonal_background.py +0 -0
  40. {osu_py-2.2.2 → osu_py-2.2.3}/osu/objects/wiki.py +0 -0
  41. {osu_py-2.2.2 → osu_py-2.2.3}/osu/results.py +0 -0
  42. {osu_py-2.2.2 → osu_py-2.2.3}/osu/util.py +0 -0
  43. {osu_py-2.2.2 → osu_py-2.2.3}/osu.py.egg-info/SOURCES.txt +0 -0
  44. {osu_py-2.2.2 → osu_py-2.2.3}/osu.py.egg-info/dependency_links.txt +0 -0
  45. {osu_py-2.2.2 → osu_py-2.2.3}/osu.py.egg-info/requires.txt +0 -0
  46. {osu_py-2.2.2 → osu_py-2.2.3}/osu.py.egg-info/top_level.txt +0 -0
  47. {osu_py-2.2.2 → osu_py-2.2.3}/pyproject.toml +0 -0
  48. {osu_py-2.2.2 → osu_py-2.2.3}/requirements.txt +0 -0
  49. {osu_py-2.2.2 → osu_py-2.2.3}/setup.cfg +0 -0
  50. {osu_py-2.2.2 → osu_py-2.2.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: osu.py
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: API Wrapper for osu!api v2 written in Python.
5
5
  Home-page: https://github.com/Sheepposu/osu.py
6
6
  Author: Sheepposu
@@ -14,4 +14,4 @@ from .util import (
14
14
  from .results import *
15
15
 
16
16
 
17
- __version__ = "2.2.2"
17
+ __version__ = "2.2.3"
@@ -1492,6 +1492,22 @@ class AsynchronousClient:
1492
1492
  res = await self.http.make_request(Path.get_users(), **{"ids[]": ids})
1493
1493
  return list(map(UserCompact, res["users"]))
1494
1494
 
1495
+ async def lookup_users(self, users: list[int, str]):
1496
+ """
1497
+ Lookup users by a mix of user ids and usernames.
1498
+ Can lookup maximum 50 at a time.
1499
+
1500
+ ids: Sequence[Union[:class:`int`, :class:`str`]]
1501
+ Can be a list of user ids and usernames.
1502
+ Usernames should be prefixed with "@" to make sure they're interpreted as usernames by the api.
1503
+
1504
+ **Returns**
1505
+
1506
+ Sequence[:class:`UserCompact`]
1507
+ """
1508
+ res = await self.http.make_request(Path.get_users(), **{"ids[]": users})
1509
+ return list(map(UserCompact, res["users"]))
1510
+
1495
1511
  async def get_wiki_page(self, locale: str, path: str) -> WikiPage:
1496
1512
  """
1497
1513
  The wiki article or image data.
@@ -1450,6 +1450,7 @@ class Client:
1450
1450
  def get_users(self, ids: Sequence[int]) -> List[UserCompact]:
1451
1451
  """
1452
1452
  Returns list of users.
1453
+ Can get maximum 50 at a time.
1453
1454
 
1454
1455
  Requires OAuth and scope public
1455
1456
 
@@ -1465,9 +1466,22 @@ class Client:
1465
1466
  Includes attributes: country, cover, groups, statistics_rulesets.
1466
1467
  """
1467
1468
  res = self.http.make_request(Path.get_users(), **{"ids[]": ids})
1468
- import json
1469
- with open("users.json", "w", encoding="utf-8") as f:
1470
- json.dump(res["users"], f)
1469
+ return list(map(UserCompact, res["users"]))
1470
+
1471
+ def lookup_users(self, users: list[int, str]):
1472
+ """
1473
+ Lookup users by a mix of user ids and usernames.
1474
+ Can lookup maximum 50 at a time.
1475
+
1476
+ ids: Sequence[Union[:class:`int`, :class:`str`]]
1477
+ Can be a list of user ids and usernames.
1478
+ Usernames should be prefixed with "@" to make sure they're interpreted as usernames by the api.
1479
+
1480
+ **Returns**
1481
+
1482
+ Sequence[:class:`UserCompact`]
1483
+ """
1484
+ res = self.http.make_request(Path.get_users(), **{"ids[]": users})
1471
1485
  return list(map(UserCompact, res["users"]))
1472
1486
 
1473
1487
  def get_wiki_page(self, locale: str, path: str) -> WikiPage:
@@ -1,7 +1,7 @@
1
1
  from dateutil import parser
2
2
  from typing import Optional, List, TYPE_CHECKING, Union, Dict
3
3
 
4
- from .beatmap import BeatmapCompact, BeatmapsetCompact
4
+ from .beatmap import BeatmapCompact, BeatmapsetCompact, Beatmap
5
5
  from .user import UserCompact
6
6
  from .current_user_attributes import ScoreUserAttributes
7
7
  from ..enums import GameModeStr, GameModeInt, Mods, Mod, ObjectType, ScoreRank
@@ -176,6 +176,10 @@ class SoloScore:
176
176
 
177
177
  beatmap_id: Optional[:class:`int`]
178
178
 
179
+ beatmap: Optional[:class:`Beatmap`]
180
+
181
+ beatmapset: Optional[:class:`BeatmapsetCompact`]
182
+
179
183
  ended_at: :class:`datetime.datetime`
180
184
 
181
185
  max_combo: :class:`int`
@@ -249,6 +253,8 @@ class SoloScore:
249
253
  "user",
250
254
  "current_user_attributes",
251
255
  "weight",
256
+ "beatmap",
257
+ "beatmapset"
252
258
  )
253
259
 
254
260
  def __init__(self, data):
@@ -280,6 +286,8 @@ class SoloScore:
280
286
  data, "current_user_attributes", ScoreUserAttributes
281
287
  )
282
288
  self.weight: Optional[PpWeight] = get_optional(data, "weight", PpWeight)
289
+ self.beatmap: Optional[Beatmap] = get_optional(data, "beatmap", Beatmap)
290
+ self.beatmapset: Optional[BeatmapsetCompact] = get_optional(data, "beatmapset", BeatmapsetCompact)
283
291
 
284
292
  def __repr__(self):
285
293
  return prettify(self, "beatmap_id", "statistics")
@@ -306,11 +314,10 @@ class PpWeight:
306
314
 
307
315
 
308
316
  def get_score_object(data) -> Union[SoloScore, LegacyScore]:
309
- # EAFP cuz type attribute is not reliable
310
- try:
317
+ if data["type"] == "solo_score":
311
318
  return SoloScore(data)
312
- except KeyError:
313
- return LegacyScore(data)
319
+
320
+ return LegacyScore(data)
314
321
 
315
322
 
316
323
  class ScoreStatistics:
@@ -338,6 +338,9 @@ class User(UserCompact):
338
338
  post_count: :class:`int`
339
339
  number of forum posts
340
340
 
341
+ profile_hue: Optional[:class:`int`]
342
+ Custom color hue in HSL degrees (0-359).
343
+
341
344
  profile_order: List[:class:`str`]
342
345
  Ordered list of sections in user profile page. Sections consist of:
343
346
  me, recent_activity, beatmaps, historical, kudosu, top_ranks, medals
@@ -365,6 +368,7 @@ class User(UserCompact):
365
368
  "playmode",
366
369
  "playstyle",
367
370
  "post_count",
371
+ "profile_hue",
368
372
  "profile_order",
369
373
  "title",
370
374
  "title_url",
@@ -387,6 +391,7 @@ class User(UserCompact):
387
391
  self.playmode: GameModeStr = GameModeStr(get_required(data, "playmode"))
388
392
  self.playstyle: List[str] = get_required(data, "playstyle")
389
393
  self.post_count: int = get_required(data, "post_count")
394
+ self.profile_hue: Optional[int] = get_required(data, "profile_hue")
390
395
  self.profile_order: List[str] = get_required(data, "profile_order")
391
396
  self.title: Optional[str] = get_required(data, "title")
392
397
  self.title_url: Optional[str] = get_required(data, "title_url")
@@ -172,6 +172,10 @@ class Path:
172
172
  def get_users(cls):
173
173
  return cls("get", "users", "public")
174
174
 
175
+ @classmethod
176
+ def lookup_users(cls):
177
+ return cls("get", "users/lookup", "public")
178
+
175
179
  @classmethod
176
180
  def get_wiki_page(cls, locale, path):
177
181
  return cls("get", f"wiki/{locale}/{path}", None)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: osu.py
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: API Wrapper for osu!api v2 written in Python.
5
5
  Home-page: https://github.com/Sheepposu/osu.py
6
6
  Author: Sheepposu
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
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