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


Python builtins.map方法代碼示例

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


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

示例1: format_group_index

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import map [as 別名]
def format_group_index(group_keys):
    group_keys = sorted(group_keys)

    num = []
    num00 = []

    for k, g in groupby(enumerate(group_keys), lambda i_x: i_x[0]-i_x[1]):
        group = list(map(itemgetter(1), g))
        g_min, g_max = min(group), max(group)

        if g_min == g_max:
            num.append('{0:01d}'.format(g_min))
            num00.append('{0:02d}'.format(g_min))
        else:
            num.append('{0:01d}-{1:01d}'.format(g_min, g_max))
            num00.append('{0:02d}-{1:02d}'.format(g_min, g_max))

    return ','.join(num) or '0', ','.join(num00) or '00' 
開發者ID:Tautulli,項目名稱:Tautulli,代碼行數:20,代碼來源:notification_handler.py

示例2: vals_sorted_by_key

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import map [as 別名]
def vals_sorted_by_key(adict):
    keys = sorted(adict.keys())
    return map(adict.get, keys) 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:5,代碼來源:cookiejar.py

示例3: __repr__

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import map [as 別名]
def __repr__(self):
        """Convert to formal string, for repr()."""
        L = [self._year, self._month, self._day, # These are never zero
             self._hour, self._minute, self._second, self._microsecond]
        if L[-1] == 0:
            del L[-1]
        if L[-1] == 0:
            del L[-1]
        s = ", ".join(map(str, L))
        s = "%s(%s)" % ('datetime.' + self.__class__.__name__, s)
        if self._tzinfo is not None:
            assert s[-1:] == ")"
            s = s[:-1] + ", tzinfo=%r" % self._tzinfo + ")"
        return s 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:16,代碼來源:datetime.py

示例4: _requires_unix_version

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import map [as 別名]
def _requires_unix_version(sysname, min_version):
    """Decorator raising SkipTest if the OS is `sysname` and the version is less
    than `min_version`.

    For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if
    the FreeBSD version is less than 7.2.
    """
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kw):
            if platform.system() == sysname:
                version_txt = platform.release().split('-', 1)[0]
                try:
                    version = tuple(map(int, version_txt.split('.')))
                except ValueError:
                    pass
                else:
                    if version < min_version:
                        min_version_txt = '.'.join(map(str, min_version))
                        raise unittest.SkipTest(
                            "%s version %s or higher required, not %s"
                            % (sysname, min_version_txt, version_txt))
            return func(*args, **kw)
        wrapper.min_version = min_version
        return wrapper
    return decorator 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:28,代碼來源:support.py

示例5: requires_mac_ver

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import map [as 別名]
def requires_mac_ver(*min_version):
    """Decorator raising SkipTest if the OS is Mac OS X and the OS X
    version if less than min_version.

    For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
    is lesser than 10.5.
    """
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kw):
            if sys.platform == 'darwin':
                version_txt = platform.mac_ver()[0]
                try:
                    version = tuple(map(int, version_txt.split('.')))
                except ValueError:
                    pass
                else:
                    if version < min_version:
                        min_version_txt = '.'.join(map(str, min_version))
                        raise unittest.SkipTest(
                            "Mac OS X %s or higher required, not %s"
                            % (min_version_txt, version_txt))
            return func(*args, **kw)
        wrapper.min_version = min_version
        return wrapper
    return decorator

# Don't use "localhost", since resolving it uses the DNS under recent
# Windows versions (see issue #18792). 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:31,代碼來源:support.py

示例6: compute_checksum

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import map [as 別名]
def compute_checksum(self, data):
        return encode_hex(int_to_byte(sum(map(ord, data)) % 256)) 
開發者ID:cea-sec,項目名稱:miasm,代碼行數:4,代碼來源:gdbserver.py

示例7: server_thread

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import map [as 別名]
def server_thread():
    try:
        bjsonrpc.bjsonrpc_options['threaded'] = True
        s = bjsonrpc.createserver(port=JSONRPC_EXT_PORT, handler_factory=QuasarRPCServer)
        log.info("quasar: starting jsonrpc service")
        s.serve()
        log.info("quasar: exiting jsonrpc service")
    except Exception:
        import traceback
        list(map(log.error, traceback.format_exc().split("\n")))
        raise 
開發者ID:alfa-addon,項目名稱:addon,代碼行數:13,代碼來源:rpc.py


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