Пример #1
0
    def test_env_var_file_urls(self):
        channels = (
            "file://\\\\network_share\\shared_folder\\path\\conda",
            "https://some.url/ch_name",
            "file:///some/place/on/my/machine",
        )
        with env_var("CONDA_CHANNELS", ','.join(channels)):
            new_context = Context(())
            assert new_context.channels == (
                "file://\\\\network_share\\shared_folder\\path\\conda",
                "https://some.url/ch_name",
                "file:///some/place/on/my/machine",
            )

            prioritized = prioritize_channels(new_context.channels)
            assert prioritized == OrderedDict((
                ("file://network_share/shared_folder/path/conda/%s" %
                 context.subdir,
                 ("file://network_share/shared_folder/path/conda", 0)),
                ("file://network_share/shared_folder/path/conda/noarch",
                 ("file://network_share/shared_folder/path/conda", 0)),
                ("https://some.url/ch_name/%s" % context.subdir,
                 ("https://some.url/ch_name", 1)),
                ("https://some.url/ch_name/noarch",
                 ("https://some.url/ch_name", 1)),
                ("file:///some/place/on/my/machine/%s" % context.subdir,
                 ("file:///some/place/on/my/machine", 2)),
                ("file:///some/place/on/my/machine/noarch",
                 ("file:///some/place/on/my/machine", 2)),
            ))
Пример #2
0
def download_notebook_data(id, include_env=False):
    params = dict(id=id)

    if include_env:
        from conda.base.context import Context
        context = Context()
        params.update(dict(
            platform=context.platform,
            bits=context.bits,
        ))

    r = requests.get(HOST + '/api/clone', params=params)
    data = r.json()
    if not data['success']:
        raise DappledError(data['message'])

    return data