Remove CGC attachments.

        :return: True if CGC attachments are found and removed, False otherwise
        :rtype: bool
778447
def remove_cgc_attachments(self):
        

        cgc_package_list = None
        cgc_extended_application = None

        for data in self.data:
            if data.sort == 'cgc-package-list':
                cgc_package_list = data
            elif data.sort == 'cgc-extended-application':
                cgc_extended_application = data

        if not cgc_package_list or not cgc_extended_application:
            return False

        if cgc_package_list.skip or cgc_extended_application.skip:
            # they have already been removed
            # so we still return True to indicate that CGC attachments have been removed
            return True

        # there is a single function referencing them
        cgcpl_memory_data = self.cfg.memory_data.get(cgc_package_list.addr, None)
        cgcea_memory_data = self.cfg.memory_data.get(cgc_extended_application.addr, None)
        refs = self.cfg.model.references

        if cgcpl_memory_data is None or cgcea_memory_data is None:
            return False

        if len(refs.data_addr_to_ref[cgcpl_memory_data.addr]) != 1:
            return False
        if len(refs.data_addr_to_ref[cgcea_memory_data.addr]) != 1:
            return False

        # check if the irsb addresses are the same
        if next(iter(refs.data_addr_to_ref[cgcpl_memory_data.addr])).block_addr != \
                next(iter(refs.data_addr_to_ref[cgcea_memory_data.addr])).block_addr:
            return False

        insn_addr = next(iter(refs.data_addr_to_ref[cgcpl_memory_data.addr])).insn_addr
        # get the basic block
        cfg_node = self.cfg.get_any_node(insn_addr, anyaddr=True)
        if not cfg_node:
            return False

        func_addr = cfg_node.function_address

        # this function should be calling another function
        sub_func_addr = None
        if func_addr not in self.cfg.functions:
            return False
        function = self.cfg.functions[func_addr]
        # traverse the graph and make sure there is only one call edge
        calling_targets = [ ]
        for _, dst, data in function.transition_graph.edges(data=True):
            if 'type' in data and data['type'] == 'call':
                calling_targets.append(dst.addr)

        if len(calling_targets) != 1:
            return False

        sub_func_addr = calling_targets[0]

        # alright. We want to nop this function, as well as the subfunction
        proc = next((p for p in self.procedures if p.addr == func_addr), None)
        if proc is None:
            return False

        subproc = next((p for p in self.procedures if p.addr == sub_func_addr), None)
        if subproc is None:
            return False

        # if those two data entries have any label, we should properly modify them
        # at this point, we are fairly confident that none of those labels are direct data references to either package
        # list or extended application
        has_label = True
        lowest_address = min(cgc_package_list.addr, cgc_extended_application.addr)
        for obj in (cgc_package_list, cgc_extended_application):
            labels = obj.labels
            for addr, label in labels:
                if addr != lowest_address:
                    label.base_addr = lowest_address

        if has_label:
            # is there any memory data entry that ends right at the lowest address?
            data = next((d for d in self.data if d.addr is not None and d.addr + d.size == lowest_address), None)
            if data is None:
                # since there is no gap between memory data entries (we guarantee that), this can only be that no other
                # data resides in the same memory region that CGC attachments are in
                pass
            else:
                lbl = self.symbol_manager.addr_to_label[lowest_address][0]
                if lbl not in data.end_labels:
                    data.end_labels.append(lbl)

        # practically nop the function
        proc.asm_code = "\tret\n"
        subproc.asm_code = "\tret\n"

        # remove those two data entries
        cgc_package_list.skip = True
        cgc_extended_application.skip = True

        l.info('CGC attachments are removed.')

        return True
688774
def flush(self):
        
        annotation = self.get_annotation()
        if annotation.get(ATTACHMENTS_STORAGE) is not None:
            del annotation[ATTACHMENTS_STORAGE]
664376
public function removeAttachments()
    {
        if (func_num_args() > 0) {
            $indices = is_array(func_get_arg(0)) ? func_get_arg(0) : func_get_args();

            foreach ($indices as $index) {
                unset($this->attachments[$index]);
            }

            $this->attachments = array_values($this->attachments);
        } else {
            $this->attachments = [];
        }

        return $this;
    }
364250
def clear(self, delete_thumbnails=False):
        
        prefix = settings.THUMBNAIL_KEY_PREFIX
        for key in self._find_keys_raw(prefix):
            self.cache.delete(key)
        KVStoreModel.objects.filter(key__startswith=prefix).delete()
        if delete_thumbnails:
            self.delete_all_thumbnail_files()
967627
public function clearCCs()
    {
        foreach ($this->cc as $cc) {
            unset($this->all_recipients[strtolower($cc[0])]);
        }
        $this->cc = array();
    }
1147548
def remove_file_filters(self, file_filters):
        
        self.file_filters = util.remove_from_list(self.file_filters,
                                                  file_filters)
480224
def remove_blacklisted_filepaths(self, filepaths):
        
        filepaths = util.to_absolute_paths(filepaths)
        black_paths = self.blacklisted_filepaths
        black_paths = util.remove_from_set(black_paths, filepaths)
1242797
def delete_attachment(self, id):
        
        url = self._get_url('attachment/' + str(id))
        return self._session.delete(url)
256497
def remove(self, force=False):
        
        if force:
            _fs, filename = opener.parse(self.uri)
            _fs.remove(filename)
        self.uri = None
1090939
def _clean(c):
    
    if isdir(c.sphinx.target):
        rmtree(c.sphinx.target)
405263
def _clear(self):
        
        draw = ImageDraw.Draw(self._background_image)
        draw.rectangle(self._device.bounding_box,
                       fill="black")
        del draw
1131792
def uncache(self):
        

        LOGGER.debug("> Uncaching '{0}' file content.".format(self.__path))

        self.__content = []
        return True
146569
def remove(self, attachments):
        
        if isinstance(attachments, (list, tuple)):
            attachments = ({attachment.name
                            if isinstance(attachment, BaseAttachment)
                            else attachment for attachment in attachments})
        elif isinstance(attachments, str):
            attachments = {attachments}
        elif isinstance(attachments, BaseAttachment):
            attachments = {attachments.name}
        else:
            raise ValueError('Incorrect parameter type for attachments')

        new_attachments = []
        for attachment in self.__attachments:
            if attachment.name not in attachments:
                new_attachments.append(attachment)
            else:
                if attachment.on_cloud:
                    # add to removed_attachments so later we can delete them
                    self.__removed_attachments.append(
                        attachment)
        self.__attachments = new_attachments
        self._update_parent_attachments()
        self._track_changes()
1157054
def remove_cached_item(self, path):
        
        item_path = '%s/%s/%s' % (
                current_app.static_folder,
                self.cache_folder,
                path.strip('/')
            )

        if os.path.isfile(item_path):
            os.remove(item_path)

        return True
793244
public boolean remove()
    {
        boolean bSuccess = false;
        try   {
            if ((this.getEditMode() == Constants.EDIT_IN_PROGRESS)
                || (this.getEditMode() == Constants.EDIT_CURRENT))
                    this.getTable().remove();
        } catch (Exception ex)  {
            ex.printStackTrace();
            bSuccess = false;
        }
        return bSuccess;
    }
446799
def clean(self):
        
        #TODO: add cleaning of mask files, *if* created ...
        for f in self.catalog_names:
            if 'match' in f:
                if os.path.exists(self.catalog_names[f]):
                    log.info('Deleting intermediate match file: %s'%
                                self.catalog_names[f])
                    os.remove(self.catalog_names[f])
            else:
                for extn in f:
                    if os.path.exists(extn):
                        log.info('Deleting intermediate catalog: %d'%extn)
                        os.remove(extn)
891982
def remove_library_path(path: str) -> bool:
    

    if path in sys.path:
        sys.path.remove(path)
        return True

    return False