Package schrodinger :: Package test :: Package stu :: Module common
[hide private]
[frames] | no frames]

Module common

Functions that are used in one or more modules. reduces danger of circular dependencies.


Copyright: Schrodinger, Inc. All rights reserved.

Classes [hide private]
  ZipError
Error while zipping up files.
Functions [hide private]
 
str2list(string)
Takes a string which can be a comma separated collection of positive integers and ranges and returns an ordered list of numbers.
 
str2strlist(string)
Split a string into a list of strings.
str
get_api_key()
Get the user's API key.
 
assert_build_id_matches(buildtype, build_id)
Check that the build_id is appropriate for the buildtype
 
zip_directory(dirname, fileobj=None)
Zip the contents of a directory.
Variables [hide private]
  _api_key = None
Module level cache for API key.
  BASE_URL = 'https://stu.schrodinger.com'
Address of STU server
  DATE_RE = '^\\d\\d\\d\\d-\\d\\d-\\d\\d$'
The date format that our NBs use.
  JOBID_RE = '-[a-f0-9]{8}$|-[a-f0-9]{8}\\.'
  ZIP_MODE = 8
  __package__ = 'schrodinger.test.stu'
Function Details [hide private]

str2list(string)

 

Takes a string which can be a comma separated collection of positive integers and ranges and returns an ordered list of numbers.

Parameters:
  • input_string (str @return : An ordered list of integers @rtype : list) - A comma-separated string of positive integers and ranges

str2strlist(string)

 

Split a string into a list of strings. Used in parser.

get_api_key()

 

Get the user's API key. Uses caching. Also ensures that the user's API key is only readable by self - raises RuntimeError if anyone else has read permission.

Returns: str
User's API key from disk.

zip_directory(dirname, fileobj=None)

 

Zip the contents of a directory. File names will be relative to the directory name. Preserves symlinks

Parameters:
  • dirname (str) - Directory to be zipped
  • fileobj (file-like object or path to file) - Directory will be zipped to this filename or into this file-like object.

Variables Details [hide private]

_api_key

Module level cache for API key. Only accessible by one user, so this is OK.

Value:
None