Write the found events to a sngl inspiral table
548317
def write_events(self, outname):
        
        self.make_output_dir(outname)

        if '.hdf' in outname:
            self.write_to_hdf(outname)
        else:
            raise ValueError('Cannot write to this format')
513668
def write_event(catalog):
    
    f = open('event.dat', 'w')
    for i, event in enumerate(catalog):
        try:
            evinfo = event.origins[0]
        except IndexError:
            raise IOError('No origin')
        try:
            Mag_1 = event.magnitudes[0].mag
        except IndexError:
            Mag_1 = 0.0
        try:
            t_RMS = event.origins[0].quality['standard_error']

        except AttributeError:
            print('No time residual in header')
            t_RMS = 0.0
        f.write(str(evinfo.time.year) + str(evinfo.time.month).zfill(2) +
                str(evinfo.time.day).zfill(2) + '  ' +
                str(evinfo.time.hour).rjust(2) +
                str(evinfo.time.minute).zfill(2) +
                str(evinfo.time.second).zfill(2) +
                str(evinfo.time.microsecond)[0:2].zfill(2) + '  ' +
                str(evinfo.latitude).ljust(8, str('0')) + '   ' +
                str(evinfo.longitude).ljust(8, str('0')) + '  ' +
                str(evinfo.depth / 1000).rjust(7).ljust(9, str('0')) + '   ' +
                str(Mag_1) + '    0.00    0.00   ' +
                str(t_RMS).ljust(4, str('0')) +
                str(i).rjust(11) + '\n')
    f.close()
    return
1059265
def _PrintEventsStatus(self, events_status):
    
    if events_status:
      table_view = views.CLITabularTableView(
          column_names=['Events:', 'Filtered', 'In time slice', 'Duplicates',
                        'MACB grouped', 'Total'],
          column_sizes=[15, 15, 15, 15, 15, 0])

      table_view.AddRow([
          '', events_status.number_of_filtered_events,
          events_status.number_of_events_from_time_slice,
          events_status.number_of_duplicate_events,
          events_status.number_of_macb_grouped_events,
          events_status.total_number_of_events])

      self._output_writer.Write('\n')
      table_view.Write(self._output_writer)
296712
def read_cz_lsm_event_list(fd, byte_order):
    """"""
    count = struct.unpack(byte_order+'II', fd.read(8))[1]
    events = []
    while count > 0:
        esize, etime, etype = struct.unpack(byte_order+'IdI', fd.read(16))
        etext = stripnull(fd.read(esize - 16))
        events.append((etime, etype, etext))
        count -= 1
    return events
291422
def get_events_by_ses(self, events, num_ses):
        
        numpy.random.seed(self.serial)
        sess = numpy.random.choice(num_ses, len(events)) + 1
        events_by_ses = collections.defaultdict(list)
        for ses, event in zip(sess, events):
            events_by_ses[ses].append(event)
        for ses in events_by_ses:
            events_by_ses[ses] = numpy.array(events_by_ses[ses])
        return events_by_ses
1027410
def insert(self, events):
        """"""
        if not len(events):
            return
        keys = sorted(events[0].keys())
        ss = ','.join(['%s' for _ in keys])
        query = 'INSERT INTO %s (%s) VALUES ' % (self.table, ','.join(keys))
        data = []
        for event in events:
            query += '(%s),' % ss
            data += [event[k] for k in keys]
        query = query[:-1] + ';'
        LOG.info("%s (data: %s)", query, data)
        conn = self.conn.conn
        cursor = conn.cursor()
        cursor.execute(query, data)
        conn.commit()
1277071
def write(self, *args):
        '''
        '''
        for s in args: self.out.write(s)
        event = ''.join(*args)
1295558
def OnOk(self, event):
        """"""

        # Get key values from textctrls

        key_strings = [self.row_textctrl.GetValue(),
                       self.col_textctrl.GetValue(),
                       self.tab_textctrl.GetValue()]

        key = []

        for key_string in key_strings:
            try:
                key.append(int(key_string))
            except ValueError:
                key.append(0)

        # Post event

        post_command_event(self.parent, self.GotoCellMsg, key=tuple(key))
898941
def write( event )
      title = ''
      priority = 0
      message = if event.instance_of?(::Logsly::Logging182::LogEvent)
          priority = @map[event.level]
          @layout.format(event)
        else
          event.to_s
        end
      return if message.empty?

      message = message.gsub(ColoredRegexp, '')
      if @title_sep
        title, message = message.split(@title_sep)
        title, message = '', title if message.nil?
      end

      growl(title.strip, message.strip, priority)
      self
    end
1264494
def WriteEventBody(self, event):
    
    output_values = []
    for field_name in self._fields:
      output_value = self._dynamic_fields_helper.GetFormattedField(
          event, field_name)

      output_value = self._SanitizeField(output_value)
      output_values.append(output_value)

    output_line = '{0:s}\n'.format(self._field_delimiter.join(output_values))
    self._output_writer.Write(output_line)
871109
def event_table(events):
    """"""
    table = formatting.Table([
        "Id",
        "Start Date",
        "End Date",
        "Subject",
        "Status",
        "Acknowledged",
        "Updates",
        "Impacted Resources"
    ], title="Upcoming Events")
    table.align['Subject'] = 'l'
    table.align['Impacted Resources'] = 'l'
    for event in events:
        table.add_row([
            event.get('id'),
            utils.clean_time(event.get('startDate')),
            utils.clean_time(event.get('endDate')),
            # Some subjects can have \r\n for some reason.
            utils.clean_splitlines(event.get('subject')),
            utils.lookup(event, 'statusCode', 'name'),
            event.get('acknowledgedFlag'),
            event.get('updateCount'),
            event.get('impactedResourceCount')
        ])
    return table
480418
def event_return(events):
    '''
    
    '''
    conn = _get_conn()
    if conn is None:
        return None
    cur = conn.cursor()
    for event in events:
        tag = event.get('tag', '')
        data = event.get('data', '')
        sql = '''INSERT INTO salt_events
                (tag, data, master_id)
                VALUES (%s, %s, %s)'''
        cur.execute(sql, (tag, salt.utils.json.dumps(data), __opts__['id']))
    _close_conn(conn)
41733
def WriteEventBody(self, event):
    
    inode = getattr(event, 'inode', None)
    if inode is None:
      event.inode = 0

    json_dict = self._JSON_SERIALIZER.WriteSerializedDict(event)
    json_string = json.dumps(json_dict, sort_keys=True)

    if self._event_counter != 0:
      self._output_writer.Write(', ')

    line = '"event_{0:d}": {1:s}\n'.format(self._event_counter, json_string)
    self._output_writer.Write(line)

    self._event_counter += 1
143109
def on_binlog(event, stream):
    
    rows, meta = _rows_event_to_dict(event, stream)

    table_name = '%s.%s' % (meta['schema'], meta['table'])

    if meta['action'] == 'insert':
        sig = signals.rows_inserted
    elif meta['action'] == 'update':
        sig = signals.rows_updated
    elif meta['action'] == 'delete':
        sig = signals.rows_deleted
    else:
        raise RuntimeError('Invalid action "%s"' % meta['action'])

    sig.send(table_name, rows=rows, meta=meta)
978722
def user_write_events(self) -> List[str]:
        
        return [event_type for event_type, event in self.items if event.get_event_action()
                in event_actions.WRITE_ACTIONS]
1342038
def _pretty_print_event(event, colored):
        
        event.timestamp = colored.yellow(event.timestamp)
        event.log_stream_name = colored.cyan(event.log_stream_name)

        return ' '.join([event.log_stream_name, event.timestamp, event.message])
436587
def add_template_events_to_ifo(self, ifo, columns, vectors):
        
        # Just call through to the standard function
        self.template_events = self.template_event_dict[ifo]
        self.add_template_events(columns, vectors)
        self.template_event_dict[ifo] = self.template_events
        self.template_events = None