<commit_before>from __future__ import (
    unicode_literals,
    absolute_import,
    print_function,
    division,
    )

import uuid
import struct
from .utils import (int_from_bytes, bytes_from_int)

MOBID_STRUCT = struct.Struct(''.join(( '<',
   '12B',  # UInt8Array12   SMPTELabel
   'B',    # UInt8          length
   'B',    # UInt8          instanceHigh
   'B',    # UInt8          instanceMid
   'B',    # UInt8          instanceLow
   'I',    # UInt32         Data1
   'H',    # UInt16         Data2
   'H',    # UInt16         Data3
   '8B',   # UInt8Array8    Data4
 )))

class MobID(object):
    def __init__(self, mobid=None, bytes_le=None, int=None):

        self.SMPTELabel = [0 for i in range(12)]
        self.length = 0
        self.instanceHigh = 0
        self.instanceMid = 0
        self.instanceLow = 0
        self.Data1 = 0
        self.Data2 = 0
        self.Data3 = 0
        self.Data4 = [0 for i in range(8)]

        if not mobid is None:
            self.urn = mobid

        if not bytes_le is None:
            self.bytes_le = bytes_le

        if not int is None:
            self.int = int

    @staticmethod
    def new():
        m = MobID()
        m.SMPTELabel = [0x06, 0x0a, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x01, 0x01, 0x0f, 0x00]
        m.length = 0x13
        m.instanceHigh = 0x00
        m.instanceMid = 0x00
        m.instanceLow = 0x00
        m.material = uuid.uuid4()
        return m

    @property
    def material(self):
        return uuid.UUID(bytes_le=self.bytes_le[16:])

    @material.setter
    def material(self, value):
        self.Data1 = value.time_low
        self.Data2 = value.time_mid
        self.Data3 = value.time_hi_version
        self.Data4 = list(struct.unpack("8B", value.bytes[8:]))

    @property
    def bytes_le(self):
        return MOBID_STRUCT.pack(
        self.SMPTELabel[0],
        self.SMPTELabel[1],
        self.SMPTELabel[2],
        self.SMPTELabel[3],
        self.SMPTELabel[4],
        self.SMPTELabel[5],
        self.SMPTELabel[6],
        self.SMPTELabel[7],
        self.SMPTELabel[8],
        self.SMPTELabel[9],
        self.SMPTELabel[10],
        self.SMPTELabel[11],
        self.length,
        self.instanceHigh,
        self.instanceMid,
        self.instanceLow,
        self.Data1,
        self.Data2,
        self.Data3,
        self.Data4[0],
        self.Data4[1],
        self.Data4[2],
        self.Data4[3],
        self.Data4[4],
        self.Data4[5],
        self.Data4[6],
        self.Data4[7])

    @bytes_le.setter
    def bytes_le(self, data):

        (
        self.SMPTELabel[0],
        self.SMPTELabel[1],
        self.SMPTELabel[2],
        self.SMPTELabel[3],
        self.SMPTELabel[4],
        self.SMPTELabel[5],
        self.SMPTELabel[6],
        self.SMPTELabel[7],
        self.SMPTELabel[8],
        self.SMPTELabel[9],
        self.SMPTELabel[10],
        self.SMPTELabel[11],
        self.length,
        self.instanceHigh,
        self.instanceMid,
        self.instanceLow,
        self.Data1,
        self.Data2,
        self.Data3,
        self.Data4[0],
        self.Data4[1],
        self.Data4[2],
        self.Data4[3],
        self.Data4[4],
        self.Data4[5],
        self.Data4[6],
        self.Data4[7],
        ) = MOBID_STRUCT.unpack(data)

    def _from_dict(self, d):
        self.length = d.get("length", 0)
        self.instanceHigh = d.get("instanceHigh", 0)
        self.instanceMid = d.get("instanceMid", 0)
        self.instanceLow = d.get("instanceLow", 0)

        material = d.get("material", {'Data1':0, 'Data2':0, 'Data3':0})

        self.Data1 = material.get('Data1', 0)
        self.Data2 = material.get('Data2', 0)
        self.Data3 = material.get('Data3', 0)

        Data4 = material.get("Data4", [0 for i in xrange(8)])

        for i in xrange(8):
            if i >= len(Data4):
                break
            self.Data4[i] = Data4[i]

        SMPTELabel = d.get("SMPTELabel", [0 for i in xrange(12)])<commit_msg>fix method name<commit_after>from __future__ import (
    unicode_literals,
    absolute_import,
    print_function,
    division,
    )

import uuid
import struct
from .utils import (int_from_bytes, bytes_from_int)

MOBID_STRUCT = struct.Struct(''.join(( '<',
   '12B',  # UInt8Array12   SMPTELabel
   'B',    # UInt8          length
   'B',    # UInt8          instanceHigh
   'B',    # UInt8          instanceMid
   'B',    # UInt8          instanceLow
   'I',    # UInt32         Data1
   'H',    # UInt16         Data2
   'H',    # UInt16         Data3
   '8B',   # UInt8Array8    Data4
 )))

class MobID(object):
    def __init__(self, mobid=None, bytes_le=None, int=None):

        self.SMPTELabel = [0 for i in range(12)]
        self.length = 0
        self.instanceHigh = 0
        self.instanceMid = 0
        self.instanceLow = 0
        self.Data1 = 0
        self.Data2 = 0
        self.Data3 = 0
        self.Data4 = [0 for i in range(8)]

        if not mobid is None:
            self.urn = mobid

        if not bytes_le is None:
            self.bytes_le = bytes_le

        if not int is None:
            self.int = int

    @staticmethod
    def new():
        m = MobID()
        m.SMPTELabel = [0x06, 0x0a, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x01, 0x01, 0x0f, 0x00]
        m.length = 0x13
        m.instanceHigh = 0x00
        m.instanceMid = 0x00
        m.instanceLow = 0x00
        m.material = uuid.uuid4()
        return m

    @property
    def material(self):
        return uuid.UUID(bytes_le=self.bytes_le[16:])

    @material.setter
    def material(self, value):
        self.Data1 = value.time_low
        self.Data2 = value.time_mid
        self.Data3 = value.time_hi_version
        self.Data4 = list(struct.unpack("8B", value.bytes[8:]))

    @property
    def bytes_le(self):
        return MOBID_STRUCT.pack(
        self.SMPTELabel[0],
        self.SMPTELabel[1],
        self.SMPTELabel[2],
        self.SMPTELabel[3],
        self.SMPTELabel[4],
        self.SMPTELabel[5],
        self.SMPTELabel[6],
        self.SMPTELabel[7],
        self.SMPTELabel[8],
        self.SMPTELabel[9],
        self.SMPTELabel[10],
        self.SMPTELabel[11],
        self.length,
        self.instanceHigh,
        self.instanceMid,
        self.instanceLow,
        self.Data1,
        self.Data2,
        self.Data3,
        self.Data4[0],
        self.Data4[1],
        self.Data4[2],
        self.Data4[3],
        self.Data4[4],
        self.Data4[5],
        self.Data4[6],
        self.Data4[7])

    @bytes_le.setter
    def bytes_le(self, data):

        (
        self.SMPTELabel[0],
        self.SMPTELabel[1],
        self.SMPTELabel[2],
        self.SMPTELabel[3],
        self.SMPTELabel[4],
        self.SMPTELabel[5],
        self.SMPTELabel[6],
        self.SMPTELabel[7],
        self.SMPTELabel[8],
        self.SMPTELabel[9],
        self.SMPTELabel[10],
        self.SMPTELabel[11],
        self.length,
        self.instanceHigh,
        self.instanceMid,
        self.instanceLow,
        self.Data1,
        self.Data2,
        self.Data3,
        self.Data4[0],
        self.Data4[1],
        self.Data4[2],
        self.Data4[3],
        self.Data4[4],
        self.Data4[5],
        self.Data4[6],
        self.Data4[7],
        ) = MOBID_STRUCT.unpack(data)

    def from_dict(self, d):
        self.length = d.get("length", 0)
        self.instanceHigh = d.get("instanceHigh", 0)
        self.instanceMid = d.get("instanceMid", 0)
        self.instanceLow = d.get("instanceLow", 0)

        material = d.get("material", {'Data1':0, 'Data2':0, 'Data3':0})

        self.Data1 = material.get('Data1', 0)
        self.Data2 = material.get('Data2', 0)
        self.Data3 = material.get('Data3', 0)

        Data4 = material.get("Data4", [0 for i in xrange(8)])

        for i in xrange(8):
            if i >= len(Data4):
                break
            self.Data4[i] = Data4[i]

        SMPTELabel = d.get("SMPTELabel", [0 for i in xrange(12)])
{'fraction_non_alphanumeric': 0.12717051842598376, 'fraction_numerical': 0.046970643347907556, 'mean_word_length': 1.7616419454984478, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1246361', 'n_tokens_mistral': 3076, 'n_tokens_neox': 2927, 'n_words': 529}