nbodykit.tutorials.wget

Functions

available_examples()

Return a list of available example data files from the nbodykit data repository on NERSC.

download_example_data(filenames[, ...])

Download a data file from the nbodykit repository of example data.

mirror(url[, target])

Mirror a URL recursively to a local target.

resolve_link(link, url)

Classes

ListingParser(url)

Parses an HTML file and build a list of links.

class nbodykit.tutorials.wget.ListingParser(url)[source]

Parses an HTML file and build a list of links.

Links are stored into the ‘links’ set. They are resolved into absolute links.

Methods

check_for_whole_start_tag(i)

close()

Handle any buffered data.

feed(data)

Feed data to the parser.

get_starttag_text()

Return full source of start tag: '<...>'.

getpos()

Return current line number and offset.

goahead(end)

handle_charref(name)

handle_comment(data)

handle_data(data)

handle_decl(decl)

handle_endtag(tag)

handle_entityref(name)

handle_pi(data)

handle_startendtag(tag, attrs)

parse_bogus_comment(i[, report])

parse_comment(i[, report])

parse_declaration(i)

parse_endtag(i)

parse_html_declaration(i)

parse_marked_section(i[, report])

parse_pi(i)

parse_starttag(i)

reset()

Reset this instance.

unescape(s)

updatepos(i, j)

clear_cdata_mode

error

handle_starttag

set_cdata_mode

unknown_decl

close()

Handle any buffered data.

feed(data)

Feed data to the parser.

Call this as often as you want, with as little or as much text as you want (may include ‘n’).

get_starttag_text()

Return full source of start tag: ‘<…>’.

getpos()

Return current line number and offset.

reset()

Reset this instance. Loses all unprocessed data.

nbodykit.tutorials.wget.available_examples()[source]

Return a list of available example data files from the nbodykit data repository on NERSC.

Returns

examples – list of the available file names for download

Return type

list

nbodykit.tutorials.wget.download_example_data(filenames, download_dirname=None)[source]

Download a data file from the nbodykit repository of example data.

For a list of valid file names, see available_examples().

Parameters
  • filenames (str, list of str) – the name(s) of the example file to download (relative to the path of the nbodykit repository); see available_examples() for the example file names

  • download_dirname (str, optional) – a local directory to download the file to; if not specified, the file will be downloaded to the current working directory

nbodykit.tutorials.wget.mirror(url, target=None)[source]

Mirror a URL recursively to a local target.

If target is not supplied, the last part of the url is used as the target.

Parameters
  • url (str) – the URL to download

  • target (str, optional) – the local file target to save the url to; if not provided, the last part of the url is used.