Returns the Root layer as list with bytes
188687
def getBytes(self) -> list:
        ''''''
        tmpList = []
        tmpList.extend(_FIRST_INDEX)
        # first append the high byte from the Flags and Length
        # high 4 bit: 0x7 then the bits 8-11(indexes) from _length
        length = self.length - 16
        tmpList.append((0x7 << 4) + (length >> 8))
        # Then append the lower 8 bits from _length
        tmpList.append(length & 0xFF)

        tmpList.extend(self._vector)
        tmpList.extend(self._cid)
        return tmpList
1072173
def split_stacks(self, stacks: List[List[BaseLayer]]) \
            -> List[List[BaseLayer]]:
        

        ns: List[List[BaseLayer]] = []

        for stack in stacks:
            cur: List[BaseLayer] = []

            for layer in stack:
                if cur and isinstance(layer, lyr.RawText):
                    ns.append(cur)
                    cur = []

                cur.append(layer)

            if cur:
                ns.append(cur)

        return ns
291970
def get_main_chain_layers(self):
        """"""
        main_chain = self.get_main_chain()
        ret = []
        for u in main_chain:
            for v, layer_id in self.adj_list[u]:
                if v in main_chain and u in main_chain:
                    ret.append(layer_id)
        return ret
255110
def to_array(self, *args, **kwargs):
        
        from root_numpy import tree2array
        return tree2array(self, *args, **kwargs)
551957
def get_source_folders(self):
        """"""
        if self.root is None:
            return []
        result = list(self._custom_source_folders)
        result.extend(self.pycore._find_source_folders(self.root))
        return result
1370909
def read_bplist(data, start, length):
    """"""
    # TODO: pylint doesn't find FMT_BINARY, why?
    # pylint: disable=no-member
    return plistlib.loads(data[start:start+length],
                          fmt=plistlib.FMT_BINARY)
425507
def get_layers(proto):
    
    if len(proto.layer):
        return proto.layer
    elif len(proto.layers):
        return proto.layers
    else:
        raise ValueError('Invalid proto file.')
657123
def spans(self, layer):
        
        spans = []
        for data in self[layer]:
            spans.append((data[START], data[END]))
        return spans
596484
def roots(self):
      """"""
      return [x for x in self._nodes.values() if x.id not in self._c2p]
1233606
def layers(self):
        
        # sample output:
        # {
        #     "Created": 1457116802,
        #     "Id": "sha256:507cb13a216097710f0d234668bf64a4c92949c573ba15eba13d05aad392fe04",
        #     "Size": 204692029,
        #     "Tags": [
        #         "docker.io/fedora:latest"
        #     ],
        #     "Comment": "",
        #     "CreatedBy": "/bin/sh -c #(nop) ADD file:bcb5e5c... in /"
        # }
        try:
            response = self.d.history(self.image_id)
        except docker.errors.NotFound:
            raise NotAvailableAnymore()

        layers = []
        for l in response:
            layer_id = l["Id"]
            if layer_id == "<missing>":
                layers.append(DockerImage(l, self.docker_backend))
            else:
                layers.append(self.docker_backend.get_image_by_id(layer_id))
        return layers
976051
def layers(self):
        '''
        '''
        from keras.layers import Input

        L = dict()
        for key in self.fields:
            L[key] = Input(name=key,
                           shape=self.fields[key].shape,
                           dtype=self.fields[key].dtype)

        return L
1045329
def _GetSerializedPartitionList(self):
        
        partition_list = list()
        
        for part in self.partitions:
            partition_list.append((part.node, unpack("<L", part.hash_value)[0]))

        return partition_list
410399
def list_path(root_dir):
    
    res = []
    if os.path.isdir(root_dir):
        for name in os.listdir(root_dir):
            res.append(name)
    return res
1290438
def getLayerIndex(self, layer):
                      
        for i in range(len(self.layers)):
            if layer == self.layers[i]: # shallow cmp
                return i
        return -1 # not in list
1163211
def list_proxy(root_package = 'vlcp'):
    '''
    
    '''
    proxy_dict = OrderedDict()
    pkg = __import__(root_package, fromlist=['_'])
    for imp, module, _ in walk_packages(pkg.__path__, root_package + '.'):
        m = __import__(module, fromlist = ['_'])
        for _, v in vars(m).items():
            if v is not None and isinstance(v, type) and issubclass(v, _ProxyModule) \
                    and v is not _ProxyModule \
                    and v.__module__ == module \
                    and hasattr(v, '_default'):
                name = v.__name__.lower()
                if name not in proxy_dict:
                    proxy_dict[name] = {'defaultmodule': v._default.__name__.lower(),
                                        'class': repr(v._default.__module__ + '.' + v._default.__name__)}
    return proxy_dict
1038805
def list_hierarchy(class_name, bases):
    

    class_list = [Uri(class_name)]
    for base in bases:
        if base.__name__ not in IGNORE_CLASSES:
            class_list.append(Uri(base.__name__))
    return list([i for i in set(class_list)])
650677
def _list_images(self, root):
        
        self.labels = []
        self.items = []

        valid_unseen_sub_idx = [1, 2, 20, 22]
        skip_sub_idx = [21]

        if self._mode == 'train':
            sub_idx = ['s' + str(i) for i in range(1, 35) \
                             if i not in valid_unseen_sub_idx + skip_sub_idx]
        elif self._mode == 'valid':
            sub_idx = ['s' + str(i) for i in valid_unseen_sub_idx]

        folder_path = []
        for i in sub_idx:
            folder_path.extend(glob.glob(os.path.join(root, i, "*")))

        for folder in folder_path:
            filename = glob.glob(os.path.join(folder, "*"))
            if len(filename) != self._seq_len:
                continue
            filename.sort()
            label = os.path.split(folder)[-1]
            self.items.append((filename, label))