Formats an announce event into a usable string.
760928
protected String formatAnnounceEvent(
          AnnounceRequestMessage.RequestEvent event) {
    return AnnounceRequestMessage.RequestEvent.NONE.equals(event)
            ? ""
            : String.format(" %s", event.name());
  }
1147121
protected void formatMessage(String aID, Map<Object,Object> aBindValues)
	   {
	      Presenter presenter = Presenter.getPresenter(this.getClass());
	       
	       message = presenter.getText(aID,aBindValues);
	   }
1052232
def convert_message_to_string(self, message):
        """"""
        final_message = ''
        for submessage in message:
            final_message += '* {submessage}\n'.format(submessage=submessage)
        return final_message
1156755
public static String toLine(Event event) {
    StringBuffer sb = new StringBuffer();
    sb.append(event.getOutcome());
    String[] context = event.getContext();
    for (int ci=0,cl=context.length;ci<cl;ci++) {
      sb.append(" "+context[ci]);
    }
    sb.append(System.getProperty("line.separator"));
    return sb.toString();
  }
673113
function triggerModeScriptEvent($event, $params = '', $multicall = false)
    {
        if (!is_string($event)) {
            throw new InvalidArgumentException('event name must be a string: event = ' . print_r($event, true));
        }

        if (is_string($params)) {
            return $this->execute(ucfirst(__FUNCTION__), array($event, $params), $multicall);
        }

        if (is_array($params)) {
            foreach ($params as $param) {
                if (!is_string($param)) {
                    throw new InvalidArgumentException('argument must be a string: param = ' . print_r($param, true));
                }
            }
            return $this->execute(ucfirst(__FUNCTION__) . 'Array', array($event, $params), $multicall);
        }

        // else
        throw new InvalidArgumentException('argument must be string or string[]: params = ' . print_r($params, true));
    }
1083918
def _send_event(self, title, text, tags, event_type, aggregation_key, severity='info'):
        """"""
        event_dict = {
            'timestamp': int(time()),
            'source_type_name': self.SOURCE_TYPE_NAME,
            'msg_title': title,
            'event_type': event_type,
            'alert_type': severity,
            'msg_text': text,
            'tags': tags,
            'aggregation_key': aggregation_key,
        }
        self.event(event_dict)
1026781
public static function format(FSEvent $event): string
    {
        $item = is_dir($event->getPath()) ? 'Directory' : 'File';
        $events = implode(', ', $event->getTypes());
        $time = $event->getWhen()->format('Y.m.d H:i:s');

        return sprintf('%s: %s %s at %s', $item, $event->getPath(), $events, $time);
    }
1298797
def format_time_event_json(self):
        """"""
        time_event = {}
        time_event['time'] = self.timestamp

        if self.annotation is not None:
            time_event['annotation'] = self.annotation.format_annotation_json()

        if self.message_event is not None:
            time_event['message_event'] = \
                self.message_event.format_message_event_json()

        return time_event
825772
def announce(self, number):
        
        self.client.publish(self.keys.internal, self.keys.key(number))
        self.message('{} granted'.format(number))
710972
def string_format(msg, method):
    
    if method == "uppercase":
        return msg.upper()
    elif method == "lowercase":
        return msg.lower()
    elif method == "sentence":
        return msg.capitalize()
    elif method == "formal":
        return string.capwords(msg)
302357
def handle_event(self, event):
        """"""
        string = '{id:<32} '
        if 'command' in event:
            string += '{command}'
        elif 'version' in event:
            if 'hardware' in event:
                string += '{hardware} {firmware} '
            string += 'V{version} R{revision}'
        else:
            string += '{value}'
            if event.get('unit'):
                string += ' {unit}'

        print(string.format(**event))
1327002
public final void renderMessageString() {
        Object[] coreFields = event.getFieldsToLog();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < coreFields.length + xFields.length; ++i) {
            if (i > 0) {
                sb.append(fieldSeperator);
            }
            Object field = i < coreFields.length ? coreFields[i] : xFields[i - coreFields.length];
            renderObject(sb, field);

        }
        messageString = sb.toString();

    }
758656
def process_announcement( sender_namerec, op, working_dir ):
    
    node_config = get_blockstack_opts()

    # valid announcement
    announce_hash = op['message_hash']
    announcer_id = op['announcer_id']
   
    # verify that it came from this individual
    name_history = sender_namerec['history']
    allowed_value_hashes = []
    for block_height in name_history.keys():
        for historic_namerec in name_history[block_height]:
            if historic_namerec.get('value_hash'):
                allowed_value_hashes.append(historic_namerec['value_hash'])

    if announce_hash not in allowed_value_hashes:
        # this individual did not send this announcement
        log.warning("Announce hash {} not found in name history for {}".format(announce_hash, announcer_id))
        return 

    # go get it from Atlas
    zonefiles_dir = node_config.get('zonefiles', None)
    if not zonefiles_dir:
        log.warning("This node does not store zone files, so no announcement can be found")
        return 

    announce_text = get_atlas_zonefile_data(announce_hash, zonefiles_dir)
    if announce_text is None:
        log.warning("No zone file {} found".format(announce_hash))
        return

    # go append it 
    log.critical("ANNOUNCEMENT (from %s): %s\n------BEGIN MESSAGE------\n%s\n------END MESSAGE------\n" % (announcer_id, announce_hash, announce_text))         
    store_announcement( working_dir, announce_hash, announce_text )
984643
private function formatEventMessage(Event $event)
    {
        $message = null;
        $entityName = null;
        
        if ($event instanceof OrmEventInterface) {
            switch (true) {
                case ($event instanceof EntityLifecycleEvent):
                    $entityName = $event->getRepository()->getEntityName();
                    $message = $this->entityToString($event->getEntity());
                    break;
                case ($event instanceof MetadataLoadEvent):
                    $message = $this->metadataToString($event->getMetadata());
                    $entityName = $event->getMetadata()->getEntityClass();
                    break;
                case ($event instanceof FinderExecutionEvent):
                    $entityName = $event->getRepository()->getEntityName();
                    $query = $event->getSelectQuery();
                    $message = sprintf("SQL: (%s)", str_replace("\n", "\x20", $query->toSQL()));
                    break;
            }
        }
        
        $eventName = sprintf('%s::%s', (new \ReflectionObject($event))->getShortName(), $event->getName());
        $separator = str_repeat('-', 32);
        
        return sprintf("%s\n[%s]\nEntityClassName: %s\n%s", $separator, $eventName, $entityName, $message);
    }
748335
def print_events(events):
    """"""
    columns = ['Date', 'Type', 'IP Address', 'label', 'username']
    table = formatting.Table(columns)
    for event in events:
        table.add_row([event.get('eventCreateDate'), event.get('eventName'),
                       event.get('ipAddress'), event.get('label'), event.get('username')])
    return table
1098663
@Override
	public String format(AuditEvent event) {
		final StringBuilder buff = new StringBuilder();
		if (null != event.getTimestamp()) {
			buff.append(new ConcurrentDateFormatAccess(dateFormat).convertDateToString(event.getTimestamp()));
		} else {
			buff.append(new ConcurrentDateFormatAccess(dateFormat).convertDateToString(new Date()));
		}
		buff.append(CoreConstants.PIPE);
		if (null != event.getUuid()) {
			buff.append(event.getUuid().toString());
			buff.append(CoreConstants.PIPE);
		}

		buff.append(event.getActor());
		buff.append(CoreConstants.PIPE);
		buff.append(event.getOrigin());
		buff.append(CoreConstants.PIPE);

		if (event.getAction() != null) {
			buff.append(event.getAction()).append(CoreConstants.ARROW);
		}
		if (event.getFields() != null && !event.getFields().isEmpty()) {
			for (Field actionItem : event.getFields()) {
				buff.append(actionItem.getName()).append(CoreConstants.SPACE).append(actionItem.getType())
						.append(CoreConstants.COLON_CHAR).append(actionItem.getValue())
						.append(CoreConstants.COMMA_CHAR);
			}
		}
		return buff.toString();
	}
4648
def formatted(self):
        """"""
        return ' '.join(self.compact[i:i + 4] for i in range(0, len(self.compact), 4))