当前位置: 首页>>代码示例>>Python>>正文


Python future_builtins.map方法代码示例

本文整理汇总了Python中future_builtins.map方法的典型用法代码示例。如果您正苦于以下问题:Python future_builtins.map方法的具体用法?Python future_builtins.map怎么用?Python future_builtins.map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在future_builtins的用法示例。


在下文中一共展示了future_builtins.map方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: install_extra_dists

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def install_extra_dists(self, dist):
        """
        Install extras that are indicated by markers or
        install all extras if '--extras' is indicated.
        """
        extras_require = dist.extras_require or {}

        spec_extras = (
            (spec.partition(':'), reqs) for spec, reqs in extras_require.items()
        )
        matching_extras = (
            reqs
            for (name, sep, marker), reqs in spec_extras
            # include unnamed extras or all if self.extras indicated
            if (not name or self.extras)
            # never include extras that fail to pass marker eval
            and self.marker_passes(marker)
        )
        results = list(map(dist.fetch_build_eggs, matching_extras))
        return _itertools.chain.from_iterable(results) 
开发者ID:saadnpq,项目名称:matrixcli,代码行数:22,代码来源:ptr.py

示例2: run

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def run(self):
        """
        Override run to ensure requirements are available in this session (but
        don't install them anywhere).
        """
        self._warn_old_setuptools()
        dist = CustomizedDist()
        for attr in 'allow_hosts index_url'.split():
            setattr(dist, attr, getattr(self, attr))
        for attr in (
            'dependency_links install_requires ' 'tests_require extras_require '
        ).split():
            setattr(dist, attr, getattr(self.distribution, attr))
        installed_dists = self.install_dists(dist)
        if self.dry_run:
            self.announce('skipping tests (dry run)')
            return
        paths = map(_operator.attrgetter('location'), installed_dists)
        with self.paths_on_pythonpath(paths):
            with self.project_on_sys_path():
                return self.run_tests() 
开发者ID:saadnpq,项目名称:matrixcli,代码行数:23,代码来源:ptr.py

示例3: install_extra_dists

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def install_extra_dists(self, dist):
		"""
		Install extras that are indicated by markers or
		install all extras if '--extras' is indicated.
		"""
		extras_require = dist.extras_require or {}

		spec_extras = (
			(spec.partition(':'), reqs)
			for spec, reqs in extras_require.items()
		)
		matching_extras = (
			reqs
			for (name, sep, marker), reqs in spec_extras
			# include unnamed extras or all if self.extras indicated
			if (not name or self.extras)
			# never include extras that fail to pass marker eval
			and self.marker_passes(marker)
		)
		results = list(map(dist.fetch_build_eggs, matching_extras))
		return _itertools.chain.from_iterable(results) 
开发者ID:AI-DI,项目名称:Brancher,代码行数:23,代码来源:ptr.py

示例4: run

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def run(self):
		"""
		Override run to ensure requirements are available in this session (but
		don't install them anywhere).
		"""
		self._warn_old_setuptools()
		dist = CustomizedDist()
		for attr in 'allow_hosts index_url'.split():
			setattr(dist, attr, getattr(self, attr))
		for attr in (
			'dependency_links install_requires '
			'tests_require extras_require '
		).split():
			setattr(dist, attr, getattr(self.distribution, attr))
		installed_dists = self.install_dists(dist)
		if self.dry_run:
			self.announce('skipping tests (dry run)')
			return
		paths = map(_operator.attrgetter('location'), installed_dists)
		with self.paths_on_pythonpath(paths):
			with self.project_on_sys_path():
				return self.run_tests() 
开发者ID:AI-DI,项目名称:Brancher,代码行数:24,代码来源:ptr.py

示例5: test_traces_slicing

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def test_traces_slicing(openfn, kwargs):
    with openfn(**kwargs) as f:
        traces = list(map(np.copy, f.trace[0:6:2]))
        assert len(traces) == 3
        assert traces[0][49] == f.trace[0][49]
        assert traces[1][49] == f.trace[2][49]
        assert traces[2][49] == f.trace[4][49]

        rev_traces = list(map(np.copy, f.trace[4::-2]))
        assert rev_traces[0][49] == f.trace[4][49]
        assert rev_traces[1][49] == f.trace[2][49]
        assert rev_traces[2][49] == f.trace[0][49]

        # make sure buffers can be reused
        for i, trace in enumerate(f.trace[0:6:2]):
            assert np.array_equal(trace, traces[i]) 
开发者ID:equinor,项目名称:segyio,代码行数:18,代码来源:segy.py

示例6: test_traces_raw

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def test_traces_raw(openfn, kwargs):
    with openfn(**kwargs) as f:
        gen_traces = np.array(list(map(np.copy, f.trace)), dtype=np.single)

        raw_traces = f.trace.raw[:]
        assert np.array_equal(gen_traces, raw_traces)

        assert len(gen_traces) == f.tracecount
        assert len(raw_traces) == f.tracecount

        assert gen_traces[0][49] == raw_traces[0][49]
        assert gen_traces[1][49] == f.trace.raw[1][49]
        assert gen_traces[2][49] == raw_traces[2][49]

        assert np.array_equal(f.trace[10], f.trace.raw[10])

        for raw, gen in zip(f.trace.raw[::2], f.trace[::2]):
            assert np.array_equal(raw, gen)

        for raw, gen in zip(f.trace.raw[::-1], f.trace[::-1]):
            assert np.array_equal(raw, gen) 
开发者ID:equinor,项目名称:segyio,代码行数:23,代码来源:segy.py

示例7: test_itertools

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def test_itertools(self):
        from itertools import imap, izip, ifilter
        # We will assume that the itertools functions work, so provided
        # that we've got identical coppies, we will work!
        self.assertEqual(map, imap)
        self.assertEqual(zip, izip)
        self.assertEqual(filter, ifilter)
        # Testing that filter(None, stuff) raises a warning lives in
        # test_py3kwarn.py 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:test_future_builtins.py

示例8: initialize_constants

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def initialize_constants():
    src = read_cal_file('constants.py')
    nv = re.search(r'numeric_version\s+=\s+\((\d+), (\d+), (\d+)\)', src)
    calibre_constants['version'] = '%s.%s.%s' % (nv.group(1), nv.group(2), nv.group(3))
    calibre_constants['appname'] = re.search(r'__appname__\s+=\s+(u{0,1})[\'"]([^\'"]+)[\'"]', src).group(2)
    epsrc = re.compile(r'entry_points = (\{.*?\})', re.DOTALL).search(read_cal_file('linux.py')).group(1)
    entry_points = eval(epsrc, {'__appname__': calibre_constants['appname']})

    def e2b(ep):
        return re.search(r'\s*(.*?)\s*=', ep).group(1).strip()

    def e2s(ep, base='src'):
        return (base + os.path.sep + re.search(r'.*=\s*(.*?):', ep).group(1).replace('.', '/') + '.py').strip()

    def e2m(ep):
        return re.search(r'.*=\s*(.*?)\s*:', ep).group(1).strip()

    def e2f(ep):
        return ep[ep.rindex(':') + 1:].strip()

    calibre_constants['basenames'] = basenames = {}
    calibre_constants['functions'] = functions = {}
    calibre_constants['modules'] = modules = {}
    calibre_constants['scripts'] = scripts = {}
    for x in ('console', 'gui'):
        y = x + '_scripts'
        basenames[x] = list(map(e2b, entry_points[y]))
        functions[x] = list(map(e2f, entry_points[y]))
        modules[x] = list(map(e2m, entry_points[y]))
        scripts[x] = list(map(e2s, entry_points[y]))

    src = read_cal_file('ebooks/__init__.py')
    be = re.search(r'^BOOK_EXTENSIONS\s*=\s*(\[.+?\])', src, flags=re.DOTALL | re.MULTILINE).group(1)
    calibre_constants['book_extensions'] = json.loads(be.replace("'", '"')) 
开发者ID:kovidgoyal,项目名称:build-calibre,代码行数:36,代码来源:__init__.py

示例9: run

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def run(*args):
    if len(args) == 1:
        args = shlex.split(args[0])
    args = list(map(encode_for_subprocess, args))
    ret = subprocess.Popen(args).wait()
    if ret != 0:
        raise SystemExit(ret) 
开发者ID:kovidgoyal,项目名称:kitty,代码行数:9,代码来源:installer.py

示例10: test_traces_subslicing

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def test_traces_subslicing(openfn, kwargs):
    with openfn(**kwargs) as f:
        # test all sign permutations using full slice
        assert np.array_equal(f.trace[0, 0:6:2], f.trace[0][0:6:2])
        assert np.array_equal(f.trace[0, 0:-2:2], f.trace[0][0:-2:2])
        assert np.array_equal(f.trace[0, 10:2:-3], f.trace[0][10:2:-3])
        assert np.array_equal(f.trace[0, -10:50:1], f.trace[0][-10:50:1])
        assert np.array_equal(f.trace[0, -4:-2:1], f.trace[0][-4:-2:1])
        assert np.array_equal(f.trace[0, -4:0:-2], f.trace[0][-4:0:-2])
        assert np.array_equal(f.trace[0, 50:-50:-3], f.trace[0][50:-50:-3])
        # test all sign permutations using start:stop
        assert np.array_equal(f.trace[0, 0:6], f.trace[0][0:6])
        assert np.array_equal(f.trace[0, 0:-3], f.trace[0][0:-3])
        assert np.array_equal(f.trace[0, -4:-2], f.trace[0][-4:-2])
        assert np.array_equal(f.trace[0, -4:50], f.trace[0][-4:50])
        assert np.array_equal(f.trace[0, -4:-2], f.trace[0][-4:-2])
        # test all sign permutations using start::step
        assert np.array_equal(f.trace[0, 0::2], f.trace[0][0::2])
        assert np.array_equal(f.trace[0, 10::-1], f.trace[0][10::-1])
        assert np.array_equal(f.trace[0, -5::3], f.trace[0][-5::3])
        assert np.array_equal(f.trace[0, -5::-1], f.trace[0][-5::-1])
        # test all sign permutations using :stop:step
        assert np.array_equal(f.trace[0, :6:2], f.trace[0][:6:2])
        assert np.array_equal(f.trace[0, :6:-1], f.trace[0][:6:-1])
        assert np.array_equal(f.trace[0, :-6:2], f.trace[0][:-6:2])
        assert np.array_equal(f.trace[0, :-6:-2], f.trace[0][:-6:-2])
        # test all sign permutations using start:, :stop, and ::step
        assert np.array_equal(f.trace[0, 1:], f.trace[0][1:])
        assert np.array_equal(f.trace[0, -3:], f.trace[0][-3:])
        assert np.array_equal(f.trace[0, :3], f.trace[0][:3])
        assert np.array_equal(f.trace[0, :-1], f.trace[0][:-1])
        assert np.array_equal(f.trace[0, ::-1], f.trace[0][::-1])
        assert np.array_equal(f.trace[0, ::2], f.trace[0][::2])
        # test getting single element
        assert f.trace[0, 1] == f.trace[0][1]
        assert f.trace[0, -3] == f.trace[0][-3]

        # Combining trace and sub-trace slicing
        traces = list(map(np.copy, f.trace[0:6:2, 0:6]))
        assert len(traces) == 3
        assert traces[0].shape[0] == 6 
开发者ID:equinor,项目名称:segyio,代码行数:43,代码来源:segy.py

示例11: test_attributes

# 需要导入模块: import future_builtins [as 别名]
# 或者: from future_builtins import map [as 别名]
def test_attributes(openfn, kwargs):
    with openfn(**kwargs) as f:
        il = kwargs.get('iline', TraceField.INLINE_3D)
        xl = kwargs.get('xline', TraceField.CROSSLINE_3D)

        assert 1 == f.attributes(il)[0]
        assert 20 == f.attributes(xl)[0]

        assert f.tracecount == len(f.attributes(il))
        assert iter(f.attributes(il))

        ils = [(i // 5) + 1 for i in range(25)]
        attrils = list(map(int, f.attributes(il)[:]))
        assert ils == attrils

        xls = [(i % 5) + 20 for i in range(25)]
        attrxls = list(map(int, f.attributes(xl)[:]))
        assert xls == attrxls

        ils = [(i // 5) + 1 for i in range(25)][::-1]
        attrils = list(map(int, f.attributes(il)[::-1]))
        assert ils == attrils

        xls = [(i % 5) + 20 for i in range(25)][::-1]
        attrxls = list(map(int, f.attributes(xl)[::-1]))
        assert xls == attrxls

        assert f.header[0][il] == f.attributes(il)[0]
        f.mmap()
        assert f.header[0][il] == f.attributes(il)[0]

        ils = [(i // 5) + 1 for i in range(25)][1:21:3]
        attrils = list(map(int, f.attributes(il)[1:21:3]))
        assert ils == attrils

        xls = [(i % 5) + 20 for i in range(25)][2:17:5]
        attrxls = list(map(int, f.attributes(xl)[2:17:5]))
        assert xls == attrxls

        ils = [1, 2, 3, 4, 5]
        attrils = list(map(int, f.attributes(il)[[0, 5, 11, 17, 23]]))
        assert ils == attrils

        ils = [1, 2, 3, 4, 5]
        indices = np.asarray([0, 5, 11, 17, 23])
        attrils = list(map(int, f.attributes(il)[indices]))
        assert ils == attrils 
开发者ID:equinor,项目名称:segyio,代码行数:49,代码来源:segy.py


注:本文中的future_builtins.map方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。