Ejemplo n.º 1
0
def cmp_fun():
    a, b = 5, 3
    print (operator.lt(a,b))
    #True Same as a<b.
    print (operator.le(a, b))
    # False
    print (operator.eq(a,b))
    # False
    print (operator.ne(a,b))    
    #TRUE
    print(operator.ge(a,b))
    #False Same as a>=b
    print (operator.gt(a, b))
    # True
    print (operator.__lt__(a, b))
    #TRUE
    print (operator.__le__(a, b))
    #TRUE
    print (operator.__ne__(a, b))
    #TRUE Same as a<b.
    print (operator.__ge__(a, b))    
    #FALSE
    print (operator.__gt__(a, b))
    #FALSE
    print (operator.__eq__(a, b))
Ejemplo n.º 2
0
    def __compacted(self):
        clusters = []
        for cluster in self.clusters:  # Todo Cluster unable to get repair for `list`
            compact_cluster = []
            cluster_size = len(cluster)
            for _ in range(cluster_size):
                #  pandas.DataFrame.duplicated([cluster[i]], keep=False)
                cluster[_].duplicated = False

            for _ in range(cluster_size):
                if cluster[_].duplicated:
                    continue
                for j in range(1 + _, cluster_size):
                    if cluster[j].duplicated:
                        continue
                    sentences_degree = self.uniform_similarity(
                        cluster[_], cluster[j])
                    if operator.__gt__(sentences_degree,
                                       0.85):  # Threshold A > B
                        #  pandas.DataFrame.duplicated([cluster[i]], keep=False)
                        cluster[j].duplicated = True
                compact_cluster.append(cluster[_])
            clusters.append(compact_cluster)
        self.clusters = clusters
        self.__clustered()
Ejemplo n.º 3
0
 def specialcases(x):
     operator.lt(x,3)
     operator.le(x,3)
     operator.eq(x,3)
     operator.ne(x,3)
     operator.gt(x,3)
     operator.ge(x,3)
     is_operator(x,3)
     operator.__lt__(x,3)
     operator.__le__(x,3)
     operator.__eq__(x,3)
     operator.__ne__(x,3)
     operator.__gt__(x,3)
     operator.__ge__(x,3)
     # the following ones are constant-folded
     operator.eq(2,3)
     operator.__gt__(2,3)
Ejemplo n.º 4
0
 def specialcases(x):
     operator.lt(x, 3)
     operator.le(x, 3)
     operator.eq(x, 3)
     operator.ne(x, 3)
     operator.gt(x, 3)
     operator.ge(x, 3)
     is_operator(x, 3)
     operator.__lt__(x, 3)
     operator.__le__(x, 3)
     operator.__eq__(x, 3)
     operator.__ne__(x, 3)
     operator.__gt__(x, 3)
     operator.__ge__(x, 3)
     operator.xor(x, 3)
     # the following ones are constant-folded
     operator.eq(2, 3)
     operator.__gt__(2, 3)
Ejemplo n.º 5
0
def operations_to_functions(operation, a, b):
    if operation == ">=":
        return operator.__ge__(a, b)
    if operation == "<=":
        return operator.__le__(a, b)
    if operation == "=":
        return operator.__eq__(a, b)
    if operation == ">":
        return operator.__gt__(a, b)
    if operation == "<":
        return operator.__lt__(a, b)
Ejemplo n.º 6
0
 def __gt__(self, value):
     return operator.__gt__(self._tensor, value)
Ejemplo n.º 7
0
@Software: PyCharm
@File    : operator_learn.py
'''

import operator
a = 6
b = 7
operator.lt(a, b)  #less than小于

operator.le(a, b)  #lessthan or equal to小于等于

operator.eq(a, b)  #equal to等于

operator.ne(a, b)  #not equalto不等于

operator.ge(a, b)  #greaterand equal to大于等于

operator.gt(a, b)  #greater大于

operator.__le__(a, b)

operator.__lt__(a, b)

operator.__eq__(a, b)

operator.__ne__(a, b)

print(operator.__ge__(a, b))

operator.__gt__(a, b)
Ejemplo n.º 8
0
 def __gt__(self, other):
     """self > other"""
     return __gt__(get_wrapped_object(self), get_wrapped_object(other))
Ejemplo n.º 9
0
 def update_event(self, inp=-1):
     self.set_output_val(0, operator.__gt__(self.input(0), self.input(1)))
Ejemplo n.º 10
0
                     doc=operator.floordiv.__doc__)

# reversed
ge = spice(lambda x, y: operator.ge(y, x), name='ge')
__ge__ = spice(lambda x, y: operator.__ge__(y, x), name='__ge__')

getitem = spice(lambda x, y: operator.getitem(x, y),
                name='getitem',
                doc=operator.getitem.__doc__)
__getitem__ = spice(lambda x, y: operator.__getitem__(x, y),
                    name='__getitem__',
                    doc=operator.getitem.__doc__)

# reversed
gt = spice(lambda x, y: operator.gt(y, x), name='gt')
__gt__ = spice(lambda x, y: operator.__gt__(y, x))

indexOf = spice(lambda x, y: operator.indexOf(x, y),
                name='indexOf',
                doc=operator.indexOf.__doc__)
is_ = spice(lambda x, y: operator.is_(x, y),
            name='is_',
            doc=operator.is_.__doc__)
is_not = spice(lambda x, y: operator.is_not(x, y),
               name='is_not',
               doc=operator.is_not.__doc__)

# reversed
le = spice(lambda x, y: operator.le(y, x), name='le')
__le__ = spice(lambda x, y: operator.__le__(y, x), name='__le__')