Create an event instance.
197990
def create(cls, receiver_id, user_id=None):
        """"""
        event = cls(id=uuid.uuid4(), receiver_id=receiver_id, user_id=user_id)
        event.payload = event.receiver.extract_payload()
        return event
985634
function(type, eventInit) {
    var event = extend(FileUploadEvent.DEFAULT, new EventBase(type), eventInit);

    event.prototype = EventBase.prototype;
    event.constructor = FileUploadEvent;

    return event;
}
888370
def _make_event(self, value):  # pylint: disable=arguments-differ
        """"""
        super(SystemLED, self)._make_event(
            self._led_type_code,
            self.code,
            value)
717979
@Override
	public void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		
		EVENT_CONFIGURATION = EventLinker.Configuration.newInstance(this);
	}
1336431
def _create_event(self, event_state, event_type, event_value,
                      proc_list, proc_desc, peak_time):
        
        if event_state == "WARNING" or event_state == "CRITICAL":
            # Define the automatic process sort key
            self.set_process_sort(event_type)

            # Create the new log item
            # Time is stored in Epoch format
            # Epoch -> DMYHMS = datetime.fromtimestamp(epoch)
            item = [
                time.mktime(datetime.now().timetuple()),  # START DATE
                -1,  # END DATE
                event_state,  # STATE: WARNING|CRITICAL
                event_type,  # TYPE: CPU, LOAD, MEM...
                event_value,  # MAX
                event_value,  # AVG
                event_value,  # MIN
                event_value,  # SUM
                1,  # COUNT
                [],  # TOP 3 PROCESS LIST
                proc_desc,  # MONITORED PROCESSES DESC
                glances_processes.sort_key]  # TOP PROCESS SORTKEY

            # Add the item to the list
            self.events_list.insert(0, item)

            # Limit the list to 'events_max' items
            if self.len() > self.events_max:
                self.events_list.pop()

            return True
        else:
            return False
652471
function( e )
        {
            var event      = new Event( aType );
            event.target   = self;
            event.srcEvent = e;

            aHandler( event );
        }
312308
def from_events(self, instance, ev_args, ctx):
        
        obj = yield from self._process(instance, ev_args, ctx)
        self.__set__(instance, obj)
        return obj
508523
function createEvent(params, cb) {
  var resourcePath = config.addURIParams("/events", params);
  var method = "POST";
  var data = {
    uid: params.guid,
    timestamp: (new Date().toISOString()),
    details: params.data.msg,
    eventClass: 'APP_STATE',
    eventType: params.data.type,
    eventLevel: 'FATAL',
    env: params.environment,
    domain: params.domain,
    dyno: '',
    appName: params.appname,
    updateBy: ''
  };

  params.resourcePath = resourcePath;
  params.method = method;
  params.data = data;

  mbaasRequest.app(params, cb);
}
1361896
def create_event(msg: EventMsgDict) -> Event:
    
    proto = msg.get('proto', '')
    cls = proto_dict.get(proto, Event)
    e = cls(msg['type'], msg)
    return e
966870
def trigger(self, event: str, **kwargs: Any) -> None:
        """"""
        event = event.upper()
        for func in self._event_handlers[event]:
            self.loop.create_task(func(**kwargs))
        # This will unblock anyone that is awaiting on the next loop update,
        # while still ensuring the next `await client.wait(event)` doesn't
        # immediately fire.
        async_event = self._events[event]
        async_event.set()
        async_event.clear()
1017875
def event(self, name, owner=None, **kwargs):
        
        return Event(self.tcex, name, owner=owner, **kwargs)
672153
def new_event(event):
    
    op_name = event.EventType.DESCRIPTOR.values_by_number[event.type].name
    if op_name == 'PUT':
        cls = PutEvent
    elif op_name == 'DELETE':
        cls = DeleteEvent
    else:
        raise Exception('Invalid op_name')

    return cls(event)
149395
function createEvent(config) {
  const { type, target } = config;
  const eventObject = new Event(type);

  if (target) {
    eventObject.target = target;
    eventObject.srcElement = target;
    eventObject.currentTarget = target;
  }

  return eventObject;
}
737824
def _create_event(self, alert_type, msg_title, msg, server, tags=None):
        
        msg_title = 'Couchbase {}: {}'.format(server, msg_title)
        msg = 'Couchbase instance {} {}'.format(server, msg)

        return {
            'timestamp': int(time.time()),
            'event_type': 'couchbase_rebalance',
            'msg_text': msg,
            'msg_title': msg_title,
            'alert_type': alert_type,
            'source_type_name': self.SOURCE_TYPE_NAME,
            'aggregation_key': server,
            'tags': tags,
        }
490227
private function createEventListener(): self
    {
        $aFields  = $this->getArguments();
        $aCreated = [];

        try {

            $aToCreate  = [];
            $aListeners = array_filter(
                array_map(function ($sListener) {
                    return implode('/', array_map('ucfirst', explode('/', ucfirst(trim($sListener)))));
                }, explode(',', $aFields['NAME']))
            );

            sort($aListeners);

            foreach ($aListeners as $sListener) {

                $aListenerBits = explode('/', $sListener);
                $aListenerBits = array_map('ucfirst', $aListenerBits);

                $sNamespace     = $this->generateNamespace($aListenerBits);
                $sClassName     = $this->generateClassName($aListenerBits);
                $sClassNameFull = $sNamespace . '\\' . $sClassName;
                $sFilePath      = $this->generateFilePath($aListenerBits);

                //  Test it does not already exist
                if (file_exists($sFilePath)) {
                    throw new ConsoleException(
                        'An event listener at "' . $sFilePath . '" already exists'
                    );
                }

                $aToCreate[] = [
                    'NAMESPACE' => $sNamespace,
                    'CLASS_NAME' => $sClassName,
                    'CLASS_NAME_FULL' => $sClassNameFull,
                    'FILE_PATH' => $sFilePath,
                    'DIRECTORY' => dirname($sFilePath) . DIRECTORY_SEPARATOR,
                ];
            }

            $this->oOutput->writeln('The following event listeners(s) will be created:');
            foreach ($aToCreate as $aConfig) {
                $this->oOutput->writeln('');
                $this->oOutput->writeln('Class: <info>' . $aConfig['CLASS_NAME_FULL'] . '</info>');
                $this->oOutput->writeln('Path:  <info>' . $aConfig['FILE_PATH'] . '</info>');
            }
            $this->oOutput->writeln('');

            if ($this->confirm('Continue?', true)) {
                foreach ($aToCreate as $aConfig) {
                    $this->oOutput->writeln('');
                    $this->oOutput->write('Creating event listener <comment>' . $aConfig['CLASS_NAME_FULL'] . '</comment>... ');
                    $this->createPath($aConfig['DIRECTORY']);
                    $this->createFile(
                        $aConfig['FILE_PATH'],
                        $this->getResource('template/event_listener.php', $aConfig)
                    );
                    $aCreated[] = $aConfig['FILE_PATH'];
                    $this->oOutput->writeln('<info>done!</info>');

                    //  @todo (Pablo - 2019-04-30) - Add to src/Events.php if properly configured
                }
            }

        } catch (ConsoleException $e) {
            $this->oOutput->writeln('<error>failed!</error>');
            //  Clean up created services
            if (!empty($aCreated)) {
                $this->oOutput->writeln('<error>Cleaning up - removing newly created files</error>');
                foreach ($aCreated as $sPath) {
                    @unlink($sPath);
                }
            }
            throw new ConsoleException($e->getMessage());
        }

        return $this;
    }
1221521
private Event createEvent(String obs) {
        int lastSpace = obs.lastIndexOf(StringUtils.SPACE);
        Event event = null;

        if (lastSpace != -1) {
            String label = obs.substring(lastSpace + 1);
            String[] contexts = obs.substring(0, lastSpace).split("\\s+");
            // Split name and value
            float[] values = RealValueFileEventStream.parseContexts(contexts);
            // Label, feature name, feature value
            event = new Event(label, contexts, values);
        }

        return event;
    }
705611
def create_event(data):
        
        event = riemann_client.riemann_pb2.Event()
        event.host = socket.gethostname()
        event.tags.extend(data.pop('tags', []))

        for key, value in data.pop('attributes', {}).items():
            attribute = event.attributes.add()
            attribute.key, attribute.value = key, value

        for name, value in data.items():
            if value is not None:
                setattr(event, name, value)
        return event