(self, x, asynchronous=False, metadata=None)
Push data into the stream at this point

        This is typically done only at source Streams but can theoretically be
        done at any point

        Parameters
        ----------
        x: any
            an element of data
        asynchronous:
            emit asynchronously
        metadata: list[dict], optional
            Various types of metadata associated with the data element in `x`.

            ref: RefCounter
            A reference counter used to check when data is done
Push data into the stream at this point
Push data into the stream at this point
def emit(self, x, asynchronous=False, metadata=None):
        """ Push data into the stream at this point

        This is typically done only at source Streams but can theoretically be
        done at any point

        Parameters
        ----------
        x: any
            an element of data
        asynchronous:
            emit asynchronously
        metadata: list[dict], optional
            Various types of metadata associated with the data element in `x`.

            ref: RefCounter
            A reference counter used to check when data is done
        """
        ts_async = getattr(thread_state, 'asynchronous', False)
        if self.loop is None or asynchronous or self.asynchronous or ts_async:
            if not ts_async:
                thread_state.asynchronous = True
            try:
                result = self._emit(x, metadata=metadata)
                if self.loop:
                    return gen.convert_yielded(result)
            finally:
                thread_state.asynchronous = ts_async
        else:
            async def _():
                thread_state.asynchronous = True
                try:
                    result = await asyncio.gather(*self._emit(x, metadata=metadata))
                finally:
                    del thread_state.asynchronous
                return result

            sync(self.loop, _)
def emit ( self , x , asynchronous = False , metadata = None ) : ts_async = getattr ( thread_state , 'asynchronous' , False ) if self . loop is None or asynchronous or self . asynchronous or ts_async : if not ts_async : thread_state . asynchronous = True try : result = self . _emit ( x , metadata = metadata ) if self . loop : return gen . convert_yielded ( result ) finally : thread_state . asynchronous = ts_async else : async def _ ( ) : thread_state . asynchronous = True try : result = await asyncio . gather ( * self . _emit ( x , metadata = metadata ) ) finally : del thread_state . asynchronous return result sync ( self . loop , _ )