ensure_from_google

ensure_from_google(key, *subkeys, name, file_id, force=False)[source]

Ensure a file is downloaded from google drive.

Parameters:
  • key (str) – The name of the module. No funny characters. The envvar <key>_HOME where key is uppercased is checked first before using the default home directory.

  • subkeys (str) – A sequence of additional strings to join. If none are given, returns the directory for this module.

  • name (str) – The name of the file

  • file_id (str) – The file identifier of the google file. If your share link is https://drive.google.com/file/d/1AsPPU4ka1Rc9u-XYMGWtvV65hF3egi0z/view, then your file id is 1AsPPU4ka1Rc9u-XYMGWtvV65hF3egi0z.

  • force (bool) – Should the download be done again, even if the path already exists? Defaults to false.

Return type:

Path

Returns:

The path of the file that has been downloaded (or already exists)

Example downloading the WK3l-15k dataset as motivated by https://github.com/pykeen/pykeen/pull/403:

>>> ensure_from_google('test', name='wk3l15k.zip', file_id='1AsPPU4ka1Rc9u-XYMGWtvV65hF3egi0z')