Allow Tabs object to be sliced

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent 2a755897
......@@ -67,10 +67,10 @@ class Tabs:
def __iter__(self):
return iter(self._tabs)
def __getitem__(self, index: Union[int, str]):
if isinstance(index, int):
return self._tabs[index]
return self.by_name(index)
def __getitem__(self, index: Union[int, str, slice]):
if isinstance(index, str):
return self.by_name(index)
return self._tabs[index]
def first(self) -> tabs.Tab:
"""Return the Roster tab"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment