python类__and__()的实例源码

genotype_filters.py 文件源码 项目:varapp-backend-py 作者: varapp 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def merge_conditions_array(conds):
    """If there are multiple affected samples sharing the same parents,
    the conditions can be redundant. Simplify the conditions array so that
    there is at most one for each genotype/sample. If there are several constraints
    for the same genotype, check that they are compatible and take the strongest
    (lowest bit value).
    :param conds: an array of couples [sample_index, genotype_bit]
    :rtype: same as input
    """
    merged = []
    if not conds:
        return merged
    # Group by sample index, and get a single common bit for all conds on that sample
    conds.sort(key=itemgetter(0))
    for idx,group in itertools.groupby(conds, itemgetter(0)):
        genbits = [x[1] for x in group]   # only the genotype bit
        common_bits = reduce(__and__, genbits)
        merged.append((idx, common_bits))
    return merged
monitor.py 文件源码 项目:DeepSea 作者: SUSE 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def finish(self, event):
            self.targets[event.minion]['finished'] = True
            self.targets[event.minion]['success'] = event.success and event.retcode == 0
            self.targets[event.minion]['event'] = event

            if reduce(operator.__and__, [t['finished'] for t in self.targets.values()]):
                self.success = reduce(
                    operator.__and__, [t['success'] for t in self.targets.values()])
                self.finished = True
compatibility.py 文件源码 项目:darkc0de-old-stuff 作者: tuwid 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def all(items):
        return reduce(operator.__and__, items)
idsets.py 文件源码 项目:nstock 作者: ybenitezf 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __and__(self, other):
        return self.intersection(other)
idsets.py 文件源码 项目:nstock 作者: ybenitezf 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def intersection_update(self, other):
        if isinstance(other, BitSet):
            return self._logic(self, operator.__and__, other)
        discard = self.discard
        for n in self:
            if n not in other:
                discard(n)
idsets.py 文件源码 项目:nstock 作者: ybenitezf 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def intersection(self, other):
        if isinstance(other, BitSet):
            return self._logic(self.copy(), operator.__and__, other)
        return BitSet(source=(n for n in self if n in other))
job.py 文件源码 项目:python_mozetl 作者: mozilla 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def extract(main_summary, new_profile, start_ds, period, slack, is_sampled):
    """
    Extract data from the main summary table taking into account the
    retention period and submission latency.

    :param main_summary: dataframe pointing to main_summary.v4
    :param new_profile:  dataframe pointing to new_profile_ping_parquet
    :param start_ds:     start date of the retention period
    :param period:       length of the retention period
    :param slack:        slack added to account for submission latency
    :return:             a dataframe containing the raw subset of data
    """
    start = arrow.get(start_ds, DS_NODASH)

    predicates = [
        (F.col("subsession_start_date") >= utils.format_date(start, DS)),
        (F.col("subsession_start_date") < utils.format_date(start, DS, period)),
        (F.col("submission_date_s3") >= utils.format_date(start, DS_NODASH)),
        (F.col("submission_date_s3") < utils.format_date(start, DS_NODASH,
                                                         period + slack)),
    ]

    if is_sampled:
        predicates.append((F.col("sample_id") == "57"))

    extract_ms = (
        main_summary
        .where(reduce(operator.__and__, predicates))
        .select(SOURCE_COLUMNS)
    )

    np = clean_new_profile(new_profile)
    extract_np = (
        np
        .where(reduce(operator.__and__, predicates))
        .select(SOURCE_COLUMNS)
    )

    coalesced_ms = coalesce_new_profile_attribution(extract_ms, np)

    return coalesced_ms.union(extract_np)
job.py 文件源码 项目:python_mozetl 作者: mozilla 项目源码 文件源码 阅读 43 收藏 0 点赞 0 评论 0
def valid_pcd(pcd, client_date):
    """Determine if the profile creation date column is valid given the date
    reported by the client."""
    pcd_format = F.date_format(pcd, 'yyyy-MM-dd')
    is_valid_pcd = [
        pcd_format.isNotNull(),
        (pcd_format > DEFAULT_DATE),
        (pcd <= client_date),
    ]
    return (
        F.when(reduce(operator.__and__, is_valid_pcd), pcd)
        .otherwise(F.lit(None))
    )
native_int.py 文件源码 项目:ntypes 作者: AlexAltea 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __and__(self, rhs):
        return op_binary(self, rhs, operator.__and__)
native_int.py 文件源码 项目:ntypes 作者: AlexAltea 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __rand__(self, lhs):
        return op_binary(lhs, self, operator.__and__)
native_int.py 文件源码 项目:ntypes 作者: AlexAltea 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __iand__(self, v):
        return self.op_binary_inplace(v, operator.__and__)
idsets.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __and__(self, other):
        return self.intersection(other)
idsets.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def intersection_update(self, other):
        if isinstance(other, BitSet):
            return self._logic(self, operator.__and__, other)
        discard = self.discard
        for n in self:
            if n not in other:
                discard(n)
idsets.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def intersection(self, other):
        if isinstance(other, BitSet):
            return self._logic(self.copy(), operator.__and__, other)
        return BitSet(source=(n for n in self if n in other))
idsets.py 文件源码 项目:WhooshSearch 作者: rokartnaz 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def __and__(self, other):
        return self.intersection(other)
idsets.py 文件源码 项目:WhooshSearch 作者: rokartnaz 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def intersection_update(self, other):
        if isinstance(other, BitSet):
            return self._logic(self, operator.__and__, other)
        discard = self.discard
        for n in self:
            if n not in other:
                discard(n)
idsets.py 文件源码 项目:WhooshSearch 作者: rokartnaz 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def intersection(self, other):
        if isinstance(other, BitSet):
            return self._logic(self.copy(), operator.__and__, other)
        return BitSet(source=(n for n in self if n in other))
thread_tools.py 文件源码 项目:cpy2py 作者: maxfischer2781 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __and__(self, other):
        with self._lock:
            return operator.__and__(self.__wrapped__, other)
thread_tools.py 文件源码 项目:cpy2py 作者: maxfischer2781 项目源码 文件源码 阅读 42 收藏 0 点赞 0 评论 0
def __rand__(self, other):
        with self._lock:
            return operator.__and__(other, self.__wrapped__)
vector.py 文件源码 项目:Heap-Project-1 作者: stacompsoc 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __eq__(self, other):
        """
        Determine whether two objects are equal.

        :other: other object
        :returns: boolean
        """
        return type(self) == type(other) and len(self) == len(other) and \
            reduce(__and__, map(lambda z: z[0] == z[1], zip(self, other)), True)
idsets.py 文件源码 项目:QualquerMerdaAPI 作者: tiagovizoto 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def __and__(self, other):
        return self.intersection(other)
idsets.py 文件源码 项目:QualquerMerdaAPI 作者: tiagovizoto 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def intersection_update(self, other):
        if isinstance(other, BitSet):
            return self._logic(self, operator.__and__, other)
        discard = self.discard
        for n in self:
            if n not in other:
                discard(n)
idsets.py 文件源码 项目:QualquerMerdaAPI 作者: tiagovizoto 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def intersection(self, other):
        if isinstance(other, BitSet):
            return self._logic(self.copy(), operator.__and__, other)
        return BitSet(source=(n for n in self if n in other))
regex.py 文件源码 项目:hachoir3 作者: vstinner 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def __and__(self, regex):
        """
        Create new optimized version of a & b.
        Returns None if there is no interesting optimization.

        >>> RegexEmpty() & RegexString('a')
        <RegexString 'a'>
        """
        if regex.__class__ == RegexEmpty:
            return self
        new_regex = self._and(regex)
        if new_regex:
            return new_regex
        else:
            return RegexAnd((self, regex))
regex.py 文件源码 项目:hachoir3 作者: vstinner 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __add__(self, regex):
        return self.__and__(regex)
regex.py 文件源码 项目:hachoir3 作者: vstinner 项目源码 文件源码 阅读 44 收藏 0 点赞 0 评论 0
def join(cls, regex):
        """
        >>> RegexAnd.join( (RegexString('Big '), RegexString('fish')) )
        <RegexString 'Big fish'>
        """
        return _join(operator.__and__, regex)
typeinference.py 文件源码 项目:android-resources-id-recovery 作者: smartdone 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def merge(old, new):
    prims = ImmutableTreeList.merge(old.prims, new.prims, operator.__and__)
    arrs = ImmutableTreeList.merge(old.arrs, new.arrs, arrays.merge)
    tainted = ImmutableTreeList.merge(old.tainted, new.tainted, operator.__or__)
    if prims is old.prims and arrs is old.arrs and tainted is old.tainted:
        return old
    return TypeInfo(prims, arrs, tainted)
compatibility.py 文件源码 项目:watcher 作者: nosmokingbandit 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def all(items):
        return reduce(operator.__and__, items)

# --- test if interpreter supports yield keyword ---
idsets.py 文件源码 项目:Hawkeye 作者: tozhengxq 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __and__(self, other):
        return self.intersection(other)
idsets.py 文件源码 项目:Hawkeye 作者: tozhengxq 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def intersection_update(self, other):
        if isinstance(other, BitSet):
            return self._logic(self, operator.__and__, other)
        discard = self.discard
        for n in self:
            if n not in other:
                discard(n)


问题


面经


文章

微信
公众号

扫码关注公众号