Return default mdata map for Objective
353839
def get_objective_mdata():
    """"""
    return {
        'cognitive_process': {
            'element_label': {
                'text': 'cognitive process',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
        'assessment': {
            'element_label': {
                'text': 'assessment',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
        'knowledge_category': {
            'element_label': {
                'text': 'knowledge category',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
    }
715899
def get_authentication_mdata():
    """"""
    return {
        'agent': {
            'element_label': {
                'text': 'agent',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
    }
520707
def get_osid_object_mdata():
    """"""
    return {
        'display_name': {
            'element_label': {
                'text': 'Display Name',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'Required, 255 character maximum',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_string_values': [{
                'text': '',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            }],
            'syntax': 'STRING',
            'minimum_string_length': 0,
            'maximum_string_length': 256,
            'string_set': []
        },
        'description': {
            'element_label': {
                'text': 'Description',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'Optional',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_string_values': [{
                'text': '',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            }],
            'syntax': 'STRING',
            'minimum_string_length': 0,
            'maximum_string_length': 1024,
            'string_set': []
        },
        'genus_type': {
            'element_label': {
                'text': 'Genus Type',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'Required genus Type of type osid.type.Type',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': True,
            'value': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_type_values': [str(DEFAULT_GENUS_TYPE)],
            'syntax': 'TYPE',
            'type_set': []
        }
    }
985676
def default(self, obj):  # pylint: disable=method-hidden
        """"""

        if hasattr(obj, 'strftime'):
            return obj.strftime("%Y-%m-%dT%H:%M:%SZ")
        elif hasattr(obj, 'get_public_dict'):
            return obj.get_public_dict()
        else:
            return json.JSONEncoder.default(self, obj)
1085710
def map_data(self, cached=False):
        '''
        
        '''
        ret = {'create': {}}
        pmap = self.map_providers_parallel(cached=cached)
        exist = set()
        defined = set()
        rendered_map = copy.deepcopy(self.rendered_map)
        for profile_name, nodes in six.iteritems(rendered_map):
            if profile_name not in self.opts['profiles']:
                msg = (
                    'The required profile, \'{0}\', defined in the map '
                    'does not exist. The defined nodes, {1}, will not '
                    'be created.'.format(
                        profile_name,
                        ', '.join('\'{0}\''.format(node) for node in nodes)
                    )
                )
                log.error(msg)
                if 'errors' not in ret:
                    ret['errors'] = {}
                ret['errors'][profile_name] = msg
                continue

            profile_data = self.opts['profiles'].get(profile_name)

            for nodename, overrides in six.iteritems(nodes):
                # Get associated provider data, in case something like size
                # or image is specified in the provider file. See issue #32510.
                if 'provider' in overrides and overrides['provider'] != profile_data['provider']:
                    alias, driver = overrides.get('provider').split(':')
                else:
                    alias, driver = profile_data.get('provider').split(':')

                provider_details = copy.deepcopy(self.opts['providers'][alias][driver])
                del provider_details['profiles']

                # Update the provider details information with profile data
                # Profile data and node overrides should override provider data, if defined.
                # This keeps map file data definitions consistent with -p usage.
                salt.utils.dictupdate.update(provider_details, profile_data)
                nodedata = copy.deepcopy(provider_details)

                # Update profile data with the map overrides
                for setting in ('grains', 'master', 'minion', 'volumes',
                                'requires'):
                    deprecated = 'map_{0}'.format(setting)
                    if deprecated in overrides:
                        log.warning(
                            'The use of \'%s\' on the \'%s\' mapping has '
                            'been deprecated. The preferred way now is to '
                            'just define \'%s\'. For now, salt-cloud will do '
                            'the proper thing and convert the deprecated '
                            'mapping into the preferred one.',
                            deprecated, nodename, setting
                        )
                        overrides[setting] = overrides.pop(deprecated)

                # merge minion grains from map file
                if 'minion' in overrides and \
                        'minion' in nodedata and \
                        'grains' in overrides['minion'] and \
                        'grains' in nodedata['minion']:
                    nodedata['minion']['grains'].update(
                        overrides['minion']['grains']
                    )
                    del overrides['minion']['grains']
                    # remove minion key if now is empty dict
                    if not overrides['minion']:
                        del overrides['minion']

                nodedata = salt.utils.dictupdate.update(nodedata, overrides)
                # Add the computed information to the return data
                ret['create'][nodename] = nodedata
                # Add the node name to the defined set
                alias, driver = nodedata['provider'].split(':')
                defined.add((alias, driver, nodename))

        def get_matching_by_name(name):
            matches = {}
            for alias, drivers in six.iteritems(pmap):
                for driver, vms in six.iteritems(drivers):
                    for vm_name, details in six.iteritems(vms):
                        if vm_name == name and driver not in matches:
                            matches[driver] = details['state']
            return matches

        for alias, drivers in six.iteritems(pmap):
            for driver, vms in six.iteritems(drivers):
                for name, details in six.iteritems(vms):
                    exist.add((alias, driver, name))
                    if name not in ret['create']:
                        continue

                    # The machine is set to be created. Does it already exist?
                    matching = get_matching_by_name(name)
                    if not matching:
                        continue

                    # A machine by the same name exists
                    for item in matching:
                        if name not in ret['create']:
                            # Machine already removed
                            break

                        log.warning("'%s' already exists, removing from "
                                    'the create map.', name)

                        if 'existing' not in ret:
                            ret['existing'] = {}
                        ret['existing'][name] = ret['create'].pop(name)

        if 'hard' in self.opts and self.opts['hard']:
            if self.opts['enable_hard_maps'] is False:
                raise SaltCloudSystemExit(
                    'The --hard map can be extremely dangerous to use, '
                    'and therefore must explicitly be enabled in the main '
                    'configuration file, by setting \'enable_hard_maps\' '
                    'to True'
                )

            # Hard maps are enabled, Look for the items to delete.
            ret['destroy'] = exist.difference(defined)
        return ret
532411
def _init_map(self, record_types=None, **kwargs):
        """"""
        osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
        self._my_map['assignedObjectiveBankIds'] = [str(kwargs['objective_bank_id'])]
        self._my_map['courseIds'] = self._courses_default
        self._my_map['assessmentIds'] = self._assessments_default
        self._my_map['objectiveId'] = str(kwargs['objective_id'])
        self._my_map['assetIds'] = self._assets_default
552144
function mapToObject ( map, opts ) {
	const length = map.getLength();
	const data = {};
	for ( let i = 0; i < length; i++ ) {
		const key = map.getKey(i).getValue();
		const value = getJsonValueFromSassValue(map.getValue(i), opts);
		data[key] = value;
	}
	return data;
}
1069678
def ConvCnstrMODMaskOptionsDefaults(method='fista'):
    

    dflt = copy.deepcopy(ccmodmsk_class_label_lookup(method).Options.defaults)
    if method == 'fista':
        dflt.update({'MaxMainIter': 1, 'BackTrack':
                     {'gamma_u': 1.2, 'MaxIter': 50}})
    else:
        dflt.update({'MaxMainIter': 1, 'AutoRho':
                     {'Period': 10, 'AutoScaling': False,
                      'RsdlRatio': 10.0, 'Scaling': 2.0,
                      'RsdlTarget': 1.0}})
    return dflt
507484
function getMap(options) {
  var obj = options.map;
  var keys = options.keys;
  var l = keys.length;

  for (var i = 0; i < l; i++) {
    var key = keys[i];

    if (plainObject(key)) {
      throw Error('Tried to get map with object key');
    }

    obj = obj[key];

    if (obj == null) {
      return obj;
    }
  }

  return obj;
}
415168
private Map<String,Object> getMap()
    {
        if (m_data == null)
            m_data = new HashMap<String,Object>();
        return (Map<String, Object>)m_data;
    }
317030
def get_default_mapping(self, z, cmapper):
        

        map_annular = dict(x=self.max_radius, y=self.max_radius,
                           inner_radius="inner_radius",
                           outer_radius="outer_radius",
                           start_angle="start_angle",
                           end_angle="end_angle",
                           fill_color={'field': z, 'transform': cmapper})

        map_seg_label = dict(x="x", y="y", text="text",
                             angle="angle", text_align="center")

        map_ann_label = dict(x="x", y="y", text="text",
                             angle="angle", text_align="center",
                             text_baseline="bottom")

        map_xmarks = dict(xs="xs", ys="ys")

        map_ymarks = dict(x= self.max_radius, y=self.max_radius,
                          start_angle=0, end_angle=2*np.pi, radius="radius")

        return {'annular_wedge_1': map_annular,
                'text_1': map_seg_label,
                'text_2': map_ann_label,
                'multi_line_1': map_xmarks,
                'arc_1': map_ymarks}
868770
function extractMDNProperties(mdnEntry) {
  if (mdnEntry.status === 'standard') {
    return {
      syntax: mdnEntry.syntax
    }
  }

  return {
    status: abbreviateStatus(mdnEntry.status),
    syntax: mdnEntry.syntax
  }
}
455304
def _update_object_map(self, obj_map):
        """"""
        # TODO: Look for <img> tags to add in alt-text and description
        # TODO: Look for <video> and <audio> tags to add in description, transcripts and vtt files?
        try:
            super(FilesRecord, self)._update_object_map(obj_map)
        except AttributeError:
            pass

        bypass_asset_content_authorization = False
        acls = None

        try:
            config = self.my_osid_object._runtime.get_configuration()
            parameter_id = Id('parameter:bypassAuthorizationForFilesRecordAssetContentLookup@json')
            bypass_asset_content_authorization = config.get_value_by_parameter(parameter_id).get_boolean_value()
        except (AttributeError, KeyError, NotFound):
            pass

        def replace_url_in_display_text(potential_display_text, dict_files_map):
            if ('text' in potential_display_text and
                    potential_display_text['text'] is not None and
                    'AssetContent' in potential_display_text['text']):
                # assume markup? Wrap this in case it's not a valid XML doc
                # with a single parent object
                wrapped_text = '<wrapper>{0}</wrapper'.format(potential_display_text['text'])
                soup = BeautifulSoup(wrapped_text, 'xml')
                media_file_elements = soup.find_all(src=media_regex)
                media_file_elements += soup.find_all(data=media_regex)
                for media_file_element in media_file_elements:
                    if 'src' in media_file_element.attrs:
                        media_key = 'src'
                    else:
                        media_key = 'data'
                    if ':' not in media_file_element[media_key]:
                        continue

                    media_label = media_file_element[media_key].split(':')[-1]

                    if media_label in dict_files_map:
                        asset_id = Id(dict_files_map[media_label]['assetId'])
                        ac_id = Id(dict_files_map[media_label]['assetContentId'])
                        if bypass_asset_content_authorization:
                            ac = acls.get_asset_content(ac_id)
                        else:
                            ac = self._get_asset_content(asset_id=asset_id, asset_content_id=ac_id)

                        if media_file_element.name == 'track':
                            try:
                                if not ac.has_files():
                                    continue
                            except AttributeError:
                                # non-multi-language VTT files
                                media_file_element[media_key] = ac.get_url()
                            else:
                                media_file_element[media_key] = ac.get_url()
                                media_file_element['srclang'] = ac.get_vtt_locale_identifier().lower()[0:2]
                                media_file_element['label'] = ac.get_vtt_locale_label()
                        elif media_file_element.name == 'transcript':
                            if not ac.has_files():
                                continue
                            transcript_template_path = '{0}/osid/transcript_template.xml'.format(ABS_PATH)
                            with codecs.open(transcript_template_path, 'r', encoding='utf-8') as template_file:
                                template = template_file.read().format(media_label,
                                                                       ac.get_transcript_locale_label().lower(),
                                                                       ac.get_transcript_locale_label().title(),
                                                                       ac.get_transcript_text())
                                new_template_tag = BeautifulSoup(template, 'xml').div
                                # media_file_element.replace_with(new_template_tag)
                                p_parent = None
                                for parent in media_file_element.parents:
                                    if parent is not None and parent.name != 'p':
                                        # insert the transcript after the top p tag
                                        # so that we don't create invalid HTML by nesting
                                        # <div> and <aside> inside of a <p> tag
                                        p_parent.insert_after(new_template_tag)
                                        break
                                    p_parent = parent
                                media_file_element.extract()
                        else:
                            media_file_element[media_key] = ac.get_url()

                    # check for alt-tags
                    if 'alt' in media_file_element.attrs:
                        alt_tag_label = media_file_element['alt'].split(':')[-1]
                        if alt_tag_label in dict_files_map:
                            asset_id = Id(dict_files_map[alt_tag_label]['assetId'])
                            ac_id = Id(dict_files_map[alt_tag_label]['assetContentId'])
                            if bypass_asset_content_authorization:
                                ac = acls.get_asset_content(ac_id)
                            else:
                                ac = self._get_asset_content(asset_id=asset_id, asset_content_id=ac_id)
                            try:
                                media_file_element['alt'] = ac.get_alt_text().text
                            except AttributeError:
                                pass

                potential_display_text['text'] = soup.wrapper.renderContents().decode('utf-8')
            else:
                for new_key, value in potential_display_text.items():
                    if isinstance(value, list):
                        new_files_map = dict_files_map
                        if 'fileIds' in potential_display_text:
                            new_files_map = potential_display_text['fileIds']
                        potential_display_text[new_key] = check_list_children(value, new_files_map)
            return potential_display_text

        def check_list_children(potential_text_list, list_files_map):
            updated_list = []
            for child in potential_text_list:
                if isinstance(child, dict):
                    files_map = list_files_map
                    if 'fileIds' in child:
                        files_map = child['fileIds']
                    updated_list.append(replace_url_in_display_text(child, files_map))
                elif isinstance(child, list):
                    updated_list.append(check_list_children(child, list_files_map))
                else:
                    updated_list.append(child)
            return updated_list

        if bypass_asset_content_authorization:
            # One assumption is that the object's catalogId can be used
            # as the repositoryId
            manager = self.my_osid_object._get_provider_manager('REPOSITORY')

            try:
                if self.my_osid_object._proxy is not None:
                    acls = manager.get_asset_content_lookup_session(proxy=self.my_osid_object._proxy)
                else:
                    acls = manager.get_asset_content_lookup_session()
            except AttributeError:
                pass
            else:
                acls.use_federated_repository_view()

        media_regex = re.compile('(AssetContent:)')
        original_files_map = {}
        if 'fileIds' in obj_map:
            original_files_map = obj_map['fileIds']

        for key, data in obj_map.items():
            if isinstance(data, dict):
                obj_map[key] = replace_url_in_display_text(data, original_files_map)
            elif isinstance(data, list):
                obj_map[key] = check_list_children(data, original_files_map)
562733
def _default_dict(self):
        """"""
        options = {}
        for attr, _, _, default, multi, _ in self._optiondict.values():
            if multi and default is None:
                options[attr] = []
            else:
                options[attr] = default
        return options
144098
@Deprecated
  public Map<String, String> toDataMap() {
    Map<String, String> map = Maps.newHashMap();
    map.put(PLATFORM_KEY, platform);
    map.put(NAME_KEY, getName());
    map.putAll(metadata);
    return map;
  }
659358
function getMapOption(from) {
        if (typeof options.map === 'string') {
            var mapPath = options.map + path.basename(from) + '.map';

            if (grunt.file.exists(mapPath)) {
                return grunt.file.read(mapPath);
            }
        }

        return options.map;
    }
1085517
function getPropertiesGroupsData(src) {
        var groups = [],
            objectName;

        // intersection for restoring paths sequence
        grunt.util._.intersection(src, grunt.file.expand(options.initFiles)).forEach(function (path) {

            objectName = paths.getObjectNameByInitFile(path.replace(
                new RegExp('^' + utils.toRegExpText(options.base.replace(/^\.\//, ''))),
                ''
            ).replace(/^\/+/, ''));

            grunt.verbose.ok(objectName);

            groups.push({
                objectName:          objectName,
                initFilePath:        path,
                pattern:             new RegExp('^' + utils.toRegExpText(objectName) + (objectName ? '\\.' : ''), 'i'),
                inlineProperties:    [],
                prototypeProperties: []
            });
        });

        return groups;
    }