FileDownloader

(class from pyomo.common.download)

class pyomo.common.download.FileDownloader(insecure=False, cacert=None)[source]

Bases: object

__init__(insecure=False, cacert=None)[source]

Methods

__init__([insecure, cacert])

create_parser([parser])

destination()

get_binary_file(url)

Retrieve the specified url and write as a binary file

get_binary_file_from_zip_archive(url, srcname)

get_file(url, binary)

get_gzipped_binary_file(url)

get_os_version([normalize])

Return a standardized representation of the OS version

get_platform_url(urlmap)

Select the url for this platform

get_sysinfo()

Return a tuple (platform_name, bits) for the current system

get_tar_archive(url[, dirOffset])

get_text_file(url)

Retrieve the specified url and write as a text file

get_url(urlmap)

DEPRECATED.

get_zip_archive(url[, dirOffset])

parse_args(argv)

retrieve_url(url)

Return the contents of a URL as an io.BytesIO object

set_destination_filename(default)

Member Documentation

classmethod get_os_version(normalize=True)[source]

Return a standardized representation of the OS version

This method was designed to help identify compatible binaries, and will return strings similar to:

  • rhel6

  • fedora24

  • ubuntu18.04

  • macos10.13

  • win10

Parameters:

normalize (bool, optional) – If True (the default) returns a simplified normalized string (e.g., ‘rhel7’) instead of the raw (os, version) tuple (e.g., (‘centos’, ‘7.7.1908’))

classmethod get_sysinfo()[source]

Return a tuple (platform_name, bits) for the current system

Returns:

  • platform_name (str) (lower case, usually in {linux, windows,) – cygwin, darwin}.

  • bits (int) (OS address width in {32, 64})

get_binary_file(url)[source]

Retrieve the specified url and write as a binary file

get_platform_url(urlmap)[source]

Select the url for this platform

Given a urlmap dict that maps the platform name (from FileDownloader.get_sysinfo()) to a platform-specific URL, return the URL that matches the current platform.

Parameters:

urlmap (dict) – Map of platform name (e.g., linux, windows, cygwin, darwin) to URL

get_text_file(url)[source]

Retrieve the specified url and write as a text file

get_url(urlmap)[source]

DEPRECATED.

Deprecated since version 5.6.9: get_url() is deprecated. Use get_platform_url()

retrieve_url(url)[source]

Return the contents of a URL as an io.BytesIO object