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


Python compat.filterfalse方法代碼示例

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


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

示例1: unique_everseen

# 需要導入模塊: from setuptools import compat [as 別名]
# 或者: from setuptools.compat import filterfalse [as 別名]
def unique_everseen(iterable, key=None):
    "List unique elements, preserving order. Remember all elements ever seen."
    # unique_everseen('AAAABBBCCDAABBB') --> A B C D
    # unique_everseen('ABBCcAD', str.lower) --> A B C D
    seen = set()
    seen_add = seen.add
    if key is None:
        for element in filterfalse(seen.__contains__, iterable):
            seen_add(element)
            yield element
    else:
        for element in iterable:
            k = key(element)
            if k not in seen:
                seen_add(k)
                yield element 
開發者ID:sugarguo,項目名稱:Flask_Blog,代碼行數:18,代碼來源:package_index.py

示例2: find

# 需要導入模塊: from setuptools import compat [as 別名]
# 或者: from setuptools.compat import filterfalse [as 別名]
def find(cls, where='.', exclude=(), include=('*',)):
        """Return a list all Python packages found within directory 'where'

        'where' should be supplied as a "cross-platform" (i.e. URL-style)
        path; it will be converted to the appropriate local path syntax.
        'exclude' is a sequence of package names to exclude; '*' can be used
        as a wildcard in the names, such that 'foo.*' will exclude all
        subpackages of 'foo' (but not 'foo' itself).

        'include' is a sequence of package names to include.  If it's
        specified, only the named packages will be included.  If it's not
        specified, all found packages will be included.  'include' can contain
        shell style wildcard patterns just like 'exclude'.

        The list of included packages is built up first and then any
        explicitly excluded packages are removed from it.
        """
        out = cls._find_packages_iter(convert_path(where))
        out = cls.require_parents(out)
        includes = cls._build_filter(*include)
        excludes = cls._build_filter('ez_setup', '*__pycache__', *exclude)
        out = filter(includes, out)
        out = filterfalse(excludes, out)
        return list(out) 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:26,代碼來源:__init__.py

示例3: _candidate_dirs

# 需要導入模塊: from setuptools import compat [as 別名]
# 或者: from setuptools.compat import filterfalse [as 別名]
def _candidate_dirs(base_path):
        """
        Return all dirs in base_path that might be packages.
        """
        has_dot = lambda name: '.' in name
        for root, dirs, files in os.walk(base_path, followlinks=True):
            # Exclude directories that contain a period, as they cannot be
            #  packages. Mutate the list to avoid traversal.
            dirs[:] = filterfalse(has_dot, dirs)
            for dir in dirs:
                yield os.path.relpath(os.path.join(root, dir), base_path) 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:13,代碼來源:__init__.py


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