Consistency Check 2: consider all nodes listed in
        _node_attributes

        :raises: ValueError -- detected inconsistency among dictionaries
353455
def _check_node_attributes_consistency(self):
        
        # Get list of nodes from the node attributes dict
        nodes_from_attributes = set(self._node_attributes.keys())

        # Perform consistency checks on each node.
        for node in nodes_from_attributes:

            # Check 2.1: make sure that the forward star for the node
            # exists.
            if node not in self._forward_star:
                raise ValueError(
                    'Consistency Check 2.1 Failed: node ' +
                    '%s not in forward star dict' % (str(node)))

            # Check 2.2: make sure that the backward star for the node
            # exists.
            if node not in self._backward_star:
                raise ValueError(
                    'Consistency Check 2.2 Failed: node ' +
                    '%s not in backward star dict' % (str(node)))

            # Get backward star and forward star
            node_fstar = self._forward_star[node]
            node_bstar = self._backward_star[node]

            # Check 2.3: make sure every hyperedge id in the forward
            # star contains the node in the tail
            for hyperedge_id in node_fstar:
                if hyperedge_id not in self._hyperedge_attributes or \
                   node not in \
                   self._hyperedge_attributes[hyperedge_id]['tail']:
                    raise ValueError(
                        'Consistency Check 2.3 Failed: node %s ' % str(node) +
                        'has hyperedge id %s in the forward ' % hyperedge_id +
                        'star, but %s is not in the tail of ' % str(node) +
                        '%s' % hyperedge_id)

            # Check 2.4: make sure every hyperedge id in the backward
            # star contains the node in the head
            for hyperedge_id in node_bstar:
                if hyperedge_id not in self._hyperedge_attributes or \
                   node not in \
                   self._hyperedge_attributes[hyperedge_id]['head']:
                    raise ValueError(
                        'Consistency Check 2.4 Failed: node %s ' % str(node) +
                        'has hyperedge id %s in the forward ' % hyperedge_id +
                        'star, but %s is not in the tail of ' % str(node) +
                        '%s' % hyperedge_id)
341252
def _diff_violations(self):
        
        if not self._diff_violations_dict:
            self._diff_violations_dict = {
                    src_path: DiffViolations(
                        self._violations.violations(src_path),
                        self._violations.measured_lines(src_path),
                        self._diff.lines_changed(src_path),
                    )
                 for src_path in self._diff.src_paths_changed()
            }
        return self._diff_violations_dict
1171228
def _is_consistent(pairs, common, clus_seen, loci_similarity):
    
    all_true1 = all([all([common and loci_similarity[(p, c)] > parameters.similar  for p in pairs if (p, c) in loci_similarity]) for c in clus_seen])
    all_true2 = all([all([common and loci_similarity[(c, p)] > parameters.similar  for p in pairs if (c, p) in loci_similarity]) for c in clus_seen])
    return all_true1 * all_true2
291778
def find_contradicts(self):
        
        eh = self.hierarchies['entity']

        # Make a dict of Statement by type
        stmts_by_type = collections.defaultdict(lambda: [])
        for idx, stmt in enumerate(self.stmts):
            stmts_by_type[indra_stmt_type(stmt)].append((idx, stmt))

        # Handle Statements with polarity first
        pos_stmts = AddModification.__subclasses__()
        neg_stmts = [modclass_to_inverse[c] for c in pos_stmts]

        pos_stmts += [Activation, IncreaseAmount]
        neg_stmts += [Inhibition, DecreaseAmount]

        contradicts = []
        for pst, nst in zip(pos_stmts, neg_stmts):
            poss = stmts_by_type.get(pst, [])
            negs = stmts_by_type.get(nst, [])

            pos_stmt_by_group = self._get_stmt_by_group(pst, poss, eh)
            neg_stmt_by_group = self._get_stmt_by_group(nst, negs, eh)
            for key, pg in pos_stmt_by_group.items():
                ng = neg_stmt_by_group.get(key, [])
                for (_, st1), (_, st2) in itertools.product(pg, ng):
                    if st1.contradicts(st2, self.hierarchies):
                        contradicts.append((st1, st2))

        # Handle neutral Statements next
        neu_stmts = [Influence, ActiveForm]
        for stt in neu_stmts:
            stmts = stmts_by_type.get(stt, [])
            for (_, st1), (_, st2) in itertools.combinations(stmts, 2):
                if st1.contradicts(st2, self.hierarchies):
                    contradicts.append((st1, st2))

        return contradicts
630647
def check(cls, dic):
        
        res = {}
        for name, text in dic.items():
            try:
                p = getattr(cls, name)
            except AttributeError:
                logging.warning('Ignored unknown parameter %s', name)
            else:
                res[name] = p.validator(text)
        return res
187413
def _preprocess_nodes_for_pydot(nodes_with_data):
    """'"""
    for (node_id, attrs) in nodes_with_data:
        if 'label' in attrs:
            yield (quote_for_pydot(node_id),
                   {'label': quote_for_pydot(attrs['label'])})
        else:
            yield (quote_for_pydot(node_id), {})
111623
def are_cmddicts_same(dict1, dict2):
  
  
  # If the set of all keys are not the same, they must not be the same.
  if set(dict1.keys()) != set(dict2.keys()):
    return False
  
  # Everything in dict1 should be in dict2
  for key in dict1:
    # Check everything except children;  Check for children recursively
    for propertytype in dict1[key]:
      if (not propertytype in dict2[key] or
          dict1[key][propertytype] != dict2[key][propertytype]):
        return False
      
    # Check children
    if not are_cmddicts_same(dict1[key]['children'], dict2[key]['children']):
      return False
      
  return True
1053749
def compare(self, node, prev_value=None, prev_index=None):
        
        if prev_value is not None and node.value != prev_value or \
           prev_index is not None and node.index != prev_index:
            raise TestFailed(index=self.index)
735720
def visit_Dict(self, node):
        
        if node.keys:
            items = node.keys + node.values
            return list(set(sum([self.visit(item) for item in items], [])))
        else:
            return [frozenset()]
947915
def visit_any_conditionnal(self, node1, node2):
        

        true_naming = false_naming = None

        try:
            tmp = self.naming.copy()
            for expr in node1:
                self.visit(expr)
            true_naming = self.naming
            self.naming = tmp
        except KeyError:
            pass

        try:
            tmp = self.naming.copy()
            for expr in node2:
                self.visit(expr)
            false_naming = self.naming
            self.naming = tmp
        except KeyError:
            pass

        if true_naming and not false_naming:
            self.naming = true_naming

        elif false_naming and not true_naming:
            self.naming = false_naming

        elif true_naming and false_naming:
            self.naming = false_naming
            for k, v in true_naming.items():
                if k not in self.naming:
                    self.naming[k] = v
                else:
                    for dep in v:
                        if dep not in self.naming[k]:
                            self.naming[k].append(dep)
1287288
def _check_for_batch_clashes(xs):
    
    names = set([x["description"] for x in xs])
    dups = set([])
    for x in xs:
        batches = tz.get_in(("metadata", "batch"), x)
        if batches:
            if not isinstance(batches, (list, tuple)):
                batches = [batches]
            for batch in batches:
                if batch in names:
                    dups.add(batch)
    if len(dups) > 0:
        raise ValueError("Batch names must be unique from sample descriptions.\n"
                         "Clashing batch names: %s" % sorted(list(dups)))
96652
def visit_Attribute(self, node: ast.Attribute) -> None:
        """"""
        if node in self._recomputed_values:
            value = self._recomputed_values[node]

            if _representable(value=value):
                text = self._atok.get_text(node)
                self.reprs[text] = value

        self.generic_visit(node=node)
254933
def visit_DictComp(self, node: ast.DictComp) -> Any:
        """"""
        result = self._execute_comprehension(node=node)

        for generator in node.generators:
            self.visit(generator.iter)

        self.recomputed_values[node] = result
        return result
131010
def check_attr(node, n):
        
        if len(node.children) > n:
            return node.children[n]
381158
def checkIsConsistent(self):
        
        if is_an_array(self.mask) and self.mask.shape != self.data.shape:
            raise ConsistencyError("Shape mismatch mask={}, data={}"
                                   .format(self.mask.shape != self.data.shape))
954511
def visit_DictComp(self, node: ast.DictComp) -> None:
        """"""
        if node in self._recomputed_values:
            value = self._recomputed_values[node]
            text = self._atok.get_text(node)

            self.reprs[text] = value

        self.generic_visit(node=node)
760332
def differing_blocks(self):
        
        differing_blocks = []
        for (block_a, block_b) in self._block_matches:
            if not self.blocks_probably_identical(block_a, block_b):
                differing_blocks.append((block_a, block_b))
        return differing_blocks