<commit_before>from koemei.model.base_object import BaseObject
from koemei.utils import check_file_extension

class Transcript(BaseObject):

    def __init__(self, fields={}):
        """
        @param fields [Hash]
        """
        super(Transcript, self).__init__(fields=fields)
        self.path = 'transcripts/'

    """
    @BaseObject._reset_headers
    def get(self):
        print >> sys.stderr, 'making get request to: %s%s' % (self.dest, self.path + self.uid)
        request = urllib2.Request(self.dest + self.path + self.uid, headers=self.headers)
        BaseObject._execute(self, request)

    @BaseObject._reset_headers
    def get_list(self):
        print >> sys.stderr, 'making get request to: %s%s' % (self.dest, self.path)

        data = {}

        if self.count:
            data.update({'count': self.count})

        if self.status:
            data.update({'status_filter': '-'.join(map(lambda x: str(x), self.status))})

        data = urllib.urlencode(data)
        url = "%s/%s?%s" % (self.dest, self.path, data)

        request = urllib2.Request(url, headers=self.headers)
        BaseObject._execute(self, request)
    """

    @classmethod
    def has_valid_file_extension(cls, file_path):
        return check_file_extension(
            file_path=file_path,
            authorized_file_types=settings.get('base', 'transcript.align.authorized_extensions').split(',')
        )<commit_msg>WIP: notes and kobject left<commit_after>import json

from koemei.model.base_object import BaseObject
from koemei.utils import check_file_extension
from koemei.utils import settings


class Transcript(BaseObject):

    def __init__(self, fields={}):
        """
        @param fields [Hash]
        """
        super(Transcript, self).__init__(fields=fields)


    @classmethod
    def get(cls, client, uuid, deleted=False):
        url = [settings.get('base', 'paths.api.transcripts'), uuid]
        response = client.request(url=url)
        response_json = json.loads(response)
        return Transcript(fields=response_json)

    @classmethod
    def has_valid_file_extension(cls, file_path):
        return check_file_extension(
            file_path=file_path,
            authorized_file_types=settings.get('base', 'transcript.align.authorized_extensions').split(',')
        )
{'fraction_non_alphanumeric': 0.12467532467532468, 'fraction_numerical': 0.0008658008658008658, 'mean_word_length': 2.9436860068259385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3713162', 'n_tokens_mistral': 708, 'n_tokens_neox': 688, 'n_words': 138}