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