def update_moderators_on_listings(self, moderator_list):
        try:
            l = objects.Listings()
            l.ParseFromString(self.db.listings.get_proto())
        except Exception:
            return
        keychain = KeyChain(self.db)
        for listing in l.listing:
            try:
                contract_hash = listing.contract_hash
                c = Contract(self.db, hash_value=contract_hash, testnet=self.protocol.multiplexer.testnet)
                contract_moderators = []
                if "moderators" in c.contract["vendor_offer"]["listing"]:
                    for m in c.contract["vendor_offer"]["listing"]["moderators"]:
                        contract_moderators.append(m["guid"])
                mods_to_remove = list(set(contract_moderators) - set(moderator_list))
                mods_to_add = list(set(moderator_list) - set(contract_moderators))
                for mod in mods_to_add:
                    mod_info = self.db.moderators.get_moderator(mod)
                    if mod_info is not None:
                        moderator_json = {
                            "guid": mod,
                            "name": mod_info[5],
                            "avatar": mod_info[7].encode("hex"),
                            "short_description": mod_info[6],
                            "fee": str(mod_info[8]) + "%",
                            "blockchain_id": mod_info[4],
                            "pubkeys": {
                                "guid": mod_info[1].encode("hex"),
                                "bitcoin": {
                                    "key": mod_info[2].encode("hex"),
                                    "signature": base64.b64encode(mod_info[3])
                                }
                            }
                        }
                        if c.contract["vendor_offer"]["listing"] not in "moderators":
                            c.contract["vendor_offer"]["listing"]["moderators"] = []
                        c.contract["vendor_offer"]["listing"]["moderators"].append(moderator_json)
                for mod in mods_to_remove:
                    for rem in c.contract["vendor_offer"]["listing"]["moderators"]:
                        if rem["guid"] == mod:
                            c.contract["vendor_offer"]["listing"]["moderators"].remove(rem)
                if "moderators" in c.contract["vendor_offer"]["listing"] and \
                                len(c.contract["vendor_offer"]["listing"]["moderators"]) == 0:
                    del c.contract["vendor_offer"]["listing"]["moderators"]

                listing = json.dumps(c.contract["vendor_offer"]["listing"], indent=4)
                c.contract["vendor_offer"]["signatures"] = {}
                c.contract["vendor_offer"]["signatures"]["guid"] = \
                    base64.b64encode(keychain.signing_key.sign(listing)[:64])
                c.contract["vendor_offer"]["signatures"]["bitcoin"] = \
                    bitcointools.encode_sig(*bitcointools.ecdsa_raw_sign(
                        listing, bitcointools.bip32_extract_key(keychain.bitcoin_master_privkey)))
                c.previous_title = None
                c.save()
            except Exception:
                pass
dataset/ETHPy150Open OpenBazaar/OpenBazaar-Server/market/network.py/Server.update_moderators_on_listings/swapped operands of `not in`