本文整理汇总了Python中operator.iand方法的典型用法代码示例。如果您正苦于以下问题:Python operator.iand方法的具体用法?Python operator.iand怎么用?Python operator.iand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类operator
的用法示例。
在下文中一共展示了operator.iand方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_messages
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def _get_messages(self, args):
"""Gets messages from the database"""
self.print_ok('Fetching data..')
conditions = [Message.scan == self.current_scan]
if args.show_only_labeled:
conditions.append(Topic.not_empty_label())
if args.message_regex:
if args.case_sensitive:
conditions.append(Message.body.regexp(args.message_regex))
else:
conditions.append(fn.lower(Message.body).regexp(args.message_regex))
if args.topic_regex:
if args.case_sensitive:
conditions.append(Topic.name.regexp(args.topic_regex))
else:
conditions.append(fn.lower(Topic.name).regexp(args.topic_regex))
return self._generic_fetch_messages(
reduce(iand, conditions),
limit=args.limit
)
示例2: _get_topics
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def _get_topics(self, args):
"""Gets the topics from the database"""
self.print_ok('Fetching data..')
conditions = [Message.scan == self.current_scan]
if args.show_only_labeled:
conditions.append(Topic.not_empty_label())
if args.regex:
if args.case_sensitive:
conditions.append(Topic.name.regexp(args.regex))
else:
conditions.append(fn.lower(Topic.name).regexp(args.regex))
return self._generic_fetch_topics(
reduce(iand, conditions),
limit=args.limit
)
示例3: testIAnd
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def testIAnd(self):
self.augmentedAssignCheck(operator.iand)
示例4: test_iand_array
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def test_iand_array(self):
self.check_array_array_op(operator.iand)
示例5: test_broadcasted_iand
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def test_broadcasted_iand(self):
self.check_array_broadcasted_op(operator.iand)
示例6: test_intersection_update_operator
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def test_intersection_update_operator(self): # test &= operator
self.assertSingleValueOperator(lambda s, o: operator.iand(s, o))
self.assertMultipleValuesOperator(
lambda s, o: operator.iand(s, functools.reduce(operator.and_, [t.copy() for t in o])))
示例7: __iand__
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def __iand__(self, other):
return Expression((self, other), operator.iand)
示例8: __iand__
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def __iand__(self, other):
return operator.iand(self._wrapped(), other)
示例9: _iand
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def _iand(self, bs):
return self._inplace_logical_helper(bs, operator.iand)
示例10: test_inplace
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def test_inplace(self):
class C(object):
def __iadd__ (self, other): return "iadd"
def __iand__ (self, other): return "iand"
def __idiv__ (self, other): return "idiv"
def __ifloordiv__(self, other): return "ifloordiv"
def __ilshift__ (self, other): return "ilshift"
def __imod__ (self, other): return "imod"
def __imul__ (self, other): return "imul"
def __ior__ (self, other): return "ior"
def __ipow__ (self, other): return "ipow"
def __irshift__ (self, other): return "irshift"
def __isub__ (self, other): return "isub"
def __itruediv__ (self, other): return "itruediv"
def __ixor__ (self, other): return "ixor"
def __getitem__(self, other): return 5 # so that C is a sequence
c = C()
self.assertEqual(operator.iadd (c, 5), "iadd")
self.assertEqual(operator.iand (c, 5), "iand")
self.assertEqual(operator.idiv (c, 5), "idiv")
self.assertEqual(operator.ifloordiv(c, 5), "ifloordiv")
self.assertEqual(operator.ilshift (c, 5), "ilshift")
self.assertEqual(operator.imod (c, 5), "imod")
self.assertEqual(operator.imul (c, 5), "imul")
self.assertEqual(operator.ior (c, 5), "ior")
self.assertEqual(operator.ipow (c, 5), "ipow")
self.assertEqual(operator.irshift (c, 5), "irshift")
self.assertEqual(operator.isub (c, 5), "isub")
self.assertEqual(operator.itruediv (c, 5), "itruediv")
self.assertEqual(operator.ixor (c, 5), "ixor")
self.assertEqual(operator.iconcat (c, c), "iadd")
self.assertEqual(operator.irepeat (c, 5), "imul")
self.assertEqual(operator.__iadd__ (c, 5), "iadd")
self.assertEqual(operator.__iand__ (c, 5), "iand")
self.assertEqual(operator.__idiv__ (c, 5), "idiv")
self.assertEqual(operator.__ifloordiv__(c, 5), "ifloordiv")
self.assertEqual(operator.__ilshift__ (c, 5), "ilshift")
self.assertEqual(operator.__imod__ (c, 5), "imod")
self.assertEqual(operator.__imul__ (c, 5), "imul")
self.assertEqual(operator.__ior__ (c, 5), "ior")
self.assertEqual(operator.__ipow__ (c, 5), "ipow")
self.assertEqual(operator.__irshift__ (c, 5), "irshift")
self.assertEqual(operator.__isub__ (c, 5), "isub")
self.assertEqual(operator.__itruediv__ (c, 5), "itruediv")
self.assertEqual(operator.__ixor__ (c, 5), "ixor")
self.assertEqual(operator.__iconcat__ (c, c), "iadd")
self.assertEqual(operator.__irepeat__ (c, 5), "imul")
示例11: filter_low_conf_regions
# 需要导入模块: import operator [as 别名]
# 或者: from operator import iand [as 别名]
def filter_low_conf_regions(
mt: Union[hl.MatrixTable, hl.Table],
filter_lcr: bool = True,
filter_decoy: bool = True,
filter_segdup: bool = True,
filter_exome_low_coverage_regions: bool = False,
high_conf_regions: Optional[List[str]] = None,
) -> Union[hl.MatrixTable, hl.Table]:
"""
Filters low-confidence regions
:param mt: MatrixTable or Table to filter
:param filter_lcr: Whether to filter LCR regions
:param filter_decoy: Whether to filter decoy regions
:param filter_segdup: Whether to filter Segdup regions
:param filter_exome_low_coverage_regions: Whether to filter exome low confidence regions
:param high_conf_regions: Paths to set of high confidence regions to restrict to (union of regions)
:return: MatrixTable or Table with low confidence regions removed
"""
build = get_reference_genome(mt.locus).name
if build == "GRCh37":
import gnomad.resources.grch37.reference_data as resources
elif build == "GRCh38":
import gnomad.resources.grch38.reference_data as resources
criteria = []
if filter_lcr:
lcr = resources.lcr_intervals.ht()
criteria.append(hl.is_missing(lcr[mt.locus]))
if filter_decoy:
decoy = resources.decoy_intervals.ht()
criteria.append(hl.is_missing(decoy[mt.locus]))
if filter_segdup:
segdup = resources.seg_dup_intervals.ht()
criteria.append(hl.is_missing(segdup[mt.locus]))
if filter_exome_low_coverage_regions:
high_cov = resources.high_coverage_intervals.ht()
criteria.append(hl.is_missing(high_cov[mt.locus]))
if high_conf_regions is not None:
for region in high_conf_regions:
region = hl.import_locus_intervals(region)
criteria.append(hl.is_defined(region[mt.locus]))
if criteria:
filter_criteria = functools.reduce(operator.iand, criteria)
if isinstance(mt, hl.MatrixTable):
mt = mt.filter_rows(filter_criteria)
else:
mt = mt.filter(filter_criteria)
return mt