partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
WeightedSampler.shuffled_indices_batch_iterator
Create an iterator that generates randomly shuffled mini-batches of sample indices. The batches will have `batch_size` elements. The generated mini-batches indices take the form of 1D NumPy integer arrays. Parameters ---------- batch_size: int Mini-batch siz...
batchup/sampling.py
def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng): """ Create an iterator that generates randomly shuffled mini-batches of sample indices. The batches will have `batch_size` elements. The generated mini-batches indices take the form of 1D NumPy integer arrays. ...
def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng): """ Create an iterator that generates randomly shuffled mini-batches of sample indices. The batches will have `batch_size` elements. The generated mini-batches indices take the form of 1D NumPy integer arrays. ...
[ "Create", "an", "iterator", "that", "generates", "randomly", "shuffled", "mini", "-", "batches", "of", "sample", "indices", ".", "The", "batches", "will", "have", "batch_size", "elements", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/sampling.py#L533-L556
[ "def", "shuffled_indices_batch_iterator", "(", "self", ",", "batch_size", ",", "shuffle_rng", ")", ":", "while", "True", ":", "yield", "shuffle_rng", ".", "choice", "(", "len", "(", "self", ".", "weights", ")", ",", "size", "=", "(", "batch_size", ",", ")"...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
WeightedSampler.class_balancing_sample_weights
Compute sample weight given an array of sample classes. The weights are assigned on a per-class basis and the per-class weights are inversely proportional to their frequency. Parameters ---------- y: NumPy array, 1D dtype=int sample classes, values must be 0 or posit...
batchup/sampling.py
def class_balancing_sample_weights(y): """ Compute sample weight given an array of sample classes. The weights are assigned on a per-class basis and the per-class weights are inversely proportional to their frequency. Parameters ---------- y: NumPy array, 1D dtyp...
def class_balancing_sample_weights(y): """ Compute sample weight given an array of sample classes. The weights are assigned on a per-class basis and the per-class weights are inversely proportional to their frequency. Parameters ---------- y: NumPy array, 1D dtyp...
[ "Compute", "sample", "weight", "given", "an", "array", "of", "sample", "classes", ".", "The", "weights", "are", "assigned", "on", "a", "per", "-", "class", "basis", "and", "the", "per", "-", "class", "weights", "are", "inversely", "proportional", "to", "th...
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/sampling.py#L559-L579
[ "def", "class_balancing_sample_weights", "(", "y", ")", ":", "h", "=", "np", ".", "bincount", "(", "y", ")", "cls_weight", "=", "1.0", "/", "(", "h", ".", "astype", "(", "float", ")", "*", "len", "(", "np", ".", "nonzero", "(", "h", ")", "[", "0"...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
WeightedSubsetSampler.shuffled_indices_batch_iterator
Create an iterator that generates randomly shuffled mini-batches of sample indices. The batches will have `batch_size` elements. The generated mini-batches indices take the form of 1D NumPy integer arrays. Parameters ---------- batch_size: int Mini-batch siz...
batchup/sampling.py
def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng): """ Create an iterator that generates randomly shuffled mini-batches of sample indices. The batches will have `batch_size` elements. The generated mini-batches indices take the form of 1D NumPy integer arrays. ...
def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng): """ Create an iterator that generates randomly shuffled mini-batches of sample indices. The batches will have `batch_size` elements. The generated mini-batches indices take the form of 1D NumPy integer arrays. ...
[ "Create", "an", "iterator", "that", "generates", "randomly", "shuffled", "mini", "-", "batches", "of", "sample", "indices", ".", "The", "batches", "will", "have", "batch_size", "elements", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/sampling.py#L688-L711
[ "def", "shuffled_indices_batch_iterator", "(", "self", ",", "batch_size", ",", "shuffle_rng", ")", ":", "while", "True", ":", "yield", "shuffle_rng", ".", "choice", "(", "self", ".", "indices", ",", "size", "=", "(", "batch_size", ",", ")", ",", "p", "=", ...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
WeightedSubsetSampler.class_balancing_sampler
Construct a `WeightedSubsetSampler` that compensates for class imbalance. Parameters ---------- y: NumPy array, 1D dtype=int sample classes, values must be 0 or positive indices: NumPy array, 1D dtype=int An array of indices that identify the subset of sa...
batchup/sampling.py
def class_balancing_sampler(y, indices): """ Construct a `WeightedSubsetSampler` that compensates for class imbalance. Parameters ---------- y: NumPy array, 1D dtype=int sample classes, values must be 0 or positive indices: NumPy array, 1D dtype=int ...
def class_balancing_sampler(y, indices): """ Construct a `WeightedSubsetSampler` that compensates for class imbalance. Parameters ---------- y: NumPy array, 1D dtype=int sample classes, values must be 0 or positive indices: NumPy array, 1D dtype=int ...
[ "Construct", "a", "WeightedSubsetSampler", "that", "compensates", "for", "class", "imbalance", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/sampling.py#L714-L733
[ "def", "class_balancing_sampler", "(", "y", ",", "indices", ")", ":", "weights", "=", "WeightedSampler", ".", "class_balancing_sample_weights", "(", "y", "[", "indices", "]", ")", "return", "WeightedSubsetSampler", "(", "weights", ",", "indices", "=", "indices", ...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
wait_for_service_available
Wait up to timeout seconds for service at host:port to start. Returns True if service becomes available, False if the container stops or raises ServiceTimeout if timeout is reached.
datacats/network.py
def wait_for_service_available(container, url, timeout): """ Wait up to timeout seconds for service at host:port to start. Returns True if service becomes available, False if the container stops or raises ServiceTimeout if timeout is reached. """ start = time.time() remaining = time...
def wait_for_service_available(container, url, timeout): """ Wait up to timeout seconds for service at host:port to start. Returns True if service becomes available, False if the container stops or raises ServiceTimeout if timeout is reached. """ start = time.time() remaining = time...
[ "Wait", "up", "to", "timeout", "seconds", "for", "service", "at", "host", ":", "port", "to", "start", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/network.py#L21-L51
[ "def", "wait_for_service_available", "(", "container", ",", "url", ",", "timeout", ")", ":", "start", "=", "time", ".", "time", "(", ")", "remaining", "=", "timeout", "while", "True", ":", "remaining", "=", "start", "+", "timeout", "-", "time", ".", "tim...
e4bae503efa997660fb3f34fe166699569653157
train
get_data_path
Get the path of the given file within the batchup data directory Parameters ---------- filename: str The filename to locate within the batchup data directory Returns ------- str The full path of the file
batchup/config.py
def get_data_path(filename): """ Get the path of the given file within the batchup data directory Parameters ---------- filename: str The filename to locate within the batchup data directory Returns ------- str The full path of the file """ if os.path.isabs(file...
def get_data_path(filename): """ Get the path of the given file within the batchup data directory Parameters ---------- filename: str The filename to locate within the batchup data directory Returns ------- str The full path of the file """ if os.path.isabs(file...
[ "Get", "the", "path", "of", "the", "given", "file", "within", "the", "batchup", "data", "directory" ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/config.py#L68-L85
[ "def", "get_data_path", "(", "filename", ")", ":", "if", "os", ".", "path", ".", "isabs", "(", "filename", ")", ":", "return", "filename", "else", ":", "return", "os", ".", "path", ".", "join", "(", "get_data_dir", "(", ")", ",", "filename", ")" ]
3fc2304e629f813c05f9e7a85a18acef3581a536
train
download
Download a file to a given path from a given URL, if it does not exist. Parameters ---------- path: str The (destination) path of the file on the local filesystem source_url: str The URL from which to download the file Returns ------- str The path of the file
batchup/config.py
def download(path, source_url): """ Download a file to a given path from a given URL, if it does not exist. Parameters ---------- path: str The (destination) path of the file on the local filesystem source_url: str The URL from which to download the file Returns -------...
def download(path, source_url): """ Download a file to a given path from a given URL, if it does not exist. Parameters ---------- path: str The (destination) path of the file on the local filesystem source_url: str The URL from which to download the file Returns -------...
[ "Download", "a", "file", "to", "a", "given", "path", "from", "a", "given", "URL", "if", "it", "does", "not", "exist", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/config.py#L88-L124
[ "def", "download", "(", "path", ",", "source_url", ")", ":", "dir_path", "=", "os", ".", "path", ".", "dirname", "(", "path", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "dir_path", ")", ":", "os", ".", "makedirs", "(", "dir_path", ")"...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
compute_sha256
Compute the SHA-256 hash of the file at the given path Parameters ---------- path: str The path of the file Returns ------- str The SHA-256 HEX digest
batchup/config.py
def compute_sha256(path): """ Compute the SHA-256 hash of the file at the given path Parameters ---------- path: str The path of the file Returns ------- str The SHA-256 HEX digest """ hasher = hashlib.sha256() with open(path, 'rb') as f: # 10MB chun...
def compute_sha256(path): """ Compute the SHA-256 hash of the file at the given path Parameters ---------- path: str The path of the file Returns ------- str The SHA-256 HEX digest """ hasher = hashlib.sha256() with open(path, 'rb') as f: # 10MB chun...
[ "Compute", "the", "SHA", "-", "256", "hash", "of", "the", "file", "at", "the", "given", "path" ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/config.py#L127-L146
[ "def", "compute_sha256", "(", "path", ")", ":", "hasher", "=", "hashlib", ".", "sha256", "(", ")", "with", "open", "(", "path", ",", "'rb'", ")", "as", "f", ":", "# 10MB chunks", "for", "chunk", "in", "iter", "(", "lambda", ":", "f", ".", "read", "...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
verify_file
Verify the integrity of a file by checking its SHA-256 hash. If no digest is supplied, the digest is printed to the console. Closely follows the code in `torchvision.datasets.utils.check_integrity` Parameters ---------- path: str The path of the file to check sha256: str The ex...
batchup/config.py
def verify_file(path, sha256): """ Verify the integrity of a file by checking its SHA-256 hash. If no digest is supplied, the digest is printed to the console. Closely follows the code in `torchvision.datasets.utils.check_integrity` Parameters ---------- path: str The path of the f...
def verify_file(path, sha256): """ Verify the integrity of a file by checking its SHA-256 hash. If no digest is supplied, the digest is printed to the console. Closely follows the code in `torchvision.datasets.utils.check_integrity` Parameters ---------- path: str The path of the f...
[ "Verify", "the", "integrity", "of", "a", "file", "by", "checking", "its", "SHA", "-", "256", "hash", ".", "If", "no", "digest", "is", "supplied", "the", "digest", "is", "printed", "to", "the", "console", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/config.py#L149-L180
[ "def", "verify_file", "(", "path", ",", "sha256", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "return", "False", "digest", "=", "compute_sha256", "(", "path", ")", "if", "sha256", "is", "None", ":", "# No digest supp...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
download_and_verify
Download a file to a given path from a given URL, if it does not exist. After downloading it, verify it integrity by checking the SHA-256 hash. Parameters ---------- path: str The (destination) path of the file on the local filesystem source_url: str The URL from which to download t...
batchup/config.py
def download_and_verify(path, source_url, sha256): """ Download a file to a given path from a given URL, if it does not exist. After downloading it, verify it integrity by checking the SHA-256 hash. Parameters ---------- path: str The (destination) path of the file on the local filesyst...
def download_and_verify(path, source_url, sha256): """ Download a file to a given path from a given URL, if it does not exist. After downloading it, verify it integrity by checking the SHA-256 hash. Parameters ---------- path: str The (destination) path of the file on the local filesyst...
[ "Download", "a", "file", "to", "a", "given", "path", "from", "a", "given", "URL", "if", "it", "does", "not", "exist", ".", "After", "downloading", "it", "verify", "it", "integrity", "by", "checking", "the", "SHA", "-", "256", "hash", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/config.py#L183-L244
[ "def", "download_and_verify", "(", "path", ",", "source_url", ",", "sha256", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "# Already exists?", "# Nothing to do, except print the SHA-256 if necessary", "if", "sha256", "is", "None", ":", ...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
copy_and_verify
Copy a file to a given path from a given path, if it does not exist. After copying it, verify it integrity by checking the SHA-256 hash. Parameters ---------- path: str The (destination) path of the file on the local filesystem source_path: str The path from which to copy the file ...
batchup/config.py
def copy_and_verify(path, source_path, sha256): """ Copy a file to a given path from a given path, if it does not exist. After copying it, verify it integrity by checking the SHA-256 hash. Parameters ---------- path: str The (destination) path of the file on the local filesystem sou...
def copy_and_verify(path, source_path, sha256): """ Copy a file to a given path from a given path, if it does not exist. After copying it, verify it integrity by checking the SHA-256 hash. Parameters ---------- path: str The (destination) path of the file on the local filesystem sou...
[ "Copy", "a", "file", "to", "a", "given", "path", "from", "a", "given", "path", "if", "it", "does", "not", "exist", ".", "After", "copying", "it", "verify", "it", "integrity", "by", "checking", "the", "SHA", "-", "256", "hash", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/config.py#L247-L298
[ "def", "copy_and_verify", "(", "path", ",", "source_path", ",", "sha256", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "# Already exists?", "# Nothing to do, except print the SHA-256 if necessary", "if", "sha256", "is", "None", ":", "...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
ckan_extension_template
Create ckanext-(name) in target directory.
datacats/template.py
def ckan_extension_template(name, target): """ Create ckanext-(name) in target directory. """ setupdir = '{0}/ckanext-{1}theme'.format(target, name) extdir = setupdir + '/ckanext/{0}theme'.format(name) templatedir = extdir + '/templates/' staticdir = extdir + '/static/datacats' makedirs...
def ckan_extension_template(name, target): """ Create ckanext-(name) in target directory. """ setupdir = '{0}/ckanext-{1}theme'.format(target, name) extdir = setupdir + '/ckanext/{0}theme'.format(name) templatedir = extdir + '/templates/' staticdir = extdir + '/static/datacats' makedirs...
[ "Create", "ckanext", "-", "(", "name", ")", "in", "target", "directory", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/template.py#L12-L41
[ "def", "ckan_extension_template", "(", "name", ",", "target", ")", ":", "setupdir", "=", "'{0}/ckanext-{1}theme'", ".", "format", "(", "target", ",", "name", ")", "extdir", "=", "setupdir", "+", "'/ckanext/{0}theme'", ".", "format", "(", "name", ")", "template...
e4bae503efa997660fb3f34fe166699569653157
train
shell
Run a command or interactive shell within this environment Usage: datacats [-d] [-s NAME] shell [ENVIRONMENT [COMMAND...]] Options: -d --detach Run the resulting container in the background -s --site=NAME Specify a site to run the shell on [default: primary] ENVIRONMENT may be an environment name or a ...
datacats/cli/shell.py
def shell(environment, opts): """Run a command or interactive shell within this environment Usage: datacats [-d] [-s NAME] shell [ENVIRONMENT [COMMAND...]] Options: -d --detach Run the resulting container in the background -s --site=NAME Specify a site to run the shell on [default: primary] ENVIRON...
def shell(environment, opts): """Run a command or interactive shell within this environment Usage: datacats [-d] [-s NAME] shell [ENVIRONMENT [COMMAND...]] Options: -d --detach Run the resulting container in the background -s --site=NAME Specify a site to run the shell on [default: primary] ENVIRON...
[ "Run", "a", "command", "or", "interactive", "shell", "within", "this", "environment" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/shell.py#L10-L28
[ "def", "shell", "(", "environment", ",", "opts", ")", ":", "environment", ".", "require_data", "(", ")", "environment", ".", "start_supporting_containers", "(", ")", "return", "environment", ".", "interactive_shell", "(", "opts", "[", "'COMMAND'", "]", ",", "d...
e4bae503efa997660fb3f34fe166699569653157
train
paster
Run a paster command from the current directory Usage: datacats paster [-d] [-s NAME] [COMMAND...] Options: -s --site=NAME Specify a site to run this paster command on [default: primary] -d --detach Run the resulting container in the background You must be inside a datacats environment to run this. The...
datacats/cli/shell.py
def paster(opts): """Run a paster command from the current directory Usage: datacats paster [-d] [-s NAME] [COMMAND...] Options: -s --site=NAME Specify a site to run this paster command on [default: primary] -d --detach Run the resulting container in the background You must be inside a datacats env...
def paster(opts): """Run a paster command from the current directory Usage: datacats paster [-d] [-s NAME] [COMMAND...] Options: -s --site=NAME Specify a site to run this paster command on [default: primary] -d --detach Run the resulting container in the background You must be inside a datacats env...
[ "Run", "a", "paster", "command", "from", "the", "current", "directory" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/shell.py#L31-L57
[ "def", "paster", "(", "opts", ")", ":", "environment", "=", "Environment", ".", "load", "(", "'.'", ")", "environment", ".", "require_data", "(", ")", "environment", ".", "start_supporting_containers", "(", ")", "if", "not", "opts", "[", "'COMMAND'", "]", ...
e4bae503efa997660fb3f34fe166699569653157
train
save_new_site
Add a site's configuration to the source dir and site dir
datacats/task.py
def save_new_site(site_name, sitedir, srcdir, port, address, site_url, passwords): """ Add a site's configuration to the source dir and site dir """ cp = ConfigParser.SafeConfigParser() cp.read([srcdir + '/.datacats-environment']) section_name = 'site_' + site_name if not cp.has_se...
def save_new_site(site_name, sitedir, srcdir, port, address, site_url, passwords): """ Add a site's configuration to the source dir and site dir """ cp = ConfigParser.SafeConfigParser() cp.read([srcdir + '/.datacats-environment']) section_name = 'site_' + site_name if not cp.has_se...
[ "Add", "a", "site", "s", "configuration", "to", "the", "source", "dir", "and", "site", "dir" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L44-L75
[ "def", "save_new_site", "(", "site_name", ",", "sitedir", ",", "srcdir", ",", "port", ",", "address", ",", "site_url", ",", "passwords", ")", ":", "cp", "=", "ConfigParser", ".", "SafeConfigParser", "(", ")", "cp", ".", "read", "(", "[", "srcdir", "+", ...
e4bae503efa997660fb3f34fe166699569653157
train
save_new_environment
Save an environment's configuration to the source dir and data dir
datacats/task.py
def save_new_environment(name, datadir, srcdir, ckan_version, deploy_target=None, always_prod=False): """ Save an environment's configuration to the source dir and data dir """ with open(datadir + '/.version', 'w') as f: f.write('2') cp = ConfigParser.SafeConfigParser() cp.read...
def save_new_environment(name, datadir, srcdir, ckan_version, deploy_target=None, always_prod=False): """ Save an environment's configuration to the source dir and data dir """ with open(datadir + '/.version', 'w') as f: f.write('2') cp = ConfigParser.SafeConfigParser() cp.read...
[ "Save", "an", "environment", "s", "configuration", "to", "the", "source", "dir", "and", "data", "dir" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L78-L106
[ "def", "save_new_environment", "(", "name", ",", "datadir", ",", "srcdir", ",", "ckan_version", ",", "deploy_target", "=", "None", ",", "always_prod", "=", "False", ")", ":", "with", "open", "(", "datadir", "+", "'/.version'", ",", "'w'", ")", "as", "f", ...
e4bae503efa997660fb3f34fe166699569653157
train
find_environment_dirs
:param environment_name: exising environment name, path or None to look in current or parent directories for project returns (srcdir, extension_dir, datadir) extension_dir is the name of extension directory user was in/referenced, default: 'ckan'. This value is used by the paster cli command. ...
datacats/task.py
def find_environment_dirs(environment_name=None, data_only=False): """ :param environment_name: exising environment name, path or None to look in current or parent directories for project returns (srcdir, extension_dir, datadir) extension_dir is the name of extension directory user was in/ref...
def find_environment_dirs(environment_name=None, data_only=False): """ :param environment_name: exising environment name, path or None to look in current or parent directories for project returns (srcdir, extension_dir, datadir) extension_dir is the name of extension directory user was in/ref...
[ ":", "param", "environment_name", ":", "exising", "environment", "name", "path", "or", "None", "to", "look", "in", "current", "or", "parent", "directories", "for", "project" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L118-L170
[ "def", "find_environment_dirs", "(", "environment_name", "=", "None", ",", "data_only", "=", "False", ")", ":", "docker", ".", "require_images", "(", ")", "if", "environment_name", "is", "None", ":", "environment_name", "=", "'.'", "extension_dir", "=", "'ckan'"...
e4bae503efa997660fb3f34fe166699569653157
train
load_environment
Load configuration values for an environment :param srcdir: environment source directory :param datadir: environment data direcory, if None will be discovered from srcdir :param allow_old: Don't throw an exception if this is an old site This is only valid for sites...
datacats/task.py
def load_environment(srcdir, datadir=None, allow_old=False): """ Load configuration values for an environment :param srcdir: environment source directory :param datadir: environment data direcory, if None will be discovered from srcdir :param allow_old: Don't throw an exception ...
def load_environment(srcdir, datadir=None, allow_old=False): """ Load configuration values for an environment :param srcdir: environment source directory :param datadir: environment data direcory, if None will be discovered from srcdir :param allow_old: Don't throw an exception ...
[ "Load", "configuration", "values", "for", "an", "environment" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L173-L247
[ "def", "load_environment", "(", "srcdir", ",", "datadir", "=", "None", ",", "allow_old", "=", "False", ")", ":", "cp", "=", "ConfigParser", ".", "SafeConfigParser", "(", ")", "try", ":", "cp", ".", "read", "(", "[", "srcdir", "+", "'/.datacats-environment'...
e4bae503efa997660fb3f34fe166699569653157
train
load_site
Load configuration values for a site. Returns (port, address, site_url, passwords)
datacats/task.py
def load_site(srcdir, datadir, site_name=None): """ Load configuration values for a site. Returns (port, address, site_url, passwords) """ if site_name is None: site_name = 'primary' if not validate.valid_name(site_name): raise DatacatsError('{} is not a valid site name.'.format...
def load_site(srcdir, datadir, site_name=None): """ Load configuration values for a site. Returns (port, address, site_url, passwords) """ if site_name is None: site_name = 'primary' if not validate.valid_name(site_name): raise DatacatsError('{} is not a valid site name.'.format...
[ "Load", "configuration", "values", "for", "a", "site", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L250-L292
[ "def", "load_site", "(", "srcdir", ",", "datadir", ",", "site_name", "=", "None", ")", ":", "if", "site_name", "is", "None", ":", "site_name", "=", "'primary'", "if", "not", "validate", ".", "valid_name", "(", "site_name", ")", ":", "raise", "DatacatsError...
e4bae503efa997660fb3f34fe166699569653157
train
new_environment_check
Check if a new environment or site can be created at the given path. Returns (name, datadir, sitedir, srcdir) or raises DatacatsError
datacats/task.py
def new_environment_check(srcpath, site_name, ckan_version): """ Check if a new environment or site can be created at the given path. Returns (name, datadir, sitedir, srcdir) or raises DatacatsError """ docker.require_images() workdir, name = path.split(path.abspath(path.expanduser(srcpath))) ...
def new_environment_check(srcpath, site_name, ckan_version): """ Check if a new environment or site can be created at the given path. Returns (name, datadir, sitedir, srcdir) or raises DatacatsError """ docker.require_images() workdir, name = path.split(path.abspath(path.expanduser(srcpath))) ...
[ "Check", "if", "a", "new", "environment", "or", "site", "can", "be", "created", "at", "the", "given", "path", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L298-L348
[ "def", "new_environment_check", "(", "srcpath", ",", "site_name", ",", "ckan_version", ")", ":", "docker", ".", "require_images", "(", ")", "workdir", ",", "name", "=", "path", ".", "split", "(", "path", ".", "abspath", "(", "path", ".", "expanduser", "(",...
e4bae503efa997660fb3f34fe166699569653157
train
data_complete
Return True if the directories and containers we're expecting are present in datadir, sitedir and containers
datacats/task.py
def data_complete(datadir, sitedir, get_container_name): """ Return True if the directories and containers we're expecting are present in datadir, sitedir and containers """ if any(not path.isdir(sitedir + x) for x in ('/files', '/run', '/solr')): return False if docker.is_b...
def data_complete(datadir, sitedir, get_container_name): """ Return True if the directories and containers we're expecting are present in datadir, sitedir and containers """ if any(not path.isdir(sitedir + x) for x in ('/files', '/run', '/solr')): return False if docker.is_b...
[ "Return", "True", "if", "the", "directories", "and", "containers", "we", "re", "expecting", "are", "present", "in", "datadir", "sitedir", "and", "containers" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L351-L365
[ "def", "data_complete", "(", "datadir", ",", "sitedir", ",", "get_container_name", ")", ":", "if", "any", "(", "not", "path", ".", "isdir", "(", "sitedir", "+", "x", ")", "for", "x", "in", "(", "'/files'", ",", "'/run'", ",", "'/solr'", ")", ")", ":"...
e4bae503efa997660fb3f34fe166699569653157
train
create_directories
Create expected directories in datadir, sitedir and optionally srcdir
datacats/task.py
def create_directories(datadir, sitedir, srcdir=None): """ Create expected directories in datadir, sitedir and optionally srcdir """ # It's possible that the datadir already exists # (we're making a secondary site) if not path.isdir(datadir): os.makedirs(datadir, mode=0o700) try:...
def create_directories(datadir, sitedir, srcdir=None): """ Create expected directories in datadir, sitedir and optionally srcdir """ # It's possible that the datadir already exists # (we're making a secondary site) if not path.isdir(datadir): os.makedirs(datadir, mode=0o700) try:...
[ "Create", "expected", "directories", "in", "datadir", "sitedir", "and", "optionally", "srcdir" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L377-L402
[ "def", "create_directories", "(", "datadir", ",", "sitedir", ",", "srcdir", "=", "None", ")", ":", "# It's possible that the datadir already exists", "# (we're making a secondary site)", "if", "not", "path", ".", "isdir", "(", "datadir", ")", ":", "os", ".", "makedi...
e4bae503efa997660fb3f34fe166699569653157
train
create_virtualenv
Populate venv from preloaded image
datacats/task.py
def create_virtualenv(srcdir, datadir, preload_image, get_container_name): """ Populate venv from preloaded image """ try: if docker.is_boot2docker(): docker.data_only_container( get_container_name('venv'), ['/usr/lib/ckan'], ) ...
def create_virtualenv(srcdir, datadir, preload_image, get_container_name): """ Populate venv from preloaded image """ try: if docker.is_boot2docker(): docker.data_only_container( get_container_name('venv'), ['/usr/lib/ckan'], ) ...
[ "Populate", "venv", "from", "preloaded", "image" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L405-L442
[ "def", "create_virtualenv", "(", "srcdir", ",", "datadir", ",", "preload_image", ",", "get_container_name", ")", ":", "try", ":", "if", "docker", ".", "is_boot2docker", "(", ")", ":", "docker", ".", "data_only_container", "(", "get_container_name", "(", "'venv'"...
e4bae503efa997660fb3f34fe166699569653157
train
create_source
Copy ckan source, datapusher source (optional), who.ini and schema.xml from preload image into srcdir
datacats/task.py
def create_source(srcdir, preload_image, datapusher=False): """ Copy ckan source, datapusher source (optional), who.ini and schema.xml from preload image into srcdir """ try: docker.web_command( command='/bin/cp -a /project/ckan /project_target/ckan', rw={srcdir: '/pr...
def create_source(srcdir, preload_image, datapusher=False): """ Copy ckan source, datapusher source (optional), who.ini and schema.xml from preload image into srcdir """ try: docker.web_command( command='/bin/cp -a /project/ckan /project_target/ckan', rw={srcdir: '/pr...
[ "Copy", "ckan", "source", "datapusher", "source", "(", "optional", ")", "who", ".", "ini", "and", "schema", ".", "xml", "from", "preload", "image", "into", "srcdir" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L445-L471
[ "def", "create_source", "(", "srcdir", ",", "preload_image", ",", "datapusher", "=", "False", ")", ":", "try", ":", "docker", ".", "web_command", "(", "command", "=", "'/bin/cp -a /project/ckan /project_target/ckan'", ",", "rw", "=", "{", "srcdir", ":", "'/proje...
e4bae503efa997660fb3f34fe166699569653157
train
start_supporting_containers
Start all supporting containers (containers required for CKAN to operate) if they aren't already running, along with some extra containers specified by the user
datacats/task.py
def start_supporting_containers(sitedir, srcdir, passwords, get_container_name, extra_containers, log_syslog=False): """ Start all supporting containers (containers required for CKAN to operate) if they aren't already running, along with some extra containers specified by the user """ if...
def start_supporting_containers(sitedir, srcdir, passwords, get_container_name, extra_containers, log_syslog=False): """ Start all supporting containers (containers required for CKAN to operate) if they aren't already running, along with some extra containers specified by the user """ if...
[ "Start", "all", "supporting", "containers", "(", "containers", "required", "for", "CKAN", "to", "operate", ")", "if", "they", "aren", "t", "already", "running", "along", "with", "some", "extra", "containers", "specified", "by", "the", "user" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L478-L531
[ "def", "start_supporting_containers", "(", "sitedir", ",", "srcdir", ",", "passwords", ",", "get_container_name", ",", "extra_containers", ",", "log_syslog", "=", "False", ")", ":", "if", "docker", ".", "is_boot2docker", "(", ")", ":", "docker", ".", "data_only_...
e4bae503efa997660fb3f34fe166699569653157
train
stop_supporting_containers
Stop postgres and solr containers, along with any specified extra containers
datacats/task.py
def stop_supporting_containers(get_container_name, extra_containers): """ Stop postgres and solr containers, along with any specified extra containers """ docker.remove_container(get_container_name('postgres')) docker.remove_container(get_container_name('solr')) for container in extra_containers...
def stop_supporting_containers(get_container_name, extra_containers): """ Stop postgres and solr containers, along with any specified extra containers """ docker.remove_container(get_container_name('postgres')) docker.remove_container(get_container_name('solr')) for container in extra_containers...
[ "Stop", "postgres", "and", "solr", "containers", "along", "with", "any", "specified", "extra", "containers" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L534-L541
[ "def", "stop_supporting_containers", "(", "get_container_name", ",", "extra_containers", ")", ":", "docker", ".", "remove_container", "(", "get_container_name", "(", "'postgres'", ")", ")", "docker", ".", "remove_container", "(", "get_container_name", "(", "'solr'", "...
e4bae503efa997660fb3f34fe166699569653157
train
containers_running
Return a list of containers tracked by this environment that are running
datacats/task.py
def containers_running(get_container_name): """ Return a list of containers tracked by this environment that are running """ running = [] for n in ['web', 'postgres', 'solr', 'datapusher', 'redis']: info = docker.inspect_container(get_container_name(n)) if info and not info['State'][...
def containers_running(get_container_name): """ Return a list of containers tracked by this environment that are running """ running = [] for n in ['web', 'postgres', 'solr', 'datapusher', 'redis']: info = docker.inspect_container(get_container_name(n)) if info and not info['State'][...
[ "Return", "a", "list", "of", "containers", "tracked", "by", "this", "environment", "that", "are", "running" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/task.py#L544-L555
[ "def", "containers_running", "(", "get_container_name", ")", ":", "running", "=", "[", "]", "for", "n", "in", "[", "'web'", ",", "'postgres'", ",", "'solr'", ",", "'datapusher'", ",", "'redis'", "]", ":", "info", "=", "docker", ".", "inspect_container", "(...
e4bae503efa997660fb3f34fe166699569653157
train
Environment._load_sites
Gets the names of all of the sites from the datadir and stores them in self.sites. Also returns this list.
datacats/environment.py
def _load_sites(self): """ Gets the names of all of the sites from the datadir and stores them in self.sites. Also returns this list. """ if not self.sites: self.sites = task.list_sites(self.datadir) return self.sites
def _load_sites(self): """ Gets the names of all of the sites from the datadir and stores them in self.sites. Also returns this list. """ if not self.sites: self.sites = task.list_sites(self.datadir) return self.sites
[ "Gets", "the", "names", "of", "all", "of", "the", "sites", "from", "the", "datadir", "and", "stores", "them", "in", "self", ".", "sites", ".", "Also", "returns", "this", "list", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L73-L80
[ "def", "_load_sites", "(", "self", ")", ":", "if", "not", "self", ".", "sites", ":", "self", ".", "sites", "=", "task", ".", "list_sites", "(", "self", ".", "datadir", ")", "return", "self", ".", "sites" ]
e4bae503efa997660fb3f34fe166699569653157
train
Environment.save_site
Save environment settings in the directory that need to be saved even when creating only a new sub-site env.
datacats/environment.py
def save_site(self, create=True): """ Save environment settings in the directory that need to be saved even when creating only a new sub-site env. """ self._load_sites() if create: self.sites.append(self.site_name) task.save_new_site(self.site_name, s...
def save_site(self, create=True): """ Save environment settings in the directory that need to be saved even when creating only a new sub-site env. """ self._load_sites() if create: self.sites.append(self.site_name) task.save_new_site(self.site_name, s...
[ "Save", "environment", "settings", "in", "the", "directory", "that", "need", "to", "be", "saved", "even", "when", "creating", "only", "a", "new", "sub", "-", "site", "env", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L82-L92
[ "def", "save_site", "(", "self", ",", "create", "=", "True", ")", ":", "self", ".", "_load_sites", "(", ")", "if", "create", ":", "self", ".", "sites", ".", "append", "(", "self", ".", "site_name", ")", "task", ".", "save_new_site", "(", "self", ".",...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.save
Save environment settings into environment directory, overwriting any existing configuration and discarding site config
datacats/environment.py
def save(self): """ Save environment settings into environment directory, overwriting any existing configuration and discarding site config """ task.save_new_environment(self.name, self.datadir, self.target, self.ckan_version, self.deploy_target, self.always_prod)
def save(self): """ Save environment settings into environment directory, overwriting any existing configuration and discarding site config """ task.save_new_environment(self.name, self.datadir, self.target, self.ckan_version, self.deploy_target, self.always_prod)
[ "Save", "environment", "settings", "into", "environment", "directory", "overwriting", "any", "existing", "configuration", "and", "discarding", "site", "config" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L94-L100
[ "def", "save", "(", "self", ")", ":", "task", ".", "save_new_environment", "(", "self", ".", "name", ",", "self", ".", "datadir", ",", "self", ".", "target", ",", "self", ".", "ckan_version", ",", "self", ".", "deploy_target", ",", "self", ".", "always...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.new
Return a Environment object with settings for a new project. No directories or containers are created by this call. :params path: location for new project directory, may be relative :params ckan_version: release of CKAN to install :params site_name: The name of the site to install datab...
datacats/environment.py
def new(cls, path, ckan_version, site_name, **kwargs): """ Return a Environment object with settings for a new project. No directories or containers are created by this call. :params path: location for new project directory, may be relative :params ckan_version: release of CKAN ...
def new(cls, path, ckan_version, site_name, **kwargs): """ Return a Environment object with settings for a new project. No directories or containers are created by this call. :params path: location for new project directory, may be relative :params ckan_version: release of CKAN ...
[ "Return", "a", "Environment", "object", "with", "settings", "for", "a", "new", "project", ".", "No", "directories", "or", "containers", "are", "created", "by", "this", "call", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L103-L123
[ "def", "new", "(", "cls", ",", "path", ",", "ckan_version", ",", "site_name", ",", "*", "*", "kwargs", ")", ":", "if", "ckan_version", "==", "'master'", ":", "ckan_version", "=", "'latest'", "name", ",", "datadir", ",", "srcdir", "=", "task", ".", "new...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.load
Return an Environment object based on an existing environnment+site. :param environment_name: exising environment name, path or None to look in current or parent directories for project :param data_only: set to True to only load from data dir, not the project dir; Used for purgi...
datacats/environment.py
def load(cls, environment_name=None, site_name='primary', data_only=False, allow_old=False): """ Return an Environment object based on an existing environnment+site. :param environment_name: exising environment name, path or None to look in current or parent directories for project ...
def load(cls, environment_name=None, site_name='primary', data_only=False, allow_old=False): """ Return an Environment object based on an existing environnment+site. :param environment_name: exising environment name, path or None to look in current or parent directories for project ...
[ "Return", "an", "Environment", "object", "based", "on", "an", "existing", "environnment", "+", "site", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L126-L168
[ "def", "load", "(", "cls", ",", "environment_name", "=", "None", ",", "site_name", "=", "'primary'", ",", "data_only", "=", "False", ",", "allow_old", "=", "False", ")", ":", "srcdir", ",", "extension_dir", ",", "datadir", "=", "task", ".", "find_environme...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.data_complete
Return True if all the expected datadir files are present
datacats/environment.py
def data_complete(self): """ Return True if all the expected datadir files are present """ return task.data_complete(self.datadir, self.sitedir, self._get_container_name)
def data_complete(self): """ Return True if all the expected datadir files are present """ return task.data_complete(self.datadir, self.sitedir, self._get_container_name)
[ "Return", "True", "if", "all", "the", "expected", "datadir", "files", "are", "present" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L182-L187
[ "def", "data_complete", "(", "self", ")", ":", "return", "task", ".", "data_complete", "(", "self", ".", "datadir", ",", "self", ".", "sitedir", ",", "self", ".", "_get_container_name", ")" ]
e4bae503efa997660fb3f34fe166699569653157
train
Environment.require_data
raise a DatacatsError if the datadir or volumes are missing or damaged
datacats/environment.py
def require_data(self): """ raise a DatacatsError if the datadir or volumes are missing or damaged """ files = task.source_missing(self.target) if files: raise DatacatsError('Missing files in source directory:\n' + '\n'.join(files)) ...
def require_data(self): """ raise a DatacatsError if the datadir or volumes are missing or damaged """ files = task.source_missing(self.target) if files: raise DatacatsError('Missing files in source directory:\n' + '\n'.join(files)) ...
[ "raise", "a", "DatacatsError", "if", "the", "datadir", "or", "volumes", "are", "missing", "or", "damaged" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L189-L204
[ "def", "require_data", "(", "self", ")", ":", "files", "=", "task", ".", "source_missing", "(", "self", ".", "target", ")", "if", "files", ":", "raise", "DatacatsError", "(", "'Missing files in source directory:\\n'", "+", "'\\n'", ".", "join", "(", "files", ...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.create_directories
Call once for new projects to create the initial project directories.
datacats/environment.py
def create_directories(self, create_project_dir=True): """ Call once for new projects to create the initial project directories. """ return task.create_directories(self.datadir, self.sitedir, self.target if create_project_dir else None)
def create_directories(self, create_project_dir=True): """ Call once for new projects to create the initial project directories. """ return task.create_directories(self.datadir, self.sitedir, self.target if create_project_dir else None)
[ "Call", "once", "for", "new", "projects", "to", "create", "the", "initial", "project", "directories", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L206-L211
[ "def", "create_directories", "(", "self", ",", "create_project_dir", "=", "True", ")", ":", "return", "task", ".", "create_directories", "(", "self", ".", "datadir", ",", "self", ".", "sitedir", ",", "self", ".", "target", "if", "create_project_dir", "else", ...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.create_virtualenv
Populate venv from preloaded image
datacats/environment.py
def create_virtualenv(self): """ Populate venv from preloaded image """ return task.create_virtualenv(self.target, self.datadir, self._preload_image(), self._get_container_name)
def create_virtualenv(self): """ Populate venv from preloaded image """ return task.create_virtualenv(self.target, self.datadir, self._preload_image(), self._get_container_name)
[ "Populate", "venv", "from", "preloaded", "image" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L228-L233
[ "def", "create_virtualenv", "(", "self", ")", ":", "return", "task", ".", "create_virtualenv", "(", "self", ".", "target", ",", "self", ".", "datadir", ",", "self", ".", "_preload_image", "(", ")", ",", "self", ".", "_get_container_name", ")" ]
e4bae503efa997660fb3f34fe166699569653157
train
Environment.clean_virtualenv
Empty our virtualenv so that new (or older) dependencies may be installed
datacats/environment.py
def clean_virtualenv(self): """ Empty our virtualenv so that new (or older) dependencies may be installed """ self.user_run_script( script=scripts.get_script_path('clean_virtualenv.sh'), args=[], rw_venv=True, )
def clean_virtualenv(self): """ Empty our virtualenv so that new (or older) dependencies may be installed """ self.user_run_script( script=scripts.get_script_path('clean_virtualenv.sh'), args=[], rw_venv=True, )
[ "Empty", "our", "virtualenv", "so", "that", "new", "(", "or", "older", ")", "dependencies", "may", "be", "installed" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L235-L244
[ "def", "clean_virtualenv", "(", "self", ")", ":", "self", ".", "user_run_script", "(", "script", "=", "scripts", ".", "get_script_path", "(", "'clean_virtualenv.sh'", ")", ",", "args", "=", "[", "]", ",", "rw_venv", "=", "True", ",", ")" ]
e4bae503efa997660fb3f34fe166699569653157
train
Environment.create_source
Populate ckan directory from preloaded image and copy who.ini and schema.xml info conf directory
datacats/environment.py
def create_source(self, datapusher=True): """ Populate ckan directory from preloaded image and copy who.ini and schema.xml info conf directory """ task.create_source(self.target, self._preload_image(), datapusher)
def create_source(self, datapusher=True): """ Populate ckan directory from preloaded image and copy who.ini and schema.xml info conf directory """ task.create_source(self.target, self._preload_image(), datapusher)
[ "Populate", "ckan", "directory", "from", "preloaded", "image", "and", "copy", "who", ".", "ini", "and", "schema", ".", "xml", "info", "conf", "directory" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L253-L258
[ "def", "create_source", "(", "self", ",", "datapusher", "=", "True", ")", ":", "task", ".", "create_source", "(", "self", ".", "target", ",", "self", ".", "_preload_image", "(", ")", ",", "datapusher", ")" ]
e4bae503efa997660fb3f34fe166699569653157
train
Environment.start_supporting_containers
Start all supporting containers (containers required for CKAN to operate) if they aren't already running. :param log_syslog: A flag to redirect all container logs to host's syslog
datacats/environment.py
def start_supporting_containers(self, log_syslog=False): """ Start all supporting containers (containers required for CKAN to operate) if they aren't already running. :param log_syslog: A flag to redirect all container logs to host's syslog """ log_syslog = True if ...
def start_supporting_containers(self, log_syslog=False): """ Start all supporting containers (containers required for CKAN to operate) if they aren't already running. :param log_syslog: A flag to redirect all container logs to host's syslog """ log_syslog = True if ...
[ "Start", "all", "supporting", "containers", "(", "containers", "required", "for", "CKAN", "to", "operate", ")", "if", "they", "aren", "t", "already", "running", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L260-L277
[ "def", "start_supporting_containers", "(", "self", ",", "log_syslog", "=", "False", ")", ":", "log_syslog", "=", "True", "if", "self", ".", "always_prod", "else", "log_syslog", "# in production we always use log_syslog driver (to aggregate all the logs)", "task", ".", "st...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.create_ckan_ini
Use make-config to generate an initial development.ini file
datacats/environment.py
def create_ckan_ini(self): """ Use make-config to generate an initial development.ini file """ self.run_command( command='/scripts/run_as_user.sh /usr/lib/ckan/bin/paster make-config' ' ckan /project/development.ini', rw_project=True, ro={s...
def create_ckan_ini(self): """ Use make-config to generate an initial development.ini file """ self.run_command( command='/scripts/run_as_user.sh /usr/lib/ckan/bin/paster make-config' ' ckan /project/development.ini', rw_project=True, ro={s...
[ "Use", "make", "-", "config", "to", "generate", "an", "initial", "development", ".", "ini", "file" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L295-L304
[ "def", "create_ckan_ini", "(", "self", ")", ":", "self", ".", "run_command", "(", "command", "=", "'/scripts/run_as_user.sh /usr/lib/ckan/bin/paster make-config'", "' ckan /project/development.ini'", ",", "rw_project", "=", "True", ",", "ro", "=", "{", "scripts", ".", ...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.update_ckan_ini
Use config-tool to update development.ini with our environment settings :param skin: use environment template skin plugin True/False
datacats/environment.py
def update_ckan_ini(self, skin=True): """ Use config-tool to update development.ini with our environment settings :param skin: use environment template skin plugin True/False """ command = [ '/usr/lib/ckan/bin/paster', '--plugin=ckan', 'config-tool', '/pr...
def update_ckan_ini(self, skin=True): """ Use config-tool to update development.ini with our environment settings :param skin: use environment template skin plugin True/False """ command = [ '/usr/lib/ckan/bin/paster', '--plugin=ckan', 'config-tool', '/pr...
[ "Use", "config", "-", "tool", "to", "update", "development", ".", "ini", "with", "our", "environment", "settings" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L306-L329
[ "def", "update_ckan_ini", "(", "self", ",", "skin", "=", "True", ")", ":", "command", "=", "[", "'/usr/lib/ckan/bin/paster'", ",", "'--plugin=ckan'", ",", "'config-tool'", ",", "'/project/development.ini'", ",", "'-e'", ",", "'sqlalchemy.url = postgresql://<hidden>'", ...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.create_install_template_skin
Create an example ckan extension for this environment and install it
datacats/environment.py
def create_install_template_skin(self): """ Create an example ckan extension for this environment and install it """ ckan_extension_template(self.name, self.target) self.install_package_develop('ckanext-' + self.name + 'theme')
def create_install_template_skin(self): """ Create an example ckan extension for this environment and install it """ ckan_extension_template(self.name, self.target) self.install_package_develop('ckanext-' + self.name + 'theme')
[ "Create", "an", "example", "ckan", "extension", "for", "this", "environment", "and", "install", "it" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L331-L336
[ "def", "create_install_template_skin", "(", "self", ")", ":", "ckan_extension_template", "(", "self", ".", "name", ",", "self", ".", "target", ")", "self", ".", "install_package_develop", "(", "'ckanext-'", "+", "self", ".", "name", "+", "'theme'", ")" ]
e4bae503efa997660fb3f34fe166699569653157
train
Environment.ckan_db_init
Run db init to create all ckan tables :param retry_seconds: how long to retry waiting for db to start
datacats/environment.py
def ckan_db_init(self, retry_seconds=DB_INIT_RETRY_SECONDS): """ Run db init to create all ckan tables :param retry_seconds: how long to retry waiting for db to start """ # XXX workaround for not knowing how long we need to wait # for postgres to be ready. fix this by ch...
def ckan_db_init(self, retry_seconds=DB_INIT_RETRY_SECONDS): """ Run db init to create all ckan tables :param retry_seconds: how long to retry waiting for db to start """ # XXX workaround for not knowing how long we need to wait # for postgres to be ready. fix this by ch...
[ "Run", "db", "init", "to", "create", "all", "ckan", "tables" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L338-L360
[ "def", "ckan_db_init", "(", "self", ",", "retry_seconds", "=", "DB_INIT_RETRY_SECONDS", ")", ":", "# XXX workaround for not knowing how long we need to wait", "# for postgres to be ready. fix this by changing the postgres", "# entrypoint, or possibly running once with command=/bin/true", "...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.start_ckan
Start the apache server or paster serve :param log_syslog: A flag to redirect all container logs to host's syslog :param production: True for apache, False for paster serve + debug on :param paster_reload: Instruct paster to watch for file changes
datacats/environment.py
def start_ckan(self, production=False, log_syslog=False, paster_reload=True, interactive=False): """ Start the apache server or paster serve :param log_syslog: A flag to redirect all container logs to host's syslog :param production: True for apache, False for paster ...
def start_ckan(self, production=False, log_syslog=False, paster_reload=True, interactive=False): """ Start the apache server or paster serve :param log_syslog: A flag to redirect all container logs to host's syslog :param production: True for apache, False for paster ...
[ "Start", "the", "apache", "server", "or", "paster", "serve" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L391-L450
[ "def", "start_ckan", "(", "self", ",", "production", "=", "False", ",", "log_syslog", "=", "False", ",", "paster_reload", "=", "True", ",", "interactive", "=", "False", ")", ":", "self", ".", "stop_ckan", "(", ")", "address", "=", "self", ".", "address",...
e4bae503efa997660fb3f34fe166699569653157
train
Environment._create_run_ini
Create run/development.ini in datadir with debug and site_url overridden and with correct db passwords inserted
datacats/environment.py
def _create_run_ini(self, port, production, output='development.ini', source='development.ini', override_site_url=True): """ Create run/development.ini in datadir with debug and site_url overridden and with correct db passwords inserted """ cp = SafeConfig...
def _create_run_ini(self, port, production, output='development.ini', source='development.ini', override_site_url=True): """ Create run/development.ini in datadir with debug and site_url overridden and with correct db passwords inserted """ cp = SafeConfig...
[ "Create", "run", "/", "development", ".", "ini", "in", "datadir", "with", "debug", "and", "site_url", "overridden", "and", "with", "correct", "db", "passwords", "inserted" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L452-L494
[ "def", "_create_run_ini", "(", "self", ",", "port", ",", "production", ",", "output", "=", "'development.ini'", ",", "source", "=", "'development.ini'", ",", "override_site_url", "=", "True", ")", ":", "cp", "=", "SafeConfigParser", "(", ")", "try", ":", "cp...
e4bae503efa997660fb3f34fe166699569653157
train
Environment._run_web_container
Start web container on port with command
datacats/environment.py
def _run_web_container(self, port, command, address, log_syslog=False, datapusher=True, interactive=False): """ Start web container on port with command """ if is_boot2docker(): ro = {} volumes_from = self._get_container_name('venv') ...
def _run_web_container(self, port, command, address, log_syslog=False, datapusher=True, interactive=False): """ Start web container on port with command """ if is_boot2docker(): ro = {} volumes_from = self._get_container_name('venv') ...
[ "Start", "web", "container", "on", "port", "with", "command" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L496-L566
[ "def", "_run_web_container", "(", "self", ",", "port", ",", "command", ",", "address", ",", "log_syslog", "=", "False", ",", "datapusher", "=", "True", ",", "interactive", "=", "False", ")", ":", "if", "is_boot2docker", "(", ")", ":", "ro", "=", "{", "...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.wait_for_web_available
Wait for the web server to become available or raise DatacatsError if it fails to start.
datacats/environment.py
def wait_for_web_available(self): """ Wait for the web server to become available or raise DatacatsError if it fails to start. """ try: if not wait_for_service_available( self._get_container_name('web'), self.web_address(), ...
def wait_for_web_available(self): """ Wait for the web server to become available or raise DatacatsError if it fails to start. """ try: if not wait_for_service_available( self._get_container_name('web'), self.web_address(), ...
[ "Wait", "for", "the", "web", "server", "to", "become", "available", "or", "raise", "DatacatsError", "if", "it", "fails", "to", "start", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L568-L583
[ "def", "wait_for_web_available", "(", "self", ")", ":", "try", ":", "if", "not", "wait_for_service_available", "(", "self", ".", "_get_container_name", "(", "'web'", ")", ",", "self", ".", "web_address", "(", ")", ",", "WEB_START_TIMEOUT_SECONDS", ")", ":", "r...
e4bae503efa997660fb3f34fe166699569653157
train
Environment._choose_port
Return a port number from 5000-5999 based on the environment name to be used as a default when the user hasn't selected one.
datacats/environment.py
def _choose_port(self): """ Return a port number from 5000-5999 based on the environment name to be used as a default when the user hasn't selected one. """ # instead of random let's base it on the name chosen (and the site name) return 5000 + unpack('Q', ...
def _choose_port(self): """ Return a port number from 5000-5999 based on the environment name to be used as a default when the user hasn't selected one. """ # instead of random let's base it on the name chosen (and the site name) return 5000 + unpack('Q', ...
[ "Return", "a", "port", "number", "from", "5000", "-", "5999", "based", "on", "the", "environment", "name", "to", "be", "used", "as", "a", "default", "when", "the", "user", "hasn", "t", "selected", "one", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L585-L593
[ "def", "_choose_port", "(", "self", ")", ":", "# instead of random let's base it on the name chosen (and the site name)", "return", "5000", "+", "unpack", "(", "'Q'", ",", "sha", "(", "(", "self", ".", "name", "+", "self", ".", "site_name", ")", ".", "decode", "...
e4bae503efa997660fb3f34fe166699569653157
train
Environment._next_port
Return another port from the 5000-5999 range
datacats/environment.py
def _next_port(self, port): """ Return another port from the 5000-5999 range """ port = 5000 + (port + 1) % 1000 if port == self.port: raise DatacatsError('Too many instances running') return port
def _next_port(self, port): """ Return another port from the 5000-5999 range """ port = 5000 + (port + 1) % 1000 if port == self.port: raise DatacatsError('Too many instances running') return port
[ "Return", "another", "port", "from", "the", "5000", "-", "5999", "range" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L595-L602
[ "def", "_next_port", "(", "self", ",", "port", ")", ":", "port", "=", "5000", "+", "(", "port", "+", "1", ")", "%", "1000", "if", "port", "==", "self", ".", "port", ":", "raise", "DatacatsError", "(", "'Too many instances running'", ")", "return", "por...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.stop_ckan
Stop and remove the web container
datacats/environment.py
def stop_ckan(self): """ Stop and remove the web container """ remove_container(self._get_container_name('web'), force=True) remove_container(self._get_container_name('datapusher'), force=True)
def stop_ckan(self): """ Stop and remove the web container """ remove_container(self._get_container_name('web'), force=True) remove_container(self._get_container_name('datapusher'), force=True)
[ "Stop", "and", "remove", "the", "web", "container" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L604-L609
[ "def", "stop_ckan", "(", "self", ")", ":", "remove_container", "(", "self", ".", "_get_container_name", "(", "'web'", ")", ",", "force", "=", "True", ")", "remove_container", "(", "self", ".", "_get_container_name", "(", "'datapusher'", ")", ",", "force", "=...
e4bae503efa997660fb3f34fe166699569653157
train
Environment._current_web_port
return just the port number for the web container, or None if not running
datacats/environment.py
def _current_web_port(self): """ return just the port number for the web container, or None if not running """ info = inspect_container(self._get_container_name('web')) if info is None: return None try: if not info['State']['Running']: ...
def _current_web_port(self): """ return just the port number for the web container, or None if not running """ info = inspect_container(self._get_container_name('web')) if info is None: return None try: if not info['State']['Running']: ...
[ "return", "just", "the", "port", "number", "for", "the", "web", "container", "or", "None", "if", "not", "running" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L611-L624
[ "def", "_current_web_port", "(", "self", ")", ":", "info", "=", "inspect_container", "(", "self", ".", "_get_container_name", "(", "'web'", ")", ")", "if", "info", "is", "None", ":", "return", "None", "try", ":", "if", "not", "info", "[", "'State'", "]",...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.add_extra_container
Add a container as a 'extra'. These are running containers which are not necessary for running default CKAN but are useful for certain extensions :param container: The container name to add :param error_on_exists: Raise a DatacatsError if the extra container already exists.
datacats/environment.py
def add_extra_container(self, container, error_on_exists=False): """ Add a container as a 'extra'. These are running containers which are not necessary for running default CKAN but are useful for certain extensions :param container: The container name to add :param error_on_exist...
def add_extra_container(self, container, error_on_exists=False): """ Add a container as a 'extra'. These are running containers which are not necessary for running default CKAN but are useful for certain extensions :param container: The container name to add :param error_on_exist...
[ "Add", "a", "container", "as", "a", "extra", ".", "These", "are", "running", "containers", "which", "are", "not", "necessary", "for", "running", "default", "CKAN", "but", "are", "useful", "for", "certain", "extensions", ":", "param", "container", ":", "The",...
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L636-L657
[ "def", "add_extra_container", "(", "self", ",", "container", ",", "error_on_exists", "=", "False", ")", ":", "if", "container", "in", "self", ".", "extra_containers", ":", "if", "error_on_exists", ":", "raise", "DatacatsError", "(", "'{} is already added as an extra...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.web_address
Return the url of the web server or None if not running
datacats/environment.py
def web_address(self): """ Return the url of the web server or None if not running """ port = self._current_web_port() address = self.address or '127.0.0.1' if port is None: return None return 'http://{0}:{1}/'.format( address if address an...
def web_address(self): """ Return the url of the web server or None if not running """ port = self._current_web_port() address = self.address or '127.0.0.1' if port is None: return None return 'http://{0}:{1}/'.format( address if address an...
[ "Return", "the", "url", "of", "the", "web", "server", "or", "None", "if", "not", "running" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L665-L675
[ "def", "web_address", "(", "self", ")", ":", "port", "=", "self", ".", "_current_web_port", "(", ")", "address", "=", "self", ".", "address", "or", "'127.0.0.1'", "if", "port", "is", "None", ":", "return", "None", "return", "'http://{0}:{1}/'", ".", "forma...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.create_admin_set_password
create 'admin' account with given password
datacats/environment.py
def create_admin_set_password(self, password): """ create 'admin' account with given password """ with open(self.sitedir + '/run/admin.json', 'w') as out: json.dump({ 'name': 'admin', 'email': 'none', 'password': password, ...
def create_admin_set_password(self, password): """ create 'admin' account with given password """ with open(self.sitedir + '/run/admin.json', 'w') as out: json.dump({ 'name': 'admin', 'email': 'none', 'password': password, ...
[ "create", "admin", "account", "with", "given", "password" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L677-L696
[ "def", "create_admin_set_password", "(", "self", ",", "password", ")", ":", "with", "open", "(", "self", ".", "sitedir", "+", "'/run/admin.json'", ",", "'w'", ")", "as", "out", ":", "json", ".", "dump", "(", "{", "'name'", ":", "'admin'", ",", "'email'",...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.interactive_shell
launch interactive shell session with all writable volumes :param: list of strings to execute instead of bash
datacats/environment.py
def interactive_shell(self, command=None, paster=False, detach=False): """ launch interactive shell session with all writable volumes :param: list of strings to execute instead of bash """ if not exists(self.target + '/.bash_profile'): # this file is required for act...
def interactive_shell(self, command=None, paster=False, detach=False): """ launch interactive shell session with all writable volumes :param: list of strings to execute instead of bash """ if not exists(self.target + '/.bash_profile'): # this file is required for act...
[ "launch", "interactive", "shell", "session", "with", "all", "writable", "volumes" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L698-L768
[ "def", "interactive_shell", "(", "self", ",", "command", "=", "None", ",", "paster", "=", "False", ",", "detach", "=", "False", ")", ":", "if", "not", "exists", "(", "self", ".", "target", "+", "'/.bash_profile'", ")", ":", "# this file is required for activ...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.install_package_requirements
Install from requirements.txt file found in psrc :param psrc: name of directory in environment directory
datacats/environment.py
def install_package_requirements(self, psrc, stream_output=None): """ Install from requirements.txt file found in psrc :param psrc: name of directory in environment directory """ package = self.target + '/' + psrc assert isdir(package), package reqname = '/requir...
def install_package_requirements(self, psrc, stream_output=None): """ Install from requirements.txt file found in psrc :param psrc: name of directory in environment directory """ package = self.target + '/' + psrc assert isdir(package), package reqname = '/requir...
[ "Install", "from", "requirements", ".", "txt", "file", "found", "in", "psrc" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L770-L789
[ "def", "install_package_requirements", "(", "self", ",", "psrc", ",", "stream_output", "=", "None", ")", ":", "package", "=", "self", ".", "target", "+", "'/'", "+", "psrc", "assert", "isdir", "(", "package", ")", ",", "package", "reqname", "=", "'/require...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.purge_data
Remove uploaded files, postgres db, solr index, venv
datacats/environment.py
def purge_data(self, which_sites=None, never_delete=False): """ Remove uploaded files, postgres db, solr index, venv """ # Default to the set of all sites if not exists(self.datadir + '/.version'): format_version = 1 else: with open(self.datadir + ...
def purge_data(self, which_sites=None, never_delete=False): """ Remove uploaded files, postgres db, solr index, venv """ # Default to the set of all sites if not exists(self.datadir + '/.version'): format_version = 1 else: with open(self.datadir + ...
[ "Remove", "uploaded", "files", "postgres", "db", "solr", "index", "venv" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L856-L925
[ "def", "purge_data", "(", "self", ",", "which_sites", "=", "None", ",", "never_delete", "=", "False", ")", ":", "# Default to the set of all sites", "if", "not", "exists", "(", "self", ".", "datadir", "+", "'/.version'", ")", ":", "format_version", "=", "1", ...
e4bae503efa997660fb3f34fe166699569653157
train
Environment.logs
:param container: 'web', 'solr' or 'postgres' :param tail: number of lines to show :param follow: True to return generator instead of list :param timestamps: True to include timestamps
datacats/environment.py
def logs(self, container, tail='all', follow=False, timestamps=False): """ :param container: 'web', 'solr' or 'postgres' :param tail: number of lines to show :param follow: True to return generator instead of list :param timestamps: True to include timestamps """ ...
def logs(self, container, tail='all', follow=False, timestamps=False): """ :param container: 'web', 'solr' or 'postgres' :param tail: number of lines to show :param follow: True to return generator instead of list :param timestamps: True to include timestamps """ ...
[ ":", "param", "container", ":", "web", "solr", "or", "postgres", ":", "param", "tail", ":", "number", "of", "lines", "to", "show", ":", "param", "follow", ":", "True", "to", "return", "generator", "instead", "of", "list", ":", "param", "timestamps", ":",...
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L927-L938
[ "def", "logs", "(", "self", ",", "container", ",", "tail", "=", "'all'", ",", "follow", "=", "False", ",", "timestamps", "=", "False", ")", ":", "return", "container_logs", "(", "self", ".", "_get_container_name", "(", "container", ")", ",", "tail", ",",...
e4bae503efa997660fb3f34fe166699569653157
train
Environment._proxy_settings
Create/replace ~/.datacats/run/proxy-environment and return entry for ro mount for containers
datacats/environment.py
def _proxy_settings(self): """ Create/replace ~/.datacats/run/proxy-environment and return entry for ro mount for containers """ if not ('https_proxy' in environ or 'HTTPS_PROXY' in environ or 'http_proxy' in environ or 'HTTP_PROXY' in environ): return...
def _proxy_settings(self): """ Create/replace ~/.datacats/run/proxy-environment and return entry for ro mount for containers """ if not ('https_proxy' in environ or 'HTTPS_PROXY' in environ or 'http_proxy' in environ or 'HTTP_PROXY' in environ): return...
[ "Create", "/", "replace", "~", "/", ".", "datacats", "/", "run", "/", "proxy", "-", "environment", "and", "return", "entry", "for", "ro", "mount", "for", "containers" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L949-L984
[ "def", "_proxy_settings", "(", "self", ")", ":", "if", "not", "(", "'https_proxy'", "in", "environ", "or", "'HTTPS_PROXY'", "in", "environ", "or", "'http_proxy'", "in", "environ", "or", "'HTTP_PROXY'", "in", "environ", ")", ":", "return", "{", "}", "https_pr...
e4bae503efa997660fb3f34fe166699569653157
train
Environment._get_container_name
Gets the full name of a container of the type specified. Currently the supported types are: - 'venv' - 'postgres' - 'solr' - 'web' - 'pgdata' - 'lessc' - 'datapusher' - 'redis' The name will be formatted appr...
datacats/environment.py
def _get_container_name(self, container_type): """ Gets the full name of a container of the type specified. Currently the supported types are: - 'venv' - 'postgres' - 'solr' - 'web' - 'pgdata' - 'lessc' - 'datapu...
def _get_container_name(self, container_type): """ Gets the full name of a container of the type specified. Currently the supported types are: - 'venv' - 'postgres' - 'solr' - 'web' - 'pgdata' - 'lessc' - 'datapu...
[ "Gets", "the", "full", "name", "of", "a", "container", "of", "the", "type", "specified", ".", "Currently", "the", "supported", "types", "are", ":", "-", "venv", "-", "postgres", "-", "solr", "-", "web", "-", "pgdata", "-", "lessc", "-", "datapusher", "...
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L986-L1006
[ "def", "_get_container_name", "(", "self", ",", "container_type", ")", ":", "if", "container_type", "in", "[", "'venv'", "]", ":", "return", "'datacats_{}_{}'", ".", "format", "(", "container_type", ",", "self", ".", "name", ")", "else", ":", "return", "'dat...
e4bae503efa997660fb3f34fe166699569653157
train
less
Recompiles less files in an environment. Usage: datacats less [ENVIRONMENT] ENVIRONMENT may be an environment name or a path to an environment directory. Default: '.'
datacats/cli/less.py
def less(environment, opts): # pylint: disable=unused-argument """Recompiles less files in an environment. Usage: datacats less [ENVIRONMENT] ENVIRONMENT may be an environment name or a path to an environment directory. Default: '.' """ require_extra_image(LESSC_IMAGE) print 'Converting .less files...
def less(environment, opts): # pylint: disable=unused-argument """Recompiles less files in an environment. Usage: datacats less [ENVIRONMENT] ENVIRONMENT may be an environment name or a path to an environment directory. Default: '.' """ require_extra_image(LESSC_IMAGE) print 'Converting .less files...
[ "Recompiles", "less", "files", "in", "an", "environment", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/less.py#L13-L27
[ "def", "less", "(", "environment", ",", "opts", ")", ":", "# pylint: disable=unused-argument", "require_extra_image", "(", "LESSC_IMAGE", ")", "print", "'Converting .less files to .css...'", "for", "log", "in", "environment", ".", "compile_less", "(", ")", ":", "print...
e4bae503efa997660fb3f34fe166699569653157
train
fetch_and_convert_dataset
Decorator applied to a dataset conversion function that converts acquired source files into a dataset file that BatchUp can use. Parameters ---------- source_file: list of `AbstractSourceFile` instances A list of files to be acquired target_filename: str or callable The name of the ...
batchup/datasets/dataset.py
def fetch_and_convert_dataset(source_files, target_filename): """ Decorator applied to a dataset conversion function that converts acquired source files into a dataset file that BatchUp can use. Parameters ---------- source_file: list of `AbstractSourceFile` instances A list of files to...
def fetch_and_convert_dataset(source_files, target_filename): """ Decorator applied to a dataset conversion function that converts acquired source files into a dataset file that BatchUp can use. Parameters ---------- source_file: list of `AbstractSourceFile` instances A list of files to...
[ "Decorator", "applied", "to", "a", "dataset", "conversion", "function", "that", "converts", "acquired", "source", "files", "into", "a", "dataset", "file", "that", "BatchUp", "can", "use", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/datasets/dataset.py#L252-L399
[ "def", "fetch_and_convert_dataset", "(", "source_files", ",", "target_filename", ")", ":", "if", "not", "isinstance", "(", "target_filename", ",", "six", ".", "string_types", ")", "and", "not", "callable", "(", "target_filename", ")", ":", "raise", "TypeError", ...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
delete_dataset_cache
Delete the cache (converted files) for a dataset. Parameters ---------- filenames: str Filenames of files to delete
batchup/datasets/dataset.py
def delete_dataset_cache(*filenames): """ Delete the cache (converted files) for a dataset. Parameters ---------- filenames: str Filenames of files to delete """ for filename in filenames: filename = path_string(filename) path = config.get_data_path(filename) ...
def delete_dataset_cache(*filenames): """ Delete the cache (converted files) for a dataset. Parameters ---------- filenames: str Filenames of files to delete """ for filename in filenames: filename = path_string(filename) path = config.get_data_path(filename) ...
[ "Delete", "the", "cache", "(", "converted", "files", ")", "for", "a", "dataset", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/datasets/dataset.py#L402-L415
[ "def", "delete_dataset_cache", "(", "*", "filenames", ")", ":", "for", "filename", "in", "filenames", ":", "filename", "=", "path_string", "(", "filename", ")", "path", "=", "config", ".", "get_data_path", "(", "filename", ")", "if", "os", ".", "path", "."...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
DownloadSourceFile.acquire
Download the file and return its path Returns ------- str or None The path of the file in BatchUp's temporary directory or None if the download failed.
batchup/datasets/dataset.py
def acquire(self, **kwargs): """ Download the file and return its path Returns ------- str or None The path of the file in BatchUp's temporary directory or None if the download failed. """ return config.download_data(self.temp_filename, se...
def acquire(self, **kwargs): """ Download the file and return its path Returns ------- str or None The path of the file in BatchUp's temporary directory or None if the download failed. """ return config.download_data(self.temp_filename, se...
[ "Download", "the", "file", "and", "return", "its", "path" ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/datasets/dataset.py#L124-L135
[ "def", "acquire", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "config", ".", "download_data", "(", "self", ".", "temp_filename", ",", "self", ".", "url", ",", "self", ".", "sha256", ")" ]
3fc2304e629f813c05f9e7a85a18acef3581a536
train
CopySourceFile.acquire
Copy the file and return its path Returns ------- str or None The path of the file in BatchUp's temporary directory or None if the copy failed.
batchup/datasets/dataset.py
def acquire(self, **kwargs): """ Copy the file and return its path Returns ------- str or None The path of the file in BatchUp's temporary directory or None if the copy failed. """ if self.source_path is None: source_path = kwa...
def acquire(self, **kwargs): """ Copy the file and return its path Returns ------- str or None The path of the file in BatchUp's temporary directory or None if the copy failed. """ if self.source_path is None: source_path = kwa...
[ "Copy", "the", "file", "and", "return", "its", "path" ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/datasets/dataset.py#L185-L199
[ "def", "acquire", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "source_path", "is", "None", ":", "source_path", "=", "kwargs", "[", "self", ".", "arg_name", "]", "else", ":", "source_path", "=", "self", ".", "source_path", "return...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
ExistingSourceFile.acquire
Copy the file and return its path Returns ------- str or None The path of the file or None if it does not exist or if verification failed.
batchup/datasets/dataset.py
def acquire(self, **kwargs): """ Copy the file and return its path Returns ------- str or None The path of the file or None if it does not exist or if verification failed. """ path = path_string(self.path) if os.path.exists(path): ...
def acquire(self, **kwargs): """ Copy the file and return its path Returns ------- str or None The path of the file or None if it does not exist or if verification failed. """ path = path_string(self.path) if os.path.exists(path): ...
[ "Copy", "the", "file", "and", "return", "its", "path" ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/datasets/dataset.py#L235-L249
[ "def", "acquire", "(", "self", ",", "*", "*", "kwargs", ")", ":", "path", "=", "path_string", "(", "self", ".", "path", ")", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "if", "config", ".", "verify_file", "(", "path", ",", "sel...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
_retry_func
A function which retries a given function num times and calls retry_notif each time the function is retried. :param func: The function to retry num times. :param num: The number of times to try before giving up. :param retry_notif: Will be called with the same parameter as func if we have to retry the ...
datacats/cli/pull.py
def _retry_func(func, param, num, retry_notif, error_msg): """ A function which retries a given function num times and calls retry_notif each time the function is retried. :param func: The function to retry num times. :param num: The number of times to try before giving up. :param retry_notif: W...
def _retry_func(func, param, num, retry_notif, error_msg): """ A function which retries a given function num times and calls retry_notif each time the function is retried. :param func: The function to retry num times. :param num: The number of times to try before giving up. :param retry_notif: W...
[ "A", "function", "which", "retries", "a", "given", "function", "num", "times", "and", "calls", "retry_notif", "each", "time", "the", "function", "is", "retried", ".", ":", "param", "func", ":", "The", "function", "to", "retry", "num", "times", ".", ":", ...
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/pull.py#L55-L77
[ "def", "_retry_func", "(", "func", ",", "param", ",", "num", ",", "retry_notif", ",", "error_msg", ")", ":", "for", "retry_num", "in", "range", "(", "num", ")", ":", "if", "retry_num", ":", "retry_notif", "(", "param", ",", "retry_num", ")", "try", ":"...
e4bae503efa997660fb3f34fe166699569653157
train
WorkStream.retrieve
Retrieve a result from executing a task. Note that tasks are executed in order and that if the next task has not yet completed, this call will block until the result is available. Returns ------- A result from the result buffer.
batchup/work_pool.py
def retrieve(self): """ Retrieve a result from executing a task. Note that tasks are executed in order and that if the next task has not yet completed, this call will block until the result is available. Returns ------- A result from the result buffer. ""...
def retrieve(self): """ Retrieve a result from executing a task. Note that tasks are executed in order and that if the next task has not yet completed, this call will block until the result is available. Returns ------- A result from the result buffer. ""...
[ "Retrieve", "a", "result", "from", "executing", "a", "task", ".", "Note", "that", "tasks", "are", "executed", "in", "order", "and", "that", "if", "the", "next", "task", "has", "not", "yet", "completed", "this", "call", "will", "block", "until", "the", "r...
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/work_pool.py#L407-L425
[ "def", "retrieve", "(", "self", ")", ":", "if", "len", "(", "self", ".", "__result_buffer", ")", ">", "0", ":", "res", "=", "self", ".", "__result_buffer", ".", "popleft", "(", ")", "value", "=", "res", ".", "get", "(", ")", "else", ":", "return", ...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
install
Install or reinstall Python packages within this environment Usage: datacats install [-q] [--address=IP] [ENVIRONMENT [PACKAGE ...]] datacats install -c [q] [--address=IP] [ENVIRONMENT] Options: --address=IP The address to bind to when reloading after install -c --clean Reinstall packages ...
datacats/cli/install.py
def install(environment, opts): """Install or reinstall Python packages within this environment Usage: datacats install [-q] [--address=IP] [ENVIRONMENT [PACKAGE ...]] datacats install -c [q] [--address=IP] [ENVIRONMENT] Options: --address=IP The address to bind to when reloading after install -c...
def install(environment, opts): """Install or reinstall Python packages within this environment Usage: datacats install [-q] [--address=IP] [ENVIRONMENT [PACKAGE ...]] datacats install -c [q] [--address=IP] [ENVIRONMENT] Options: --address=IP The address to bind to when reloading after install -c...
[ "Install", "or", "reinstall", "Python", "packages", "within", "this", "environment" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/install.py#L20-L52
[ "def", "install", "(", "environment", ",", "opts", ")", ":", "environment", ".", "require_data", "(", ")", "install_all", "(", "environment", ",", "opts", "[", "'--clean'", "]", ",", "verbose", "=", "not", "opts", "[", "'--quiet'", "]", ",", "packages", ...
e4bae503efa997660fb3f34fe166699569653157
train
migrate
Migrate an environment to a given revision of the datadir format. Usage: datacats migrate [-y] [-r VERSION] [ENVIRONMENT_DIR] Options: -r --revision=VERSION The version of the datadir format you want to convert to [default: 2] -y --yes Answer yes to all questions. Defaul...
datacats/cli/migrate.py
def migrate(opts): """Migrate an environment to a given revision of the datadir format. Usage: datacats migrate [-y] [-r VERSION] [ENVIRONMENT_DIR] Options: -r --revision=VERSION The version of the datadir format you want to convert to [default: 2] -y --yes Answer yes...
def migrate(opts): """Migrate an environment to a given revision of the datadir format. Usage: datacats migrate [-y] [-r VERSION] [ENVIRONMENT_DIR] Options: -r --revision=VERSION The version of the datadir format you want to convert to [default: 2] -y --yes Answer yes...
[ "Migrate", "an", "environment", "to", "a", "given", "revision", "of", "the", "datadir", "format", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/migrate.py#L8-L38
[ "def", "migrate", "(", "opts", ")", ":", "try", ":", "version", "=", "int", "(", "opts", "[", "'--revision'", "]", ")", "except", ":", "raise", "DatacatsError", "(", "'--revision parameter must be an integer.'", ")", "always_yes", "=", "opts", "[", "'--yes'", ...
e4bae503efa997660fb3f34fe166699569653157
train
deploy
Deploy environment to production DataCats.com cloud service Usage: datacats deploy [--create] [ENVIRONMENT [TARGET_NAME]] Options: --create Create a new environment on DataCats.com instead of updating an existing environment ENVIRONMENT may be an environment name or a pat...
datacats/cli/deploy.py
def deploy(environment, opts, profile): """Deploy environment to production DataCats.com cloud service Usage: datacats deploy [--create] [ENVIRONMENT [TARGET_NAME]] Options: --create Create a new environment on DataCats.com instead of updating an existing environment ...
def deploy(environment, opts, profile): """Deploy environment to production DataCats.com cloud service Usage: datacats deploy [--create] [ENVIRONMENT [TARGET_NAME]] Options: --create Create a new environment on DataCats.com instead of updating an existing environment ...
[ "Deploy", "environment", "to", "production", "DataCats", ".", "com", "cloud", "service" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/deploy.py#L14-L53
[ "def", "deploy", "(", "environment", ",", "opts", ",", "profile", ")", ":", "target_name", "=", "opts", "[", "'TARGET_NAME'", "]", "if", "target_name", "is", "None", ":", "target_name", "=", "environment", ".", "name", "if", "not", "valid_deploy_name", "(", ...
e4bae503efa997660fb3f34fe166699569653157
train
_trim_batch
Trim the mini-batch `batch` to the size `length`. `batch` can be: - a NumPy array, in which case it's first axis will be trimmed to size `length` - a tuple, in which case `_trim_batch` applied recursively to each element and the resulting tuple returned As a consequence, mini-batches can b...
batchup/data_source.py
def _trim_batch(batch, length): """Trim the mini-batch `batch` to the size `length`. `batch` can be: - a NumPy array, in which case it's first axis will be trimmed to size `length` - a tuple, in which case `_trim_batch` applied recursively to each element and the resulting tuple returned ...
def _trim_batch(batch, length): """Trim the mini-batch `batch` to the size `length`. `batch` can be: - a NumPy array, in which case it's first axis will be trimmed to size `length` - a tuple, in which case `_trim_batch` applied recursively to each element and the resulting tuple returned ...
[ "Trim", "the", "mini", "-", "batch", "batch", "to", "the", "size", "length", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L41-L68
[ "def", "_trim_batch", "(", "batch", ",", "length", ")", ":", "if", "isinstance", "(", "batch", ",", "tuple", ")", ":", "return", "tuple", "(", "[", "_trim_batch", "(", "b", ",", "length", ")", "for", "b", "in", "batch", "]", ")", "else", ":", "retu...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
batch_map_concat
Apply a function to all the samples that are accessed as mini-batches obtained from an iterator. Returns the per-sample results. The function `func` should return the result for each sample in the mini-batch as an array. To return multiple results (e.g. loss and errors) return a tuple of arrays (e....
batchup/data_source.py
def batch_map_concat(func, batch_iter, progress_iter_func=None, n_batches=None, prepend_args=None): """ Apply a function to all the samples that are accessed as mini-batches obtained from an iterator. Returns the per-sample results. The function `func` should return the result ...
def batch_map_concat(func, batch_iter, progress_iter_func=None, n_batches=None, prepend_args=None): """ Apply a function to all the samples that are accessed as mini-batches obtained from an iterator. Returns the per-sample results. The function `func` should return the result ...
[ "Apply", "a", "function", "to", "all", "the", "samples", "that", "are", "accessed", "as", "mini", "-", "batches", "obtained", "from", "an", "iterator", ".", "Returns", "the", "per", "-", "sample", "results", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L1478-L1599
[ "def", "batch_map_concat", "(", "func", ",", "batch_iter", ",", "progress_iter_func", "=", "None", ",", "n_batches", "=", "None", ",", "prepend_args", "=", "None", ")", ":", "# Accumulator for results and number of samples", "results", "=", "[", "]", "# If `progress...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
batch_map_mean
Apply a function to all the samples that are accessed as mini-batches obtained from an iterator. Returns the across-samples mean of the results returned by `func` The `sum_axis` arguments tells `mean_batch_map` how to process the results of `func` before accumulating them: - If `sum_axis` is `None`...
batchup/data_source.py
def batch_map_mean(func, batch_iter, progress_iter_func=None, sum_axis=None, n_batches=None, prepend_args=None): """ Apply a function to all the samples that are accessed as mini-batches obtained from an iterator. Returns the across-samples mean of the results returned by `func` ...
def batch_map_mean(func, batch_iter, progress_iter_func=None, sum_axis=None, n_batches=None, prepend_args=None): """ Apply a function to all the samples that are accessed as mini-batches obtained from an iterator. Returns the across-samples mean of the results returned by `func` ...
[ "Apply", "a", "function", "to", "all", "the", "samples", "that", "are", "accessed", "as", "mini", "-", "batches", "obtained", "from", "an", "iterator", ".", "Returns", "the", "across", "-", "samples", "mean", "of", "the", "results", "returned", "by", "func...
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L1602-L1779
[ "def", "batch_map_mean", "(", "func", ",", "batch_iter", ",", "progress_iter_func", "=", "None", ",", "sum_axis", "=", "None", ",", "n_batches", "=", "None", ",", "prepend_args", "=", "None", ")", ":", "# Accumulator for results and number of samples", "results_accu...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
coerce_data_source
Helper function to coerce an object into a data source, selecting the appropriate data source class for the given object. If `x` is already a data source it is returned as is. Parameters ---------- x: any The object to coerce. If `x` is a data source, it is returned as is. If it is ...
batchup/data_source.py
def coerce_data_source(x): """ Helper function to coerce an object into a data source, selecting the appropriate data source class for the given object. If `x` is already a data source it is returned as is. Parameters ---------- x: any The object to coerce. If `x` is a data source, ...
def coerce_data_source(x): """ Helper function to coerce an object into a data source, selecting the appropriate data source class for the given object. If `x` is already a data source it is returned as is. Parameters ---------- x: any The object to coerce. If `x` is a data source, ...
[ "Helper", "function", "to", "coerce", "an", "object", "into", "a", "data", "source", "selecting", "the", "appropriate", "data", "source", "class", "for", "the", "given", "object", ".", "If", "x", "is", "already", "a", "data", "source", "it", "is", "returne...
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L1800-L1849
[ "def", "coerce_data_source", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "AbstractDataSource", ")", ":", "return", "x", "elif", "isinstance", "(", "x", ",", "(", "list", ",", "tuple", ")", ")", ":", "# Sequence of array-likes", "items", "=", "...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
AbstractDataSource.batch_map_concat
A batch oriented implementation of `map`. Applies a function to all the samples in this data source by breaking the data into mini-batches and applying the function to each mini-batch. Returns the per-sample results. This method is a wrapper around the :func:`batch_map` function...
batchup/data_source.py
def batch_map_concat(self, func, batch_size, progress_iter_func=None, n_batches=None, prepend_args=None, **kwargs): """A batch oriented implementation of `map`. Applies a function to all the samples in this data source by breaking the data into mini-batches and applying ...
def batch_map_concat(self, func, batch_size, progress_iter_func=None, n_batches=None, prepend_args=None, **kwargs): """A batch oriented implementation of `map`. Applies a function to all the samples in this data source by breaking the data into mini-batches and applying ...
[ "A", "batch", "oriented", "implementation", "of", "map", ".", "Applies", "a", "function", "to", "all", "the", "samples", "in", "this", "data", "source", "by", "breaking", "the", "data", "into", "mini", "-", "batches", "and", "applying", "the", "function", ...
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L123-L188
[ "def", "batch_map_concat", "(", "self", ",", "func", ",", "batch_size", ",", "progress_iter_func", "=", "None", ",", "n_batches", "=", "None", ",", "prepend_args", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "n_batches", "is", "None", ":", "n",...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
RandomAccessDataSource.samples_by_indices
Gather a batch of samples by indices, applying the mapping described by the (optional) `indices` array passed to the constructor. Parameters ---------- indices: 1D-array of ints or slice The samples to retrieve Returns ------- list of arrays ...
batchup/data_source.py
def samples_by_indices(self, indices): """ Gather a batch of samples by indices, applying the mapping described by the (optional) `indices` array passed to the constructor. Parameters ---------- indices: 1D-array of ints or slice The samples to retrie...
def samples_by_indices(self, indices): """ Gather a batch of samples by indices, applying the mapping described by the (optional) `indices` array passed to the constructor. Parameters ---------- indices: 1D-array of ints or slice The samples to retrie...
[ "Gather", "a", "batch", "of", "samples", "by", "indices", "applying", "the", "mapping", "described", "by", "the", "(", "optional", ")", "indices", "array", "passed", "to", "the", "constructor", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L419-L436
[ "def", "samples_by_indices", "(", "self", ",", "indices", ")", ":", "indices", "=", "self", ".", "sampler", ".", "map_indices", "(", "indices", ")", "return", "self", ".", "samples_by_indices_nomapping", "(", "indices", ")" ]
3fc2304e629f813c05f9e7a85a18acef3581a536
train
RandomAccessDataSource.batch_indices_iterator
Create an iterator that generates mini-batch sample indices. The batches will have `batch_size` elements, with the exception of the final batch which will have less if there are insufficient elements left to make a complete batch. If `shuffle` is `None` or `False` elements will be extra...
batchup/data_source.py
def batch_indices_iterator(self, batch_size, shuffle=None, **kwargs): """ Create an iterator that generates mini-batch sample indices. The batches will have `batch_size` elements, with the exception of the final batch which will have less if there are insufficient elements left t...
def batch_indices_iterator(self, batch_size, shuffle=None, **kwargs): """ Create an iterator that generates mini-batch sample indices. The batches will have `batch_size` elements, with the exception of the final batch which will have less if there are insufficient elements left t...
[ "Create", "an", "iterator", "that", "generates", "mini", "-", "batch", "sample", "indices", ".", "The", "batches", "will", "have", "batch_size", "elements", "with", "the", "exception", "of", "the", "final", "batch", "which", "will", "have", "less", "if", "th...
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L438-L479
[ "def", "batch_indices_iterator", "(", "self", ",", "batch_size", ",", "shuffle", "=", "None", ",", "*", "*", "kwargs", ")", ":", "shuffle_rng", "=", "self", ".", "_get_shuffle_rng", "(", "shuffle", ")", "if", "shuffle_rng", "is", "not", "None", ":", "retur...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
RandomAccessDataSource.batch_iterator
Create an iterator that generates mini-batches extracted from this data source. The batches will have `batch_size` elements, with the exception of the final batch which will have less if there are insufficient elements left to make a complete batch. If `shuffle` is `None` or `False` el...
batchup/data_source.py
def batch_iterator(self, batch_size, shuffle=None, **kwargs): """ Create an iterator that generates mini-batches extracted from this data source. The batches will have `batch_size` elements, with the exception of the final batch which will have less if there are insufficient ele...
def batch_iterator(self, batch_size, shuffle=None, **kwargs): """ Create an iterator that generates mini-batches extracted from this data source. The batches will have `batch_size` elements, with the exception of the final batch which will have less if there are insufficient ele...
[ "Create", "an", "iterator", "that", "generates", "mini", "-", "batches", "extracted", "from", "this", "data", "source", ".", "The", "batches", "will", "have", "batch_size", "elements", "with", "the", "exception", "of", "the", "final", "batch", "which", "will",...
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L481-L518
[ "def", "batch_iterator", "(", "self", ",", "batch_size", ",", "shuffle", "=", "None", ",", "*", "*", "kwargs", ")", ":", "for", "batch_ndx", "in", "self", ".", "batch_indices_iterator", "(", "batch_size", ",", "shuffle", "=", "shuffle", ",", "*", "*", "k...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
ArrayDataSource.samples_by_indices_nomapping
Gather a batch of samples by indices *without* applying any index mapping resulting from the (optional) use of the `indices` array passed to the constructor. Parameters ---------- indices: 1D-array of ints or slice The samples to retrieve Returns ---...
batchup/data_source.py
def samples_by_indices_nomapping(self, indices): """ Gather a batch of samples by indices *without* applying any index mapping resulting from the (optional) use of the `indices` array passed to the constructor. Parameters ---------- indices: 1D-array of ints or s...
def samples_by_indices_nomapping(self, indices): """ Gather a batch of samples by indices *without* applying any index mapping resulting from the (optional) use of the `indices` array passed to the constructor. Parameters ---------- indices: 1D-array of ints or s...
[ "Gather", "a", "batch", "of", "samples", "by", "indices", "*", "without", "*", "applying", "any", "index", "mapping", "resulting", "from", "the", "(", "optional", ")", "use", "of", "the", "indices", "array", "passed", "to", "the", "constructor", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L666-L689
[ "def", "samples_by_indices_nomapping", "(", "self", ",", "indices", ")", ":", "batch", "=", "tuple", "(", "[", "d", "[", "indices", "]", "for", "d", "in", "self", ".", "data", "]", ")", "if", "self", ".", "include_indices", ":", "if", "isinstance", "("...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
CallableDataSource.num_samples
Get the number of samples in this data source. Returns ------- int, `np.inf` or `None`. An int if the number of samples is known, `np.inf` if it is infinite or `None` if the number of samples is unknown.
batchup/data_source.py
def num_samples(self, **kwargs): """ Get the number of samples in this data source. Returns ------- int, `np.inf` or `None`. An int if the number of samples is known, `np.inf` if it is infinite or `None` if the number of samples is unknown. """ ...
def num_samples(self, **kwargs): """ Get the number of samples in this data source. Returns ------- int, `np.inf` or `None`. An int if the number of samples is known, `np.inf` if it is infinite or `None` if the number of samples is unknown. """ ...
[ "Get", "the", "number", "of", "samples", "in", "this", "data", "source", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L752-L767
[ "def", "num_samples", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "num_samples_fn", "is", "None", ":", "return", "None", "elif", "callable", "(", "self", ".", "num_samples_fn", ")", ":", "return", "self", ".", "num_samples_fn", "("...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
CompositeDataSource.samples_by_indices_nomapping
Gather a batch of samples by indices *without* applying any index mapping. Parameters ---------- indices: list of either 1D-array of ints or slice A list of index arrays or slices; one for each data source that identify the samples to access Returns ...
batchup/data_source.py
def samples_by_indices_nomapping(self, indices): """ Gather a batch of samples by indices *without* applying any index mapping. Parameters ---------- indices: list of either 1D-array of ints or slice A list of index arrays or slices; one for each data source ...
def samples_by_indices_nomapping(self, indices): """ Gather a batch of samples by indices *without* applying any index mapping. Parameters ---------- indices: list of either 1D-array of ints or slice A list of index arrays or slices; one for each data source ...
[ "Gather", "a", "batch", "of", "samples", "by", "indices", "*", "without", "*", "applying", "any", "index", "mapping", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L982-L1009
[ "def", "samples_by_indices_nomapping", "(", "self", ",", "indices", ")", ":", "if", "not", "self", ".", "_random_access", ":", "raise", "TypeError", "(", "'samples_by_indices_nomapping method not '", "'supported as one or more of the underlying '", "'data sources does not suppo...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
CompositeDataSource.batch_indices_iterator
Create an iterator that generates mini-batch sample indices The generated mini-batches indices take the form of nested lists of either: - 1D NumPy integer arrays - slices The list nesting structure with match that of the tree of data sources rooted at `self` Pa...
batchup/data_source.py
def batch_indices_iterator(self, batch_size, **kwargs): """ Create an iterator that generates mini-batch sample indices The generated mini-batches indices take the form of nested lists of either: - 1D NumPy integer arrays - slices The list nesting structure with...
def batch_indices_iterator(self, batch_size, **kwargs): """ Create an iterator that generates mini-batch sample indices The generated mini-batches indices take the form of nested lists of either: - 1D NumPy integer arrays - slices The list nesting structure with...
[ "Create", "an", "iterator", "that", "generates", "mini", "-", "batch", "sample", "indices" ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L1040-L1071
[ "def", "batch_indices_iterator", "(", "self", ",", "batch_size", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_random_access", ":", "raise", "TypeError", "(", "'batch_indices_iterator method not supported as '", "'one or more of the underlying data source...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
ChoiceDataSource.samples_by_indices_nomapping
Gather a batch of samples by indices *without* applying any index mapping. Parameters ---------- indices: a tuple of the form `(dataset_index, sample_indices)` The `dataset_index` identifies the dataset from which to draw samples while `sample_indices` identifies...
batchup/data_source.py
def samples_by_indices_nomapping(self, indices): """ Gather a batch of samples by indices *without* applying any index mapping. Parameters ---------- indices: a tuple of the form `(dataset_index, sample_indices)` The `dataset_index` identifies the dataset fro...
def samples_by_indices_nomapping(self, indices): """ Gather a batch of samples by indices *without* applying any index mapping. Parameters ---------- indices: a tuple of the form `(dataset_index, sample_indices)` The `dataset_index` identifies the dataset fro...
[ "Gather", "a", "batch", "of", "samples", "by", "indices", "*", "without", "*", "applying", "any", "index", "mapping", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L1147-L1174
[ "def", "samples_by_indices_nomapping", "(", "self", ",", "indices", ")", ":", "if", "not", "self", ".", "_random_access", ":", "raise", "TypeError", "(", "'samples_by_indices_nomapping method not '", "'supported as one or more of the underlying '", "'data sources does not suppo...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
ChoiceDataSource.batch_indices_iterator
Create an iterator that generates mini-batch sample indices The generated mini-batches indices take the form of nested lists of either: - 1D NumPy integer arrays - slices The list nesting structure with match that of the tree of data sources rooted at `self` Pa...
batchup/data_source.py
def batch_indices_iterator(self, batch_size, shuffle=None, **kwargs): """ Create an iterator that generates mini-batch sample indices The generated mini-batches indices take the form of nested lists of either: - 1D NumPy integer arrays - slices The list nesting ...
def batch_indices_iterator(self, batch_size, shuffle=None, **kwargs): """ Create an iterator that generates mini-batch sample indices The generated mini-batches indices take the form of nested lists of either: - 1D NumPy integer arrays - slices The list nesting ...
[ "Create", "an", "iterator", "that", "generates", "mini", "-", "batch", "sample", "indices" ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L1205-L1241
[ "def", "batch_indices_iterator", "(", "self", ",", "batch_size", ",", "shuffle", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_random_access", ":", "raise", "TypeError", "(", "'batch_indices_iterator method not supported as '", "'one ...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
MapDataSource.samples_by_indices_nomapping
Gather a batch of samples by indices *without* applying any index mapping. Parameters ---------- indices: 1D-array of ints or slice An index array or a slice that selects the samples to retrieve Returns ------- nested list of arrays A min...
batchup/data_source.py
def samples_by_indices_nomapping(self, indices): """ Gather a batch of samples by indices *without* applying any index mapping. Parameters ---------- indices: 1D-array of ints or slice An index array or a slice that selects the samples to retrieve Re...
def samples_by_indices_nomapping(self, indices): """ Gather a batch of samples by indices *without* applying any index mapping. Parameters ---------- indices: 1D-array of ints or slice An index array or a slice that selects the samples to retrieve Re...
[ "Gather", "a", "batch", "of", "samples", "by", "indices", "*", "without", "*", "applying", "any", "index", "mapping", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L1404-L1424
[ "def", "samples_by_indices_nomapping", "(", "self", ",", "indices", ")", ":", "if", "not", "self", ".", "_random_access", ":", "raise", "TypeError", "(", "'samples_by_indices_nomapping method not '", "'supported as one or more of the underlying '", "'data sources does not suppo...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
MapDataSource.samples_by_indices
Gather a batch of samples by indices, applying any index mapping defined by the underlying data sources. Parameters ---------- indices: 1D-array of ints or slice An index array or a slice that selects the samples to retrieve Returns ------- nested li...
batchup/data_source.py
def samples_by_indices(self, indices): """ Gather a batch of samples by indices, applying any index mapping defined by the underlying data sources. Parameters ---------- indices: 1D-array of ints or slice An index array or a slice that selects the samples to ...
def samples_by_indices(self, indices): """ Gather a batch of samples by indices, applying any index mapping defined by the underlying data sources. Parameters ---------- indices: 1D-array of ints or slice An index array or a slice that selects the samples to ...
[ "Gather", "a", "batch", "of", "samples", "by", "indices", "applying", "any", "index", "mapping", "defined", "by", "the", "underlying", "data", "sources", "." ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L1426-L1446
[ "def", "samples_by_indices", "(", "self", ",", "indices", ")", ":", "if", "not", "self", ".", "_random_access", ":", "raise", "TypeError", "(", "'samples_by_indices method not supported as one '", "'or more of the underlying data sources does '", "'not support random access'", ...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
MapDataSource.batch_indices_iterator
Create an iterator that generates mini-batch sample indices The generated mini-batches indices take the form of nested lists of either: - 1D NumPy integer arrays - slices The list nesting structure with match that of the tree of data sources rooted at `self` Pa...
batchup/data_source.py
def batch_indices_iterator(self, batch_size, **kwargs): """ Create an iterator that generates mini-batch sample indices The generated mini-batches indices take the form of nested lists of either: - 1D NumPy integer arrays - slices The list nesting structure with...
def batch_indices_iterator(self, batch_size, **kwargs): """ Create an iterator that generates mini-batch sample indices The generated mini-batches indices take the form of nested lists of either: - 1D NumPy integer arrays - slices The list nesting structure with...
[ "Create", "an", "iterator", "that", "generates", "mini", "-", "batch", "sample", "indices" ]
Britefury/batchup
python
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L1448-L1475
[ "def", "batch_indices_iterator", "(", "self", ",", "batch_size", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_random_access", ":", "raise", "TypeError", "(", "'batch_indices_iterator method not supported as '", "'one or more of the underlying data source...
3fc2304e629f813c05f9e7a85a18acef3581a536
train
purge
Purge environment database and uploaded files Usage: datacats purge [-s NAME | --delete-environment] [-y] [ENVIRONMENT] Options: --delete-environment Delete environment directory as well as its data, as well as the data for **all** sites. -s --site=NAME Specify a site to be pu...
datacats/cli/purge.py
def purge(opts): """Purge environment database and uploaded files Usage: datacats purge [-s NAME | --delete-environment] [-y] [ENVIRONMENT] Options: --delete-environment Delete environment directory as well as its data, as well as the data for **all** sites. -s --site=NAME ...
def purge(opts): """Purge environment database and uploaded files Usage: datacats purge [-s NAME | --delete-environment] [-y] [ENVIRONMENT] Options: --delete-environment Delete environment directory as well as its data, as well as the data for **all** sites. -s --site=NAME ...
[ "Purge", "environment", "database", "and", "uploaded", "files" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/purge.py#L15-L59
[ "def", "purge", "(", "opts", ")", ":", "old", "=", "False", "try", ":", "environment", "=", "Environment", ".", "load", "(", "opts", "[", "'ENVIRONMENT'", "]", ",", "opts", "[", "'--site'", "]", ")", "except", "DatacatsError", ":", "environment", "=", ...
e4bae503efa997660fb3f34fe166699569653157
train
DatacatsError.pretty_print
Print the error message to stdout with colors and borders
datacats/error.py
def pretty_print(self): """ Print the error message to stdout with colors and borders """ print colored.blue("-" * 40) print colored.red("datacats: problem was encountered:") print self.message print colored.blue("-" * 40)
def pretty_print(self): """ Print the error message to stdout with colors and borders """ print colored.blue("-" * 40) print colored.red("datacats: problem was encountered:") print self.message print colored.blue("-" * 40)
[ "Print", "the", "error", "message", "to", "stdout", "with", "colors", "and", "borders" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/error.py#L25-L32
[ "def", "pretty_print", "(", "self", ")", ":", "print", "colored", ".", "blue", "(", "\"-\"", "*", "40", ")", "print", "colored", ".", "red", "(", "\"datacats: problem was encountered:\"", ")", "print", "self", ".", "message", "print", "colored", ".", "blue",...
e4bae503efa997660fb3f34fe166699569653157
train
generate_password
Return a 16-character alphanumeric random string generated by the operating system's secure pseudo random number generator
datacats/password.py
def generate_password(): """ Return a 16-character alphanumeric random string generated by the operating system's secure pseudo random number generator """ chars = uppercase + lowercase + digits return ''.join(SystemRandom().choice(chars) for x in xrange(16))
def generate_password(): """ Return a 16-character alphanumeric random string generated by the operating system's secure pseudo random number generator """ chars = uppercase + lowercase + digits return ''.join(SystemRandom().choice(chars) for x in xrange(16))
[ "Return", "a", "16", "-", "character", "alphanumeric", "random", "string", "generated", "by", "the", "operating", "system", "s", "secure", "pseudo", "random", "number", "generator" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/password.py#L10-L16
[ "def", "generate_password", "(", ")", ":", "chars", "=", "uppercase", "+", "lowercase", "+", "digits", "return", "''", ".", "join", "(", "SystemRandom", "(", ")", ".", "choice", "(", "chars", ")", "for", "x", "in", "xrange", "(", "16", ")", ")" ]
e4bae503efa997660fb3f34fe166699569653157
train
_machine_check_connectivity
This method calls to docker-machine on the command line and makes sure that it is up and ready. Potential improvements to be made: - Support multiple machine names (run a `docker-machine ls` and then see which machines are active. Use a priority list)
datacats/docker.py
def _machine_check_connectivity(): """ This method calls to docker-machine on the command line and makes sure that it is up and ready. Potential improvements to be made: - Support multiple machine names (run a `docker-machine ls` and then see which machines are active. Use a priority li...
def _machine_check_connectivity(): """ This method calls to docker-machine on the command line and makes sure that it is up and ready. Potential improvements to be made: - Support multiple machine names (run a `docker-machine ls` and then see which machines are active. Use a priority li...
[ "This", "method", "calls", "to", "docker", "-", "machine", "on", "the", "command", "line", "and", "makes", "sure", "that", "it", "is", "up", "and", "ready", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L66-L92
[ "def", "_machine_check_connectivity", "(", ")", ":", "with", "open", "(", "devnull", ",", "'w'", ")", "as", "devnull_f", ":", "try", ":", "status", "=", "subprocess", ".", "check_output", "(", "[", "'docker-machine'", ",", "'status'", ",", "'dev'", "]", ",...
e4bae503efa997660fb3f34fe166699569653157
train
ro_rw_to_binds
ro and rw {localdir: binddir} dicts to docker-py's {localdir: {'bind': binddir, 'ro': T/F}} binds dicts
datacats/docker.py
def ro_rw_to_binds(ro, rw): """ ro and rw {localdir: binddir} dicts to docker-py's {localdir: {'bind': binddir, 'ro': T/F}} binds dicts """ out = {} if ro: for localdir, binddir in ro.iteritems(): out[localdir] = {'bind': binddir, 'ro': True} if rw: for localdir, ...
def ro_rw_to_binds(ro, rw): """ ro and rw {localdir: binddir} dicts to docker-py's {localdir: {'bind': binddir, 'ro': T/F}} binds dicts """ out = {} if ro: for localdir, binddir in ro.iteritems(): out[localdir] = {'bind': binddir, 'ro': True} if rw: for localdir, ...
[ "ro", "and", "rw", "{", "localdir", ":", "binddir", "}", "dicts", "to", "docker", "-", "py", "s", "{", "localdir", ":", "{", "bind", ":", "binddir", "ro", ":", "T", "/", "F", "}}", "binds", "dicts" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L140-L152
[ "def", "ro_rw_to_binds", "(", "ro", ",", "rw", ")", ":", "out", "=", "{", "}", "if", "ro", ":", "for", "localdir", ",", "binddir", "in", "ro", ".", "iteritems", "(", ")", ":", "out", "[", "localdir", "]", "=", "{", "'bind'", ":", "binddir", ",", ...
e4bae503efa997660fb3f34fe166699569653157
train
web_command
Run a single command in a web image optionally preloaded with the ckan source and virtual envrionment. :param command: command to execute :param ro: {localdir: binddir} dict for read-only volumes :param rw: {localdir: binddir} dict for read-write volumes :param links: links passed to start :par...
datacats/docker.py
def web_command(command, ro=None, rw=None, links=None, image='datacats/web', volumes_from=None, commit=False, clean_up=False, stream_output=None, entrypoint=None): """ Run a single command in a web image optionally preloaded with the ckan source and virtual envrionment. ...
def web_command(command, ro=None, rw=None, links=None, image='datacats/web', volumes_from=None, commit=False, clean_up=False, stream_output=None, entrypoint=None): """ Run a single command in a web image optionally preloaded with the ckan source and virtual envrionment. ...
[ "Run", "a", "single", "command", "in", "a", "web", "image", "optionally", "preloaded", "with", "the", "ckan", "source", "and", "virtual", "envrionment", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L163-L212
[ "def", "web_command", "(", "command", ",", "ro", "=", "None", ",", "rw", "=", "None", ",", "links", "=", "None", ",", "image", "=", "'datacats/web'", ",", "volumes_from", "=", "None", ",", "commit", "=", "False", ",", "clean_up", "=", "False", ",", "...
e4bae503efa997660fb3f34fe166699569653157
train
remote_server_command
Wraps web_command function with docker bindings needed to connect to a remote server (such as datacats.com) and run commands there (for example, when you want to copy your catalog to that server). The files binded to the docker image include the user's ssh credentials: ssh_config file, ...
datacats/docker.py
def remote_server_command(command, environment, user_profile, **kwargs): """ Wraps web_command function with docker bindings needed to connect to a remote server (such as datacats.com) and run commands there (for example, when you want to copy your catalog to that server). The files binded ...
def remote_server_command(command, environment, user_profile, **kwargs): """ Wraps web_command function with docker bindings needed to connect to a remote server (such as datacats.com) and run commands there (for example, when you want to copy your catalog to that server). The files binded ...
[ "Wraps", "web_command", "function", "with", "docker", "bindings", "needed", "to", "connect", "to", "a", "remote", "server", "(", "such", "as", "datacats", ".", "com", ")", "and", "run", "commands", "there", "(", "for", "example", "when", "you", "want", "to...
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L215-L253
[ "def", "remote_server_command", "(", "command", ",", "environment", ",", "user_profile", ",", "*", "*", "kwargs", ")", ":", "if", "environment", ".", "remote_server_key", ":", "temp", "=", "tempfile", ".", "NamedTemporaryFile", "(", "mode", "=", "\"wb\"", ")",...
e4bae503efa997660fb3f34fe166699569653157
train
run_container
Wrapper for docker create_container, start calls :param log_syslog: bool flag to redirect container's logs to host's syslog :returns: container info dict or None if container couldn't be created Raises PortAllocatedError if container couldn't start on the requested port.
datacats/docker.py
def run_container(name, image, command=None, environment=None, ro=None, rw=None, links=None, detach=True, volumes_from=None, port_bindings=None, log_syslog=False): """ Wrapper for docker create_container, start calls :param log_syslog: bool flag to redirect container's l...
def run_container(name, image, command=None, environment=None, ro=None, rw=None, links=None, detach=True, volumes_from=None, port_bindings=None, log_syslog=False): """ Wrapper for docker create_container, start calls :param log_syslog: bool flag to redirect container's l...
[ "Wrapper", "for", "docker", "create_container", "start", "calls" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L256-L300
[ "def", "run_container", "(", "name", ",", "image", ",", "command", "=", "None", ",", "environment", "=", "None", ",", "ro", "=", "None", ",", "rw", "=", "None", ",", "links", "=", "None", ",", "detach", "=", "True", ",", "volumes_from", "=", "None", ...
e4bae503efa997660fb3f34fe166699569653157
train
remove_container
Wrapper for docker remove_container :returns: True if container was found and removed
datacats/docker.py
def remove_container(name, force=False): """ Wrapper for docker remove_container :returns: True if container was found and removed """ try: if not force: _get_docker().stop(name) except APIError: pass try: _get_docker().remove_container(name, force=True)...
def remove_container(name, force=False): """ Wrapper for docker remove_container :returns: True if container was found and removed """ try: if not force: _get_docker().stop(name) except APIError: pass try: _get_docker().remove_container(name, force=True)...
[ "Wrapper", "for", "docker", "remove_container" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L318-L334
[ "def", "remove_container", "(", "name", ",", "force", "=", "False", ")", ":", "try", ":", "if", "not", "force", ":", "_get_docker", "(", ")", ".", "stop", "(", "name", ")", "except", "APIError", ":", "pass", "try", ":", "_get_docker", "(", ")", ".", ...
e4bae503efa997660fb3f34fe166699569653157
train
container_logs
Wrapper for docker logs, attach commands.
datacats/docker.py
def container_logs(name, tail, follow, timestamps): """ Wrapper for docker logs, attach commands. """ if follow: return _get_docker().attach( name, stdout=True, stderr=True, stream=True ) return _docker.logs( name, ...
def container_logs(name, tail, follow, timestamps): """ Wrapper for docker logs, attach commands. """ if follow: return _get_docker().attach( name, stdout=True, stderr=True, stream=True ) return _docker.logs( name, ...
[ "Wrapper", "for", "docker", "logs", "attach", "commands", "." ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L349-L367
[ "def", "container_logs", "(", "name", ",", "tail", ",", "follow", ",", "timestamps", ")", ":", "if", "follow", ":", "return", "_get_docker", "(", ")", ".", "attach", "(", "name", ",", "stdout", "=", "True", ",", "stderr", "=", "True", ",", "stream", ...
e4bae503efa997660fb3f34fe166699569653157
train
collect_logs
Returns a string representation of the logs from a container. This is similar to container_logs but uses the `follow` option and flattens the logs into a string instead of a generator. :param name: The container name to grab logs for :return: A string representation of the logs
datacats/docker.py
def collect_logs(name): """ Returns a string representation of the logs from a container. This is similar to container_logs but uses the `follow` option and flattens the logs into a string instead of a generator. :param name: The container name to grab logs for :return: A string representation ...
def collect_logs(name): """ Returns a string representation of the logs from a container. This is similar to container_logs but uses the `follow` option and flattens the logs into a string instead of a generator. :param name: The container name to grab logs for :return: A string representation ...
[ "Returns", "a", "string", "representation", "of", "the", "logs", "from", "a", "container", ".", "This", "is", "similar", "to", "container_logs", "but", "uses", "the", "follow", "option", "and", "flattens", "the", "logs", "into", "a", "string", "instead", "of...
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L370-L383
[ "def", "collect_logs", "(", "name", ")", ":", "logs", "=", "container_logs", "(", "name", ",", "\"all\"", ",", "True", ",", "None", ")", "string", "=", "\"\"", "for", "s", "in", "logs", ":", "string", "+=", "s", "return", "string" ]
e4bae503efa997660fb3f34fe166699569653157
train
pull_stream
Return generator of pull status objects
datacats/docker.py
def pull_stream(image): """ Return generator of pull status objects """ return (json.loads(s) for s in _get_docker().pull(image, stream=True))
def pull_stream(image): """ Return generator of pull status objects """ return (json.loads(s) for s in _get_docker().pull(image, stream=True))
[ "Return", "generator", "of", "pull", "status", "objects" ]
datacats/datacats
python
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L394-L398
[ "def", "pull_stream", "(", "image", ")", ":", "return", "(", "json", ".", "loads", "(", "s", ")", "for", "s", "in", "_get_docker", "(", ")", ".", "pull", "(", "image", ",", "stream", "=", "True", ")", ")" ]
e4bae503efa997660fb3f34fe166699569653157