當前位置: 首頁>>代碼示例>>Python>>正文


Python operator.ior方法代碼示例

本文整理匯總了Python中operator.ior方法的典型用法代碼示例。如果您正苦於以下問題:Python operator.ior方法的具體用法?Python operator.ior怎麽用?Python operator.ior使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在operator的用法示例。


在下文中一共展示了operator.ior方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testIOr

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def testIOr(self):
        self.augmentedAssignCheck(operator.ior) 
開發者ID:myhdl,項目名稱:myhdl,代碼行數:4,代碼來源:test_Signal.py

示例2: delete

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def delete(self, session_id, data_keys, devices=None, _tell=False):
        if not devices:
            devices = functools.reduce(
                operator.ior, self._manager_ref.get_data_locations(session_id, data_keys), set())
        else:
            devices = self._normalize_devices(devices)

        devices = self._normalize_devices(devices)
        for dev_type in devices:
            handler = self.get_storage_handler(dev_type)
            handler.delete(session_id, data_keys, _tell=_tell) 
開發者ID:mars-project,項目名稱:mars,代碼行數:13,代碼來源:client.py

示例3: pin_data_keys

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def pin_data_keys(self, session_id, data_keys, token, devices=None):
        if not devices:
            devices = functools.reduce(
                operator.ior, self._manager_ref.get_data_locations(session_id, data_keys), set())
        else:
            devices = self._normalize_devices(devices)

        pinned = set()
        for dev in devices:
            handler = self.get_storage_handler(dev)
            if not getattr(handler, '_spillable', False):
                continue
            keys = handler.pin_data_keys(session_id, data_keys, token)
            pinned.update(keys)
        return list(pinned) 
開發者ID:mars-project,項目名稱:mars,代碼行數:17,代碼來源:client.py

示例4: unpin_data_keys

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def unpin_data_keys(self, session_id, data_keys, token, devices=None):
        if not devices:
            devices = functools.reduce(
                operator.ior, self._manager_ref.get_data_locations(session_id, data_keys), set())
        else:
            devices = self._normalize_devices(devices)

        for dev in devices:
            handler = self.get_storage_handler(dev)
            if not getattr(handler, '_spillable', False):
                continue
            handler.unpin_data_keys(session_id, data_keys, token) 
開發者ID:mars-project,項目名稱:mars,代碼行數:14,代碼來源:client.py

示例5: get_ins_mask

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def get_ins_mask(self, instructions):
        return reduce(ior, instructions) 
開發者ID:opennetworkinglab,項目名稱:fabric-p4test,代碼行數:4,代碼來源:fabric_test.py

示例6: get_iregex_filter

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def get_iregex_filter(expression, *fields, mapping=None, logger=None, values=None):
    ret = Q()
    for dis in expression.split(' || '):
        cond = Q()
        for con in dis.split(' && '):
            r = con.strip()
            fs = fields
            suff = '__iregex'
            if ':' in r and mapping:
                k, v = r.split(':', 1)
                if k in mapping:
                    mapped = mapping[k]
                    try:
                        fs = mapped['fields']

                        r = mapped['func'](v) if 'func' in mapped else v

                        suff = mapped.get('suff', '')
                        if callable(suff):
                            suff = suff(r)
                    except Exception as e:
                        if logger:
                            logger.error(f'Field "{k}" has error: {e}')
                        continue
                    if values is not None:
                        values.setdefault(k, []).append(r)
            if isinstance(r, str):
                r = verify_regex(r, logger=logger)
            cond &= functools.reduce(operator.ior, (Q(**{f'{field}{suff}': r}) for field in fs))
        ret |= cond
    return ret 
開發者ID:aropan,項目名稱:clist,代碼行數:33,代碼來源:regex.py

示例7: test_ior_array

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def test_ior_array(self):
        self.check_array_array_op(operator.ior) 
開發者ID:cupy,項目名稱:cupy,代碼行數:4,代碼來源:test_ndarray_elementwise_op.py

示例8: test_broadcasted_ior

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def test_broadcasted_ior(self):
        self.check_array_broadcasted_op(operator.ior) 
開發者ID:cupy,項目名稱:cupy,代碼行數:4,代碼來源:test_ndarray_elementwise_op.py

示例9: object_hook

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def object_hook(obj):
    _isoformat = obj.get('_isoformat')
    if _isoformat is not None:
        return datetime.datetime.fromisoformat(_isoformat)
    _bytes = obj.get('_bytes')
    if _bytes is not None:
        return bytes.fromhex(_bytes)
    _enum = obj.get('_enum')
    if _enum is not None:
        cls, flags = _enum.split('.')
        flags = map(lambda i: RouterFlags[i], flags.split('|'))
        return reduce(ior, flags)
    return obj 
開發者ID:torpyorg,項目名稱:torpy,代碼行數:15,代碼來源:test_documents.py

示例10: __init__

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def __init__(self, hass, device, endpoint):
        """Initialize the light."""
        self._device = device
        self._endpoint = endpoint
        self._is_on = False
        self._brightness = 0
        a = self._device.get_attribute(endpoint, 6, 0)
        if a:
            self._is_on = a.get('value', False)
        ieee = device.ieee or device.addr  # compatibility
        entity_id = 'zigate_{}_{}'.format(ieee,
                                          endpoint)
        self.entity_id = ENTITY_ID_FORMAT.format(entity_id)

        import zigate
        supported_features = set()
        supported_features.add(SUPPORT_TRANSITION)
        for action_type in device.available_actions(endpoint)[endpoint]:
            if action_type == zigate.ACTIONS_LEVEL:
                supported_features.add(SUPPORT_BRIGHTNESS)
            elif action_type == zigate.ACTIONS_COLOR:
                supported_features.add(SUPPORT_COLOR)
            elif action_type == zigate.ACTIONS_TEMPERATURE:
                supported_features.add(SUPPORT_COLOR_TEMP)
            elif action_type == zigate.ACTIONS_HUE:
                supported_features.add(SUPPORT_HUE_COLOR)
        self._supported_features = reduce(ior, supported_features)
        hass.bus.listen('zigate.attribute_updated', self._handle_event) 
開發者ID:doudz,項目名稱:homeassistant-zigate,代碼行數:30,代碼來源:light.py

示例11: test_update_operator

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def test_update_operator(self):  # test |= operator
        self.assertSingleValueOperator(lambda s, o: operator.ior(s, o))
        self.assertMultipleValuesOperator(
            lambda s, o: operator.ior(s, functools.reduce(operator.ior, [t.copy() for t in o]))) 
開發者ID:mathiasertl,項目名稱:django-ca,代碼行數:6,代碼來源:tests_extensions.py

示例12: __ior__

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def __ior__(self, other):
        return Expression((self, other), operator.ior) 
開發者ID:ebranca,項目名稱:owasp-pysec,代碼行數:4,代碼來源:expr.py

示例13: _get_reduce_op

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def _get_reduce_op(self, reduce_nodes):
        require(len(reduce_nodes) == 2)
        require(isinstance(reduce_nodes[0], ir.Assign))
        require(isinstance(reduce_nodes[1], ir.Assign))
        require(isinstance(reduce_nodes[0].value, ir.Expr))
        require(isinstance(reduce_nodes[1].value, ir.Var))
        rhs = reduce_nodes[0].value

        if rhs.op == 'inplace_binop':
            if rhs.fn in ('+=', operator.iadd):
                return Reduce_Type.Sum
            if rhs.fn in ('|=', operator.ior):
                return Reduce_Type.Or
            if rhs.fn in ('*=', operator.imul):
                return Reduce_Type.Prod

        if rhs.op == 'call':
            func = find_callname(self.state.func_ir, rhs, self.state.typemap)
            if func == ('min', 'builtins'):
                if isinstance(self.state.typemap[rhs.args[0].name], numba.core.typing.builtins.IndexValueType):
                    return Reduce_Type.Argmin
                return Reduce_Type.Min
            if func == ('max', 'builtins'):
                if isinstance(self.state.typemap[rhs.args[0].name], numba.core.typing.builtins.IndexValueType):
                    return Reduce_Type.Argmax
                return Reduce_Type.Max

        raise GuardException  # pragma: no cover 
開發者ID:IntelPython,項目名稱:sdc,代碼行數:30,代碼來源:distributed.py

示例14: __ior__

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def __ior__(self, other):
        return operator.ior(self._wrapped(), other) 
開發者ID:pschanely,項目名稱:CrossHair,代碼行數:4,代碼來源:objectproxy.py

示例15: _ior

# 需要導入模塊: import operator [as 別名]
# 或者: from operator import ior [as 別名]
def _ior(self, bs):
        return self._inplace_logical_helper(bs, operator.ior) 
開發者ID:scott-griffiths,項目名稱:bitstring,代碼行數:4,代碼來源:bitstring.py


注:本文中的operator.ior方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。