Create protobuf item.

        :return: protobuf structure
        :rtype: ~unidown.plugin.protobuf.link_item_pb2.LinkItemProto
329181
def to_protobuf(self) -> LinkItemProto:
        
        result = LinkItemProto()
        result.name = self._name
        result.time.CopyFrom(datetime_to_timestamp(self._time))
        return result
442872
def item_enclosure_url(self, item):
        
        try:
            url = item.image.url
        except (AttributeError, ValueError):
            img = BeautifulSoup(item.html_content, 'html.parser').find('img')
            url = img.get('src') if img else None
        self.cached_enclosure_url = url
        if url:
            url = urljoin(self.site_url, url)
            if self.feed_format == 'rss':
                url = url.replace('https://', 'http://')
        return url
910895
def create(self, data={}, **kwargs):
        "
        url = self.base_url
        return self.post_url(url, data, **kwargs)
1008716
def to_item
      item = DICOM::Item.new
      item.add(DICOM::Element.new(COLL_TYPE, @type))
      item.add(DICOM::Element.new(COLL_POS, positions_string))
      return item
    end
206425
def create(self, item, **kwargs):
        
        response = self._new_response()
        if self._prototype_handler.check(item, 'create', response):
            self._encrypt(item)
            params = {'Item': item}
            self._call_ddb_method(self.table.put_item,
                                  params, response)
            if response.status == 'success':
                response.data = item
        response.prepare()
        return response
564597
public function createItem()
    {
        if(!\tao_helpers_Request::isAjax()){
            throw new common_exception_BadRequest('wrong request mode');
        }
        $clazz = new \core_kernel_classes_Resource($this->getRequestParameter('id'));
        if ($clazz->isClass()) {
            $clazz = new \core_kernel_classes_Class($clazz);
        } else {
            foreach ($clazz->getTypes() as $type) {
                // determine class from selected instance
                $clazz = $type;
                break;
            }
        }
        $service = \taoItems_models_classes_ItemsService::singleton();

        $label = $service->createUniqueLabel($clazz);
        $item = $service->createInstance($clazz, $label);

        if(!is_null($item)){
            $service->setItemModel($item, new \core_kernel_classes_Resource(ItemModel::MODEL_URI));
            $this->getEventManager()->trigger(new ItemCreatedEvent($item->getUri()));
            $response = array(
                'label'	=> $item->getLabel(),
                'uri' 	=> $item->getUri()
            );
        } else {
            $response = false;
        }
        $this->returnJson($response);
    }
441154
def to_protobuf(self):
        """"""
        self._validate()
        kwargs = {k: _convert(getattr(self, k), 'to_protobuf')
                  for k in self._get_params()}
        return self._protobuf_cls(**kwargs)
13302
def create_items(self):
        
        if not self.mode['items'] or len(self.mode['items']) == 0: return

        # FIXME: Check if already contains
        self.collman.add(self.player)

        for k in self.mode['items']:
            item = self.mode['items'][k]
            #{'terminal': False, 'num': 50, 'scale': 1.0, 'reward': 2.0}
            radius = item['scale'] * self.player.radius
            for i in range(item['num']):
                self.add_item(radius, k)
953137
def new_from_list(cls, items, **kwargs):
        
        obj = cls(**kwargs)
        for item in items:
            obj.append(ListItem(item))
        return obj
1323456
def linkify_item_templates(self, item):
        
        tpls = []
        tpl_names = item.get_templates()

        for name in tpl_names:
            template = self.find_tpl_by_name(name)
            if not template:
                # TODO: Check if this should not be better to report as an error ?
                self.add_warning("%s %s use/inherit from an unknown template: %s ! from: %s"
                                 % (type(item).__name__, item.get_name(), name, item.imported_from))
            else:
                if template is item:
                    self.add_error("%s %s use/inherits from itself ! from: %s"
                                   % (type(item).__name__, item._get_name(), item.imported_from))
                else:
                    tpls.append(template.uuid)
        item.templates = tpls
945306
def _build_protobuf(self):
        
        pb = _pb_from_query(self._query)

        start_cursor = self.next_page_token
        if start_cursor is not None:
            pb.start_cursor = base64.urlsafe_b64decode(start_cursor)

        end_cursor = self._end_cursor
        if end_cursor is not None:
            pb.end_cursor = base64.urlsafe_b64decode(end_cursor)

        if self.max_results is not None:
            pb.limit.value = self.max_results - self.num_results

        if start_cursor is None and self._offset is not None:
            # NOTE: We don't need to add an offset to the request protobuf
            #       if we are using an existing cursor, because the offset
            #       is only relative to the start of the result set, not
            #       relative to each page (this method is called per-page)
            pb.offset = self._offset

        return pb
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
791607
def create(self, data):
        
        data = values.of({'Data': serialize.object(data), })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return SyncListItemInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            list_sid=self._solution['list_sid'],
        )
92028
def append(self, item):
        
        if not is_any(item):
            raise MemberTypeError(self, item, member=len(self))
        self._data.append(item)
818802
public void createItems() {
        mItemAdapter.clear();

        int profileOffset = 0;
        if (mAccountHeader != null && mAccountHeader.getAccountHeaderBuilder().mProfileImagesVisible) {
            IProfile profile = mAccountHeader.getActiveProfile();
            if (profile instanceof IDrawerItem) {
                mItemAdapter.add(generateMiniDrawerItem((IDrawerItem) profile));
                profileOffset = 1;
            }
        }

        int select = -1;
        if (mDrawer != null) {
            if (getDrawerItems() != null) {
                //migrate to miniDrawerItems
                int length = getDrawerItems().size();

                int position = 0;
                for (int i = 0; i < length; i++) {
                    IDrawerItem miniDrawerItem = generateMiniDrawerItem(getDrawerItems().get(i));
                    if (miniDrawerItem != null) {
                        if (miniDrawerItem.isSelected()) {
                            select = position;
                        }
                        mItemAdapter.add(miniDrawerItem);
                        position = position + 1;
                    }
                }

                if (select >= 0) {
                    //+1 because of the profile
                    mAdapter.select(select + profileOffset);
                }
            }
        }

        //listener
        if (mOnMiniDrawerItemOnClickListener != null) {
            mAdapter.withOnClickListener(mOnMiniDrawerItemOnClickListener);
        } else {
            mAdapter.withOnClickListener(new OnClickListener<IDrawerItem>() {
                @Override
                public boolean onClick(View v, IAdapter<IDrawerItem> adapter, final IDrawerItem item, final int position) {
                    int type = getMiniDrawerType(item);

                    //if a listener is defined and we consume the event return
                    if (mOnMiniDrawerItemClickListener != null && mOnMiniDrawerItemClickListener.onItemClick(v, position, item, type)) {
                        return false;
                    }

                    if (type == ITEM) {
                        //fire the onClickListener also if the specific drawerItem is not Selectable
                        if (item.isSelectable()) {
                            //make sure we are on the original drawerItemList
                            if (mAccountHeader != null && mAccountHeader.isSelectionListShown()) {
                                mAccountHeader.toggleSelectionList(v.getContext());
                            }
                            IDrawerItem drawerItem = mDrawer.getDrawerItem(item.getIdentifier());
                            if (drawerItem != null && !drawerItem.isSelected()) {
                                //set the selection
                                mDrawer.setSelection(item, true);
                            }
                        } else if (mDrawer.getOnDrawerItemClickListener() != null) {
                            //get the original `DrawerItem` from the Drawer as this one will contain all information
                            mDrawer.getOnDrawerItemClickListener().onItemClick(v, position, DrawerUtils.getDrawerItem(getDrawerItems(), item.getIdentifier()));
                        }
                    } else if (type == PROFILE) {
                        if (mAccountHeader != null && !mAccountHeader.isSelectionListShown()) {
                            mAccountHeader.toggleSelectionList(v.getContext());
                        }
                        if (mCrossFader != null) {
                            mCrossFader.crossfade();
                        }
                    }
                    return false;
                }
            });
        }
        mAdapter.withOnLongClickListener(mOnMiniDrawerItemLongClickListener);
        mRecyclerView.scrollToPosition(0);
    }
339318
def _create(self):
        

        if 'name' in self._data:
            obj_ref = self.api.add(self.obj_parent(), self.obj_type(), name=self.obj_name())
        else:
            obj_ref = self.api.add(self.obj_parent(), self.obj_type())
        self.api.commit()
        return self.api.remapIds(obj_ref)
85982
def default_links_item_factory(community):
    """"""
    return dict(
        self=url_for(
            '.communities_item', community_id=community['id'], _external=True),
        html=current_app.config.get(
            'COMMUNITIES_URL_COMMUNITY_VIEW',
            '{protocol}://{host}/communities/{community_id}/'
        ).format(
            protocol=request.environ['wsgi.url_scheme'],
            host=request.environ['HTTP_HOST'],
            community_id=community['id']
        )
    )