• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python moves.map函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中setuptools.extern.six.moves.map函数的典型用法代码示例。如果您正苦于以下问题:Python map函数的具体用法?Python map怎么用?Python map使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _move_install_requirements_markers

    def _move_install_requirements_markers(self):
        """
        Move requirements in `install_requires` that are using environment
        markers `extras_require`.
        """

        # divide the install_requires into two sets, simple ones still
        # handled by install_requires and more complex ones handled
        # by extras_require.

        def is_simple_req(req):
            return not req.marker

        spec_inst_reqs = getattr(self, 'install_requires', None) or ()
        inst_reqs = list(pkg_resources.parse_requirements(spec_inst_reqs))
        simple_reqs = filter(is_simple_req, inst_reqs)
        complex_reqs = filterfalse(is_simple_req, inst_reqs)
        self.install_requires = list(map(str, simple_reqs))

        for r in complex_reqs:
            self._tmp_extras_require[':' + str(r.marker)].append(r)
        self.extras_require = dict(
            (k, [str(r) for r in map(self._clean_req, v)])
            for k, v in self._tmp_extras_require.items()
        )
开发者ID:AlerzDev,项目名称:Brazo-Proyecto-Final,代码行数:25,代码来源:dist.py


示例2: _convert_pyx_sources_to_c

 def _convert_pyx_sources_to_c(self):
     "convert .pyx extensions to .c"
     def pyx_to_c(source):
         if source.endswith('.pyx'):
             source = source[:-4] + '.c'
         return source
     self.sources = list(map(pyx_to_c, self.sources))
开发者ID:Yankur,项目名称:Web-application,代码行数:7,代码来源:extension.py


示例3: run_tests

    def run_tests(self):
        # Purge modules under test from sys.modules. The test loader will
        # re-import them from the build location. Required when 2to3 is used
        # with namespace packages.
        if six.PY3 and getattr(self.distribution, 'use_2to3', False):
            module = self.test_suite.split('.')[0]
            if module in _namespace_packages:
                del_modules = []
                if module in sys.modules:
                    del_modules.append(module)
                module += '.'
                for name in sys.modules:
                    if name.startswith(module):
                        del_modules.append(name)
                list(map(sys.modules.__delitem__, del_modules))

        exit_kwarg = {} if sys.version_info < (2, 7) else {"exit": False}
        test = unittest_main(
            None, None, self._argv,
            testLoader=self._resolve_as_ep(self.test_loader),
            testRunner=self._resolve_as_ep(self.test_runner),
            **exit_kwarg
        )
        if not test.result.wasSuccessful():
            msg = 'Test failed: %s' % test.result
            self.announce(msg, log.ERROR)
            raise DistutilsError(msg)
开发者ID:Chrisjunghwan,项目名称:blogapp,代码行数:27,代码来源:test.py


示例4: test_defaults_case_sensitivity

    def test_defaults_case_sensitivity(self):
        """
        Make sure default files (README.*, etc.) are added in a case-sensitive
        way to avoid problems with packages built on Windows.
        """

        open(os.path.join(self.temp_dir, 'readme.rst'), 'w').close()
        open(os.path.join(self.temp_dir, 'SETUP.cfg'), 'w').close()

        dist = Distribution(SETUP_ATTRS)
        # the extension deliberately capitalized for this test
        # to make sure the actual filename (not capitalized) gets added
        # to the manifest
        dist.script_name = 'setup.PY'
        cmd = sdist(dist)
        cmd.ensure_finalized()

        with quiet():
            cmd.run()

        # lowercase all names so we can test in a
        # case-insensitive way to make sure the files
        # are not included.
        manifest = map(lambda x: x.lower(), cmd.filelist.files)
        assert 'readme.rst' not in manifest, manifest
        assert 'setup.py' not in manifest, manifest
        assert 'setup.cfg' not in manifest, manifest
开发者ID:Slicer,项目名称:setuptools,代码行数:27,代码来源:test_sdist.py


示例5: creds_by_repository

    def creds_by_repository(self):
        sections_with_repositories = [
            section for section in self.sections()
            if self.get(section, 'repository').strip()
        ]

        return dict(map(self._get_repo_cred, sections_with_repositories))
开发者ID:547358880,项目名称:flask-tutorial,代码行数:7,代码来源:package_index.py


示例6: process_url

    def process_url(self, url, retrieve=False):
        """Evaluate a URL as a possible download, and maybe retrieve it"""
        if url in self.scanned_urls and not retrieve:
            return
        self.scanned_urls[url] = True
        if not URL_SCHEME(url):
            self.process_filename(url)
            return
        else:
            dists = list(distros_for_url(url))
            if dists:
                if not self.url_ok(url):
                    return
                self.debug("Found link: %s", url)

        if dists or not retrieve or url in self.fetched_urls:
            list(map(self.add, dists))
            return  # don't need the actual page

        if not self.url_ok(url):
            self.fetched_urls[url] = True
            return

        self.info("Reading %s", url)
        self.fetched_urls[url] = True   # prevent multiple fetch attempts
        f = self.open_url(url, "Download error on %s: %%s -- Some packages may not be found!" % url)
        if f is None: return
        self.fetched_urls[f.url] = True
        if 'html' not in f.headers.get('content-type', '').lower():
            f.close()   # not html, we can't process it
            return

        base = f.url     # handle redirects
        page = f.read()
        if not isinstance(page, str): # We are in Python 3 and got bytes. We want str.
开发者ID:Yankur,项目名称:Web-application,代码行数:35,代码来源:package_index.py


示例7: _download_to

 def _download_to(self, url, filename):
     self.info("Downloading %s", url)
     # Download the file
     fp = None
     try:
         checker = HashChecker.from_url(url)
         fp = self.open_url(url)
         if isinstance(fp, urllib.error.HTTPError):
             raise DistutilsError(
                 "Can't download %s: %s %s" % (url, fp.code, fp.msg)
             )
         headers = fp.info()
         blocknum = 0
         bs = self.dl_blocksize
         size = -1
         if "content-length" in headers:
             # Some servers return multiple Content-Length headers :(
             sizes = get_all_headers(headers, 'Content-Length')
             size = max(map(int, sizes))
             self.reporthook(url, filename, blocknum, bs, size)
         with open(filename, 'wb') as tfp:
             while True:
                 block = fp.read(bs)
                 if block:
                     checker.feed(block)
                     tfp.write(block)
                     blocknum += 1
                     self.reporthook(url, filename, blocknum, bs, size)
                 else:
                     break
             self.check_hash(checker, filename, tfp)
         return headers
     finally:
         if fp:
             fp.close()
开发者ID:547358880,项目名称:flask-tutorial,代码行数:35,代码来源:package_index.py


示例8: run

    def run(self):
        aliases = self.distribution.get_option_dict('aliases')

        if not self.args:
            print("Command Aliases")
            print("---------------")
            for alias in aliases:
                print("setup.py alias", format_alias(alias, aliases))
            return

        elif len(self.args) == 1:
            alias, = self.args
            if self.remove:
                command = None
            elif alias in aliases:
                print("setup.py alias", format_alias(alias, aliases))
                return
            else:
                print("No alias definition found for %r" % alias)
                return
        else:
            alias = self.args[0]
            command = ' '.join(map(shquote, self.args[1:]))

        edit_config(self.filename, {'aliases': {alias: command}}, self.dry_run)
开发者ID:shakthydoss,项目名称:suriyan,代码行数:25,代码来源:alias.py


示例9: find_external_links

def find_external_links(url, page):
    """Find rel="homepage" and rel="download" links in `page`, yielding URLs"""

    for match in REL.finditer(page):
        tag, rel = match.groups()
        rels = set(map(str.strip, rel.lower().split(',')))
        if 'homepage' in rels or 'download' in rels:
            for match in HREF.finditer(tag):
开发者ID:Yankur,项目名称:Web-application,代码行数:8,代码来源:package_index.py


示例10: resume

    def resume(self):
        "restore and re-raise any exception"

        if '_saved' not in vars(self):
            return

        type, exc = map(pickle.loads, self._saved)
        six.reraise(type, exc, self._tb)
开发者ID:547358880,项目名称:flask-tutorial,代码行数:8,代码来源:sandbox.py


示例11: scan

        def scan(link):
            # Process a URL to see if it's for a package page
            if link.startswith(self.index_url):
                parts = list(map(
<<<<<<< HEAD
                    unquote, link[len(self.index_url):].split('/')
=======
                    urllib.parse.unquote, link[len(self.index_url):].split('/')
>>>>>>> 54eef0be98b1b67c8507db91f4cfa90b64991027
                ))
                if len(parts)==2 and '#' not in parts[1]:
                    # it's a package page, sanitize and index it
                    pkg = safe_name(parts[0])
                    ver = safe_version(parts[1])
                    self.package_pages.setdefault(pkg.lower(),{})[link] = True
                    return to_filename(pkg), to_filename(ver)
            return None, None
开发者ID:Yankur,项目名称:Web-application,代码行数:17,代码来源:package_index.py


示例12: scan_egg_link

 def scan_egg_link(self, path, entry):
     lines = [_f for _f in map(str.strip,
                               open(os.path.join(path, entry))) if _f]
     if len(lines)==2:
         for dist in find_distributions(os.path.join(path, lines[0])):
             dist.location = os.path.join(path, *lines)
             dist.precedence = SOURCE_DIST
             self.add(dist)
开发者ID:Yankur,项目名称:Web-application,代码行数:8,代码来源:package_index.py


示例13: test_conditional_dependencies

    def test_conditional_dependencies(self):
        specs = 'splort==4', 'quux>=1.1'
        requires = list(map(pkg_resources.Requirement.parse, specs))

        for d in pkg_resources.find_distributions(self.tmpdir):
            assert d.requires() == requires[:1]
            assert d.requires(extras=('baz',)) == requires
            assert d.extras == ['baz']
开发者ID:a514514772,项目名称:lol_replayer_for_tencent,代码行数:8,代码来源:test_dist_info.py


示例14: findall

def findall(dir=os.curdir):
    """
    Find all files under 'dir' and return the list of full filenames.
    Unless dir is '.', return full filenames with dir prepended.
    """
    files = _find_all_simple(dir)
    if dir == os.curdir:
        make_rel = functools.partial(os.path.relpath, start=dir)
        files = map(make_rel, files)
    return list(files)
开发者ID:BookUpStudyGroups,项目名称:Django_Server,代码行数:10,代码来源:__init__.py


示例15: test_conditional_dependencies

    def test_conditional_dependencies(self, metadata):
        specs = 'splort==4', 'quux>=1.1'
        requires = list(map(pkg_resources.Requirement.parse, specs))

        for d in pkg_resources.find_distributions(metadata):
            assert d.requires() == requires[:1]
            assert d.requires(extras=('baz',)) == [
                requires[0],
                pkg_resources.Requirement.parse('quux>=1.1;extra=="baz"'),
            ]
            assert d.extras == ['baz']
开发者ID:Postgre,项目名称:HackingTools,代码行数:11,代码来源:test_dist_info.py


示例16: process_url

    def process_url(self, url, retrieve=False):
        """Evaluate a URL as a possible download, and maybe retrieve it"""
        if os.getenv("CONDA_BUILD"):
            raise RuntimeError("Setuptools downloading is disabled in conda build. "
                               "Be sure to add all dependencies in the meta.yaml  url=%s" % url)

        if url in self.scanned_urls and not retrieve:
            return
        self.scanned_urls[url] = True
        if not URL_SCHEME(url):
            self.process_filename(url)
            return
        else:
            dists = list(distros_for_url(url))
            if dists:
                if not self.url_ok(url):
                    return
                self.debug("Found link: %s", url)

        if dists or not retrieve or url in self.fetched_urls:
            list(map(self.add, dists))
            return  # don't need the actual page

        if not self.url_ok(url):
            self.fetched_urls[url] = True
            return

        self.info("Reading %s", url)
        self.fetched_urls[url] = True  # prevent multiple fetch attempts
        tmpl = "Download error on %s: %%s -- Some packages may not be found!"
        f = self.open_url(url, tmpl % url)
        if f is None:
            return
        self.fetched_urls[f.url] = True
        if 'html' not in f.headers.get('content-type', '').lower():
            f.close()  # not html, we can't process it
            return

        base = f.url  # handle redirects
        page = f.read()
        if not isinstance(page, str):
            # In Python 3 and got bytes but want str.
            if isinstance(f, urllib.error.HTTPError):
                # Errors have no charset, assume latin1:
                charset = 'latin-1'
            else:
                charset = f.headers.get_param('charset') or 'latin-1'
            page = page.decode(charset, "ignore")
        f.close()
        for match in HREF.finditer(page):
            link = urllib.parse.urljoin(base, htmldecode(match.group(1)))
            self.process_url(link)
        if url.startswith(self.index_url) and getattr(f, 'code', None) != 404:
            page = self.process_index(url, page)
开发者ID:DamirAinullin,项目名称:PTVS,代码行数:54,代码来源:package_index.py


示例17: scan

 def scan(link):
     # Process a URL to see if it's for a package page
     if link.startswith(self.index_url):
         parts = list(map(urllib.parse.unquote, link[len(self.index_url) :].split("/")))
         if len(parts) == 2 and "#" not in parts[1]:
             # it's a package page, sanitize and index it
             pkg = safe_name(parts[0])
             ver = safe_version(parts[1])
             self.package_pages.setdefault(pkg.lower(), {})[link] = True
             return to_filename(pkg), to_filename(ver)
     return None, None
开发者ID:yazhao,项目名称:yazhao.github.io,代码行数:11,代码来源:package_index.py


示例18: __init__

 def __init__(
         self, index_url="https://pypi.python.org/simple", hosts=('*',),
         ca_bundle=None, verify_ssl=True, *args, **kw
         ):
     Environment.__init__(self,*args,**kw)
     self.index_url = index_url + "/"[:not index_url.endswith('/')]
     self.scanned_urls = {}
     self.fetched_urls = {}
     self.package_pages = {}
     self.allows = re.compile('|'.join(map(translate,hosts))).match
     self.to_scan = []
     if verify_ssl and ssl_support.is_available and (ca_bundle or ssl_support.find_ca_bundle()):
         self.opener = ssl_support.opener_for(ca_bundle)
开发者ID:Yankur,项目名称:Web-application,代码行数:13,代码来源:package_index.py


示例19: _convert_pyx_sources_to_lang

 def _convert_pyx_sources_to_lang(self):
     """
     Replace sources with .pyx extensions to sources with the target
     language extension. This mechanism allows language authors to supply
     pre-converted sources but to prefer the .pyx sources.
     """
     if _have_cython():
         # the build has Cython, so allow it to compile the .pyx files
         return
     lang = self.language or ""
     target_ext = ".cpp" if lang.lower() == "c++" else ".c"
     sub = functools.partial(re.sub, ".pyx$", target_ext)
     self.sources = list(map(sub, self.sources))
开发者ID:RoseOu,项目名称:Flask-learning,代码行数:13,代码来源:extension.py


示例20: run

    def run(self):
        installed_dists = self.install_dists(self.distribution)

        cmd = ' '.join(self._argv)
        if self.dry_run:
            self.announce('skipping "%s" (dry run)' % cmd)
            return

        self.announce('running "%s"' % cmd)

        paths = map(operator.attrgetter('location'), installed_dists)
        with self.paths_on_pythonpath(paths):
            with self.project_on_sys_path():
                self.run_tests()
开发者ID:Chrisjunghwan,项目名称:blogapp,代码行数:14,代码来源:test.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python package_index.PackageIndex类代码示例发布时间:2022-05-27
下一篇:
Python dist.Distribution类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap