Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
This class extends the FileType class from the argparse module. It will try to open
the file and pass the handle to a new LogFile object, but if that's not possible it 
will catch the exception and interpret the string as a MongoDB URI and try to connect 
to the database. In that case, it will return a ProfileCollection object.

Both derive from the same base class InputSource and support iteration over LogEvents.

src/m/t/mtools-1.1.4/mtools/mlogfilter/filters/mask_filter.py   mtools(Download)
from datetime_filter import DateTimeFilter
from datetime import MINYEAR, timedelta
from mtools.util.logevent import LogEvent
from mtools.util.logfile import LogFile
from mtools.util.cmdlinetool import InputSourceAction
 
    filterArgs = [
       ('--mask', {'action':'store', 'type':InputSourceAction(), 'help':'source (log file or system.profile db) to create the filter mask.'}), 
       ('--mask-size', {'action':'store',  'type':int, 'default':60, 'help':'mask size in seconds around each filter point (default: 60 secs, 30 on each side of the event)'}),
       ('--mask-center', {'action':'store',  'choices':['start', 'end', 'both'], 'default':'end', 'help':'mask center point for events with duration (default: end). If both is chosen, all events from start to end are returned.'})

src/m/t/mtools-HEAD/mtools/mlogfilter/filters/mask_filter.py   mtools(Download)
from datetime_filter import DateTimeFilter
from datetime import MINYEAR, timedelta
from mtools.util.logevent import LogEvent
from mtools.util.logfile import LogFile
from mtools.util.cmdlinetool import InputSourceAction
 
    filterArgs = [
       ('--mask', {'action':'store', 'type':InputSourceAction(), 'help':'source (log file or system.profile db) to create the filter mask.'}), 
       ('--mask-size', {'action':'store',  'type':int, 'default':60, 'help':'mask size in seconds around each filter point (default: 60 secs, 30 on each side of the event)'}),
       ('--mask-center', {'action':'store',  'choices':['start', 'end', 'both'], 'default':'end', 'help':'mask center point for events with duration (default: end). If both is chosen, all events from start to end are returned.'})