コード例 #1
0
ファイル: classify.py プロジェクト: ActivityWatch/aw-research
def _query_complete():  # noqa
    from aw_transform import (query_bucket, find_bucket, filter_keyvals,
                              exclude_keyvals, period_union, concat)

    hostname = ""  # set in preprocessing

    browsernames_chrome = ["Chromium"]  # TODO: Include more browsers
    browsernames_ff = ["Firefox"]  # TODO: Include more browsers

    events = flood(query_bucket(find_bucket("aw-watcher-window", hostname)))
    events_afk = query_bucket(
        find_bucket("aw-watcher-afk", hostname)
    )  # TODO: Readd flooding for afk-events once a release has been made that includes the flooding-fix
    events_web_chrome = flood(
        query_bucket(find_bucket("aw-watcher-web-chrome")))
    events_web_ff = flood(query_bucket(find_bucket("aw-watcher-web-firefox")))

    # Combine window events with web events
    events_browser_chrome = filter_keyvals(events, "app", browsernames_chrome)
    events_web_chrome = filter_period_intersect(events_web_chrome,
                                                events_browser_chrome)

    events_browser_ff = filter_keyvals(events, "app", browsernames_ff)
    events_web_ff = filter_period_intersect(events_web_ff, events_browser_ff)

    events_web = concat(events_web_chrome, events_web_ff)

    # TODO: Browser events should only be excluded when there's a web-event replacing it
    events = exclude_keyvals(events, "app", browsernames_chrome)
    events = exclude_keyvals(events, "app", browsernames_ff)
    events = concat(events, events_web)

    # Filter away all inactive (afk and non-audible) time
    events_notafk = filter_keyvals(events_afk, "status", ["not-afk"])
    events_audible = filter_keyvals(events_web, "audible", [True])
    events_active = period_union(events_notafk, events_audible)
    events = filter_period_intersect(events, events_active)

    return events
コード例 #2
0
def q2_concat(events1: list, events2: list) -> List[Event]:
    _verify_variable_is_type(events1, list)
    _verify_variable_is_type(events2, list)
    return concat(events1, events2)
コード例 #3
0
ファイル: functions.py プロジェクト: geraore/aw-core
def q2_concat(events1: list, events2: list) -> List[Event]:
    return concat(events1, events2)
コード例 #4
0
def q2_concat(events1: list, events2: list) -> List[Event]:
    _verify_variable_is_type(events1, list)
    _verify_variable_is_type(events2, list)
    return concat(events1, events2)