Create a data item in the library from data.

        .. versionadded:: 1.0
        .. deprecated:: 1.1
           Use :py:meth:`~nion.swift.Facade.Library.create_data_item_from_data` instead.

        Scriptable: No
433361
def create_data_item_from_data(self, data: numpy.ndarray, title: str=None) -> DataItem:
        
        return DataItem(self.__document_controller.add_data(data, title))
1245859
def _create_data_loader(self, data, **kwargs):
        """"""
        if data is None:
            return None

        # Set DataLoader config
        # NOTE: Not applicable if data is already a DataLoader
        config = {
            **self.config["train_config"]["data_loader_config"],
            **kwargs,
            "pin_memory": self.config["device"] != "cpu",
        }
        # Return data as DataLoader
        if isinstance(data, DataLoader):
            return data
        elif isinstance(data, Dataset):
            return DataLoader(data, **config)
        elif isinstance(data, (tuple, list)):
            return DataLoader(self._create_dataset(*data), **config)
        else:
            raise ValueError("Input data type not recognized.")
444615
def create_items(sender, instance, **kwargs):
    
    if instance.item_id is None and instance.item is None:
        item = Item()
        if hasattr(instance, 'active'):
            item.active = getattr(instance, 'active')
        item.save()
        instance.item = item
558255
def append(self, item):
        
        try:
            self._data[self._position] = item
        except IndexError:
            self._grow()
            self._data[self._position] = item
        self._position += 1
        return self
1308280
def create(self, data, inlineparent = None):
        '''
        
        '''
        try:
            return self.struct.unpack(data)[0]
        except struct.error as exc:
            raise BadFormatError(exc)
443502
def from_data(data):
    
    if len(data) == 0:  # pragma: no cover
        return None
    else:
        ptable = PrettyTable()
        ptable.field_names = data[0].keys()
        for row in data:
            ptable.add_row(row)
        return ptable
1230302
def from_dict(data, ctx):
        

        data = data.copy()

        if data.get('bid') is not None:
            data['bid'] = \
                ctx.instrument.CandlestickData.from_dict(
                    data['bid'], ctx
                )

        if data.get('ask') is not None:
            data['ask'] = \
                ctx.instrument.CandlestickData.from_dict(
                    data['ask'], ctx
                )

        if data.get('mid') is not None:
            data['mid'] = \
                ctx.instrument.CandlestickData.from_dict(
                    data['mid'], ctx
                )

        return Candlestick(**data)
139786
def createItem( self ):
        
        if not self.isEditable():
            return None
        
        if self._createItem is None:
            self.blockSignals(True)
            
            self._createItem = XMultiTagCreateItem(self)
            self.addItem(self._createItem)
            
            self.blockSignals(False)
        
        return self._createItem
21596
def usable_item(self, data):
        

        # Use metadata as item
        item = data['meta']

        # Add nested IO for data
        elems, elems_is_complex = self.getlist('parameter')
        if elems_is_complex:
            elems = [elem['name'] for elem in elems]

        add, add_is_complex = self.getlist('add')
        item['data'] = DataIO(
            data=data['data'],
            parameter=elems,
            add=add,
            start_date=self.getvalue('start_date'),
            end_date=self.getvalue('end_date'),
        )

        # TupleMapper will convert item to namedtuple
        return super(StationDataIO, self).usable_item(item)
458748
def create_item(self, name):
        
        item = self.app.create_item(name)

        return TodoListUX(ux=self, controlled_list=item)
81270
def create_for_data(cls, data, format, width, height, stride=None):
        
        return cls(format, width, height, data, stride)
1011484
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, 'Data4': [0 for i in range(8)]})

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

        self.Data4 = material.get("Data4", [0 for i in range(8)])
        self.SMPTELabel = d.get("SMPTELabel", [0 for i in range(12)])
990500
def new_from_json_dict(cls, data):
        
        new_data = {utils.to_snake_case(key): value
                    for key, value in data.items()}

        return cls(**new_data)
953137
def new_from_list(cls, items, **kwargs):
        
        obj = cls(**kwargs)
        for item in items:
            obj.append(ListItem(item))
        return obj
1365796
def _import_data(self, data):
        

        for key, value in data.items():
            if key.startswith('__'):
                self._not_allowed_field(key)
                continue

            if not self.get_field_obj(key) and not self._define_new_field_by_value(key, value):
                self._not_allowed_value(key, value)
                continue

            setattr(self, key, value)
826183
def data_item(self) -> DataItem:
        
        display_panel = self.__display_panel
        if not display_panel:
            return None
        data_item = display_panel.data_item
        return DataItem(data_item) if data_item else None
446929
def create(self, item, dry_run=None):
        """"""
        logger.debug('Creating new item. Item: {item} Path: {data_file}'.format(
            item=item,
            data_file=self.data_file
        ))

        items = load_file(self.client, self.bucket_name, self.data_file)
        items = append_item(self.namespace, self.version, item, items)
        save_file(self.client, self.bucket_name, self.data_file, items, dry_run=dry_run)

        return item