if product is not available in sitetree anymore it is deleted (also called by Kwc_Shop_Cart_Component)
501719
private function _getProductsData(Kwf_Component_Data $subroot = null)
    {
        $ret = array();

        $items = $this->getChildRows('Products');
        $ret = array();

        foreach ($items as $i) {
            $data = Kwc_Shop_VoucherProduct_AddToCart_OrderProductData::getInstance($i->add_component_class);
            $r = array(
                'id' => $i->id,
                'additionalOrderData' => $data->getAdditionalOrderData($i),
                'price' => $this->_getProductPrice($i),
                'amount' => $data->getAmount($i),
                'text' => $data->getProductText($i),
            );
            if ($subroot) {
                $addComponent = Kwc_Shop_AddToCartAbstract_OrderProductData::getAddComponentByDbId(
                    $i->add_component_id, $subroot
                );
                if (!$addComponent) {
                    //product doesn't exist anymore, also delete from cart
                    $i->delete();
                    continue;
                } else {
                    $r['product'] = $addComponent->parent;
                    $r['text'] = $addComponent->getComponent()->getProductText($i);
                }
            }
            $ret[] = (object)$r;
        }
        return $ret;
    }
117310
public function removeOrphanProducts()
    {
        $write = $this->getConnection();
        $catalogTable = $this->getTable(Schema::EMAIL_CATALOG_TABLE);
        $select = $write->select();
        $select->reset()
            ->from(
                ['c' => $catalogTable],
                ['c.product_id']
            )
            ->joinLeft(
                [
                    'e' => $this->getTable(
                        'catalog_product_entity'
                    ),
                ],
                'c.product_id = e.entity_id'
            )
            ->where('e.entity_id is NULL');

        //delete sql statement
        $deleteSql = $select->deleteFromSelect('c');

        //run query
        $write->query($deleteSql);
    }
803967
def remove_unreferenced_items(self, stale_cts):
        
        stale_ct_ids = list(stale_cts.keys())
        parent_types = (ContentItem.objects.order_by()
                        .exclude(polymorphic_ctype__in=stale_ct_ids)
                        .values_list('parent_type', flat=True).distinct())

        num_unreferenced = 0

        for ct_id in parent_types:
            parent_ct = ContentType.objects.get_for_id(ct_id)
            unreferenced_items = (ContentItem.objects
                                  .filter(parent_type=ct_id)
                                  .order_by('polymorphic_ctype', 'pk'))

            if parent_ct.model_class() is not None:
                # Only select the items that are part of removed pages,
                # unless the parent type was removed - then removing all is correct.
                unreferenced_items = unreferenced_items.exclude(
                    parent_id__in=parent_ct.get_all_objects_for_this_type()
                )

            if unreferenced_items:
                for item in unreferenced_items:
                    self.stdout.write(
                        "- {cls}#{id} points to nonexisting {app_label}.{model}".format(
                            cls=item.__class__.__name__, id=item.pk,
                            app_label=parent_ct.app_label, model=parent_ct.model
                        ))
                    num_unreferenced += 1
                    if not self.dry_run and self.remove_unreferenced:
                        item.delete()

        if not num_unreferenced:
            self.stdout.write("No unreferenced items found.")
        else:
            self.stdout.write("{0} unreferenced items found.".format(num_unreferenced))
            if not self.remove_unreferenced:
                self.stdout.write("Re-run this command with --remove-unreferenced to remove these items")
601366
def auto_clear_shopping_cart(self, auto_clear_shopping_cart):
        
        allowed_values = ["never", "orderCreated", "orderCompleted"]  # noqa: E501
        if auto_clear_shopping_cart is not None and auto_clear_shopping_cart not in allowed_values:
            raise ValueError(
                "Invalid value for `auto_clear_shopping_cart` ({0}), must be one of {1}"  # noqa: E501
                .format(auto_clear_shopping_cart, allowed_values)
            )

        self._auto_clear_shopping_cart = auto_clear_shopping_cart
919931
def absent(profile='pagerduty', subdomain=None, api_key=None, **kwargs):
    '''
    
    '''
    r = __salt__['pagerduty_util.resource_absent']('services',
                                                   ['name', 'id'],
                                                   profile,
                                                   subdomain,
                                                   api_key,
                                                   **kwargs)
    return r
636386
def dropDataProducts(self, *pathnames):
        """"""
        trash = QTreeWidget(None)
        updated = False
        for path in pathnames:
            item = self.dpitems.get(path)
            if item and not item._dp.archived:
                self.takeTopLevelItem(self.indexOfTopLevelItem(item))
                trash.addTopLevelItem(item)
                del self.dpitems[path]
                updated = True
        if updated:
            self.emit(SIGNAL("updated"))
1265176
def cart_clear(self, CartId=None, HMAC=None, **kwargs):
        
        if not CartId or not HMAC:
            raise CartException('CartId required for CartClear call')
        response = self.api.CartClear(CartId=CartId, HMAC=HMAC, **kwargs)
        root = objectify.fromstring(response)

        new_cart = AmazonCart(root)
        self._check_for_cart_error(new_cart)

        return new_cart
530941
def OnRemoveCards(self, removedcards):
        """"""
        parentnode = self.root
        for cardtoremove in removedcards:
            (childCard, cookie) = self.GetFirstChild(parentnode)
            while childCard.IsOk():
                if self.GetItemText(childCard) == \
                        toHexString(cardtoremove.atr):
                    self.Delete(childCard)
                (childCard, cookie) = self.GetNextChild(parentnode, cookie)
        self.Expand(self.root)
        self.EnsureVisible(self.root)
        self.Repaint()
903012
function () {
            var carousel = this, n = carousel.get("numItems");

            while (n > 0) {
                if (!carousel.removeItem(0)) {
                    YAHOO.log("Item could not be removed - missing?",
                              "warn", WidgetName);
                }
                /*
                    For dynamic loading, the numItems may be much larger than
                    the actual number of items in the table. So, set the
                    numItems to zero, and break out of the loop if the table
                    is already empty.
                 */
                if (carousel._itemsTable.numItems === 0) {
                    carousel.set("numItems", 0);
                    break;
                }
                n--;
            }

            carousel.fireEvent(allItemsRemovedEvent);
        }
120467
public function remove()
    {
        //if user selected not to update modules, skipping all updates
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("noButton")) {
            \OxidEsales\Eshop\Core\Registry::getSession()->setVariable("blSkipDeletedExtChecking", true);

            return;
        }

        $oModuleList = oxNew(\OxidEsales\Eshop\Core\Module\ModuleList::class);
        $oModuleList->cleanup();
    }
699842
def child_removed(self, child):
        
        super(AbstractWidgetItemGroup, self).child_removed(child)
        self.get_member('_items').reset(self)
1010847
def find_cart_items(options)
			conditions = {:resource_id => nil, :parent_id => nil}
			conditions[:resource_id] = options[:resource].id.to_s if options[:resource]
			Auth.configuration.cart_item_class.constantize.where(conditions)
		end
1128201
private function isCartEmpty(Tree $tree): bool
    {
        $cart = Session::get('cart', []);

        return empty($cart[$tree->name()]);
    }
1242869
def prune_missing(table):
    
    try:
        for item in table.select():
            if not os.path.isfile(item.file_path):
                logger.info("File disappeared: %s", item.file_path)
                item.delete()
    except:  # pylint:disable=bare-except
        logger.exception("Error pruning %s", table)
186465
def content_deleted(sender, instance=None, **kwargs):
    
    if getattr(instance, "_index", True):
        cls = instance.get_real_instance_class()
        index = cls.search_objects.mapping.index
        doc_type = cls.search_objects.mapping.doc_type

        cls.search_objects.client.delete(index, doc_type, instance.id, ignore=[404])
717303
def on_remove(self, widget, data=None):
        """"""

        path_list = None
        if self.view is not None:
            model, path_list = self.tree_view.get_selection().get_selected_rows()
        old_path = self.get_path()
        models = [self.list_store[path][self.MODEL_STORAGE_ID] for path in path_list] if path_list else []
        if models:
            try:
                self.remove_core_elements(models)
            except AttributeError as e:
                self._logger.warning("The respective core element of {1}.list_store couldn't be removed. -> {0}"
                                  "".format(e, self.__class__.__name__))
            if len(self.list_store) > 0:
                self.tree_view.set_cursor(min(old_path[0], len(self.list_store) - 1))
            return True
        else:
            self._logger.warning("Please select an element to be removed.")
668995
def search_template_absent(name):
    '''
    
    '''

    ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}

    try:
        template = __salt__['elasticsearch.search_template_get'](id=name)
        if template:
            if __opts__['test']:
                ret['comment'] = 'Search template {0} will be removed'.format(name)
                ret['changes']['old'] = salt.utils.json.loads(template["template"])
                ret['result'] = None
            else:
                ret['result'] = __salt__['elasticsearch.search_template_delete'](id=name)
                if ret['result']:
                    ret['comment'] = 'Successfully removed search template {0}'.format(name)
                    ret['changes']['old'] = salt.utils.json.loads(template["template"])
                else:
                    ret['comment'] = 'Failed to remove search template {0} for unknown reasons'.format(name)
        else:
            ret['comment'] = 'Search template {0} is already absent'.format(name)
    except Exception as err:
        ret['result'] = False
        ret['comment'] = six.text_type(err)

    return ret