a2e45b8fdde315b756691b4ae573ad55f55dc002,homeassistant/components/history.py,,get_significant_states,#Any#Any#Any#,39

Before Change


    where = 
        (domain IN ({}) OR last_changed=last_updated)
        AND domain NOT IN ({}) AND last_updated > ?
    .format(",".join(""%s"" % x for x in SIGNIFICANT_DOMAINS),
               ",".join(""%s"" % x for x in IGNORE_DOMAINS))

    data = [start_time]

    if end_time is not None:
        where += "AND last_updated < ? "
        data.append(end_time)

    if entity_id is not None:
        where += "AND entity_id = ? "

After Change


    as well as all states from certain domains (for instance
    thermostat so that we get current temperature in our graphs).
    
    states = recorder.get_model("States")
    query = recorder.query("States").filter(
        (states.domain.in_(SIGNIFICANT_DOMAINS) |
         (states.last_changed == states.last_updated)) &
        ((~states.domain.in_(IGNORE_DOMAINS)) &
         (states.last_updated > start_time)))

    if end_time is not None:
        query = query.filter(states.last_updated < end_time)

    if entity_id is not None:
        query = query.filter_by(entity_id=entity_id.lower())

    states = (
        state for state in recorder.execute(
            query.order_by(states.entity_id, states.last_updated))
        if _is_significant(state))

    return states_to_json(states, start_time, entity_id)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: home-assistant/home-assistant
Commit Name: a2e45b8fdde315b756691b4ae573ad55f55dc002
Time: 2016-07-02
Author: rhooper@toybox.ca
File Name: homeassistant/components/history.py
Class Name:
Method Name: get_significant_states


Project Name: HazyResearch/fonduer
Commit Name: ffaad7649566c35b015694219f73aba8b6705902
Time: 2018-09-01
Author: lwhsiao@stanford.edu
File Name: src/fonduer/utils/utils_udf.py
Class Name:
Method Name: add_keys


Project Name: commonsense/conceptnet5
Commit Name: e809acfe2fc641630dd978b12576e35af1acc87e
Time: 2019-03-26
Author: rspeer@luminoso.com
File Name: conceptnet5/db/query.py
Class Name: AssertionFinder
Method Name: query


Project Name: sentinel-hub/eo-learn
Commit Name: a51009230ba17528e4462fe022af5f2c92bdae15
Time: 2020-01-22
Author: matej.aleksandrov@sinergise.com
File Name: core/eolearn/tests/test_eoworkflow.py
Class Name: TestEOWorkflow
Method Name: test_get_tasks