Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions nixnet/_session/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


@six.add_metaclass(abc.ABCMeta)
class Collection(collections.Mapping):
class Collection(collections.Sequence):
"""Collection of items in a session."""

def __init__(self, handle):
Expand Down Expand Up @@ -42,7 +42,6 @@ def __contains__(self, index):
raise TypeError(index)

def __getitem__(self, index):
# type: (typing.Union[int, typing.Text]) -> Item
if isinstance(index, six.integer_types):
name = self._list_cache[index]
elif isinstance(index, six.string_types):
Expand All @@ -59,6 +58,12 @@ def __getitem__(self, index):

def get(self, index, default=None):
# type: (typing.Union[int, typing.Text], typing.Any) -> Item
"""Access an item, returning ``default`` on failure.

Args:
index(str or int): Item name or index
default: Value to return when lookup fails
"""
if isinstance(index, six.integer_types):
try:
name = self._list_cache[index]
Expand Down