Skip to content

Instantly share code, notes, and snippets.

@WuTheFWasThat
Created August 25, 2017 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WuTheFWasThat/091a17d4b5cab597dfd5d4c2d96faf09 to your computer and use it in GitHub Desktop.
Save WuTheFWasThat/091a17d4b5cab597dfd5d4c2d96faf09 to your computer and use it in GitHub Desktop.
pyrsistent stubs
# Stubs for pyrsistent (Python 3.6)
#
from typing import Dict, TypeVar, Generic, Iterable, Optional, Any, Union, Sequence
# PMap
K = TypeVar('K')
V = TypeVar('V')
class PMap(Generic[K, V], object):
def set(self, key: K, val: V) -> PMap[K, V]: ...
def remove(self, key: K) -> PMap[K, V]: ...
def discard(self, key: K) -> PMap[K, V]: ...
def copy(self) -> PMap[K, V]: ...
# TODO: all the __underscore_methods__, update, update_with, transform, evolver
def pmap(initial: Dict[K, V] = {}, pre_size: int = 0) -> PMap[K, V]: ...
def m(**kwargs: Dict[K, V]) -> PMap[K, V]: ...
# PVector
T = TypeVar('T')
class PVector(Sequence[T]):
def set(self, i: int, val: T) -> PVector[T]: ...
def mset(self, *args: Iterable[Union[T, int]]) -> PVector[T]: ...
def append(self, val: T) -> PVector[T]: ...
def extend(self, obj: Iterable[T]) -> PVector[T]: ...
def delete(self, index: int, stop: Optional[int]) -> PVector[T]: ...
def remove(self, value: T) -> PVector[T]: ...
# TODO: transform, evolver, some of the __underscore_methods__
def pvector(iterable: Iterable[T]) -> PVector[T]: ...
def v(*iterable: Iterable[T]) -> PVector[T]: ...
# TODO: pbag, b, PBag
# TODO: plist, l, PList
# TODO: pdeque, dq, PDeque
# TODO: CheckedPMap, CheckedPVector, CheckedPSet, InvariantException, CheckedKeyTypeError,
# CheckedValueTypeError, CheckedType, optional
# TODO: field, PTypeError, pset_field, pmap_field, pvector_field
# TODO: PRecord
# TODO: PClass, PClassMeta
# TODO: immutable
# TODO: freeze, thaw, mutant
# TODO: inc, discard, rex, ny
# TODO: get_in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment