meetup2xibo.log_summarizer package

Submodules

meetup2xibo.log_summarizer.application_scope module

Application scope holds command line arguments.

class meetup2xibo.log_summarizer.application_scope.ApplicationScope(args)[source]

Bases: object

Application scope provides configuration values.

app_name
email_subject

Return the email subject.

email_to

Return the email “To” address.

infile

Return the open input file.

mappings
outfile

Return the open output file.

version

meetup2xibo.log_summarizer.command_line module

Command line options.

meetup2xibo.log_summarizer.command_line.parse_args(args=None)[source]

meetup2xibo.log_summarizer.crud_lister module

Collects and lists CRUD event log lines.

class meetup2xibo.log_summarizer.crud_lister.CrudLister[source]

Bases: object

Collects and lists CRUD event log lines organized by Meetup event.

add_log_line(log_line)[source]

Add a log line.

sorted_current_event_logs()[source]

Return a list of current event logs sorted for reporting.

sorted_past_event_logs()[source]

Return a list of past event logs sorted for reporting.

meetup2xibo.log_summarizer.event module

Meetup and Xibo events store, compare, and report fields.

class meetup2xibo.log_summarizer.event.Event(name, start_time, end_time, meetup_id, location='Default Location', venue_name='', find_us='', **other_fields)[source]

Bases: object

Meetup and Xibo events store, compare, and report fields.

differences(other)[source]

Return a list of differences between this and another later event in (field, before, after) tuple format.

end_time
find_us
classmethod from_fields(field_list)[source]

Make an event from a list for (name, value) field tuples.

location
meetup_id
name
report_sort_key()[source]

Return a sort key for sorting into reporting order.

start_time
url

Return the Meetup URL for this event.

venue

meetup2xibo.log_summarizer.event_log module

Collects and reports event log activity.

class meetup2xibo.log_summarizer.event_log.EventLog[source]

Bases: object

Collects and reports event log activity.

add_event_log_line(log_line)[source]

Add a log line to the list.

add_log_line(log_line)[source]

Add a log line to the list.

add_unknown_location_log_line(log_line)[source]

Add an unknown location log line to the list if changed.

final_event

Return the final event from the log line list.

has_current_event()[source]

Return true if the log contains a current event.

log_lines

Return the list of log lines.

note_current_event()[source]

Note that there is a current event in the log.

report_sort_key()[source]

Return a key for sorting into report order.

meetup2xibo.log_summarizer.injector module

Injectors.

meetup2xibo.log_summarizer.injector.inject_conflict_reporter()[source]

Return an empty conflict reporter.

meetup2xibo.log_summarizer.injector.inject_crud_lister()[source]

Return an empty event CRUD lister.

meetup2xibo.log_summarizer.injector.inject_date_today()[source]

Return today’s date as a string formated as YYYY-MM-DD.

meetup2xibo.log_summarizer.injector.inject_email_renderer(application_scope)[source]

Inject an email renderer.

meetup2xibo.log_summarizer.injector.inject_input_stream(application_scope)[source]

Return the input stream.

meetup2xibo.log_summarizer.injector.inject_jinja2_env()[source]

Returns a Jinja2 environment for templates in this package.

meetup2xibo.log_summarizer.injector.inject_location_mapper()[source]

Return a location mapper.

meetup2xibo.log_summarizer.injector.inject_location_mapping_csv_renderer()[source]

Return a location mapping CSV renderer.

meetup2xibo.log_summarizer.injector.inject_log_parser()[source]

Return a function that provides a log parser for some text.

meetup2xibo.log_summarizer.injector.inject_log_summarizer(application_scope)[source]

Return a log summarizer configured by an application scope.

meetup2xibo.log_summarizer.injector.inject_output_stream(application_scope)[source]

Return the output stream.

meetup2xibo.log_summarizer.injector.inject_renderer(application_scope)[source]

Inject a renderer.

meetup2xibo.log_summarizer.injector.inject_start_counter()[source]

Return an empty program start counter.

meetup2xibo.log_summarizer.injector.inject_summary()[source]

Return a summary.

meetup2xibo.log_summarizer.injector.inject_summary_renderer()[source]

Inject a log summary renderer.

meetup2xibo.log_summarizer.injector.inject_suppressed_event_tracker()[source]

Return a suppressed event tracker.

meetup2xibo.log_summarizer.log_lines module

Various type of log lines.

class meetup2xibo.log_summarizer.log_lines.CurrentEventLogLine(timestamp, event, action)[source]

Bases: meetup2xibo.log_summarizer.log_lines.EventLogLine

A log line reporting an event activity.

add_to_event_log(event_log)[source]

Add this log line to an event log tracker.

class meetup2xibo.log_summarizer.log_lines.DeleteEventLogLine(timestamp, event)[source]

Bases: meetup2xibo.log_summarizer.log_lines.CurrentEventLogLine

A log line reporting a deleted event.

class meetup2xibo.log_summarizer.log_lines.EventLocationLogLine(timestamp, location, event)[source]

Bases: meetup2xibo.log_summarizer.log_lines.EventLogLine

A log line reporting an event location mapping.

key_fields()[source]

Return a tuple of key fields to distinguish location mappings of interest.

location

Return the log line’s location.

class meetup2xibo.log_summarizer.log_lines.EventLogLine(timestamp, event, action)[source]

Bases: meetup2xibo.log_summarizer.log_lines.LogLine

A log line reporting an event activity.

add_to_event_log(event_log)[source]

Add this log line to an event log tracker.

event

Return the log line’s event.

final_event

Return the final event from the log line.

meetup_id

Return the Meetup ID of this log line’s event.

class meetup2xibo.log_summarizer.log_lines.InsertEventLogLine(timestamp, event)[source]

Bases: meetup2xibo.log_summarizer.log_lines.CurrentEventLogLine

A log line reporting an inserted event.

class meetup2xibo.log_summarizer.log_lines.LogLine(timestamp, action)[source]

Bases: object

A log line reporting an activity.

action

Return the action description, such as “Inserted”.

add_to_event_log(event_log)[source]

Add this log line to an event log tracker.

timestamp

Return the log line’s timestamp.

class meetup2xibo.log_summarizer.log_lines.RetireEventLogLine(timestamp, event)[source]

Bases: meetup2xibo.log_summarizer.log_lines.EventLogLine

A log line reporting a retired event.

class meetup2xibo.log_summarizer.log_lines.SpecialLocationLogLine(timestamp, special_location)[source]

Bases: meetup2xibo.log_summarizer.log_lines.LogLine

A log line reporting an special locaation.

meetup_id

Return the Meetup ID of this log line’s speical location.

special_location

Return the log line’s special location.

class meetup2xibo.log_summarizer.log_lines.SuppressEventLogLine(timestamp, event)[source]

Bases: meetup2xibo.log_summarizer.log_lines.EventLogLine

A log line reporting a suppressed event.

class meetup2xibo.log_summarizer.log_lines.UnknownLocationLogLine(timestamp, event)[source]

Bases: meetup2xibo.log_summarizer.log_lines.EventLogLine

A log line reporting an unknown locaation.

add_to_event_log(event_log)[source]

Add this log line to an event log tracker.

class meetup2xibo.log_summarizer.log_lines.UpdateEventLogLine(timestamp, before_event, after_event)[source]

Bases: meetup2xibo.log_summarizer.log_lines.CurrentEventLogLine

A log line reporting an updated event.

after_event

Return the log line’s event.

before_event

Return the log line’s before event.

final_event

Return the final event from the log line.

updates()[source]

Return a list of updates in (field, before, after) tuple format.

meetup2xibo.log_summarizer.log_parser module

Parses logs and collects the interesting information.

class meetup2xibo.log_summarizer.log_parser.Field(name, value)

Bases: tuple

name

Alias for field number 0

value

Alias for field number 1

class meetup2xibo.log_summarizer.log_parser.LogLineStart(timestamp, log_level)

Bases: tuple

log_level

Alias for field number 1

timestamp

Alias for field number 0

class meetup2xibo.log_summarizer.log_parser.SpecialLocation(meetup_id, location, override, comment, places)

Bases: tuple

comment

Alias for field number 3

location

Alias for field number 1

meetup_id

Alias for field number 0

override

Alias for field number 2

places

Alias for field number 4

class meetup2xibo.log_summarizer.log_parser.Summary(counter, crud_lister, conflict_reporter, location_mapper, suppressed_event_tracker)

Bases: tuple

conflict_reporter

Alias for field number 2

counter

Alias for field number 0

crud_lister

Alias for field number 1

location_mapper

Alias for field number 3

suppressed_event_tracker

Alias for field number 4

class meetup2xibo.log_summarizer.log_parser.UpdateToLogLine(timestamp, event)

Bases: tuple

event

Alias for field number 1

timestamp

Alias for field number 0

meetup2xibo.log_summarizer.log_parser.make_log_parser_class()[source]

Make a log line parser class.

meetup2xibo.log_summarizer.log_parser.parse_error_hash(self)[source]

Define missing ParseError.__hash__().

meetup2xibo.log_summarizer.log_summarizer module

Summarizes meetup2xibo logs, reporting meeting changes.

class meetup2xibo.log_summarizer.log_summarizer.LogSummarizer(input_stream, output_stream, summary, log_parser, renderer)[source]

Bases: object

Summarizes meetup2xibo logs, reporting meeting changes.

run()[source]

Summarize the logs.

meetup2xibo.log_summarizer.renderer module

Renders the log summary in HTML.

class meetup2xibo.log_summarizer.renderer.EmailRenderer(email_to, email_subject)[source]

Bases: object

Renders an email message containing summary HTML content.

address_list()[source]

Return a list of “To” email addresses.

can_render()[source]

Return true it an email message can be rendered; false otherwise.

make_message()[source]

Make and return an email addressed to “To” recipients and with the supplied subject.

render(summary_html, csv_data)[source]

Render an email reporting summary information and possibly some csv data.

class meetup2xibo.log_summarizer.renderer.LocationMappingCsvRenderer[source]

Bases: object

Renders location mappings as comma separated values.

render(location_mapper)[source]

Render location mappings as comma separated values, if possible.

render_csv(location_mapper)[source]

Render location mappings as comma separated values.

static write_csv_header(csv_writer)[source]

Write the CSV header line.

write_csv_mapping(csv_writer, log_line)[source]

Write a CSV line for the event location log line.

write_csv_mappings(csv_writer, mapping_list)[source]

Write CSV lines for the location mapping log lines a list.

class meetup2xibo.log_summarizer.renderer.Renderer(mappings_flag, email_renderer, summary_renderer, location_mapping_csv_renderer)[source]

Bases: object

Renders the combined email headers and log summary.

render(summary)[source]

Render an email message containing the log file summary as a string.

class meetup2xibo.log_summarizer.renderer.SummaryRenderer(jinja2_env, template_name)[source]

Bases: object

Renders the log summary in HTML.

render(summary)[source]

Render the log file summary as a string.

meetup2xibo.log_summarizer.renderer.make_jinja2_env(package)[source]

Make a Jinja2 environment for a Python package.

meetup2xibo.log_summarizer.start_counter module

Counts program starts.

class meetup2xibo.log_summarizer.start_counter.StartCounter[source]

Bases: object

Counts program starts.

count(name)[source]

Count the start of a named program.

counts()[source]

Return a sorted list of (name, count) tuples.

Module contents