当前位置: 首页>>代码示例>>Python>>正文


Python operator.eq方法代码示例

本文整理汇总了Python中operator.eq方法的典型用法代码示例。如果您正苦于以下问题:Python operator.eq方法的具体用法?Python operator.eq怎么用?Python operator.eq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在operator的用法示例。


在下文中一共展示了operator.eq方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_dedup_with_blocking_vs_sortedneighbourhood

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def test_dedup_with_blocking_vs_sortedneighbourhood(self, window):
        indexers = [
            NeighbourhoodBlock(
                ['var_arange', 'var_block10'],
                max_nulls=1,
                windows=[window, 1]),
            NeighbourhoodBlock(
                left_on=['var_arange', 'var_block10'],
                right_on=['var_arange', 'var_block10'],
                max_nulls=1,
                windows=[window, 1]),
            SortedNeighbourhood(
                'var_arange', block_on='var_block10', window=window),
        ]
        self.assert_index_comparisons(eq, indexers, self.a)
        self.assert_index_comparisons(gt, indexers[-2:], self.incomplete_a) 
开发者ID:J535D165,项目名称:recordlinkage,代码行数:18,代码来源:neighbourhoodblock_test.py

示例2: test_link_with_blocking_vs_sortedneighbourhood

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def test_link_with_blocking_vs_sortedneighbourhood(self, window):
        indexers = [
            NeighbourhoodBlock(
                ['var_arange', 'var_block10'],
                max_nulls=1,
                windows=[window, 1]),
            NeighbourhoodBlock(
                left_on=['var_arange', 'var_block10'],
                right_on=['var_arange', 'var_block10'],
                max_nulls=1,
                windows=[window, 1]),
            SortedNeighbourhood(
                'var_arange', block_on='var_block10', window=window),
        ]
        self.assert_index_comparisons(eq, indexers, self.a, self.b)
        self.assert_index_comparisons(gt, indexers[-2:], self.incomplete_a,
                                      self.incomplete_b) 
开发者ID:J535D165,项目名称:recordlinkage,代码行数:19,代码来源:neighbourhoodblock_test.py

示例3: test_richcompare_crash

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def test_richcompare_crash(self):
        # gh-4613
        import operator as op

        # dummy class where __array__ throws exception
        class Foo(object):
            __array_priority__ = 1002

            def __array__(self, *args, **kwargs):
                raise Exception()

        rhs = Foo()
        lhs = np.array(1)
        for f in [op.lt, op.le, op.gt, op.ge]:
            if sys.version_info[0] >= 3:
                assert_raises(TypeError, f, lhs, rhs)
            elif not sys.py3kwarning:
                # With -3 switch in python 2, DeprecationWarning is raised
                # which we are not interested in
                f(lhs, rhs)
        assert_(not op.eq(lhs, rhs))
        assert_(op.ne(lhs, rhs)) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:24,代码来源:test_regression.py

示例4: test_compare_frame

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def test_compare_frame(self):
        # GH#24282 check that Categorical.__cmp__(DataFrame) defers to frame
        data = ["a", "b", 2, "a"]
        cat = Categorical(data)

        df = DataFrame(cat)

        for op in [operator.eq, operator.ne, operator.ge,
                   operator.gt, operator.le, operator.lt]:
            with pytest.raises(ValueError):
                # alignment raises unless we transpose
                op(cat, df)

        result = cat == df.T
        expected = DataFrame([[True, True, True, True]])
        tm.assert_frame_equal(result, expected)

        result = cat[::-1] != df.T
        expected = DataFrame([[False, True, True, False]])
        tm.assert_frame_equal(result, expected) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:22,代码来源:test_operators.py

示例5: visit_binary

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def visit_binary(self, binary, **kwargs):
        """Move bind parameters to the right-hand side of an operator, where
        possible.

        """
        if (
            isinstance(binary.left, expression.BindParameter)
            and binary.operator == operator.eq
            and not isinstance(binary.right, expression.BindParameter)
        ):
            return self.process(
                expression.BinaryExpression(binary.right,
                                            binary.left,
                                            binary.operator),
                **kwargs)
        return super(MSSQLCompiler, self).visit_binary(binary, **kwargs) 
开发者ID:jpush,项目名称:jbox,代码行数:18,代码来源:base.py

示例6: _validate_query_state

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def _validate_query_state(self):
        for attr, methname, notset, op in (
            ('_limit', 'limit()', None, operator.is_),
            ('_offset', 'offset()', None, operator.is_),
            ('_order_by', 'order_by()', False, operator.is_),
            ('_group_by', 'group_by()', False, operator.is_),
            ('_distinct', 'distinct()', False, operator.is_),
            (
                '_from_obj',
                'join(), outerjoin(), select_from(), or from_self()',
                (), operator.eq)
        ):
            if not op(getattr(self.query, attr), notset):
                raise sa_exc.InvalidRequestError(
                    "Can't call Query.update() or Query.delete() "
                    "when %s has been called" %
                    (methname, )
                ) 
开发者ID:jpush,项目名称:jbox,代码行数:20,代码来源:persistence.py

示例7: get_op

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
            '<':  operator.lt,
            '>':  operator.gt,
            '<=': operator.le,
            '>=': operator.ge,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
开发者ID:jpush,项目名称:jbox,代码行数:20,代码来源:__init__.py

示例8: make_multi_lable

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def make_multi_lable(self,dic):
        for key in dic:
            pre=None
            #print("before:",dic[key])
            temp=[]
            for info in dic[key]:
                if pre==None:
                    pre=info
                    temp.append(info)
                elif operator.eq(info.bbox.tolist(),pre.bbox.tolist()):
                        temp[-1].img_class.append(info.img_class[0])
                        #这是个陷坑
                        #dic[key].remove(info)
                else:
                    pre=info
                    temp.append(info)
            dic[key]=temp
        #print("dic:",dic) 
开发者ID:MagicChuyi,项目名称:SlowFast-Network-pytorch,代码行数:20,代码来源:AVA_video_v1.py

示例9: make_multi_lable

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def make_multi_lable(self,dic):
        for key in dic:
            pre=None
            #print("before:",dic[key])
            temp=[]
            for info in dic[key]:
                if pre==None:
                    pre=info
                    temp.append(info)
                elif operator.eq(info.bbox.tolist(),pre.bbox.tolist()):
                        temp[-1].img_class.append(info.img_class[0])
                        #这是个陷坑
                        #dic[key].remove(info)
                else:
                    pre=info
                    temp.append(info)
            dic[key]=temp
        #print("dic:",dic)



    #把dic的信息转换成一一对应的list信息(bboxes,labels,detector_bboxes_list,width,height,ratio,image_position) 
开发者ID:MagicChuyi,项目名称:SlowFast-Network-pytorch,代码行数:24,代码来源:AVA_video_v2.py

示例10: make_multi_lable

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def make_multi_lable(self,dic):
        for key in dic:
            pre=None
            #print("before:",dic[key])
            temp=[]
            for info in dic[key]:
                if pre==None:
                    pre=info
                    temp.append(info)
                elif operator.eq(info.bbox.tolist(),pre.bbox.tolist()):
                        temp[-1].img_class.append(info.img_class[0])
                        temp[-1].prob.append(info.prob[0])
                        #这是个陷坑
                        #dic[key].remove(info)
                else:
                    pre=info
                    temp.append(info)
            dic[key]=temp 
开发者ID:MagicChuyi,项目名称:SlowFast-Network-pytorch,代码行数:20,代码来源:imshow_result.py

示例11: test_values

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def test_values(self):
        # check all operators and all comparison results
        self.checkvalue("lt", 0, 0, False)
        self.checkvalue("le", 0, 0, True )
        self.checkvalue("eq", 0, 0, True )
        self.checkvalue("ne", 0, 0, False)
        self.checkvalue("gt", 0, 0, False)
        self.checkvalue("ge", 0, 0, True )

        self.checkvalue("lt", 0, 1, True )
        self.checkvalue("le", 0, 1, True )
        self.checkvalue("eq", 0, 1, False)
        self.checkvalue("ne", 0, 1, True )
        self.checkvalue("gt", 0, 1, False)
        self.checkvalue("ge", 0, 1, False)

        self.checkvalue("lt", 1, 0, False)
        self.checkvalue("le", 1, 0, False)
        self.checkvalue("eq", 1, 0, False)
        self.checkvalue("ne", 1, 0, True )
        self.checkvalue("gt", 1, 0, True )
        self.checkvalue("ge", 1, 0, True ) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:24,代码来源:test_richcmp.py

示例12: _filter_checks

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def _filter_checks(checks, type=None, context=None, inverse=False):
    result = []
    comparator = operator.eq if inverse else operator.ne
    for check in checks:
        if type and comparator(check['type'], type):
            continue
        if context and comparator(check['context'], context):
            continue
        result.append(check)
    return result 
开发者ID:frictionlessdata,项目名称:goodtables-py,代码行数:12,代码来源:inspector.py

示例13: testEq

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def testEq(self):
        self.comparisonCheck(operator.eq) 
开发者ID:myhdl,项目名称:myhdl,代码行数:4,代码来源:test_Signal.py

示例14: __eq__

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def __eq__(self, other: Union['Quantity', float, int]) -> bool:
        return Quantity._bool_operation(self, other, operator.eq) 
开发者ID:tensortrade-org,项目名称:tensortrade,代码行数:4,代码来源:quantity.py

示例15: _compare

# 需要导入模块: import operator [as 别名]
# 或者: from operator import eq [as 别名]
def _compare(self, op, other):
        if isinstance(other, SplitKey):
            if self.sampling != other.sampling:
                if op == operator.eq:
                    return False
                if op == operator.ne:
                    return True
                raise TypeError(
                    "Cannot compare %s with different sampling" %
                    self.__class__.__name__)
            return op(self.key, other.key)
        if isinstance(other, numpy.datetime64):
            return op(self.key, other)
        raise TypeError("Cannot compare %r with %r" % (self, other)) 
开发者ID:gnocchixyz,项目名称:gnocchi,代码行数:16,代码来源:carbonara.py


注:本文中的operator.eq方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。