<commit_before>import pili.api as api
import pili.conf as conf
import time
from .utils import __hmac_sha1__
from urlparse import urlparse

def create_stream(hub=conf.HUB, **args):
    res = api.create_stream(hub=hub, **args)
    return Stream(data=res)

def get_stream(stream_id):
    return Stream(stream_id=stream_id)

def streams(hub=conf.HUB, limit=None):
    marker = None
    while True:
        res = api.get_stream_list(hub=hub, marker=marker, limit=None)
        if res["items"] is not None:
            for data in res["items"]:
                yield Stream(data=data)
        else:
            break
        marker = res["marker"]

class Stream(object):
    """
    Stream is used to control a stream. You should always create a Stream object by the
    interfaces of an application.
    """
    def __init__(self, stream_id=None, data=None):
        if not (stream_id or data):
            raise ValueError('invalid key')
        if not stream_id:
            stream_id = data["id"]
        self.__stream_id__ = stream_id
        self.__data__ = data
        self.play = Play(stream_id)
        self.publish= Publish(stream_id, self.publishSecurity, self.publishKey)

    def __getattr__(self, attr):
        if not self.__data__:
            self.refresh()
        return self.__data__[attr]

    def refresh(self):
        self.__data__ = api.get_stream(stream_id=self.__stream_id__)
        return self.__data__

    def update(self, **args):
        res = api.update_stream(stream_id=self.__stream_id__, **args)
        self.__data__ = res
        return res

    def delete(self):<commit_msg>Add attribution 'data' for Stream, so that 'stream.data' can be called<commit_after>import pili.api as api
import pili.conf as conf
import time
from .utils import __hmac_sha1__
from urlparse import urlparse

def create_stream(hub=conf.HUB, **args):
    res = api.create_stream(hub=hub, **args)
    return Stream(data=res)

def get_stream(stream_id):
    return Stream(stream_id=stream_id)

def streams(hub=conf.HUB, limit=None):
    marker = None
    while True:
        res = api.get_stream_list(hub=hub, marker=marker, limit=None)
        if res["items"] is not None:
            for data in res["items"]:
                yield Stream(data=data)
        else:
            break
        marker = res["marker"]

class Stream(object):
    """
    Stream is used to control a stream. You should always create a Stream object by the
    interfaces of an application.
    """
    def __init__(self, stream_id=None, data=None):
        if not (stream_id or data):
            raise ValueError('invalid key')
        if not stream_id:
            stream_id = data["id"]
        self.__stream_id__ = stream_id
        self.__data__ = data
        self.play = Play(stream_id)
        self.publish= Publish(stream_id, self.publishSecurity, self.publishKey)

    def __getattr__(self, attr):
        if not self.__data__:
            self.refresh()
        return self.__data__ if attr == "data" else self.__data__[attr]

    def refresh(self):
        self.__data__ = api.get_stream(stream_id=self.__stream_id__)
        return self.__data__

    def update(self, **args):
        res = api.update_stream(stream_id=self.__stream_id__, **args)
        self.__data__ = res
        return res

    def delete(self):
{'fraction_non_alphanumeric': 0.09873188405797101, 'fraction_numerical': 0.0006038647342995169, 'mean_word_length': 2.6446644664466445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2795234', 'n_tokens_mistral': 1002, 'n_tokens_neox': 995, 'n_words': 278}