def sync_tasks(self, tasks):
        """ Performs the first sync of a list of tasks, often defined in the config file. """

        tasks_by_hash = {_hash_task(t): t for t in tasks}

        for task in self.all_tasks:
            if tasks_by_hash.get(task["hash"]):
                del tasks_by_hash[task["hash"]]
            else:
                self.collection.remove({"_id": task["_id"]})
                log.debug(task["hash"] % "Scheduler: deleted %s")

        for h, task in tasks_by_hash.iteritems():
            task["hash"] = h
            task["datelastqueued"] = datetime.datetime.fromtimestamp(0)
            if task.get("dailytime"):
                # Because MongoDB can store datetimes but not times,
                # we add today's date to the dailytime.
                # The date part will be discarded in check()
                task["dailytime"] = datetime.datetime.combine(
                    datetime.datetime.utcnow(), task["dailytime"])
                task["interval"] = 3600 * 24

            self.collection.find_one_and_update({"hash": task["hash"]}, {"$set": task}, upsert=True)
            log.debug("Scheduler: added %s" % task["hash"])

        self.refresh()
dataset/ETHPy150Open pricingassistant/mrq/mrq/scheduler.py/Scheduler.sync_tasks/swapped operands of `%`