Update metadata for this HDU
763389
def _update_info(self):
        
        try:
            self._FITS.movabs_hdu(self._ext+1)
        except IOError:
            raise RuntimeError("no such hdu")

        self._info = self._FITS.get_hdu_info(self._ext+1)
1050942
def update(self):
        """"""
        for linenum in reversed(sorted(self.updates)):
            self.replace_baseline_repr(linenum, self.updates[linenum])

        if not self.TEST_MODE:
            path = '{}.update{}'.format(*os.path.splitext(self.path))
            with io.open(path, 'w', encoding='utf-8') as fh:
                fh.write('\n'.join(self.lines))
            print('UPDATE: {}'.format(self.showpath(path)))
1091973
def update(self, archive_name, version_metadata):
        '''
        
        '''
        version_metadata['updated'] = self.create_timestamp()
        version_metadata['version'] = str(
            version_metadata.get('version', None))

        if version_metadata.get('message') is not None:
            version_metadata['message'] = str(version_metadata['message'])

        self._update(archive_name, version_metadata)
695570
def _update(self, data):
      '''
      '''
      self.orderby = data['orderby']
      self.revision = data['revisionid']
      self.title = data['title']
      self.lines = [Line(self.guideid, self.stepid, line['lineid'], data=line)
                    for line in data['lines']]
      # TODO: Support video.
      if data['media']['type'] == 'image':
         self.media = []
         for image in data['media']['data']:
            self.media.append(Image(image['id']))
827196
def _update_srcmap_file(self, sources, overwrite=True):
        """"""

        if not os.path.isfile(self.files['srcmap']):
            return

        hdulist = fits.open(self.files['srcmap'])
        hdunames = [hdu.name.upper() for hdu in hdulist]

        srcmaps = {}

        for src in sources:

            if src.name.upper() in hdunames and not overwrite:
                continue
            self.logger.debug('Creating source map for %s', src.name)
            srcmaps[src.name] = self._create_srcmap(src.name, src)

        if srcmaps:
            self.logger.debug(
                'Updating source map file for component %s.', self.name)
            srcmap_utils.update_source_maps(self.files['srcmap'], srcmaps,
                                            logger=self.logger)
        hdulist.close()
740775
def _update_asset_content_filename_on_disk_to_match_id(self, ac):
        """"""
        def has_secondary_storage():
            return 'secondary_data_store_path' in self._config_map

        datastore_path = ''
        secondary_data_store_path = ''

        if 'data_store_full_path' in self._config_map:
            datastore_path = self._config_map['data_store_full_path']
        if has_secondary_storage():
            secondary_data_store_path = self._config_map['secondary_data_store_path']
        relative_path = self._config_map['data_store_path']

        filepath = os.path.join(datastore_path, ac._my_map['url'])
        old_filename = os.path.splitext(os.path.basename(filepath))[0]
        new_path = filepath.replace(old_filename, ac.ident.identifier)
        os.rename(filepath, new_path)

        # Should also rename the file stored in the secondary path
        if has_secondary_storage():
            old_path = '{0}/repository/AssetContent'.format(relative_path)
            filepath = os.path.join(datastore_path, ac._my_map['url']).replace(old_path, secondary_data_store_path)
            old_filename = os.path.splitext(os.path.basename(filepath))[0]
            new_path = filepath.replace(old_filename, ac.ident.identifier)
            os.rename(filepath, new_path)
837176
def update_metadata(self, archive_name, archive_metadata):
        '''
        
        '''

        required_metadata_keys = self.required_archive_metadata.keys()
        for key, val in archive_metadata.items():
            if key in required_metadata_keys and val is None:
                raise ValueError(
                    'Cannot remove required metadata attribute "{}"'.format(
                        key))

        self._update_metadata(archive_name, archive_metadata)
844759
private void updateMetadata(CdjStatus update, TrackMetadata data) {
        hotCache.put(DeckReference.getDeckReference(update.getDeviceNumber(), 0), data);  // Main deck
        if (data.getCueList() != null) {  // Update the cache with any hot cues in this track as well
            for (CueList.Entry entry : data.getCueList().entries) {
                if (entry.hotCueNumber != 0) {
                    hotCache.put(DeckReference.getDeckReference(update.getDeviceNumber(), entry.hotCueNumber), data);
                }
            }
        }
        deliverTrackMetadataUpdate(update.getDeviceNumber(), data);
    }
386807
def update_nb_metadata(nb_path=None, title=None, summary=None, keywords='fastai', overwrite=True, **kwargs):
    ""
    nb = read_nb(nb_path)
    data = {'title': title, 'summary': summary, 'keywords': keywords, **kwargs}
    data = {k:v for (k,v) in data.items() if v is not None} # remove none values
    if not data: return
    nb['metadata']['jekyll'] = data
    write_nb(nb, nb_path)
    NotebookNotary().sign(nb)
508725
private void updateRequestMetadata() {
        // Take event level metadata, merge with top level metadata
        // event level metadata takes precedence
        try {
            JSONObject metadata = new JSONObject();
            Iterator<String> i = prefHelper_.getRequestMetadata().keys();
            while (i.hasNext()) {
                String k = i.next();
                metadata.put(k, prefHelper_.getRequestMetadata().get(k));
            }
            JSONObject originalMetadata = params_.optJSONObject(Defines.Jsonkey.Metadata.getKey());
            if (originalMetadata != null) {
                Iterator<String> postIter = originalMetadata.keys();
                while (postIter.hasNext()) {
                    String key = postIter.next();
                    // override keys from above
                    metadata.put(key, originalMetadata.get(key));
                }
            }
            // Install metadata need to be send only with Install request
            if ((this instanceof ServerRequestRegisterInstall) && prefHelper_.getInstallMetadata().length() > 0) {
                params_.putOpt(Defines.Jsonkey.InstallMetadata.getKey(), prefHelper_.getInstallMetadata());
            }
            params_.put(Defines.Jsonkey.Metadata.getKey(), metadata);
        } catch (JSONException e) {
           PrefHelper.Debug("Could not merge metadata, ignoring user metadata.");
        }
    }
1111582
def as_hdu(self):
        ""
        from astropy.io import fits

        # transfer header, preserving ordering
        ahdr = self.get_header()
        header = fits.Header(ahdr.items())
        data = self.get_mddata()

        hdu = fits.PrimaryHDU(data=data, header=header)
        return hdu
1065332
def _update_physical_disk_details(raid_config, server):
    """"""
    raid_config['physical_disks'] = []
    physical_drives = server.get_physical_drives()
    for physical_drive in physical_drives:
        physical_drive_dict = physical_drive.get_physical_drive_dict()
        raid_config['physical_disks'].append(physical_drive_dict)
1072724
def load_metadata(self, data_dir, feature_name=None):
    """"""
    # Restore names if defined
    filepath = _get_metadata_filepath(data_dir, feature_name)
    if tf.io.gfile.exists(filepath):
      with tf.io.gfile.GFile(filepath, 'r') as f:
        info_data = json.load(f)
      self.set_encoding_format(info_data['encoding_format'])
      self.set_shape([None if d == -1 else d for d in info_data['shape']])
1114762
def update_jupytext_formats_metadata(metadata, new_format):
    """"""
    new_format = long_form_one_format(new_format)
    formats = long_form_multiple_formats(metadata.get('jupytext', {}).get('formats', ''))
    if not formats:
        return

    for fmt in formats:
        if identical_format_path(fmt, new_format):
            fmt['format_name'] = new_format.get('format_name')
            break

    metadata.setdefault('jupytext', {})['formats'] = short_form_multiple_formats(formats)
261684
def update_primary(hdu_in, hdu=None):
    
    if hdu is None:
        hdu = fits.PrimaryHDU(data=hdu_in.data, header=hdu_in.header)
    else:
        hdu.data += hdu_in.data
    return hdu
284719
def update_image(hdu_in, hdu=None):
    
    if hdu is None:
        hdu = fits.ImageHDU(
            data=hdu_in.data, header=hdu_in.header, name=hdu_in.name)
    else:
        hdu.data += hdu_in.data
    return hdu
139923
def _patchDatetimeMetadata( self, res, mk ):
        """"""
        t = res[epyc.Experiment.METADATA][mk]
        res[epyc.Experiment.METADATA][mk] = dateutil.parser.parse(t)