scratchattach 2.1.10a2__py3-none-any.whl → 2.1.10a3__py3-none-any.whl

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.
@@ -4,9 +4,10 @@ from abc import ABC, abstractmethod
4
4
 
5
5
  import requests
6
6
  from ..utils import exceptions, commons
7
+ from typing import TypeVar
7
8
  from types import FunctionType
8
9
 
9
-
10
+ C = TypeVar("C", bound="BaseSiteComponent")
10
11
  class BaseSiteComponent(ABC):
11
12
  @abstractmethod
12
13
  def __init__(self):
@@ -51,7 +52,7 @@ class BaseSiteComponent(ABC):
51
52
  raise exceptions.Unauthenticated(
52
53
  "You need to use session.connect_xyz (NOT get_xyz) in order to perform this operation.")
53
54
 
54
- def _make_linked_object(self, identificator_id, identificator, Class, NotFoundException) -> BaseSiteComponent:
55
+ def _make_linked_object(self, identificator_id, identificator, Class: type[C], NotFoundException) -> C:
55
56
  """
56
57
  Internal function for making a linked object (authentication kept) based on an identificator (like a project id or username)
57
58
  Class must inherit from BaseSiteComponent
@@ -19,6 +19,17 @@ from . import activity
19
19
 
20
20
  from ..utils.requests import Requests as requests
21
21
 
22
+ class Verificator:
23
+
24
+ def __init__(self, user: User, project_id: int):
25
+ self.project = user._make_linked_object("id", project_id, project.Project, exceptions.ProjectNotFound)
26
+ self.projecturl = self.project.url
27
+ self.code = ''.join(random.choices(string.ascii_letters + string.digits, k=8))
28
+ self.username = user.username
29
+
30
+ def check(self) -> bool:
31
+ return bool(list(filter(lambda x : x.author_name == self.username and (x.content == self.code or x.content.startswith(self.code) or x.content.endswith(self.code)), self.project.comments())))
32
+
22
33
  class User(BaseSiteComponent):
23
34
 
24
35
  '''
@@ -799,20 +810,8 @@ class User(BaseSiteComponent):
799
810
  It will return True if the user commented the code.
800
811
  """
801
812
 
802
- class Verificator:
803
-
804
- def __init__(self, user):
805
- self.project = user._make_linked_object("id", verification_project_id, project.Project, exceptions.ProjectNotFound)
806
- self.projecturl = self.project.url
807
- self.code = ''.join(random.choices(string.ascii_letters + string.digits, k=130))
808
- self.username = user.username
809
-
810
- def check(self):
811
- return list(filter(lambda x : x.author_name == self.username, self.project.comments())) != []
812
-
813
- v = Verificator(self)
814
- print(f"{self.username} has to go to {v.projecturl} and comment {v.code} to verify their identity")
815
- return Verificator(self)
813
+ v = Verificator(self, verification_project_id)
814
+ return v
816
815
 
817
816
  # ------ #
818
817
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scratchattach
3
- Version: 2.1.10a2
3
+ Version: 2.1.10a3
4
4
  Summary: A Scratch API Wrapper
5
5
  Home-page: https://scratchattach.tim1de.net
6
6
  Author: TimMcCool
@@ -38,7 +38,7 @@ scratchattach/other/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
38
38
  scratchattach/other/other_apis.py,sha256=7EyB3uB-1AYAH7Nb6eZ3VmACGdXvEQ39NJ1iahUoy04,9059
39
39
  scratchattach/other/project_json_capabilities.py,sha256=qSlJIJOgAxhSchD3fOIhK57rCe0_GrHadXBs5UXKuFU,22622
40
40
  scratchattach/site/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- scratchattach/site/_base.py,sha256=tvzDXU9C4ZOT1JonK_h1UP-atllao7vIN7NopbazXuY,2130
41
+ scratchattach/site/_base.py,sha256=S-ynYKe7LslZxaZzE0hZsga0eLB2XlQo5erAfKct8yc,2193
42
42
  scratchattach/site/activity.py,sha256=a019lhoUwL9mdZI1Sz9mMg9EsDt2Lp5ziJSSDQ8-BWM,14319
43
43
  scratchattach/site/backpack_asset.py,sha256=V_ypvTi-hqf0LF8zks2uHIicraBssc1_eEHVqHMzikc,3286
44
44
  scratchattach/site/browser_cookies.py,sha256=aaYLawtifngZ0pgaXHjBiWvYHUfflS8ZcXRjTTrge3A,1566
@@ -49,15 +49,15 @@ scratchattach/site/forum.py,sha256=BZ_2jqDW3o-22AG1vP9s1W7l9yBbjBkFqG_DGV9IDuA,1
49
49
  scratchattach/site/project.py,sha256=Mi5TAu31O07-Ue6N1jd_hwFwVpoTlzCdVBLv-xx7le4,30967
50
50
  scratchattach/site/session.py,sha256=mP4tTSZUs9dz0e3Zk6JF9RmSizFaYExbbEEYmA5TBnM,48278
51
51
  scratchattach/site/studio.py,sha256=Tv7AY1TwvlQpR9VjUEs-qmavrZsLxchkXk59aoH0_EI,22918
52
- scratchattach/site/user.py,sha256=fqXkUqKJWN4fUj4Wgnk27EYbEifrPAFvtz8WFkxvnvQ,34546
52
+ scratchattach/site/user.py,sha256=TCO1QRtPeJdb3p-ziCwa6NqObHSNP0DMmcOl5De-Yl8,34496
53
53
  scratchattach/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  scratchattach/utils/commons.py,sha256=6yCfUvQlQbl2VPhxJiK1MSdBdXpBbkr5uYyB2LLIcdI,8155
55
55
  scratchattach/utils/encoder.py,sha256=rqJfQ5gmjf7s8aTiGhR0W1ejYN5tHbAgJlxv7JhGqZQ,2479
56
56
  scratchattach/utils/enums.py,sha256=93ylCrxWycunahISSIjBqTIJ2r1Hb2b9RMvvzmUiQ-c,8294
57
57
  scratchattach/utils/exceptions.py,sha256=hrnPuXRRwR-kTHnrQVyfAD6PDOg1hZQd-jaXuUSNKSQ,6274
58
58
  scratchattach/utils/requests.py,sha256=x_EfcbLdBpQQuH9g4MMSaM8RN3tUm9OtzPEJQQiwilY,2709
59
- scratchattach-2.1.10a2.dist-info/licenses/LICENSE,sha256=1PRKLhZU4wYt5M-C9f7q0W3go3u_ojnZMNOdR3g3J-E,1080
60
- scratchattach-2.1.10a2.dist-info/METADATA,sha256=YJAMgHg-_9oEuppoOEqdiHaukO3_W--R1y4k-xtgJsE,5465
61
- scratchattach-2.1.10a2.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
62
- scratchattach-2.1.10a2.dist-info/top_level.txt,sha256=gIwCwW39ohXn0JlnvSzAjV7VtL3qPlRnHiRqBbxsEUE,14
63
- scratchattach-2.1.10a2.dist-info/RECORD,,
59
+ scratchattach-2.1.10a3.dist-info/licenses/LICENSE,sha256=1PRKLhZU4wYt5M-C9f7q0W3go3u_ojnZMNOdR3g3J-E,1080
60
+ scratchattach-2.1.10a3.dist-info/METADATA,sha256=RzReJUHflsgc5P29JhmZkHG3eAMMkKRre5dK9LOD_Ms,5465
61
+ scratchattach-2.1.10a3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
62
+ scratchattach-2.1.10a3.dist-info/top_level.txt,sha256=gIwCwW39ohXn0JlnvSzAjV7VtL3qPlRnHiRqBbxsEUE,14
63
+ scratchattach-2.1.10a3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5