当前位置: 首页>>代码示例>>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;未经允许,请勿转载。