Skip to content

Commit 9369f65

Browse files
committed
slots fix
1 parent e19fd94 commit 9369f65

File tree

13 files changed

+24
-28
lines changed

13 files changed

+24
-28
lines changed

tryhackme/badge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
class Badge:
4-
__slots__ = ("title", "name", "description", "earned", )
4+
__slots__ = ("_state", "_to_earn", "title", "name", "description", "earned", )
55

66
def __init__(self, state, data):
77
self._state = state

tryhackme/game.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from .user import KOTHUser
22

33
class KingoftheHill:
4-
__slot__ = ("id", "start_time", "finnish_time", "status", "flag_count", "resets", "game_type", "ceator", "users", "King", )
4+
__slot__ = ("_state", "id", "start_time", "finnish_time", "status", "flag_count", "resets", "game_type", "ceator", "users", "King", )
55

66
def __init__(self, state, data):
77
self._state = state

tryhackme/message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from . import utils
22

33
class Message:
4-
__slots__ = ("group", "inserted", "user", )
4+
__slots__ = ("_state", "group", "inserted", "user", )
55

66
def __init__(self, state, group, data):
77
self._state = state
@@ -16,7 +16,7 @@ def _from_data(self, data):
1616

1717
# * can only be used on `get_all_message_groups` api call
1818
class MessageGroup:
19-
__slots__ = ("messages", "id", "title", )
19+
__slots__ = ("_state", "_users", "messages", "id", "title", )
2020
def __init__(self, state, data):
2121
self._state = state
2222
self.messages = []

tryhackme/module.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
class Module:
4-
__slots__ = ("name", "code", "id", "description", "summary", )
4+
__slots__ = ("_state", "_rooms", "_prerequisites", "_next_steps", "name", "code", "id", "description", "summary", )
55

66
def __init__(self, state, data):
77
self._state = state
@@ -16,7 +16,7 @@ def _from_data(self, data):
1616
self.summary = data.get('summary')
1717
self._rooms = data.get('rooms')
1818
self._prerequisites = data.get('prerequisites')
19-
self._nextSteps = data.get('nextSteps')
19+
self._next_steps = data.get('nextSteps')
2020

2121
@property
2222
def rooms(self):
@@ -25,6 +25,6 @@ def rooms(self):
2525
def prerequisites(self):
2626
return [self._state.store_module(module) for module in self._prerequisites]
2727
@property
28-
def nextSteps(self):
29-
return [self._state.store_module(module) for module in self._nextSteps]
28+
def next_steps(self):
29+
return [self._state.store_module(module) for module in self._next_steps]
3030

tryhackme/path.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from . import utils
33

44
class Path:
5-
__slots__ = ("code", "raw_description", "color", "raw_intro", "type", "public", "room_count", "summary", "difficult", "time_to_complete", )
5+
__slots__ = ("_state", "_badges", "_careers", "_modules", "_tasks", "code", "raw_description", "color", "raw_intro", "type", "public", "room_count", "summary", "difficult", "time_to_complete", )
66

77
def __init__(self, state, data):
88
self._state = state
@@ -47,11 +47,9 @@ def tasks(self):
4747
@property
4848
def modules(self):
4949
return [self._state.store_module(module) for module in self._module]
50-
5150
@property
5251
def badges(self):
5352
return [self._state.store_badge(badge) for badge in self._badges]
54-
# ? What is this
5553
@property
56-
def careers(self):
54+
def careers(self): # ? What is this
5755
return [career for career in self._careers]

tryhackme/question.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from . import utils
22

33
class Question:
4-
__slots__ = ("raw_question", "question", "raw_hint", "hint", "number", "raw_description", "description", "extra_points", "correct", "attempts", "submission", "has_answer", )
4+
__slots__ = ("_state", "raw_question", "question", "raw_hint", "hint", "number", "raw_description", "description", "extra_points", "correct", "attempts", "submission", "has_answer", )
55

66
def __init__(self, state, data):
77
self._state = state
@@ -14,7 +14,7 @@ def _from_data(self, data):
1414
self.hint = utils.HTML_parse(self.raw_hint)
1515
self.number = data.get("questionNo")
1616

17-
# * only when valid session is used
17+
# * only when authenticated
1818
self.raw_description = data.get("answerDesc", "")
1919
self.description = utils.HTML_parse(self.raw_description)
2020
self.extra_points = data.get("extraPoints", None)

tryhackme/room.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ? writeups class
55

66
class Room:
7-
__slots__ = ("name", "id", "title", "description", "created", "published", "users", "type", "public", "difficulty", "freeToUse", "ctf", "tags", "ipType", "simpleRoom", "writeups", "locked", "comingSoon", "views", "certificate", "timeToComplete", "userCompleted", )
7+
__slots__ = ("_state", "_creators", "name", "id", "title", "description", "created", "published", "users", "type", "public", "difficulty", "freeToUse", "ctf", "tags", "ipType", "simpleRoom", "writeups", "locked", "comingSoon", "views", "certificate", "timeToComplete", "userCompleted", )
88

99
def __init__(self, state, data):
1010
self._state = state
@@ -65,7 +65,7 @@ def tasks(self):
6565
if self.freeToUse or self._state.subscribed:
6666
return [RoomTask(state=self._state, data=task) for task in self._state.http.get_room_tasks(room_code=self.name).get('data')]
6767
else:
68-
return [RoomTask(state=self._state, data=task) for task in self._state.http.get_room_tasks(room_code=self.name, settings={"static": True})]
68+
return [RoomTask(state=self._state, data=task) for task in self._state.http.get_room_tasks(room_code=self.name, settings=["static"]).get('data')]
6969
@property
7070
def creators(self):
7171
return [self._state.store_user(username=user.get('username')) for user in self._creators]

tryhackme/serie.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
class Serie:
4-
__slots__ = ("id", "code", "name", "description", "difficulty", )
4+
__slots__ = ("_state", "_rooms", "id", "code", "name", "description", "difficulty", )
55
def __init__(self, state, data):
66
self._state = state
77

tryhackme/task.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
class RoomTask:
6-
__slots__ = ("raw_title", "raw_description", "description", "type", "number", "created", "deadline", "uploadId", )
6+
__slots__ = ("_state", "_questions", "raw_title", "raw_description", "description", "type", "number", "created", "deadline", "uploadId", )
77

88
def __init__(self, state, data):
99
self._state = state
@@ -32,7 +32,7 @@ def questions(self):
3232

3333

3434
class PathTask:
35-
__slots__ = ("id", "title", "time", "overview", "outcome", "number", )
35+
__slots__ = ("_state", "_module_url", "_rooms", "id", "title", "time", "overview", "outcome", "number", )
3636

3737
def __init__(self, state, data):
3838
self.state = state
@@ -42,7 +42,7 @@ def __init__(self, state, data):
4242
def _from_data(self, data):
4343
self.id = data.get("_id")
4444
self.title = data.get("title")
45-
self._moduleURL = data.get("moduleURL")
45+
self._module_url = data.get("moduleURL")
4646
self.time = int(data.get("time"))
4747
self.overview = data.get("overview")
4848
self.outcomes = data.get("outcome")
@@ -54,4 +54,4 @@ def rooms(self):
5454
return [self._state.get_room(room_code=room.get("code")) for room in self._rooms]
5555
@property
5656
def module(self):
57-
return self._state.get_module(moduleURL=self._moduleURL)
57+
return self._state.get_module(moduleURL=self._module_url)

tryhackme/team.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
class Team:
4-
__slots__ = ("name", "captain", "password", "university", )
4+
__slots__ = ("_state", "_members", "name", "captain", "password", "university", )
55

66
def __init__(self, state, data):
77
self._state = state

0 commit comments

Comments
 (0)