Skip to content

unique fails on dicts #140

@CJ-Wright

Description

@CJ-Wright
from streamz import Stream
source = Stream()
s = source.unique().sink(print)
source.emit({'a': 1})

gives an error

~/dev/streamz/streamz/core.py in emit(self, x, asynchronous)
    243                 thread_state.asynchronous = True
    244             try:
--> 245                 result = self._emit(x)
    246                 return gen.convert_yielded(result)
    247             finally:

~/dev/streamz/streamz/core.py in _emit(self, x)
    224         result = []
    225         for downstream in list(self.downstreams):
--> 226             r = downstream.update(x, who=self)
    227             if type(r) is list:
    228                 result.extend(r)

~/dev/streamz/streamz/core.py in update(self, x, who)
    992     def update(self, x, who=None):
    993         y = self.key(x)
--> 994         if y not in self.seen:
    995             self.seen[y] = 1
    996             return self._emit(x)

TypeError: unhashable type: 'dict'

Is this expected behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions