Python operator 模块,__gt__() 实例源码

我们从Python开源项目中,提取了以下32个代码示例,用于说明如何使用operator.__gt__()

项目:apiscout    作者:danielplohmann    | 项目源码 | 文件源码
def lrange(num1, num2=None, step=1):
    """
    Allows iteration over arbitrary numbers instead of dword long numbers.
    Credits go to:
    http://stackoverflow.com/questions/2187135/range-and-xrange-for-13-digit-numbers-in-python
    http://stackoverflow.com/users/263162/ricardo-cardenes
    """
    op = operator.__lt__

    if num2 is None:
        num1, num2 = 0, num1
    if num2 < num1:
        if step > 0:
            num1 = num2
        op = operator.__gt__
    elif step < 0:
        num1 = num2

    while op(num1, num2):
        yield num1
        num1 += step
项目:Tattle    作者:nickmaccarthy    | 项目源码 | 文件源码
def get_operator(op):
    if not op: return None

    if "ge" in op or ">=" in op:
        opr = operator.__ge__
    elif "gt" in op or ">" in op:
        opr = operator.__gt__
    elif "le" in op or "<=" in op:
        opr = operator.__le__
    elif "lt" in op or "<" in op:
        opr = operator.__lt__
    elif "eq" in op or "=" in op or "==" in op:
        opr = operator.eq
    elif "ne" in op or "!=" in op or "<>" in op:
        opr = operator.ne
    return opr
项目:ntypes    作者:AlexAltea    | 项目源码 | 文件源码
def __gt__(self, rhs):
        return op_relational(self, rhs, operator.__gt__)


# Aliases
项目:ntypes    作者:AlexAltea    | 项目源码 | 文件源码
def __gt__(self, rhs):
        return op_relational(self, rhs, operator.__gt__)


# Aliases
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def __gt__(self, other):
        return self.x > other
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def __gt__(self, other):
        return Vector([a > b for a, b in zip(self.data, self.__cast(other))])
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_misbehavin(self):
        class Misb:
            def __lt__(self_, other): return 0
            def __gt__(self_, other): return 0
            def __eq__(self_, other): return 0
            def __le__(self_, other): self.fail("This shouldn't happen")
            def __ge__(self_, other): self.fail("This shouldn't happen")
            def __ne__(self_, other): self.fail("This shouldn't happen")
        a = Misb()
        b = Misb()
        self.assertEqual(a<b, 0)
        self.assertEqual(a==b, 0)
        self.assertEqual(a>b, 0)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def __gt__(self, other):
        return self.x > other
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def __gt__(self, other):
        return Vector([a > b for a, b in zip(self.data, self.__cast(other))])
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_misbehavin(self):
        class Misb:
            def __lt__(self_, other): return 0
            def __gt__(self_, other): return 0
            def __eq__(self_, other): return 0
            def __le__(self_, other): self.fail("This shouldn't happen")
            def __ge__(self_, other): self.fail("This shouldn't happen")
            def __ne__(self_, other): self.fail("This shouldn't happen")
            def __cmp__(self_, other): raise RuntimeError, "expected"
        a = Misb()
        b = Misb()
        self.assertEqual(a<b, 0)
        self.assertEqual(a==b, 0)
        self.assertEqual(a>b, 0)
        self.assertRaises(RuntimeError, cmp, a, b)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def __gt__(self, other):
        return self.x > other
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def __gt__(self, other):
        return Vector([a > b for a, b in zip(self.data, self.__cast(other))])
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_misbehavin(self):
        class Misb:
            def __lt__(self_, other): return 0
            def __gt__(self_, other): return 0
            def __eq__(self_, other): return 0
            def __le__(self_, other): self.fail("This shouldn't happen")
            def __ge__(self_, other): self.fail("This shouldn't happen")
            def __ne__(self_, other): self.fail("This shouldn't happen")
            def __cmp__(self_, other): raise RuntimeError, "expected"
        a = Misb()
        b = Misb()
        self.assertEqual(a<b, 0)
        self.assertEqual(a==b, 0)
        self.assertEqual(a>b, 0)
        self.assertRaises(RuntimeError, cmp, a, b)
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def __gt__(self, other):
        return self.x > other
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def __gt__(self, other):
        return Vector([a > b for a, b in zip(self.data, self.__cast(other))])
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_misbehavin(self):
        class Misb:
            def __lt__(self_, other): return 0
            def __gt__(self_, other): return 0
            def __eq__(self_, other): return 0
            def __le__(self_, other): self.fail("This shouldn't happen")
            def __ge__(self_, other): self.fail("This shouldn't happen")
            def __ne__(self_, other): self.fail("This shouldn't happen")
        a = Misb()
        b = Misb()
        self.assertEqual(a<b, 0)
        self.assertEqual(a==b, 0)
        self.assertEqual(a>b, 0)
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def __gt__(self, other):
        return self.x > other
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def __gt__(self, other):
        return Vector([a > b for a, b in zip(self.data, self.__cast(other))])
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def test_misbehavin(self):
        class Misb:
            def __lt__(self_, other): return 0
            def __gt__(self_, other): return 0
            def __eq__(self_, other): return 0
            def __le__(self_, other): self.fail("This shouldn't happen")
            def __ge__(self_, other): self.fail("This shouldn't happen")
            def __ne__(self_, other): self.fail("This shouldn't happen")
            def __cmp__(self_, other): raise RuntimeError, "expected"
        a = Misb()
        b = Misb()
        self.assertEqual(a<b, 0)
        self.assertEqual(a==b, 0)
        self.assertEqual(a>b, 0)
        self.assertRaises(RuntimeError, cmp, a, b)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def __gt__(self, other):
        return self.x > other
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def __gt__(self, other):
        return Vector([a > b for a, b in zip(self.data, self.__cast(other))])
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def test_misbehavin(self):
        class Misb:
            def __lt__(self_, other): return 0
            def __gt__(self_, other): return 0
            def __eq__(self_, other): return 0
            def __le__(self_, other): self.fail("This shouldn't happen")
            def __ge__(self_, other): self.fail("This shouldn't happen")
            def __ne__(self_, other): self.fail("This shouldn't happen")
        a = Misb()
        b = Misb()
        self.assertEqual(a<b, 0)
        self.assertEqual(a==b, 0)
        self.assertEqual(a>b, 0)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def __gt__(self, other):
        return self.x > other
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def __gt__(self, other):
        return Vector([a > b for a, b in zip(self.data, self.__cast(other))])
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_misbehavin(self):
        class Misb:
            def __lt__(self_, other): return 0
            def __gt__(self_, other): return 0
            def __eq__(self_, other): return 0
            def __le__(self_, other): self.fail("This shouldn't happen")
            def __ge__(self_, other): self.fail("This shouldn't happen")
            def __ne__(self_, other): self.fail("This shouldn't happen")
            def __cmp__(self_, other): raise RuntimeError, "expected"
        a = Misb()
        b = Misb()
        self.assertEqual(a<b, 0)
        self.assertEqual(a==b, 0)
        self.assertEqual(a>b, 0)
        self.assertRaises(RuntimeError, cmp, a, b)
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def __gt__(self, other):
        return self.x > other
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def __gt__(self, other):
        return Vector([a > b for a, b in zip(self.data, self.__cast(other))])
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def test_misbehavin(self):
        class Misb:
            def __lt__(self_, other): return 0
            def __gt__(self_, other): return 0
            def __eq__(self_, other): return 0
            def __le__(self_, other): self.fail("This shouldn't happen")
            def __ge__(self_, other): self.fail("This shouldn't happen")
            def __ne__(self_, other): self.fail("This shouldn't happen")
        a = Misb()
        b = Misb()
        self.assertEqual(a<b, 0)
        self.assertEqual(a==b, 0)
        self.assertEqual(a>b, 0)
项目:enterprise-fibonacci    作者:surrsurus    | 项目源码 | 文件源码
def greaterThan(typeA, typeB):
    if operator.__gt__(typeA.number.getNum(), typeB.number.getNum()):
        return True
    else:
        return False
项目:rvmi-rekall    作者:fireeye    | 项目源码 | 文件源码
def __gt__(self, _):
        return False
项目:rvmi-rekall    作者:fireeye    | 项目源码 | 文件源码
def __gt__(self, other):
        return self.__comparator__(other, operator.__gt__)
项目:py-flags    作者:pasztorpisti    | 项目源码 | 文件源码
def test_gt(self):
        self._test_incompatible_types_fail(operator.__gt__)

        self.assertFalse(no_flags > no_flags)
        self.assertFalse(no_flags > all_flags)
        self.assertFalse(no_flags > f0)
        self.assertFalse(no_flags > f1)
        self.assertFalse(no_flags > f2)
        self.assertFalse(no_flags > f01)
        self.assertFalse(no_flags > f02)
        self.assertFalse(no_flags > f12)

        self.assertTrue(f0 > no_flags)
        self.assertFalse(f0 > all_flags)
        self.assertFalse(f0 > f0)
        self.assertFalse(f0 > f1)
        self.assertFalse(f0 > f2)
        self.assertFalse(f0 > f01)
        self.assertFalse(f0 > f02)
        self.assertFalse(f0 > f12)

        self.assertTrue(f01 > no_flags)
        self.assertFalse(f01 > all_flags)
        self.assertTrue(f01 > f0)
        self.assertTrue(f01 > f1)
        self.assertFalse(f01 > f2)
        self.assertFalse(f01 > f01)
        self.assertFalse(f01 > f02)
        self.assertFalse(f01 > f12)

        self.assertFalse(no_flags > all_flags)
        self.assertFalse(all_flags > all_flags)
        self.assertFalse(f0 > all_flags)
        self.assertFalse(f1 > all_flags)
        self.assertFalse(f2 > all_flags)
        self.assertFalse(f01 > all_flags)
        self.assertFalse(f02 > all_flags)
        self.assertFalse(f12 > all_flags)