Verify original is subset of replica
496349
def compare_field_caches(self, replica, original):
        """"""
        if original is None:
            original = []
        if replica is None:
            replica = []
        self.pr_dbg("Comparing orig with %s fields to replica with %s fields" %
                    (len(original), len(replica)))
        # convert list into dict, with each item's ['name'] as key
        orig = self.list_to_compare_dict(original)
        if orig is None:
            self.pr_dbg("Original has duplicate fields")
            return 1
        repl = self.list_to_compare_dict(replica)
        if repl is None:
            self.pr_dbg("Replica has duplicate fields")
            return 1
        # search orig for each item in repl
        # if any items in repl not within orig or vice versa, then complain
        # make sure contents of each item match
        orig_found = {}
        for (key, field) in iteritems(repl):
            field_name = field['name']
            if field_name not in orig:
                self.pr_dbg("Replica has field not found in orig %s: %s" %
                            (field_name, field))
                return 1
            orig_found[field_name] = True
            if orig[field_name] != field:
                self.pr_dbg("Field in replica doesn't match orig:")
                self.pr_dbg("orig:%s\nrepl:%s" % (orig[field_name], field))
                return 1
        unfound = set(orig_found.keys()) - set(repl.keys())
        if len(unfound) > 0:
            self.pr_dbg("Orig contains fields that were not in replica")
            self.pr_dbg('%s' % unfound)
            return 1
        # We don't care about case when replica has more fields than orig
        # unfound = set(repl.keys()) - set(orig_found.keys())
        # if len(unfound) > 0:
        #     self.pr_dbg("Replica contains fields that were not in orig")
        #     self.pr_dbg('%s' % unfound)
        #     return 1
        self.pr_dbg("Original matches replica")
        return 0
292004
def is_commit_id_equal(self, dest, name):
        
        if not name:
            # Then avoid an unnecessary subprocess call.
            return False

        return self.get_revision(dest) == name
320898
def _check_self_replicate(self, myntr):
        
        # print 'BFS Dictionary Update - Self Replicate'
        find = 0
        for nonterm in self.grammar.grammar_nonterminals_map:
            for i in self.grammar.grammar_nonterminals_map[nonterm]:
                if self.grammar.grammar_rules[i][0] not in self.resolved and not isinstance(
                        self.grammar.grammar_rules[i][1], (set, tuple)) \
                        and self.grammar.grammar_rules[i][1] == myntr:
                    self.resolved[self.grammar.grammar_rules[i][0]] = self.resolved[myntr]
                    if self._checkfinal(self.grammar.grammar_rules[i][0]):
                        return self.resolved[self.grammar.grammar_rules[i][0]]
                    if self.grammar.grammar_rules[i][0] not in self.bfs_queue:
                        self.bfs_queue.append(self.grammar.grammar_rules[i][0])
                    find = 1
        if find == 1:
            return 1
        return 0
1184625
boolean isStale(long[] newVersions, int replicaIndex) {
        int index = replicaIndex - 1;
        long currentVersion = versions[index];
        long newVersion = newVersions[index];
        return currentVersion > newVersion;
    }
1023028
def is_valid_pid_to_be_updated(did):
    """"""
    return (
        is_existing_object(did)
        and not is_local_replica(did)
        and not is_archived(did)
        and not is_obsoleted(did)
    )
823094
def verify(data, sig)
      regenerate_pubkey unless @key.public_key
      sig = Bitcoin::OpenSSL_EC.repack_der_signature(sig)
      if sig
        @key.dsa_verify_asn1(data, sig)
      else
        false
      end
    end
95568
def check_splits_equals(splits1, splits2):
  """"""
  if set(splits1) ^ set(splits2):  # Name intersection should be null
    return False
  for _, (split1, split2) in utils.zip_dict(splits1, splits2):
    if split1.num_shards != split2.num_shards:
      return False
  return True
728302
def get_replicas(self, keyspace, key):
        
        t = self.token_map
        if not t:
            return []
        try:
            return t.get_replicas(keyspace, t.token_class.from_key(key))
        except NoMurmur3:
            return []
484832
def is_subset(self, other):
        """"""
        if isinstance(other, Permissions):
            return (self.value & other.value) == self.value
        else:
            raise TypeError("cannot compare {} with {}".format(self.__class__.__name__, other.__class__.__name__))
436520
def validate_list_of_identical_dicts(self, list_of_dicts):
        """"""
        hashes = []
        for _dict in list_of_dicts:
            hashes.append(hash(frozenset(_dict.items())))

        self.log.debug('Hashes: {}'.format(hashes))
        if len(set(hashes)) == 1:
            self.log.debug('Dicts within list are identical')
        else:
            return 'Dicts within list are not identical'

        return None
289243
PartitionReplica checkAndGetPrimaryReplicaOwner(int partitionId, int replicaIndex) {
        InternalPartitionImpl partition = partitionStateManager.getPartitionImpl(partitionId);
        PartitionReplica owner = partition.getOwnerReplicaOrNull();
        if (owner == null) {
            logger.info("Sync replica target is null, no need to sync -> partitionId=" + partitionId + ", replicaIndex="
                    + replicaIndex);
            return null;
        }

        PartitionReplica localReplica = PartitionReplica.from(nodeEngine.getLocalMember());
        if (owner.equals(localReplica)) {
            if (logger.isFinestEnabled()) {
                logger.finest("This node is now owner of partition, cannot sync replica -> partitionId=" + partitionId
                        + ", replicaIndex=" + replicaIndex + ", partition-info="
                        + partitionStateManager.getPartitionImpl(partitionId));
            }
            return null;
        }

        if (!partition.isOwnerOrBackup(localReplica)) {
            if (logger.isFinestEnabled()) {
                logger.finest("This node is not backup replica of partitionId=" + partitionId
                        + ", replicaIndex=" + replicaIndex + " anymore.");
            }
            return null;
        }
        return owner;
    }
352690
def has_matching_etag(remote_storage, source_storage, path, prefixed_path):
    
    storage_etag = get_etag(remote_storage, path, prefixed_path)
    local_etag = get_file_hash(source_storage, path)
    return storage_etag == local_etag
692755
def verify_identifiers(identifiers, n_items):
    """"""
    if identifiers is None:
        return identifiers

    identifiers = np.array(identifiers, copy=False)

    # Check length for consistency
    if len(identifiers) != n_items:
        raise ValueError("identifiers has inconsistent dimension.")

    # Check that identifiers are unique
    if len(np.unique(identifiers)) != n_items:
        raise ValueError("identifiers contains duplicate values.")

    return identifiers
134774
public function isReplicaSet($datasource)
    {
        if (array_key_exists($datasource,$this->dataSources))
        {
            if(array_key_exists("replicaSet",$this->dataSources[$datasource]) && !empty($this->dataSources[$datasource]["replicaSet"])) {
                return true;
            }
        }

        return false;
    }
300906
boolean isReplicaCorrupt(Block blk, DatanodeDescriptor node) {
    Collection<DatanodeDescriptor> nodes = getNodes(blk);
    return ((nodes != null) && (nodes.contains(node)));
  }
652567
def dict_is_subset(subset: Any, full_set: Any) -> bool:
    

    if not isinstance(subset, full_set.__class__):
        return False
    elif isinstance(subset, dict):
        for k, v in subset.items():
            if k not in full_set or not dict_is_subset(v, full_set[k]):
                return False

        return True
    elif isinstance(subset, list):
        if len(subset) != len(full_set):
            return False

        for a, b in zip(subset, full_set):
            if not dict_is_subset(a, b):
                return False

        return True
    else:
        return subset == full_set
559782
def verify(x, t, y, pi, errorOnFail=True):
    
    # Unpack the proof
    p,c,u = pi

    # Verify types
    assertType(x, G1Element)
    assertType(y, GtElement)
    assertType(p, G1Element)
    assertScalarType(c)
    assertScalarType(u)

    # TODO: beta can be pre-computed while waiting for a server response.
    Q = generatorG1()
    beta = pair(x,hashG2(t))

    # Recompute c'
    t1 = Q*u + p*c 
    t2 = beta**u * y**c

    t1.normalize()

    cPrime = hashZ(Q,p,beta,y,t1,t2)

    # Check computed @c' against server's value @c
    if cPrime == c:
        return True

    if errorOnFail:
        raise Exception("zero-knowledge proof failed verification.")
    else:
        return False