Skip to content

Commit

Permalink
feat: use collections.abc instead of typing
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkolenz committed Jan 11, 2023
1 parent 9e423c6 commit c0ced56
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions arguebuf/services/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import, annotations

import collections
import typing as t
from collections import abc
from uuid import uuid1


Expand Down Expand Up @@ -52,14 +52,14 @@ def missing_key_error(name: str, key: str) -> str:
U = t.TypeVar("U")


class ImmutableList(t.Sequence[T]):
class ImmutableList(abc.Sequence[T]):
"""Read-only view."""

__slots__ = "_store"

_store: t.Sequence[T]
_store: t.MutableSequence[T]

def __init__(self, items: t.Optional[t.Sequence[T]] = None):
def __init__(self, items: t.Optional[t.MutableSequence[T]] = None):
self._store = items or list()

def __len__(self) -> int:
Expand All @@ -83,14 +83,14 @@ def __str__(self) -> str:
return self._store.__str__()


class ImmutableSet(t.AbstractSet[T]):
class ImmutableSet(abc.Set[T]):
"""Read-only view."""

__slots__ = "_store"

_store: t.Set[T]
_store: t.MutableSet[T]

def __init__(self, items: t.Optional[t.Set[T]] = None):
def __init__(self, items: t.Optional[t.MutableSet[T]] = None):
self._store = items or set()

def __len__(self) -> int:
Expand All @@ -114,10 +114,10 @@ class ImmutableDict(t.Mapping[T, U]):

__slots__ = "_store"

_store: t.Dict[T, U]
_store: t.MutableMapping[T, U]

def __init__(self, items: t.Optional[t.Dict[T, U]] = None):
self._store = items or collections.OrderedDict()
def __init__(self, items: t.Optional[t.MutableMapping[T, U]] = None):
self._store = items or dict()

def __len__(self) -> int:
return self._store.__len__()
Expand Down

0 comments on commit c0ced56

Please sign in to comment.