Handles all comparisons.
766003
def _handle_comparison(self, truism):
        

        # print("COMP:", truism)

        is_lt, is_equal, is_unsigned = self.comparison_info[truism.op]

        size = len(truism.args[0])
        int_max = 2**size-1 if is_unsigned else 2**(size-1)-1
        int_min = -2**(size-1)

        left_min = self._min(truism.args[0], signed=not is_unsigned)
        left_max = self._max(truism.args[0], signed=not is_unsigned)
        right_min = self._min(truism.args[1], signed=not is_unsigned)
        right_max = self._max(truism.args[1], signed=not is_unsigned)

        bound_max = right_max if is_equal else (right_max-1 if is_lt else right_max+1)
        bound_min = right_min if is_equal else (right_min-1 if is_lt else right_min+1)

        if is_lt and bound_max < int_min:
            # if the bound max is negative and we're unsigned less than, we're fucked
            raise ClaripyBalancerUnsatError()
        elif not is_lt and bound_min > int_max:
            # if the bound min is too big, we're fucked
            raise ClaripyBalancerUnsatError()

        current_min = int_min
        current_max = int_max

        if is_lt:
            current_max = min(int_max, left_max, bound_max)
            self._add_upper_bound(truism.args[0], current_max)
        else:
            current_min = max(int_min, left_min, bound_min)
            self._add_lower_bound(truism.args[0], current_min)
67703
def __cmp(self, other, comparitor):
        """"""
        if not isinstance(other, TagWidget):
            return NotImplemented

        self_len = len(self.translated)
        oth_len = len(other.translated)

        if (self_len == 1) is not (oth_len == 1):
            return comparitor(self_len, oth_len)
        return comparitor(self.translated.lower(), other.translated.lower())
497169
def compare(args):
    
    p = OptionParser(compare.__doc__)
    p.set_cpus()
    opts, args = p.parse_args(args)

    if len(args) < 2:
        sys.exit(not p.print_help())

    truths = args[0]
    cnvoutputs = args[1:]
    cpus = min(len(cnvoutputs), opts.cpus)
    p = Pool(processes=cpus)
    results = []
    files = [(x, truths) for x in cnvoutputs]
    r = p.map_async(compare_worker, files, callback=results.append)
    r.wait()

    for res in results:
        print("\n".join(res))
632795
@MainThread
    private void handleTasksExecution() {
        if (isExecuting || executionQueue.isEmpty()) {
            return; // Nothing to dispatch
        }

        try {
            isExecuting = true;
            handleTasksExecutionWrapped();
        } finally {
            isExecuting = false;
        }
    }
218702
public void validate(Object o)
    {
        if (o != null && o instanceof Comparable)
        {
            compareMinExclusive((Comparable<?>)o);
            compareMinInclusive((Comparable<?>)o);
            compareMaxExclusive((Comparable<?>)o);
            compareMaxInclusive((Comparable<?>)o);
        }
    }
327940
def compare(self, compare_recipe, suffix='_compare'):
        """"""
        assert isinstance(compare_recipe, Recipe)
        assert isinstance(suffix, basestring)
        self.compare_recipe.append(compare_recipe)
        self.suffix.append(suffix)
        self.dirty = True
        return self.recipe
1363358
public static final <T> int compare(T o1, T o2, Comparator<T> comp)
    {
        if (comp != null)
        {
            return comp.compare(o1, o2);
        }
        else
        {
            return ((Comparable<T>)o1).compareTo(o2);
        }
    }
125053
def compare(node1, node2):
    """"""
    if not os.path.isdir("a"):
        print("error: comparison feature not initialized", file=sys.stderr)
        sys.exit(4)

    print("=" * 80)
    print("WERKZEUG INTERNAL BENCHMARK -- COMPARE MODE".center(80))
    print("-" * 80)

    def _hg_update(repo, node):
        def hg(*x):
            return subprocess.call(
                ["hg"] + list(x), cwd=repo, stdout=null_out, stderr=null_out
            )

        hg("revert", "-a", "--no-backup")
        client = subprocess.Popen(
            ["hg", "status", "--unknown", "-n", "-0"], stdout=subprocess.PIPE, cwd=repo
        )
        unknown = client.communicate()[0]
        if unknown:
            client = subprocess.Popen(
                ["xargs", "-0", "rm", "-f"],
                cwd=repo,
                stdout=null_out,
                stdin=subprocess.PIPE,
            )
            client.communicate(unknown)
        hg("pull", "../..")
        hg("update", node)
        if node == "tip":
            diff = subprocess.Popen(
                ["hg", "diff"], cwd="..", stdout=subprocess.PIPE
            ).communicate()[0]
            if diff:
                client = subprocess.Popen(
                    ["hg", "import", "--no-commit", "-"],
                    cwd=repo,
                    stdout=null_out,
                    stdin=subprocess.PIPE,
                )
                client.communicate(diff)

    _hg_update("a", node1)
    _hg_update("b", node2)
    d1 = run("a", no_header=True)
    d2 = run("b", no_header=True)

    print("DIRECT COMPARISON".center(80))
    print("-" * 80)
    for key in sorted(d1):
        delta = d1[key] - d2[key]
        if abs(1 - d1[key] / d2[key]) < TOLERANCE or abs(delta) < MIN_RESOLUTION:
            delta = "=="
        else:
            delta = "%+.4f (%+d%%)" % (delta, round(d2[key] / d1[key] * 100 - 100))
        print("%36s   %.4f    %.4f    %s" % (format_func(key), d1[key], d2[key], delta))
    print("-" * 80)
544702
def compare(self, control_result, experimental_result):
        _compare = getattr(self, '_compare', lambda x, y: x == y)
        
        return (
            # Mismatch if only one of the results returned an error, or if
            # different types of errors were returned.
            type(control_result.error) is type(experimental_result.error) and
            _compare(control_result.value, experimental_result.value)
        )
371059
def napi_compare(left, ops, comparators, **kwargs):
    """"""

    values = []
    for op, right in zip(ops, comparators):
        value = COMPARE[op](left, right)
        values.append(value)
        left = right
    result = napi_and(values, **kwargs)
    if isinstance(result, ndarray):
        return result
    else:
        return bool(result)
34834
def comparable(self):
        """"""
        document_dict = self.compare_safe(self._document)

        # Remove uncompared fields
        self._remove_keys(document_dict, self._uncompared_fields)

        # Remove any empty values
        clean_document_dict = {}
        for k, v in document_dict.items():
            if not v and not isinstance(v, (int, float)):
                continue
            clean_document_dict[k] = v

        # Convert any referenced fields to Frames
        for ref_field, ref_cls in self._compared_refs.items():
            ref = getattr(self, ref_field)
            if not ref:
                continue

            # Check for fields which contain a list of references
            if isinstance(ref, list):
                if isinstance(ref[0], Frame):
                    continue

                # Dereference the list of reference IDs
                setattr(
                    clean_document_dict,
                    ref_field,
                    ref_cls.many(In(Q._id, ref))
                    )

            else:
                if isinstance(ref, Frame):
                    continue

                # Dereference the reference ID
                setattr(
                    clean_document_dict,
                    ref_field,
                    ref_cls.byId(ref)
                    )

        return clean_document_dict
1040822
protected function compareLanguages(): void
    {
    	foreach($this->needed_languages as $needed_language){
    		if(!in_array($needed_language, $this->languages)){
    			array_push($this->languages, $needed_language);
		    }
	    }
    }
202638
def start_processing_handler(self, event):
        """"""
        results_path = os.path.join(self.configuration['results_folder'],
                                    "filesystem.json")
        self.logger.debug("Event %s: start comparing %s with %s.",
                          event, self.checkpoints[0], self.checkpoints[1])

        results = compare_disks(self.checkpoints[0], self.checkpoints[1],
                                self.configuration)

        with open(results_path, 'w') as results_file:
            json.dump(results, results_file)

        self.processing_done.set()
874679
static void assertEquals(String message, Object comparison1, Object comparison2)
    {
        if(comparison1 == comparison2)
        {
            return;
        }
        if(comparison1.equals(comparison2))
        {
            return;
        }

        System.err.println(message);
    }
757327
public <T> void compare(Comparison comparison, Label trueLabel, Local<T> a, Local<T> b) {
        adopt(trueLabel);
        Rop rop = comparison.rop(StdTypeList.make(a.type.ropType, b.type.ropType));
        addInstruction(new PlainInsn(rop, sourcePosition, null,
                RegisterSpecList.make(a.spec(), b.spec())), trueLabel);
    }
899108
def visit_compare(self, node, parent):
        """"""
        newnode = nodes.Compare(node.lineno, node.col_offset, parent)
        newnode.postinit(
            self.visit(node.left, newnode),
            [
                (self._cmp_op_classes[op.__class__], self.visit(expr, newnode))
                for (op, expr) in zip(node.ops, node.comparators)
            ],
        )
        return newnode
1374903
def equals(self, rhs):
    

    for comparator in self._comparators:
      if comparator.equals(rhs):
        return True

    return False