Populate internal map to translate between incoming message event type and saga type.
334735
private Multimap<Class, SagaType> initializeMessageMappings(final Map<Class<? extends Saga>, SagaHandlersMap> handlersMap) {
        Multimap<Class, SagaType> scannedTypes = LinkedListMultimap.create();

        for (Map.Entry<Class<? extends Saga>, SagaHandlersMap> entry : handlersMap.entrySet()) {
            Class<? extends Saga> sagaClass = entry.getKey();

            Collection<MessageHandler> sagaHandlers = entry.getValue().messageHandlers();
            for (MessageHandler handler : sagaHandlers) {

                // remember all message types where a completely new saga needs to be started.
                if (handler.getStartsSaga()) {
                    scannedTypes.put(handler.getMessageType(), SagaType.startsNewSaga(sagaClass));
                } else {
                    scannedTypes.put(handler.getMessageType(), SagaType.continueSaga(sagaClass));
                }
            }
        }

        return scannedTypes;
    }
689030
private Map<String, Properties> loadRegisteredMessageResources(String name) {
        Map<String, Properties> messageResources = new TreeMap<>();

        // Load default messages
        Properties defaultMessages = loadMessages(String.format(name, ""));
        if (defaultMessages == null) {
            log.error("Could not locate the default messages resource '{}', please create it.", String.format(name, ""));
        } else {
            messageResources.put("", defaultMessages);
        }

        // Load the registered language resources
        List<String> registeredLanguages = languages.getRegisteredLanguages();
        for (String language : registeredLanguages) {
            // First step: Load complete language eg. en-US
            Properties messages = loadMessages(String.format(name, "_" + language));

            Properties messagesLangOnly = null;

            // If the language has a country code load the default values for
            // the language. For example missing keys in en-US will
            // be filled-in by the default language.
            String langComponent = languages.getLanguageComponent(language);
            if (!langComponent.equals(language)) {
                // see if we have already loaded the language messages
                messagesLangOnly = messageResources.get(langComponent);
                if (messagesLangOnly == null) {
                    // load the language messages
                    messagesLangOnly = loadMessages(String.format(name, "_" + langComponent));
                }
            }

            // If a language is registered in application.properties it should
            // be there.
            if (messages == null) {
                log.error(
                    "Could not locate the '{}' messages resource '{}' specified in '{}'.",
                    language, String.format(name, "_" + language),
                    PippoConstants.SETTING_APPLICATION_LANGUAGES);
            } else {
                // add a new language

                // start with the default messages
                Properties compositeMessages = new Properties(defaultMessages);

                // put all the language component messages "en"
                if (messagesLangOnly != null) {
                    compositeMessages.putAll(messagesLangOnly);

                    // cache language component messages
                    if (!messageResources.containsKey(langComponent)) {
                        Properties langResources = new Properties();
                        langResources.putAll(compositeMessages);
                        messageResources.put(langComponent, langResources);
                    }
                }

                // put all the language specific messages "en-US"
                compositeMessages.putAll(messages);

                // and add the composite messages to the hashmap with the
                // mapping.
                messageResources.put(language.toLowerCase(), compositeMessages);
            }
        }

        return Collections.unmodifiableMap(messageResources);
    }
235874
function createI18nMessageFactory(interpolationConfig) {
    var /** @type {?} */ visitor = new _I18nVisitor(_expParser, interpolationConfig);
    return function (nodes, meaning, description) {
        return visitor.toI18nMessage(nodes, meaning, description);
    };
}
1234519
def cli(env):
    """"""
    mgr = SoftLayer.EventLogManager(env.client)

    event_log_types = mgr.get_event_log_types()

    table = formatting.Table(COLUMNS)

    for event_log_type in event_log_types:
        table.add_row([event_log_type])

    env.fout(table)
749051
def GetCustomJsonFieldMapping(message_type, python_name=None, json_name=None):
    """"""
    return _FetchRemapping(message_type, 'field',
                           python_name=python_name, json_name=json_name,
                           mappings=_JSON_FIELD_MAPPINGS)
295438
function populateMaps (extensions, types) {
  // source preference (least -> most)
  var preference = ['nginx', 'apache', undefined, 'iana']

  Object.keys(db).forEach(function forEachMimeType (type) {
    var mime = db[type]
    var exts = mime.extensions

    if (!exts || !exts.length) {
      return
    }

    // mime -> extensions
    extensions[type] = exts

    // extension -> mime
    for (var i = 0; i < exts.length; i++) {
      var extension = exts[i]

      if (types[extension]) {
        var from = preference.indexOf(db[types[extension]].source)
        var to = preference.indexOf(mime.source)

        if (types[extension] !== 'application/octet-stream' &&
          (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) {
          // skip the remapping
          continue
        }
      }

      // set the extension -> mime
      types[extension] = type
    }
  })
}
489388
def _projected_entity_to_message(ent, message_type):
  
  msg = message_type()
  analyzed = _analyze_indexed_fields(ent._projection)
  for name, sublist in analyzed.iteritems():
    prop = ent._properties[name]
    val = prop._get_value(ent)
    assert isinstance(prop, model.StructuredProperty) == bool(sublist)
    if sublist:
      field = message_type.field_by_name(name)
      assert isinstance(field, messages.MessageField)
      assert prop._repeated == field.repeated
      if prop._repeated:
        assert isinstance(val, list)
        val = [_projected_entity_to_message(v, field.type) for v in val]
      else:
        assert isinstance(val, prop._modelclass)
        val = _projected_entity_to_message(val, field.type)
    setattr(msg, name, val)
  return msg
607436
void mapTraitInstanceToVertex(ITypedStruct traitInstance, IDataType entityType, AtlasVertex parentInstanceVertex)
            throws AtlasException {
        // add a new AtlasVertex for the struct or trait instance
        final String traitName = traitInstance.getTypeName();
        AtlasVertex traitInstanceVertex = graphHelper.createVertexWithoutIdentity(traitInstance.getTypeName(), null,
                typeSystem.getDataType(TraitType.class, traitName).getAllSuperTypeNames());
        if (LOG.isDebugEnabled()) {
            LOG.debug("created vertex {} for trait {}", string(traitInstanceVertex), traitName);
        }

        // map all the attributes to this newly created AtlasVertex
        mapInstanceToVertex(traitInstance, traitInstanceVertex, traitInstance.fieldMapping().fields, false, Operation.CREATE);

        // add an edge to the newly created AtlasVertex from the parent
        String relationshipLabel = GraphHelper.getTraitLabel(entityType.getName(), traitName);
        graphHelper.getOrCreateEdge(parentInstanceVertex, traitInstanceVertex, relationshipLabel);
    }
192896
private static MessageInfoType mapMessageInfo(MessageInfo messageInfo) {
        if (messageInfo == null) {
            return null;
        }
        MessageInfoType miType = new MessageInfoType();
        miType.setMessageId(messageInfo.getMessageId());
        miType.setFlowId(messageInfo.getFlowId());
        miType.setPorttype(convertString(messageInfo.getPortType()));
        miType.setOperationName(messageInfo.getOperationName());
        miType.setTransport(messageInfo.getTransportType());
        return miType;
    }
1285601
def map_init(interface, params):
    """"""
    import numpy as np
    import random
    np.random.seed(params['seed'])
    random.seed(params['seed'])
    return params
177608
def generate_message_mappings_array(outf, msgs):
    """"""

    classes = []
    for msg in msgs:
        classes.append("%u: %s.self" % (msg.id, msg.swift_name))
    t.write(outf, """



/**
    Array for mapping message id to proper struct
*/
private let messageIdToClass: [UInt8: Message.Type] = [${ARRAY_CONTENT}]
""", {'ARRAY_CONTENT' : ", ".join(classes)})
1201832
def InitFromGrrMessage(self, message):
    """"""

    if message.source:
      self.client_id = message.source.Basename()
    self.payload_type = compatibility.GetName(message.payload.__class__)
    self.payload = message.payload
    self.timestamp = message.age

    return self
470375
function transformTypeImport(path, state) {
    var source = path.get('source');
    if (source.type === 'StringLiteral') {
      var module = mapModule(state, source.node.value);
      if (module) {
        source.replaceWith(t.stringLiteral(module));
      }
    }
  }
9452
def __make_innermsg(resource, rtype, ref, action=None, payload=None, limit=None):
        
        if action is not None and not isinstance(action, (tuple, list)):
            raise TypeError('action must be None/tuple/list')
        p = {M_RESOURCE: resource,
             M_TYPE: int(rtype),
             M_CLIENTREF: ref,
             # Ensure action path consists only of strings
             M_ACTION: tuple(u(element) for element in action) if action else None,
             M_PAYLOAD: payload}
        if limit is not None:  # Note: fmtted like "0/15" where 0 = offset, 15 = limit
            p[M_RANGE] = limit
        return p
1091513
function MessageEvent (type, eventInitDict) {
  Object.defineProperty(this, 'type', { writable: false, value: type, enumerable: true })
  for (var f in eventInitDict) {
    if (eventInitDict.hasOwnProperty(f)) {
      Object.defineProperty(this, f, { writable: false, value: eventInitDict[f], enumerable: true })
    }
  }
}
737105
function() {
            var that = this;

            return api.execute("get:types")
            .then(function(types) {
                return dialogs.fields(i18n.t("visualization.create.title"), {
                    "eventName": {
                        'label': i18n.t("visualization.create.fields.eventName"),
                        'type': "select",
                        'options': _.chain(types)
                        .map(function(type) {
                            return [type.type, type.type];
                        })
                        .object()
                        .value()
                    },
                    "type": {
                        'label': i18n.t("visualization.create.fields.type"),
                        'type': "select",
                        'options': _.chain(allVisualizations)
                        .map(function(visualization, vId) {
                            return [
                                vId,
                                visualization.title
                            ];
                        })
                        .object()
                        .value()
                    }
                })
            })
            .then(function(data) {
                that.report.visualizations.add(data);

                return that.report.edit().fail(dialogs.error);
            });
        }
273210
function  {
  var defaultLocaleBundle, localeBundle, merged;
  var aux = {};

  init();

  // Load i18n content.
  loadCldr(defaultLocale);
  loadCldr(locale);

  defaultLocaleBundle = new Globalize(defaultLocale).cldr.attributes.bundle;
  localeBundle = new Globalize(locale).cldr.attributes.bundle;

  assertLocale(locale);
  assert(typeof translation === "object", "missing or invalid `translation` argument, JSON expected (e.g., {\"en\": ...})");
  assert(typeof defaultLocale === "string", "missing or invalid `defaultLocale` argument, String expected (e.g., \"en\")");

  aux[localeBundle] = generateDefaultTranslation(defaultLocale)[defaultLocaleBundle];
  merged = merge({}, aux, translation);
  if (orderedStringify(translation) !== orderedStringify(merged)) {
    return merged;
  }
}