Skip to content

Commit 099ea1d

Browse files
committed
fix: Actually deprecate scratchdb methods
1 parent 65c3d9f commit 099ea1d

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

scratchattach/site/project.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from io import BytesIO
1010

1111
from typing import Any
12+
from typing_extensions import deprecated
1213
from . import user, comment, studio
1314
from scratchattach.utils import exceptions
1415
from scratchattach.utils import commons
@@ -487,8 +488,8 @@ def set_fields(self, fields_dict, *, use_site_api=False):
487488
use_site_api (bool):
488489
When enabled, the fields are set using the scratch.mit.edu/site-api API.
489490
This function allows setting more fields than Project.set_fields.
490-
For example you can also share / unshare the project by setting the "shared" field.
491-
According to the Scratch team, this API is deprecated. As of 2024 it's still fully functional tho.
491+
For example, you can also share / unshare the project by setting the "shared" field.
492+
According to the Scratch team, this API is deprecated. As of 2024 it's still fully functional though.
492493
"""
493494
self._assert_permission()
494495
if use_site_api:
@@ -716,7 +717,7 @@ def set_notes(self, text):
716717
"""
717718
self.set_fields({"description": text})
718719

719-
720+
@deprecated("Deprecated because ScratchDB is down indefinitely.")
720721
def ranks(self):
721722
"""
722723
Gets information about the project's ranks. Fetched from ScratchDB.
@@ -727,7 +728,6 @@ def ranks(self):
727728
Returns:
728729
dict: A dict containing the project's ranks. If the ranks aren't available, all values will be -1.
729730
"""
730-
print("Warning: Project.ranks method is deprecated because ScratchDB is down indefinitely.")
731731
return requests.get(
732732
f"https://scratchdb.lefty.one/v3/project/info/{self.id}"
733733
).json()["statistics"]["ranks"]

scratchattach/site/user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,7 @@ def comment_by_id(self, comment_id) -> comment.Comment:
824824
def message_events(self):
825825
return message_events.MessageEvents(self)
826826

827+
@deprecated("This method is deprecated because ScratchDB is down indefinitely.")
827828
def stats(self):
828829
"""
829830
Gets information about the user's stats. Fetched from ScratchDB.
@@ -834,7 +835,6 @@ def stats(self):
834835
Returns:
835836
dict: A dict containing the user's stats. If the stats aren't available, all values will be -1.
836837
"""
837-
print("Warning: ScratchDB is down indefinitely, therefore this method is deprecated.")
838838
try:
839839
stats= requests.get(
840840
f"https://scratchdb.lefty.one/v3/user/info/{self.username}"
@@ -844,6 +844,7 @@ def stats(self):
844844
stats = {"loves":-1,"favorites":-1,"comments":-1,"views":-1,"followers":-1,"following":-1}
845845
return stats
846846

847+
@deprecated("Warning: ScratchDB is down indefinitely, therefore this method is deprecated.")
847848
def ranks(self):
848849
"""
849850
Gets information about the user's ranks. Fetched from ScratchDB.
@@ -854,7 +855,6 @@ def ranks(self):
854855
Returns:
855856
dict: A dict containing the user's ranks. If the ranks aren't available, all values will be -1.
856857
"""
857-
print("Warning: ScratchDB is down indefinitely, therefore this method is deprecated.")
858858
try:
859859
return requests.get(
860860
f"https://scratchdb.lefty.one/v3/user/info/{self.username}"

0 commit comments

Comments
 (0)