Add a asset and store it in the self.assets

        :returns: None
        :rtype: None
        :raises: None
502475
def add_asset(self, ):
        
        i = self.asset_treev.currentIndex()
        item = i.internalPointer()
        if item:
            asset = item.internal_data()
            if not isinstance(asset, djadapter.models.Asset):
                return
            if self._shot:
                self._shot.assets.add(asset)
            else:
                self._asset.assets.add(asset)
            self.assets.append(asset)
            item.set_parent(None)
89822
def add_asset(self, filename, asset_type, display_name,
        encoding_rate=None, frame_width=None, frame_height=None,
        encode_to=None, encode_multiple=False,
        h264_preserve_as_rendition=False, h264_no_processing=False):
        
        m = hashlib.md5()
        fp = file(filename, 'rb')
        bits = fp.read(262144)  ## 256KB
        while bits:
            m.update(bits)
            bits = fp.read(262144)
        fp.close()

        hash_code = m.hexdigest()
        refid = "%s-%s" % (os.path.basename(filename), hash_code)

        asset = {
            'filename': filename,
            'type': asset_type,
            'size': os.path.getsize(filename),
            'refid': refid,
            'hash-code': hash_code}

        if encoding_rate:
            asset.update({'encoding-rate': encoding_rate})
        if frame_width:
            asset.update({'frame-width': frame_width})
        if frame_height:
            asset.update({'frame-height': frame_height})
        if display_name:
            asset.update({'display-name': display_name})
        if encode_to:
            asset.update({'encode-to': encode_to})
            asset.update({'encode-multiple': encode_multiple})
            if encode_multiple and h264_preserve_as_rendition:
                asset.update({
                    'h264-preserve-as-rendition': h264_preserve_as_rendition})
        else:
            if h264_no_processing:
                asset.update({'h264-no-processing': h264_no_processing})
        self.assets.append(asset)
111677
@Override
    public T add(Asset asset, String name) {
        this.getArchive().add(asset, name);
        return covarientReturn();
    }
273718
def add_storage(self, storage=None, type='disk', address=None):
        
        self.cloud_manager.attach_storage(server=self.uuid,
                                          storage=storage.uuid,
                                          storage_type=type,
                                          address=address)
        storage.address = address
        storage.type = type
        self.storage_devices.append(storage)
739258
def shot_add_asset(self, *args, **kwargs):
        
        if not self.cur_shot:
            return
        dialog = AssetAdderDialog(shot=self.cur_shot)
        dialog.exec_()
        assets = dialog.assets
        atypes = {}
        for c in self.shot_asset_model.root.childItems:
            atypes[c.internal_data()] = c
        for asset in assets:
            atypeitem = atypes.get(asset.atype)
            if not atypeitem:
                atypedata = djitemdata.AtypeItemData(asset.atype)
                atypeitem = treemodel.TreeItem(atypedata, self.shot_asset_model.root)
                atypes[asset.atype] = atypeitem
            assetdata = djitemdata.AssetItemData(asset)
            treemodel.TreeItem(assetdata, atypeitem)
        self.cur_shot.save()
1044227
def add(assetclass: int, symbol: str):
    
    assert isinstance(symbol, str)
    assert isinstance(assetclass, int)

    symbol = symbol.upper()
    app = AppAggregate()
    new_item = app.add_stock_to_class(assetclass, symbol)
    print(f"Record added: {new_item}.")
1036249
def add(self, files):
    
    if files.__class__.__name__ == 'str':
      self._files.append(files)
    else:
      self._files.extend(files)
543459
def add(self, obj=None, filename=None, data=None, info={}, html=None):
        ""
        initial_last_key = list(self._files.keys())[-1] if len(self) else None
        if self._auto:
            exporters = self.exporters[:]
            # Can only associate html for one exporter at a time
            for exporter in exporters:
                self.exporters = [exporter]
                super(NotebookArchive, self).add(obj, filename, data,
                                                 info=dict(info,
                                                           notebook=self.notebook_name))
                # Only add substitution if file successfully added to archive.
                new_last_key = list(self._files.keys())[-1] if len(self) else None
                if new_last_key != initial_last_key:
                    self._replacements[new_last_key] = html

            # Restore the full list of exporters
            self.exporters = exporters
1026524
def asset_remove_asset(self, *args, **kwargs):
        
        if not self.cur_asset:
            return
        i = self.asset_asset_treev.currentIndex()
        item = i.internalPointer()
        if item:
            asset = item.internal_data()
            if not isinstance(asset, djadapter.models.Asset):
                return
            log.debug("Removing asset %s.", asset.name)
            item.set_parent(None)
            self.cur_asset.assets.remove(asset)
1289739
def AddToBalance(self, assetId, fixed8_val):
        
        found = False
        for key, balance in self.Balances.items():
            if key == assetId:
                self.Balances[assetId] = self.Balances[assetId] + fixed8_val
                found = True
        if not found:
            self.Balances[assetId] = fixed8_val
867681
private function addAsset (Asset $asset) : Asset
    {
        $storage = $this->locator->get(AssetStorage::class);
        $cache = $this->locator->get(AssetsCache::class);

        $asset = $storage->import($asset);
        $cache->add($asset);

        return $asset;
    }
155299
def asset_options
      # include all base action options
      result = options.deep_clone

      # anything left on the command line should be filters as all options have
      # been consumed, for pass through options, filters must be ignored by overwritting them
      filters = args.dup
      filters += result[:filter] if result[:filter]
      result = result.merge(:filter => filters) unless filters.empty?

      # asset type to create
      type = result[:type] || asset_type
      result = result.merge(:type => type)

      # optional key: :assets_folder, absolute path or relative to config file if :base_folder is specified
      result = result.merge(:assets_folder => configuration[:folders][:assets]) if configuration[:folders]

      # optional key: :base_folder is the folder that contains the main config file
      result = result.merge(:base_folder => File.dirname(configuration[:configuration_filename])) if configuration[:configuration_filename]

      result
    end
167424
def setup_asset_signals(self, ):
        
        log.debug("Setting up asset signals.")
        self.asset_asset_view_pb.clicked.connect(self.asset_view_asset)
        self.asset_asset_create_pb.clicked.connect(self.asset_create_asset)
        self.asset_asset_add_pb.clicked.connect(self.asset_add_asset)
        self.asset_asset_remove_pb.clicked.connect(self.asset_remove_asset)
        self.asset_task_view_pb.clicked.connect(self.asset_view_task)
        self.asset_task_create_pb.clicked.connect(self.asset_create_task)
        self.asset_desc_pte.textChanged.connect(self.asset_save)
895181
def register_base_assets(self):
        
        from abilian.web import assets as bundles

        self.register_asset("css", bundles.LESS)
        self.register_asset("js-top", bundles.TOP_JS)
        self.register_asset("js", bundles.JS)
        self.register_i18n_js(*bundles.JS_I18N)
119277
def get_asset(self):
        
        # Implemented from template for osid.learning.Activity.get_objective
        if not bool(self._my_map['assetId']):
            raise errors.IllegalState('asset empty')
        mgr = self._get_provider_manager('REPOSITORY')
        if not mgr.supports_asset_lookup():
            raise errors.OperationFailed('Repository does not support Asset lookup')
        lookup_session = mgr.get_asset_lookup_session(proxy=getattr(self, "_proxy", None))
        lookup_session.use_federated_repository_view()
        return lookup_session.get_asset(self.get_asset_id())
562239
@Override
    public T add(NamedAsset namedAsset) {

        Validate.notNull(namedAsset, "No named asset was specified");

        return add(namedAsset, namedAsset.getName());

    }
732435
def compile_assets
      sources_with_assets.each do |file|
        source = File.read file
        assets.each { |a| a.update_source! source }
        Utils.write_to_file source, file, preserve: true
      end
      self
    end