Skip to content

Commit a9adab4

Browse files
authored
Overwrite __len__ for CommandDefinitions and States (#18)
1 parent 523730e commit a9adab4

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.6.8
1+
3.7.8

tahoma_api/models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ def __contains__(self, name: str) -> bool:
125125
def __getitem__(self, command: str) -> Optional[CommandDefinition]:
126126
return next((cd for cd in self._commands if cd.command_name == command), None)
127127

128+
def __len__(self) -> int:
129+
return len(self._commands)
130+
128131
get = __getitem__
129132

130133

@@ -150,6 +153,9 @@ def __contains__(self, name: str) -> bool:
150153
def __getitem__(self, name: str) -> Optional[State]:
151154
return next((state for state in self._states if state.name == name), None)
152155

156+
def __len__(self) -> int:
157+
return len(self._states)
158+
153159
get = __getitem__
154160

155161

0 commit comments

Comments
 (0)