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
thread_with_callback
Return a thread emiting `state_changed` between each sub-requests. :param on_error: callback str -> None :param on_done: callback object -> None :param requete_with_callback: Job to execute. monitor_callable -> None :return: Non started thread
pyDLib/Core/threads.py
def thread_with_callback(on_error, on_done, requete_with_callback): """ Return a thread emiting `state_changed` between each sub-requests. :param on_error: callback str -> None :param on_done: callback object -> None :param requete_with_callback: Job to execute. monitor_callable -> None :return...
def thread_with_callback(on_error, on_done, requete_with_callback): """ Return a thread emiting `state_changed` between each sub-requests. :param on_error: callback str -> None :param on_done: callback object -> None :param requete_with_callback: Job to execute. monitor_callable -> None :return...
[ "Return", "a", "thread", "emiting", "state_changed", "between", "each", "sub", "-", "requests", "." ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/threads.py#L67-L97
[ "def", "thread_with_callback", "(", "on_error", ",", "on_done", ",", "requete_with_callback", ")", ":", "class", "C", "(", "THREAD", ")", ":", "error", "=", "SIGNAL", "(", "str", ")", "done", "=", "SIGNAL", "(", "object", ")", "state_changed", "=", "SIGNAL...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
protege_data
Used to crypt/decrypt data before saving locally. Override if securit is needed. bytes -> str when decrypting str -> bytes when crypting :param datas_str: When crypting, str. when decrypting bytes :param sens: True to crypt, False to decrypt
pyDLib/Core/security.py
def protege_data(datas_str, sens): """ Used to crypt/decrypt data before saving locally. Override if securit is needed. bytes -> str when decrypting str -> bytes when crypting :param datas_str: When crypting, str. when decrypting bytes :param sens: True to crypt, False to decrypt """ ...
def protege_data(datas_str, sens): """ Used to crypt/decrypt data before saving locally. Override if securit is needed. bytes -> str when decrypting str -> bytes when crypting :param datas_str: When crypting, str. when decrypting bytes :param sens: True to crypt, False to decrypt """ ...
[ "Used", "to", "crypt", "/", "decrypt", "data", "before", "saving", "locally", ".", "Override", "if", "securit", "is", "needed", ".", "bytes", "-", ">", "str", "when", "decrypting", "str", "-", ">", "bytes", "when", "crypting" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/security.py#L1-L11
[ "def", "protege_data", "(", "datas_str", ",", "sens", ")", ":", "return", "bytes", "(", "datas_str", ",", "encoding", "=", "\"utf8\"", ")", "if", "sens", "else", "str", "(", "datas_str", ",", "encoding", "=", "\"utf8\"", ")" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
train
build_parser
Build a parser for CLI arguments and options.
keysmith.py
def build_parser(parser: argparse.ArgumentParser) -> None: """Build a parser for CLI arguments and options.""" parser.add_argument( '--delimiter', help='a delimiter for the samples (teeth) in the key', default=' ', ) parser.add_argument( '--encoding', help='the en...
def build_parser(parser: argparse.ArgumentParser) -> None: """Build a parser for CLI arguments and options.""" parser.add_argument( '--delimiter', help='a delimiter for the samples (teeth) in the key', default=' ', ) parser.add_argument( '--encoding', help='the en...
[ "Build", "a", "parser", "for", "CLI", "arguments", "and", "options", "." ]
dmtucker/keysmith
python
https://github.com/dmtucker/keysmith/blob/a0d7388e0f4e36baac93bece933b0e8d7b3c6e3c/keysmith.py#L26-L62
[ "def", "build_parser", "(", "parser", ":", "argparse", ".", "ArgumentParser", ")", "->", "None", ":", "parser", ".", "add_argument", "(", "'--delimiter'", ",", "help", "=", "'a delimiter for the samples (teeth) in the key'", ",", "default", "=", "' '", ",", ")", ...
a0d7388e0f4e36baac93bece933b0e8d7b3c6e3c
train
default_parser
Create a parser for CLI arguments and options.
keysmith.py
def default_parser() -> argparse.ArgumentParser: """Create a parser for CLI arguments and options.""" parser = argparse.ArgumentParser( prog=CONSOLE_SCRIPT, formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) build_parser(parser) return parser
def default_parser() -> argparse.ArgumentParser: """Create a parser for CLI arguments and options.""" parser = argparse.ArgumentParser( prog=CONSOLE_SCRIPT, formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) build_parser(parser) return parser
[ "Create", "a", "parser", "for", "CLI", "arguments", "and", "options", "." ]
dmtucker/keysmith
python
https://github.com/dmtucker/keysmith/blob/a0d7388e0f4e36baac93bece933b0e8d7b3c6e3c/keysmith.py#L65-L72
[ "def", "default_parser", "(", ")", "->", "argparse", ".", "ArgumentParser", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "CONSOLE_SCRIPT", ",", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFormatter", ",", ")", "build_p...
a0d7388e0f4e36baac93bece933b0e8d7b3c6e3c
train
key
Concatenate strings generated by the tooth function.
keysmith.py
def key( seq: Sequence, tooth: Callable[[Sequence], str] = ( lambda seq: str(random.SystemRandom().choice(seq)).strip() ), nteeth: int = 6, delimiter: str = ' ', ) -> str: """Concatenate strings generated by the tooth function.""" return delimiter.join(tooth(s...
def key( seq: Sequence, tooth: Callable[[Sequence], str] = ( lambda seq: str(random.SystemRandom().choice(seq)).strip() ), nteeth: int = 6, delimiter: str = ' ', ) -> str: """Concatenate strings generated by the tooth function.""" return delimiter.join(tooth(s...
[ "Concatenate", "strings", "generated", "by", "the", "tooth", "function", "." ]
dmtucker/keysmith
python
https://github.com/dmtucker/keysmith/blob/a0d7388e0f4e36baac93bece933b0e8d7b3c6e3c/keysmith.py#L75-L84
[ "def", "key", "(", "seq", ":", "Sequence", ",", "tooth", ":", "Callable", "[", "[", "Sequence", "]", ",", "str", "]", "=", "(", "lambda", "seq", ":", "str", "(", "random", ".", "SystemRandom", "(", ")", ".", "choice", "(", "seq", ")", ")", ".", ...
a0d7388e0f4e36baac93bece933b0e8d7b3c6e3c
train
main
Execute CLI commands.
keysmith.py
def main(argv: Sequence[str] = SYS_ARGV) -> int: """Execute CLI commands.""" args = default_parser().parse_args(argv) try: seq = POPULATIONS[args.population] # type: Sequence except KeyError: try: with open(args.population, 'r', encoding=args.encoding) as file_: ...
def main(argv: Sequence[str] = SYS_ARGV) -> int: """Execute CLI commands.""" args = default_parser().parse_args(argv) try: seq = POPULATIONS[args.population] # type: Sequence except KeyError: try: with open(args.population, 'r', encoding=args.encoding) as file_: ...
[ "Execute", "CLI", "commands", "." ]
dmtucker/keysmith
python
https://github.com/dmtucker/keysmith/blob/a0d7388e0f4e36baac93bece933b0e8d7b3c6e3c/keysmith.py#L87-L114
[ "def", "main", "(", "argv", ":", "Sequence", "[", "str", "]", "=", "SYS_ARGV", ")", "->", "int", ":", "args", "=", "default_parser", "(", ")", ".", "parse_args", "(", "argv", ")", "try", ":", "seq", "=", "POPULATIONS", "[", "args", ".", "population",...
a0d7388e0f4e36baac93bece933b0e8d7b3c6e3c
train
add_firewalld_service
adds a firewall rule
bookshelf/api_v1.py
def add_firewalld_service(service, permanent=True): """ adds a firewall rule """ yum_install(packages=['firewalld']) with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): p = '' if permanent: p = '--permanent' sud...
def add_firewalld_service(service, permanent=True): """ adds a firewall rule """ yum_install(packages=['firewalld']) with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): p = '' if permanent: p = '--permanent' sud...
[ "adds", "a", "firewall", "rule" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L81-L91
[ "def", "add_firewalld_service", "(", "service", ",", "permanent", "=", "True", ")", ":", "yum_install", "(", "packages", "=", "[", "'firewalld'", "]", ")", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'"...
a6770678e735de95b194f6e6989223970db5f654
train
add_firewalld_port
adds a firewall rule
bookshelf/api_v1.py
def add_firewalld_port(port, permanent=True): """ adds a firewall rule """ yum_install(packages=['firewalld']) log_green('adding a new fw rule: %s' % port) with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): p = '' if permanen...
def add_firewalld_port(port, permanent=True): """ adds a firewall rule """ yum_install(packages=['firewalld']) log_green('adding a new fw rule: %s' % port) with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): p = '' if permanen...
[ "adds", "a", "firewall", "rule" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L94-L106
[ "def", "add_firewalld_port", "(", "port", ",", "permanent", "=", "True", ")", ":", "yum_install", "(", "packages", "=", "[", "'firewalld'", "]", ")", "log_green", "(", "'adding a new fw rule: %s'", "%", "port", ")", "with", "settings", "(", "hide", "(", "'wa...
a6770678e735de95b194f6e6989223970db5f654
train
apt_add_repository_from_apt_string
adds a new repository file for apt
bookshelf/api_v1.py
def apt_add_repository_from_apt_string(apt_string, apt_file): """ adds a new repository file for apt """ apt_file_path = '/etc/apt/sources.list.d/%s' % apt_file if not file_contains(apt_file_path, apt_string.lower(), use_sudo=True): file_append(apt_file_path, apt_string.lower(), use_sudo=True) ...
def apt_add_repository_from_apt_string(apt_string, apt_file): """ adds a new repository file for apt """ apt_file_path = '/etc/apt/sources.list.d/%s' % apt_file if not file_contains(apt_file_path, apt_string.lower(), use_sudo=True): file_append(apt_file_path, apt_string.lower(), use_sudo=True) ...
[ "adds", "a", "new", "repository", "file", "for", "apt" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L173-L182
[ "def", "apt_add_repository_from_apt_string", "(", "apt_string", ",", "apt_file", ")", ":", "apt_file_path", "=", "'/etc/apt/sources.list.d/%s'", "%", "apt_file", "if", "not", "file_contains", "(", "apt_file_path", ",", "apt_string", ".", "lower", "(", ")", ",", "use...
a6770678e735de95b194f6e6989223970db5f654
train
arch
returns the current cpu archictecture
bookshelf/api_v1.py
def arch(): """ returns the current cpu archictecture """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): result = sudo('rpm -E %dist').strip() return result
def arch(): """ returns the current cpu archictecture """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): result = sudo('rpm -E %dist').strip() return result
[ "returns", "the", "current", "cpu", "archictecture" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L193-L198
[ "def", "arch", "(", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ",", "capture", "=", "True", ")", ":", "result", "=", "sudo", "(", "'rpm -E %dist'...
a6770678e735de95b194f6e6989223970db5f654
train
disable_openssh_rdns
Set 'UseDNS no' in openssh config to disable rDNS lookups On each request for a new channel openssh defaults to an rDNS lookup on the client IP. This can be slow, if it fails for instance, adding 10s of overhead to every request for a new channel (not connection). This can add a lot of time to a pr...
bookshelf/api_v1.py
def disable_openssh_rdns(distribution): """ Set 'UseDNS no' in openssh config to disable rDNS lookups On each request for a new channel openssh defaults to an rDNS lookup on the client IP. This can be slow, if it fails for instance, adding 10s of overhead to every request for a new channel (not...
def disable_openssh_rdns(distribution): """ Set 'UseDNS no' in openssh config to disable rDNS lookups On each request for a new channel openssh defaults to an rDNS lookup on the client IP. This can be slow, if it fails for instance, adding 10s of overhead to every request for a new channel (not...
[ "Set", "UseDNS", "no", "in", "openssh", "config", "to", "disable", "rDNS", "lookups" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L201-L226
[ "def", "disable_openssh_rdns", "(", "distribution", ")", ":", "log_green", "(", "'Disabling openssh reverse dns lookups'", ")", "openssh_config_file", "=", "'/etc/ssh/sshd_config'", "dns_config", "=", "'UseDNS no'", "if", "not", "file_contains", "(", "openssh_config_file", ...
a6770678e735de95b194f6e6989223970db5f654
train
connect_to_ec2
returns a connection object to AWS EC2
bookshelf/api_v1.py
def connect_to_ec2(region, access_key_id, secret_access_key): """ returns a connection object to AWS EC2 """ conn = boto.ec2.connect_to_region(region, aws_access_key_id=access_key_id, aws_secret_access_key=secret_access_key) return...
def connect_to_ec2(region, access_key_id, secret_access_key): """ returns a connection object to AWS EC2 """ conn = boto.ec2.connect_to_region(region, aws_access_key_id=access_key_id, aws_secret_access_key=secret_access_key) return...
[ "returns", "a", "connection", "object", "to", "AWS", "EC2" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L235-L240
[ "def", "connect_to_ec2", "(", "region", ",", "access_key_id", ",", "secret_access_key", ")", ":", "conn", "=", "boto", ".", "ec2", ".", "connect_to_region", "(", "region", ",", "aws_access_key_id", "=", "access_key_id", ",", "aws_secret_access_key", "=", "secret_a...
a6770678e735de95b194f6e6989223970db5f654
train
connect_to_rackspace
returns a connection object to Rackspace
bookshelf/api_v1.py
def connect_to_rackspace(region, access_key_id, secret_access_key): """ returns a connection object to Rackspace """ pyrax.set_setting('identity_type', 'rackspace') pyrax.set_default_region(region) pyrax.set_credentials(access_key_id, secret_access_key)...
def connect_to_rackspace(region, access_key_id, secret_access_key): """ returns a connection object to Rackspace """ pyrax.set_setting('identity_type', 'rackspace') pyrax.set_default_region(region) pyrax.set_credentials(access_key_id, secret_access_key)...
[ "returns", "a", "connection", "object", "to", "Rackspace" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L243-L251
[ "def", "connect_to_rackspace", "(", "region", ",", "access_key_id", ",", "secret_access_key", ")", ":", "pyrax", ".", "set_setting", "(", "'identity_type'", ",", "'rackspace'", ")", "pyrax", ".", "set_default_region", "(", "region", ")", "pyrax", ".", "set_credent...
a6770678e735de95b194f6e6989223970db5f654
train
create_gce_image
Shuts down the instance and creates and image from the disk. Assumes that the disk name is the same as the instance_name (this is the default behavior for boot disks on GCE).
bookshelf/api_v1.py
def create_gce_image(zone, project, instance_name, name, description): """ Shuts down the instance and creates and image from the disk. Assumes that the disk name is the same as the instance_name (this is the default be...
def create_gce_image(zone, project, instance_name, name, description): """ Shuts down the instance and creates and image from the disk. Assumes that the disk name is the same as the instance_name (this is the default be...
[ "Shuts", "down", "the", "instance", "and", "creates", "and", "image", "from", "the", "disk", "." ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L282-L315
[ "def", "create_gce_image", "(", "zone", ",", "project", ",", "instance_name", ",", "name", ",", "description", ")", ":", "disk_name", "=", "instance_name", "try", ":", "down_gce", "(", "instance_name", "=", "instance_name", ",", "project", "=", "project", ",",...
a6770678e735de95b194f6e6989223970db5f654
train
create_image
proxy call for ec2, rackspace create ami backend functions
bookshelf/api_v1.py
def create_image(cloud, **kwargs): """ proxy call for ec2, rackspace create ami backend functions """ if cloud == 'ec2': return create_ami(**kwargs) if cloud == 'rackspace': return create_rackspace_image(**kwargs) if cloud == 'gce': return create_gce_image(**kwargs)
def create_image(cloud, **kwargs): """ proxy call for ec2, rackspace create ami backend functions """ if cloud == 'ec2': return create_ami(**kwargs) if cloud == 'rackspace': return create_rackspace_image(**kwargs) if cloud == 'gce': return create_gce_image(**kwargs)
[ "proxy", "call", "for", "ec2", "rackspace", "create", "ami", "backend", "functions" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L318-L327
[ "def", "create_image", "(", "cloud", ",", "*", "*", "kwargs", ")", ":", "if", "cloud", "==", "'ec2'", ":", "return", "create_ami", "(", "*", "*", "kwargs", ")", "if", "cloud", "==", "'rackspace'", ":", "return", "create_rackspace_image", "(", "*", "*", ...
a6770678e735de95b194f6e6989223970db5f654
train
create_server
Create a new instance
bookshelf/api_v1.py
def create_server(cloud, **kwargs): """ Create a new instance """ if cloud == 'ec2': _create_server_ec2(**kwargs) elif cloud == 'rackspace': _create_server_rackspace(**kwargs) elif cloud == 'gce': _create_server_gce(**kwargs) else: raise ValueError("Unknow...
def create_server(cloud, **kwargs): """ Create a new instance """ if cloud == 'ec2': _create_server_ec2(**kwargs) elif cloud == 'rackspace': _create_server_rackspace(**kwargs) elif cloud == 'gce': _create_server_gce(**kwargs) else: raise ValueError("Unknow...
[ "Create", "a", "new", "instance" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L361-L372
[ "def", "create_server", "(", "cloud", ",", "*", "*", "kwargs", ")", ":", "if", "cloud", "==", "'ec2'", ":", "_create_server_ec2", "(", "*", "*", "kwargs", ")", "elif", "cloud", "==", "'rackspace'", ":", "_create_server_rackspace", "(", "*", "*", "kwargs", ...
a6770678e735de95b194f6e6989223970db5f654
train
gce_wait_until_done
Perform a GCE operation, blocking until the operation completes. This function will then poll the operation until it reaches state 'DONE' or times out, and then returns the final operation resource dict. :param operation: A dict representing a pending GCE operation resource. :returns dict: A dict...
bookshelf/api_v1.py
def gce_wait_until_done(operation): """ Perform a GCE operation, blocking until the operation completes. This function will then poll the operation until it reaches state 'DONE' or times out, and then returns the final operation resource dict. :param operation: A dict representing a pending GC...
def gce_wait_until_done(operation): """ Perform a GCE operation, blocking until the operation completes. This function will then poll the operation until it reaches state 'DONE' or times out, and then returns the final operation resource dict. :param operation: A dict representing a pending GC...
[ "Perform", "a", "GCE", "operation", "blocking", "until", "the", "operation", "completes", "." ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L375-L423
[ "def", "gce_wait_until_done", "(", "operation", ")", ":", "operation_name", "=", "operation", "[", "'name'", "]", "if", "'zone'", "in", "operation", ":", "zone_url_parts", "=", "operation", "[", "'zone'", "]", ".", "split", "(", "'/'", ")", "project", "=", ...
a6770678e735de95b194f6e6989223970db5f654
train
startup_gce_instance
For now, jclouds is broken for GCE and we will have static slaves in Jenkins. Use this to boot them.
bookshelf/api_v1.py
def startup_gce_instance(instance_name, project, zone, username, machine_type, image, public_key, disk_name=None): """ For now, jclouds is broken for GCE and we will have static slaves in Jenkins. Use this to boot them. """ log_green("Started...") log_yellow("...Creatin...
def startup_gce_instance(instance_name, project, zone, username, machine_type, image, public_key, disk_name=None): """ For now, jclouds is broken for GCE and we will have static slaves in Jenkins. Use this to boot them. """ log_green("Started...") log_yellow("...Creatin...
[ "For", "now", "jclouds", "is", "broken", "for", "GCE", "and", "we", "will", "have", "static", "slaves", "in", "Jenkins", ".", "Use", "this", "to", "boot", "them", "." ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L499-L519
[ "def", "startup_gce_instance", "(", "instance_name", ",", "project", ",", "zone", ",", "username", ",", "machine_type", ",", "image", ",", "public_key", ",", "disk_name", "=", "None", ")", ":", "log_green", "(", "\"Started...\"", ")", "log_yellow", "(", "\"......
a6770678e735de95b194f6e6989223970db5f654
train
_create_server_ec2
Creates EC2 Instance and saves it state in a local json file
bookshelf/api_v1.py
def _create_server_ec2(region, access_key_id, secret_access_key, disk_name, disk_size, ami, key_pair, instance_type, username, ...
def _create_server_ec2(region, access_key_id, secret_access_key, disk_name, disk_size, ami, key_pair, instance_type, username, ...
[ "Creates", "EC2", "Instance", "and", "saves", "it", "state", "in", "a", "local", "json", "file" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L556-L615
[ "def", "_create_server_ec2", "(", "region", ",", "access_key_id", ",", "secret_access_key", ",", "disk_name", ",", "disk_size", ",", "ami", ",", "key_pair", ",", "instance_type", ",", "username", ",", "tags", "=", "{", "}", ",", "security_groups", "=", "None",...
a6770678e735de95b194f6e6989223970db5f654
train
_create_server_rackspace
Creates Rackspace Instance and saves it state in a local json file
bookshelf/api_v1.py
def _create_server_rackspace(region, access_key_id, secret_access_key, disk_name, disk_size, ami, key_pair, instance_...
def _create_server_rackspace(region, access_key_id, secret_access_key, disk_name, disk_size, ami, key_pair, instance_...
[ "Creates", "Rackspace", "Instance", "and", "saves", "it", "state", "in", "a", "local", "json", "file" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L618-L670
[ "def", "_create_server_rackspace", "(", "region", ",", "access_key_id", ",", "secret_access_key", ",", "disk_name", ",", "disk_size", ",", "ami", ",", "key_pair", ",", "instance_type", ",", "username", ",", "instance_name", ",", "tags", "=", "{", "}", ",", "se...
a6770678e735de95b194f6e6989223970db5f654
train
dir_attribs
cuisine dir_attribs doesn't do sudo, so we implement our own Updates the mode/owner/group for the given remote directory.
bookshelf/api_v1.py
def dir_attribs(location, mode=None, owner=None, group=None, recursive=False, use_sudo=False): """ cuisine dir_attribs doesn't do sudo, so we implement our own Updates the mode/owner/group for the given remote directory.""" recursive = recursive and "-R " or "" if mode: if us...
def dir_attribs(location, mode=None, owner=None, group=None, recursive=False, use_sudo=False): """ cuisine dir_attribs doesn't do sudo, so we implement our own Updates the mode/owner/group for the given remote directory.""" recursive = recursive and "-R " or "" if mode: if us...
[ "cuisine", "dir_attribs", "doesn", "t", "do", "sudo", "so", "we", "implement", "our", "own", "Updates", "the", "mode", "/", "owner", "/", "group", "for", "the", "given", "remote", "directory", "." ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L673-L692
[ "def", "dir_attribs", "(", "location", ",", "mode", "=", "None", ",", "owner", "=", "None", ",", "group", "=", "None", ",", "recursive", "=", "False", ",", "use_sudo", "=", "False", ")", ":", "recursive", "=", "recursive", "and", "\"-R \"", "or", "\"\"...
a6770678e735de95b194f6e6989223970db5f654
train
disable_selinux
disables selinux
bookshelf/api_v1.py
def disable_selinux(): """ disables selinux """ if contains(filename='/etc/selinux/config', text='SELINUX=enforcing'): sed('/etc/selinux/config', 'SELINUX=enforcing', 'SELINUX=disabled', use_sudo=True) if contains(filename='/etc/selinux/config', text='SE...
def disable_selinux(): """ disables selinux """ if contains(filename='/etc/selinux/config', text='SELINUX=enforcing'): sed('/etc/selinux/config', 'SELINUX=enforcing', 'SELINUX=disabled', use_sudo=True) if contains(filename='/etc/selinux/config', text='SE...
[ "disables", "selinux" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L757-L773
[ "def", "disable_selinux", "(", ")", ":", "if", "contains", "(", "filename", "=", "'/etc/selinux/config'", ",", "text", "=", "'SELINUX=enforcing'", ")", ":", "sed", "(", "'/etc/selinux/config'", ",", "'SELINUX=enforcing'", ",", "'SELINUX=disabled'", ",", "use_sudo", ...
a6770678e735de95b194f6e6989223970db5f654
train
destroy_ebs_volume
destroys an ebs volume
bookshelf/api_v1.py
def destroy_ebs_volume(region, volume_id, access_key_id, secret_access_key): """ destroys an ebs volume """ conn = connect_to_ec2(region, access_key_id, secret_access_key) if ebs_volume_exists(region, volume_id, access_key_id, secret_access_key): log_yellow('destroying EBS volume ...') conn...
def destroy_ebs_volume(region, volume_id, access_key_id, secret_access_key): """ destroys an ebs volume """ conn = connect_to_ec2(region, access_key_id, secret_access_key) if ebs_volume_exists(region, volume_id, access_key_id, secret_access_key): log_yellow('destroying EBS volume ...') conn...
[ "destroys", "an", "ebs", "volume" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L798-L804
[ "def", "destroy_ebs_volume", "(", "region", ",", "volume_id", ",", "access_key_id", ",", "secret_access_key", ")", ":", "conn", "=", "connect_to_ec2", "(", "region", ",", "access_key_id", ",", "secret_access_key", ")", "if", "ebs_volume_exists", "(", "region", ","...
a6770678e735de95b194f6e6989223970db5f654
train
destroy_ec2
terminates the instance
bookshelf/api_v1.py
def destroy_ec2(region, instance_id, access_key_id, secret_access_key): """ terminates the instance """ conn = connect_to_ec2(region, access_key_id, secret_access_key) data = get_ec2_info(instance_id=instance_id, region=region, access_key_id=access_key_id, ...
def destroy_ec2(region, instance_id, access_key_id, secret_access_key): """ terminates the instance """ conn = connect_to_ec2(region, access_key_id, secret_access_key) data = get_ec2_info(instance_id=instance_id, region=region, access_key_id=access_key_id, ...
[ "terminates", "the", "instance" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L807-L827
[ "def", "destroy_ec2", "(", "region", ",", "instance_id", ",", "access_key_id", ",", "secret_access_key", ")", ":", "conn", "=", "connect_to_ec2", "(", "region", ",", "access_key_id", ",", "secret_access_key", ")", "data", "=", "get_ec2_info", "(", "instance_id", ...
a6770678e735de95b194f6e6989223970db5f654
train
destroy_rackspace
terminates the instance
bookshelf/api_v1.py
def destroy_rackspace(region, instance_id, access_key_id, secret_access_key): """ terminates the instance """ nova = connect_to_rackspace(region, access_key_id, secret_access_key) server = nova.servers.get(instance_id) log_yellow('deleting...
def destroy_rackspace(region, instance_id, access_key_id, secret_access_key): """ terminates the instance """ nova = connect_to_rackspace(region, access_key_id, secret_access_key) server = nova.servers.get(instance_id) log_yellow('deleting...
[ "terminates", "the", "instance" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L839-L858
[ "def", "destroy_rackspace", "(", "region", ",", "instance_id", ",", "access_key_id", ",", "secret_access_key", ")", ":", "nova", "=", "connect_to_rackspace", "(", "region", ",", "access_key_id", ",", "secret_access_key", ")", "server", "=", "nova", ".", "servers",...
a6770678e735de95b194f6e6989223970db5f654
train
down_ec2
shutdown of an existing EC2 instance
bookshelf/api_v1.py
def down_ec2(instance_id, region, access_key_id, secret_access_key): """ shutdown of an existing EC2 instance """ conn = connect_to_ec2(region, access_key_id, secret_access_key) # get the instance_id from the state file, and stop the instance instance = conn.stop_instances(instance_ids=instance_id)[0] ...
def down_ec2(instance_id, region, access_key_id, secret_access_key): """ shutdown of an existing EC2 instance """ conn = connect_to_ec2(region, access_key_id, secret_access_key) # get the instance_id from the state file, and stop the instance instance = conn.stop_instances(instance_ids=instance_id)[0] ...
[ "shutdown", "of", "an", "existing", "EC2", "instance" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L874-L883
[ "def", "down_ec2", "(", "instance_id", ",", "region", ",", "access_key_id", ",", "secret_access_key", ")", ":", "conn", "=", "connect_to_ec2", "(", "region", ",", "access_key_id", ",", "secret_access_key", ")", "# get the instance_id from the state file, and stop the inst...
a6770678e735de95b194f6e6989223970db5f654
train
ebs_volume_exists
finds out if a ebs volume exists
bookshelf/api_v1.py
def ebs_volume_exists(region, volume_id, access_key_id, secret_access_key): """ finds out if a ebs volume exists """ conn = connect_to_ec2(region, access_key_id, secret_access_key) for vol in conn.get_all_volumes(): if vol.id == volume_id: return True
def ebs_volume_exists(region, volume_id, access_key_id, secret_access_key): """ finds out if a ebs volume exists """ conn = connect_to_ec2(region, access_key_id, secret_access_key) for vol in conn.get_all_volumes(): if vol.id == volume_id: return True
[ "finds", "out", "if", "a", "ebs", "volume", "exists" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L915-L920
[ "def", "ebs_volume_exists", "(", "region", ",", "volume_id", ",", "access_key_id", ",", "secret_access_key", ")", ":", "conn", "=", "connect_to_ec2", "(", "region", ",", "access_key_id", ",", "secret_access_key", ")", "for", "vol", "in", "conn", ".", "get_all_vo...
a6770678e735de95b194f6e6989223970db5f654
train
enable_marathon_basic_authentication
configures marathon to start with authentication
bookshelf/api_v1.py
def enable_marathon_basic_authentication(principal, password): """ configures marathon to start with authentication """ upstart_file = '/etc/init/marathon.conf' with hide('running', 'stdout'): sudo('echo -n "{}" > /etc/marathon-mesos.credentials'.format(password)) boot_args = ' '.join(['exec', ...
def enable_marathon_basic_authentication(principal, password): """ configures marathon to start with authentication """ upstart_file = '/etc/init/marathon.conf' with hide('running', 'stdout'): sudo('echo -n "{}" > /etc/marathon-mesos.credentials'.format(password)) boot_args = ' '.join(['exec', ...
[ "configures", "marathon", "to", "start", "with", "authentication" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L944-L962
[ "def", "enable_marathon_basic_authentication", "(", "principal", ",", "password", ")", ":", "upstart_file", "=", "'/etc/init/marathon.conf'", "with", "hide", "(", "'running'", ",", "'stdout'", ")", ":", "sudo", "(", "'echo -n \"{}\" > /etc/marathon-mesos.credentials'", "....
a6770678e735de95b194f6e6989223970db5f654
train
enable_mesos_basic_authentication
enables and adds a new authorized principal
bookshelf/api_v1.py
def enable_mesos_basic_authentication(principal, password): """ enables and adds a new authorized principal """ restart = False secrets_file = '/etc/mesos/secrets' secrets_entry = '%s %s' % (principal, password) if not file_contains(filename=secrets_file, text=secrets_entry,...
def enable_mesos_basic_authentication(principal, password): """ enables and adds a new authorized principal """ restart = False secrets_file = '/etc/mesos/secrets' secrets_entry = '%s %s' % (principal, password) if not file_contains(filename=secrets_file, text=secrets_entry,...
[ "enables", "and", "adds", "a", "new", "authorized", "principal" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L965-L990
[ "def", "enable_mesos_basic_authentication", "(", "principal", ",", "password", ")", ":", "restart", "=", "False", "secrets_file", "=", "'/etc/mesos/secrets'", "secrets_entry", "=", "'%s %s'", "%", "(", "principal", ",", "password", ")", "if", "not", "file_contains",...
a6770678e735de95b194f6e6989223970db5f654
train
file_attribs
Updates the mode/owner/group for the remote file at the given location.
bookshelf/api_v1.py
def file_attribs(location, mode=None, owner=None, group=None, sudo=False): """Updates the mode/owner/group for the remote file at the given location.""" return dir_attribs(location, mode, owner, group, False, sudo)
def file_attribs(location, mode=None, owner=None, group=None, sudo=False): """Updates the mode/owner/group for the remote file at the given location.""" return dir_attribs(location, mode, owner, group, False, sudo)
[ "Updates", "the", "mode", "/", "owner", "/", "group", "for", "the", "remote", "file", "at", "the", "given", "location", "." ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1014-L1017
[ "def", "file_attribs", "(", "location", ",", "mode", "=", "None", ",", "owner", "=", "None", ",", "group", "=", "None", ",", "sudo", "=", "False", ")", ":", "return", "dir_attribs", "(", "location", ",", "mode", ",", "owner", ",", "group", ",", "Fals...
a6770678e735de95b194f6e6989223970db5f654
train
get_ec2_info
queries EC2 for details about a particular instance_id
bookshelf/api_v1.py
def get_ec2_info(instance_id, region, access_key_id, secret_access_key, username): """ queries EC2 for details about a particular instance_id """ conn = connect_to_ec2(region, access_key_id, secret_access_key) instance = conn.get_only_i...
def get_ec2_info(instance_id, region, access_key_id, secret_access_key, username): """ queries EC2 for details about a particular instance_id """ conn = connect_to_ec2(region, access_key_id, secret_access_key) instance = conn.get_only_i...
[ "queries", "EC2", "for", "details", "about", "a", "particular", "instance_id" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1027-L1065
[ "def", "get_ec2_info", "(", "instance_id", ",", "region", ",", "access_key_id", ",", "secret_access_key", ",", "username", ")", ":", "conn", "=", "connect_to_ec2", "(", "region", ",", "access_key_id", ",", "secret_access_key", ")", "instance", "=", "conn", ".", ...
a6770678e735de95b194f6e6989223970db5f654
train
get_ip_address_from_rackspace_server
returns an ipaddress for a rackspace instance
bookshelf/api_v1.py
def get_ip_address_from_rackspace_server(server_id): """ returns an ipaddress for a rackspace instance """ nova = connect_to_rackspace() server = nova.servers.get(server_id) # the server was assigned IPv4 and IPv6 addresses, locate the IPv4 address ip_address = None for network in server...
def get_ip_address_from_rackspace_server(server_id): """ returns an ipaddress for a rackspace instance """ nova = connect_to_rackspace() server = nova.servers.get(server_id) # the server was assigned IPv4 and IPv6 addresses, locate the IPv4 address ip_address = None for network in server...
[ "returns", "an", "ipaddress", "for", "a", "rackspace", "instance" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1073-L1091
[ "def", "get_ip_address_from_rackspace_server", "(", "server_id", ")", ":", "nova", "=", "connect_to_rackspace", "(", ")", "server", "=", "nova", ".", "servers", ".", "get", "(", "server_id", ")", "# the server was assigned IPv4 and IPv6 addresses, locate the IPv4 address", ...
a6770678e735de95b194f6e6989223970db5f654
train
get_rackspace_info
queries Rackspace for details about a particular server id
bookshelf/api_v1.py
def get_rackspace_info(server_id, region, access_key_id, secret_access_key, username): """ queries Rackspace for details about a particular server id """ nova = connect_to_rackspace(region, access_key_id, secret_acce...
def get_rackspace_info(server_id, region, access_key_id, secret_access_key, username): """ queries Rackspace for details about a particular server id """ nova = connect_to_rackspace(region, access_key_id, secret_acce...
[ "queries", "Rackspace", "for", "details", "about", "a", "particular", "server", "id" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1094-L1123
[ "def", "get_rackspace_info", "(", "server_id", ",", "region", ",", "access_key_id", ",", "secret_access_key", ",", "username", ")", ":", "nova", "=", "connect_to_rackspace", "(", "region", ",", "access_key_id", ",", "secret_access_key", ")", "server", "=", "nova",...
a6770678e735de95b194f6e6989223970db5f654
train
install_oracle_java
installs oracle java
bookshelf/api_v1.py
def install_oracle_java(distribution, java_version): """ installs oracle java """ if 'ubuntu' in distribution: accept_oracle_license = ('echo ' 'oracle-java' + java_version + 'installer ' 'shared/accepted-oracle-license-v1-1 ' ...
def install_oracle_java(distribution, java_version): """ installs oracle java """ if 'ubuntu' in distribution: accept_oracle_license = ('echo ' 'oracle-java' + java_version + 'installer ' 'shared/accepted-oracle-license-v1-1 ' ...
[ "installs", "oracle", "java" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1158-L1176
[ "def", "install_oracle_java", "(", "distribution", ",", "java_version", ")", ":", "if", "'ubuntu'", "in", "distribution", ":", "accept_oracle_license", "=", "(", "'echo '", "'oracle-java'", "+", "java_version", "+", "'installer '", "'shared/accepted-oracle-license-v1-1 '"...
a6770678e735de95b194f6e6989223970db5f654
train
install_mesos_single_box_mode
install mesos (all of it) on a single node
bookshelf/api_v1.py
def install_mesos_single_box_mode(distribution): """ install mesos (all of it) on a single node""" if 'ubuntu' in distribution: log_green('adding mesosphere apt-key') apt_add_key(keyid='E56151BF') os = lsb_release() apt_string = 'deb http://repos.mesosphere.io/%s %s main' % ( ...
def install_mesos_single_box_mode(distribution): """ install mesos (all of it) on a single node""" if 'ubuntu' in distribution: log_green('adding mesosphere apt-key') apt_add_key(keyid='E56151BF') os = lsb_release() apt_string = 'deb http://repos.mesosphere.io/%s %s main' % ( ...
[ "install", "mesos", "(", "all", "of", "it", ")", "on", "a", "single", "node" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1179-L1232
[ "def", "install_mesos_single_box_mode", "(", "distribution", ")", ":", "if", "'ubuntu'", "in", "distribution", ":", "log_green", "(", "'adding mesosphere apt-key'", ")", "apt_add_key", "(", "keyid", "=", "'E56151BF'", ")", "os", "=", "lsb_release", "(", ")", "apt_...
a6770678e735de95b194f6e6989223970db5f654
train
insert_line_in_file_after_regex
inserts a line in the middle of a file
bookshelf/api_v1.py
def insert_line_in_file_after_regex(path, line, after_regex, use_sudo=False): """ inserts a line in the middle of a file """ tmpfile = str(uuid.uuid4()) get_file(path, tmpfile, use_sudo=use_sudo) with open(tmpfile) as f: original = f.read() if line not in original: outfile = str(uu...
def insert_line_in_file_after_regex(path, line, after_regex, use_sudo=False): """ inserts a line in the middle of a file """ tmpfile = str(uuid.uuid4()) get_file(path, tmpfile, use_sudo=use_sudo) with open(tmpfile) as f: original = f.read() if line not in original: outfile = str(uu...
[ "inserts", "a", "line", "in", "the", "middle", "of", "a", "file" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1235-L1255
[ "def", "insert_line_in_file_after_regex", "(", "path", ",", "line", ",", "after_regex", ",", "use_sudo", "=", "False", ")", ":", "tmpfile", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "get_file", "(", "path", ",", "tmpfile", ",", "use_sudo", "=...
a6770678e735de95b194f6e6989223970db5f654
train
install_python_module
instals a python module using pip
bookshelf/api_v1.py
def install_python_module(name): """ instals a python module using pip """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): run('pip --quiet install %s' % name)
def install_python_module(name): """ instals a python module using pip """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): run('pip --quiet install %s' % name)
[ "instals", "a", "python", "module", "using", "pip" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1300-L1305
[ "def", "install_python_module", "(", "name", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "run", "(", "'pip -...
a6770678e735de95b194f6e6989223970db5f654
train
install_python_module_locally
instals a python module using pip
bookshelf/api_v1.py
def install_python_module_locally(name): """ instals a python module using pip """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): local('pip --quiet install %s' % name)
def install_python_module_locally(name): """ instals a python module using pip """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): local('pip --quiet install %s' % name)
[ "instals", "a", "python", "module", "using", "pip" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1308-L1312
[ "def", "install_python_module_locally", "(", "name", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "local", "(",...
a6770678e735de95b194f6e6989223970db5f654
train
install_system_gem
install a particular gem
bookshelf/api_v1.py
def install_system_gem(gem): """ install a particular gem """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): sudo("gem install %s --no-rdoc --no-ri" % gem)
def install_system_gem(gem): """ install a particular gem """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): sudo("gem install %s --no-rdoc --no-ri" % gem)
[ "install", "a", "particular", "gem" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1315-L1319
[ "def", "install_system_gem", "(", "gem", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "sudo", "(", "\"gem ins...
a6770678e735de95b194f6e6989223970db5f654
train
is_vagrant_plugin_installed
checks if vagrant plugin is installed
bookshelf/api_v1.py
def is_vagrant_plugin_installed(plugin, use_sudo=False): """ checks if vagrant plugin is installed """ cmd = 'vagrant plugin list' if use_sudo: results = sudo(cmd) else: results = run(cmd) installed_plugins = [] for line in results: plugin = re.search('^(\S.*) \((.*)\)...
def is_vagrant_plugin_installed(plugin, use_sudo=False): """ checks if vagrant plugin is installed """ cmd = 'vagrant plugin list' if use_sudo: results = sudo(cmd) else: results = run(cmd) installed_plugins = [] for line in results: plugin = re.search('^(\S.*) \((.*)\)...
[ "checks", "if", "vagrant", "plugin", "is", "installed" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1398-L1413
[ "def", "is_vagrant_plugin_installed", "(", "plugin", ",", "use_sudo", "=", "False", ")", ":", "cmd", "=", "'vagrant plugin list'", "if", "use_sudo", ":", "results", "=", "sudo", "(", "cmd", ")", "else", ":", "results", "=", "run", "(", "cmd", ")", "install...
a6770678e735de95b194f6e6989223970db5f654
train
is_deb_package_installed
checks if a particular deb package is installed
bookshelf/api_v1.py
def is_deb_package_installed(pkg): """ checks if a particular deb package is installed """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): result = sudo('dpkg-query -l "%s" | grep -q ^.i' % pkg) return not bool(result.return_code)
def is_deb_package_installed(pkg): """ checks if a particular deb package is installed """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): result = sudo('dpkg-query -l "%s" | grep -q ^.i' % pkg) return not bool(result.return_code)
[ "checks", "if", "a", "particular", "deb", "package", "is", "installed" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1416-L1423
[ "def", "is_deb_package_installed", "(", "pkg", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ",", "capture", "=", "True", ")", ":", "result", "=", "su...
a6770678e735de95b194f6e6989223970db5f654
train
is_ssh_available
checks if ssh port is open
bookshelf/api_v1.py
def is_ssh_available(host, port=22): """ checks if ssh port is open """ s = socket.socket() try: s.connect((host, port)) return True except: return False
def is_ssh_available(host, port=22): """ checks if ssh port is open """ s = socket.socket() try: s.connect((host, port)) return True except: return False
[ "checks", "if", "ssh", "port", "is", "open" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1462-L1469
[ "def", "is_ssh_available", "(", "host", ",", "port", "=", "22", ")", ":", "s", "=", "socket", ".", "socket", "(", ")", "try", ":", "s", ".", "connect", "(", "(", "host", ",", "port", ")", ")", "return", "True", "except", ":", "return", "False" ]
a6770678e735de95b194f6e6989223970db5f654
train
os_release
returns /etc/os-release in a dictionary
bookshelf/api_v1.py
def os_release(username, ip_address): """ returns /etc/os-release in a dictionary """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): _os_release = {} with settings(host_string=username + '@' + ip_address): data = run('...
def os_release(username, ip_address): """ returns /etc/os-release in a dictionary """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): _os_release = {} with settings(host_string=username + '@' + ip_address): data = run('...
[ "returns", "/", "etc", "/", "os", "-", "release", "in", "a", "dictionary" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1472-L1487
[ "def", "os_release", "(", "username", ",", "ip_address", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ",", "capture", "=", "True", ")", ":", "_os_rel...
a6770678e735de95b194f6e6989223970db5f654
train
load_state_from_disk
loads the state from a local data.json file
bookshelf/api_v1.py
def load_state_from_disk(): """ loads the state from a local data.json file """ if is_there_state(): with open('data.json', 'r') as f: data = json.load(f) return data else: return False
def load_state_from_disk(): """ loads the state from a local data.json file """ if is_there_state(): with open('data.json', 'r') as f: data = json.load(f) return data else: return False
[ "loads", "the", "state", "from", "a", "local", "data", ".", "json", "file" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1498-L1506
[ "def", "load_state_from_disk", "(", ")", ":", "if", "is_there_state", "(", ")", ":", "with", "open", "(", "'data.json'", ",", "'r'", ")", "as", "f", ":", "data", "=", "json", ".", "load", "(", "f", ")", "return", "data", "else", ":", "return", "False...
a6770678e735de95b194f6e6989223970db5f654
train
print_ec2_info
outputs information about our EC2 instance
bookshelf/api_v1.py
def print_ec2_info(region, instance_id, access_key_id, secret_access_key, username): """ outputs information about our EC2 instance """ data = get_ec2_info(instance_id=instance_id, region=region, ...
def print_ec2_info(region, instance_id, access_key_id, secret_access_key, username): """ outputs information about our EC2 instance """ data = get_ec2_info(instance_id=instance_id, region=region, ...
[ "outputs", "information", "about", "our", "EC2", "instance" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1538-L1559
[ "def", "print_ec2_info", "(", "region", ",", "instance_id", ",", "access_key_id", ",", "secret_access_key", ",", "username", ")", ":", "data", "=", "get_ec2_info", "(", "instance_id", "=", "instance_id", ",", "region", "=", "region", ",", "access_key_id", "=", ...
a6770678e735de95b194f6e6989223970db5f654
train
print_gce_info
outputs information about our Rackspace instance
bookshelf/api_v1.py
def print_gce_info(zone, project, instance_name, data): """ outputs information about our Rackspace instance """ try: instance_info = _get_gce_compute().instances().get( project=project, zone=zone, instance=instance_name ).execute() log_yellow(pformat(...
def print_gce_info(zone, project, instance_name, data): """ outputs information about our Rackspace instance """ try: instance_info = _get_gce_compute().instances().get( project=project, zone=zone, instance=instance_name ).execute() log_yellow(pformat(...
[ "outputs", "information", "about", "our", "Rackspace", "instance" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1561-L1582
[ "def", "print_gce_info", "(", "zone", ",", "project", ",", "instance_name", ",", "data", ")", ":", "try", ":", "instance_info", "=", "_get_gce_compute", "(", ")", ".", "instances", "(", ")", ".", "get", "(", "project", "=", "project", ",", "zone", "=", ...
a6770678e735de95b194f6e6989223970db5f654
train
print_rackspace_info
outputs information about our Rackspace instance
bookshelf/api_v1.py
def print_rackspace_info(region, instance_id, access_key_id, secret_access_key, username): """ outputs information about our Rackspace instance """ data = get_rackspace_info(server_id=instance_id, ...
def print_rackspace_info(region, instance_id, access_key_id, secret_access_key, username): """ outputs information about our Rackspace instance """ data = get_rackspace_info(server_id=instance_id, ...
[ "outputs", "information", "about", "our", "Rackspace", "instance" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1586-L1605
[ "def", "print_rackspace_info", "(", "region", ",", "instance_id", ",", "access_key_id", ",", "secret_access_key", ",", "username", ")", ":", "data", "=", "get_rackspace_info", "(", "server_id", "=", "instance_id", ",", "region", "=", "region", ",", "access_key_id"...
a6770678e735de95b194f6e6989223970db5f654
train
restart_service
restarts a service
bookshelf/api_v1.py
def restart_service(service): """ restarts a service """ with settings(hide('running', 'stdout'), warn_only=True): log_yellow('stoping service %s' % service) sudo('service %s stop' % service) log_yellow('starting service %s' % service) sudo('service %s start' % service)
def restart_service(service): """ restarts a service """ with settings(hide('running', 'stdout'), warn_only=True): log_yellow('stoping service %s' % service) sudo('service %s stop' % service) log_yellow('starting service %s' % service) sudo('service %s start' % service)
[ "restarts", "a", "service" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1633-L1639
[ "def", "restart_service", "(", "service", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ")", ",", "warn_only", "=", "True", ")", ":", "log_yellow", "(", "'stoping service %s'", "%", "service", ")", "sudo", "(", "'service %s st...
a6770678e735de95b194f6e6989223970db5f654
train
rsync
syncs the src code to the remote box
bookshelf/api_v1.py
def rsync(): """ syncs the src code to the remote box """ log_green('syncing code to remote box...') data = load_state_from_disk() if 'SOURCE_PATH' in os.environ: with lcd(os.environ['SOURCE_PATH']): local("rsync -a " "--info=progress2 " "--exclud...
def rsync(): """ syncs the src code to the remote box """ log_green('syncing code to remote box...') data = load_state_from_disk() if 'SOURCE_PATH' in os.environ: with lcd(os.environ['SOURCE_PATH']): local("rsync -a " "--info=progress2 " "--exclud...
[ "syncs", "the", "src", "code", "to", "the", "remote", "box" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1642-L1659
[ "def", "rsync", "(", ")", ":", "log_green", "(", "'syncing code to remote box...'", ")", "data", "=", "load_state_from_disk", "(", ")", "if", "'SOURCE_PATH'", "in", "os", ".", "environ", ":", "with", "lcd", "(", "os", ".", "environ", "[", "'SOURCE_PATH'", "]...
a6770678e735de95b194f6e6989223970db5f654
train
save_ec2_state_locally
queries EC2 for details about a particular instance_id and stores those details locally
bookshelf/api_v1.py
def save_ec2_state_locally(instance_id, region, username, access_key_id, secret_access_key): """ queries EC2 for details about a particular instance_id and stores those details locally """ # r...
def save_ec2_state_locally(instance_id, region, username, access_key_id, secret_access_key): """ queries EC2 for details about a particular instance_id and stores those details locally """ # r...
[ "queries", "EC2", "for", "details", "about", "a", "particular", "instance_id", "and", "stores", "those", "details", "locally" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1662-L1676
[ "def", "save_ec2_state_locally", "(", "instance_id", ",", "region", ",", "username", ",", "access_key_id", ",", "secret_access_key", ")", ":", "# retrieve the IP information from the instance", "data", "=", "get_ec2_info", "(", "instance_id", ",", "region", ",", "access...
a6770678e735de95b194f6e6989223970db5f654
train
ssh_session
opens a ssh shell to the host
bookshelf/api_v1.py
def ssh_session(key_filename, username, ip_address, *cli): """ opens a ssh shell to the host """ local('ssh -t -i %s %s@%s %s' % (key_filename, username, ip_address, ...
def ssh_session(key_filename, username, ip_address, *cli): """ opens a ssh shell to the host """ local('ssh -t -i %s %s@%s %s' % (key_filename, username, ip_address, ...
[ "opens", "a", "ssh", "shell", "to", "the", "host" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1721-L1729
[ "def", "ssh_session", "(", "key_filename", ",", "username", ",", "ip_address", ",", "*", "cli", ")", ":", "local", "(", "'ssh -t -i %s %s@%s %s'", "%", "(", "key_filename", ",", "username", ",", "ip_address", ",", "\"\"", ".", "join", "(", "chain", ".", "f...
a6770678e735de95b194f6e6989223970db5f654
train
up_ec2
boots an existing ec2_instance
bookshelf/api_v1.py
def up_ec2(region, access_key_id, secret_access_key, instance_id, username): """ boots an existing ec2_instance """ conn = connect_to_ec2(region, access_key_id, secret_access_key) # boot the ec2 instance instance = conn.start_instances(instance_ids=instance_i...
def up_ec2(region, access_key_id, secret_access_key, instance_id, username): """ boots an existing ec2_instance """ conn = connect_to_ec2(region, access_key_id, secret_access_key) # boot the ec2 instance instance = conn.start_instances(instance_ids=instance_i...
[ "boots", "an", "existing", "ec2_instance" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1782-L1817
[ "def", "up_ec2", "(", "region", ",", "access_key_id", ",", "secret_access_key", ",", "instance_id", ",", "username", ")", ":", "conn", "=", "connect_to_ec2", "(", "region", ",", "access_key_id", ",", "secret_access_key", ")", "# boot the ec2 instance", "instance", ...
a6770678e735de95b194f6e6989223970db5f654
train
wait_for_ssh
probes the ssh port and waits until it is available
bookshelf/api_v1.py
def wait_for_ssh(host, port=22, timeout=600): """ probes the ssh port and waits until it is available """ log_yellow('waiting for ssh...') for iteration in xrange(1, timeout): #noqa sleep(1) if is_ssh_available(host, port): return True else: log_yellow('waitin...
def wait_for_ssh(host, port=22, timeout=600): """ probes the ssh port and waits until it is available """ log_yellow('waiting for ssh...') for iteration in xrange(1, timeout): #noqa sleep(1) if is_ssh_available(host, port): return True else: log_yellow('waitin...
[ "probes", "the", "ssh", "port", "and", "waits", "until", "it", "is", "available" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L1897-L1905
[ "def", "wait_for_ssh", "(", "host", ",", "port", "=", "22", ",", "timeout", "=", "600", ")", ":", "log_yellow", "(", "'waiting for ssh...'", ")", "for", "iteration", "in", "xrange", "(", "1", ",", "timeout", ")", ":", "#noqa", "sleep", "(", "1", ")", ...
a6770678e735de95b194f6e6989223970db5f654
train
_get_visuals
Renvoi les éléments graphiques d'un utilisateur. :param user: Dictionnaire d'infos de l'utilisateur :return QPixmap,QLabel: Image et nom
pyDLib/GUI/login.py
def _get_visuals(user): """ Renvoi les éléments graphiques d'un utilisateur. :param user: Dictionnaire d'infos de l'utilisateur :return QPixmap,QLabel: Image et nom """ pixmap = SuperUserAvatar() if user["status"] == "admin" else UserAvatar() label = user["label"] return pixmap, QLabel(...
def _get_visuals(user): """ Renvoi les éléments graphiques d'un utilisateur. :param user: Dictionnaire d'infos de l'utilisateur :return QPixmap,QLabel: Image et nom """ pixmap = SuperUserAvatar() if user["status"] == "admin" else UserAvatar() label = user["label"] return pixmap, QLabel(...
[ "Renvoi", "les", "éléments", "graphiques", "d", "un", "utilisateur", "." ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/login.py#L14-L23
[ "def", "_get_visuals", "(", "user", ")", ":", "pixmap", "=", "SuperUserAvatar", "(", ")", "if", "user", "[", "\"status\"", "]", "==", "\"admin\"", "else", "UserAvatar", "(", ")", "label", "=", "user", "[", "\"label\"", "]", "return", "pixmap", ",", "QLab...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
saveDirectory
save a directory to a certain alias/nickname
hallie/modules/user.py
def saveDirectory(alias): """save a directory to a certain alias/nickname""" if not settings.platformCompatible(): return False dataFile = open(settings.getDataFile(), "wb") currentDirectory = os.path.abspath(".") directory = {alias : currentDirectory} pickle.dump(directory, dataFile) speech.success(alias + " ...
def saveDirectory(alias): """save a directory to a certain alias/nickname""" if not settings.platformCompatible(): return False dataFile = open(settings.getDataFile(), "wb") currentDirectory = os.path.abspath(".") directory = {alias : currentDirectory} pickle.dump(directory, dataFile) speech.success(alias + " ...
[ "save", "a", "directory", "to", "a", "certain", "alias", "/", "nickname" ]
mikemelch/hallie
python
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/user.py#L26-L35
[ "def", "saveDirectory", "(", "alias", ")", ":", "if", "not", "settings", ".", "platformCompatible", "(", ")", ":", "return", "False", "dataFile", "=", "open", "(", "settings", ".", "getDataFile", "(", ")", ",", "\"wb\"", ")", "currentDirectory", "=", "os",...
a6dbb691145a85b776a1919e4c7930e0ae598437
train
goToDirectory
go to a saved directory
hallie/modules/user.py
def goToDirectory(alias): """go to a saved directory""" if not settings.platformCompatible(): return False data = pickle.load(open(settings.getDataFile(), "rb")) try: data[alias] except KeyError: speech.fail("Sorry, it doesn't look like you have saved " + alias + " yet.") speech.fail("Go to the directory y...
def goToDirectory(alias): """go to a saved directory""" if not settings.platformCompatible(): return False data = pickle.load(open(settings.getDataFile(), "rb")) try: data[alias] except KeyError: speech.fail("Sorry, it doesn't look like you have saved " + alias + " yet.") speech.fail("Go to the directory y...
[ "go", "to", "a", "saved", "directory" ]
mikemelch/hallie
python
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/user.py#L37-L53
[ "def", "goToDirectory", "(", "alias", ")", ":", "if", "not", "settings", ".", "platformCompatible", "(", ")", ":", "return", "False", "data", "=", "pickle", ".", "load", "(", "open", "(", "settings", ".", "getDataFile", "(", ")", ",", "\"rb\"", ")", ")...
a6dbb691145a85b776a1919e4c7930e0ae598437
train
ModelManager.list
List model instances. Currently this gets *everything* and iterates through all possible pages in the API. This may be unsuitable for production environments with huge databases, so finer grained page support should likely be added at some point. Args: filters (dict...
saltant/models/resource.py
def list(self, filters=None): """List model instances. Currently this gets *everything* and iterates through all possible pages in the API. This may be unsuitable for production environments with huge databases, so finer grained page support should likely be added at some point....
def list(self, filters=None): """List model instances. Currently this gets *everything* and iterates through all possible pages in the API. This may be unsuitable for production environments with huge databases, so finer grained page support should likely be added at some point....
[ "List", "model", "instances", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/resource.py#L53-L129
[ "def", "list", "(", "self", ",", "filters", "=", "None", ")", ":", "# Add in the page and page_size parameters to the filter, such", "# that our request gets *all* objects in the list. However,", "# don't do this if the user has explicitly included these", "# parameters in the filter.", ...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
ModelManager.get
Get the model instance with a given id. Args: id (int or str): The primary identifier (e.g., pk or UUID) for the task instance to get. Returns: :class:`saltant.models.resource.Model`: A :class:`saltant.models.resource.Model` subclass ...
saltant/models/resource.py
def get(self, id): """Get the model instance with a given id. Args: id (int or str): The primary identifier (e.g., pk or UUID) for the task instance to get. Returns: :class:`saltant.models.resource.Model`: A :class:`saltant.models.resourc...
def get(self, id): """Get the model instance with a given id. Args: id (int or str): The primary identifier (e.g., pk or UUID) for the task instance to get. Returns: :class:`saltant.models.resource.Model`: A :class:`saltant.models.resourc...
[ "Get", "the", "model", "instance", "with", "a", "given", "id", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/resource.py#L131-L157
[ "def", "get", "(", "self", ",", "id", ")", ":", "# Get the object", "request_url", "=", "self", ".", "_client", ".", "base_api_url", "+", "self", ".", "detail_url", ".", "format", "(", "id", "=", "id", ")", "response", "=", "self", ".", "_client", ".",...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
ModelManager.validate_request_success
Validates that a request was successful. Args: response_text (str): The response body of the request. request_url (str): The URL the request was made at. status_code (int): The status code of the response. expected_status_code (int): The expected status code of t...
saltant/models/resource.py
def validate_request_success( response_text, request_url, status_code, expected_status_code ): """Validates that a request was successful. Args: response_text (str): The response body of the request. request_url (str): The URL the request was made at. sta...
def validate_request_success( response_text, request_url, status_code, expected_status_code ): """Validates that a request was successful. Args: response_text (str): The response body of the request. request_url (str): The URL the request was made at. sta...
[ "Validates", "that", "a", "request", "was", "successful", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/resource.py#L194-L220
[ "def", "validate_request_success", "(", "response_text", ",", "request_url", ",", "status_code", ",", "expected_status_code", ")", ":", "try", ":", "assert", "status_code", "==", "expected_status_code", "except", "AssertionError", ":", "msg", "=", "(", "\"Request to {...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
BaseTaskInstance.sync
Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: This task instance ... instance after syncing.
saltant/models/base_task_instance.py
def sync(self): """Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: This task instance .....
def sync(self): """Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: This task instance .....
[ "Sync", "this", "model", "with", "latest", "data", "on", "the", "saltant", "server", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_instance.py#L92-L104
[ "def", "sync", "(", "self", ")", ":", "self", "=", "self", ".", "manager", ".", "get", "(", "uuid", "=", "self", ".", "uuid", ")", "return", "self" ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
BaseTaskInstance.wait_until_finished
Wait until a task instance with the given UUID is finished. Args: refresh_period (int, optional): How many seconds to wait before checking the task's status. Defaults to 5 seconds. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstan...
saltant/models/base_task_instance.py
def wait_until_finished( self, refresh_period=DEFAULT_TASK_INSTANCE_WAIT_REFRESH_PERIOD ): """Wait until a task instance with the given UUID is finished. Args: refresh_period (int, optional): How many seconds to wait before checking the task's status. Defaults to...
def wait_until_finished( self, refresh_period=DEFAULT_TASK_INSTANCE_WAIT_REFRESH_PERIOD ): """Wait until a task instance with the given UUID is finished. Args: refresh_period (int, optional): How many seconds to wait before checking the task's status. Defaults to...
[ "Wait", "until", "a", "task", "instance", "with", "the", "given", "UUID", "is", "finished", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_instance.py#L125-L141
[ "def", "wait_until_finished", "(", "self", ",", "refresh_period", "=", "DEFAULT_TASK_INSTANCE_WAIT_REFRESH_PERIOD", ")", ":", "return", "self", ".", "manager", ".", "wait_until_finished", "(", "uuid", "=", "self", ".", "uuid", ",", "refresh_period", "=", "refresh_pe...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
BaseTaskInstanceManager.create
Create a task instance. Args: task_type_id (int): The ID of the task type to base the task instance on. task_queue_id (int): The ID of the task queue to run the job on. arguments (dict, optional): The arguments to give the task ...
saltant/models/base_task_instance.py
def create(self, task_type_id, task_queue_id, arguments=None, name=""): """Create a task instance. Args: task_type_id (int): The ID of the task type to base the task instance on. task_queue_id (int): The ID of the task queue to run the job on. ...
def create(self, task_type_id, task_queue_id, arguments=None, name=""): """Create a task instance. Args: task_type_id (int): The ID of the task type to base the task instance on. task_queue_id (int): The ID of the task queue to run the job on. ...
[ "Create", "a", "task", "instance", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_instance.py#L178-L220
[ "def", "create", "(", "self", ",", "task_type_id", ",", "task_queue_id", ",", "arguments", "=", "None", ",", "name", "=", "\"\"", ")", ":", "# Make arguments an empty dictionary if None", "if", "arguments", "is", "None", ":", "arguments", "=", "{", "}", "# Cre...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
BaseTaskInstanceManager.clone
Clone the task instance with given UUID. Args: uuid (str): The UUID of the task instance to clone. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: A task instance model instance representing the task instance created due to ...
saltant/models/base_task_instance.py
def clone(self, uuid): """Clone the task instance with given UUID. Args: uuid (str): The UUID of the task instance to clone. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: A task instance model instance representing the task ...
def clone(self, uuid): """Clone the task instance with given UUID. Args: uuid (str): The UUID of the task instance to clone. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: A task instance model instance representing the task ...
[ "Clone", "the", "task", "instance", "with", "given", "UUID", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_instance.py#L222-L249
[ "def", "clone", "(", "self", ",", "uuid", ")", ":", "# Clone the object", "request_url", "=", "self", ".", "_client", ".", "base_api_url", "+", "self", ".", "clone_url", ".", "format", "(", "id", "=", "uuid", ")", "response", "=", "self", ".", "_client",...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
BaseTaskInstanceManager.terminate
Terminate the task instance with given UUID. Args: uuid (str): The UUID of the task instance to terminate. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: A task instance model instance representing the task instance that wa...
saltant/models/base_task_instance.py
def terminate(self, uuid): """Terminate the task instance with given UUID. Args: uuid (str): The UUID of the task instance to terminate. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: A task instance model instance representing the...
def terminate(self, uuid): """Terminate the task instance with given UUID. Args: uuid (str): The UUID of the task instance to terminate. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: A task instance model instance representing the...
[ "Terminate", "the", "task", "instance", "with", "given", "UUID", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_instance.py#L267-L294
[ "def", "terminate", "(", "self", ",", "uuid", ")", ":", "# Clone the object", "request_url", "=", "self", ".", "_client", ".", "base_api_url", "+", "self", ".", "terminate_url", ".", "format", "(", "id", "=", "uuid", ")", "response", "=", "self", ".", "_...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
BaseTaskInstanceManager.wait_until_finished
Wait until a task instance with the given UUID is finished. Args: uuid (str): The UUID of the task instance to wait for. refresh_period (float, optional): How many seconds to wait in between checking the task's status. Defaults to 5 seconds. Retu...
saltant/models/base_task_instance.py
def wait_until_finished( self, uuid, refresh_period=DEFAULT_TASK_INSTANCE_WAIT_REFRESH_PERIOD ): """Wait until a task instance with the given UUID is finished. Args: uuid (str): The UUID of the task instance to wait for. refresh_period (float, optional): How many sec...
def wait_until_finished( self, uuid, refresh_period=DEFAULT_TASK_INSTANCE_WAIT_REFRESH_PERIOD ): """Wait until a task instance with the given UUID is finished. Args: uuid (str): The UUID of the task instance to wait for. refresh_period (float, optional): How many sec...
[ "Wait", "until", "a", "task", "instance", "with", "the", "given", "UUID", "is", "finished", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_instance.py#L312-L338
[ "def", "wait_until_finished", "(", "self", ",", "uuid", ",", "refresh_period", "=", "DEFAULT_TASK_INSTANCE_WAIT_REFRESH_PERIOD", ")", ":", "# Wait for the task to finish", "task_instance", "=", "self", ".", "get", "(", "uuid", ")", "while", "task_instance", ".", "stat...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
BaseTaskInstanceManager.response_data_to_model_instance
Convert response data to a task instance model. Args: response_data (dict): The data from the request's response. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: A task instance model instance representing the task instance ...
saltant/models/base_task_instance.py
def response_data_to_model_instance(self, response_data): """Convert response data to a task instance model. Args: response_data (dict): The data from the request's response. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: A task in...
def response_data_to_model_instance(self, response_data): """Convert response data to a task instance model. Args: response_data (dict): The data from the request's response. Returns: :class:`saltant.models.base_task_instance.BaseTaskInstance`: A task in...
[ "Convert", "response", "data", "to", "a", "task", "instance", "model", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_instance.py#L340-L364
[ "def", "response_data_to_model_instance", "(", "self", ",", "response_data", ")", ":", "# Coerce datetime strings into datetime objects", "response_data", "[", "\"datetime_created\"", "]", "=", "dateutil", ".", "parser", ".", "parse", "(", "response_data", "[", "\"datetim...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
CGEFinder.kma
I expect that there will only be one hit pr gene, but if there are more, I assume that the sequence of the hits are the same in the res file and the aln file.
cgecore/cgefinder.py
def kma(inputfile_1, out_path, databases, db_path_kma, min_cov=0.6, threshold=0.9, kma_path="cge/kma/kma", sample_name="", inputfile_2=None, kma_mrs=None, kma_gapopen=None, kma_gapextend=None, kma_penalty=None, kma_reward=None, kma_pm=None, kma_fpm=None, kma_memmode=False...
def kma(inputfile_1, out_path, databases, db_path_kma, min_cov=0.6, threshold=0.9, kma_path="cge/kma/kma", sample_name="", inputfile_2=None, kma_mrs=None, kma_gapopen=None, kma_gapextend=None, kma_penalty=None, kma_reward=None, kma_pm=None, kma_fpm=None, kma_memmode=False...
[ "I", "expect", "that", "there", "will", "only", "be", "one", "hit", "pr", "gene", "but", "if", "there", "are", "more", "I", "assume", "that", "the", "sequence", "of", "the", "hits", "are", "the", "same", "in", "the", "res", "file", "and", "the", "aln...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cgefinder.py#L28-L247
[ "def", "kma", "(", "inputfile_1", ",", "out_path", ",", "databases", ",", "db_path_kma", ",", "min_cov", "=", "0.6", ",", "threshold", "=", "0.9", ",", "kma_path", "=", "\"cge/kma/kma\"", ",", "sample_name", "=", "\"\"", ",", "inputfile_2", "=", "None", ",...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
RowWrapper._ids_and_column_names
Ensure all column names are unique identifiers.
src/brunns/row/rowwrapper.py
def _ids_and_column_names(names, force_lower_case=False): """Ensure all column names are unique identifiers.""" fixed = OrderedDict() for name in names: identifier = RowWrapper._make_identifier(name) if force_lower_case: identifier = identifier.lower() ...
def _ids_and_column_names(names, force_lower_case=False): """Ensure all column names are unique identifiers.""" fixed = OrderedDict() for name in names: identifier = RowWrapper._make_identifier(name) if force_lower_case: identifier = identifier.lower() ...
[ "Ensure", "all", "column", "names", "are", "unique", "identifiers", "." ]
brunns/brunns-row
python
https://github.com/brunns/brunns-row/blob/f7076a2d3072447719f728caadf08f33a6a26a7a/src/brunns/row/rowwrapper.py#L54-L64
[ "def", "_ids_and_column_names", "(", "names", ",", "force_lower_case", "=", "False", ")", ":", "fixed", "=", "OrderedDict", "(", ")", "for", "name", "in", "names", ":", "identifier", "=", "RowWrapper", ".", "_make_identifier", "(", "name", ")", "if", "force_...
f7076a2d3072447719f728caadf08f33a6a26a7a
train
RowWrapper._make_identifier
Attempt to convert string into a valid identifier by replacing invalid characters with "_"s, and prefixing with "a_" if necessary.
src/brunns/row/rowwrapper.py
def _make_identifier(string): """Attempt to convert string into a valid identifier by replacing invalid characters with "_"s, and prefixing with "a_" if necessary.""" string = re.sub(r"[ \-+/\\*%&$£#@.,;:'" "?<>]", "_", string) if re.match(r"^\d", string): string = "a_{0}".fo...
def _make_identifier(string): """Attempt to convert string into a valid identifier by replacing invalid characters with "_"s, and prefixing with "a_" if necessary.""" string = re.sub(r"[ \-+/\\*%&$£#@.,;:'" "?<>]", "_", string) if re.match(r"^\d", string): string = "a_{0}".fo...
[ "Attempt", "to", "convert", "string", "into", "a", "valid", "identifier", "by", "replacing", "invalid", "characters", "with", "_", "s", "and", "prefixing", "with", "a_", "if", "necessary", "." ]
brunns/brunns-row
python
https://github.com/brunns/brunns-row/blob/f7076a2d3072447719f728caadf08f33a6a26a7a/src/brunns/row/rowwrapper.py#L67-L73
[ "def", "_make_identifier", "(", "string", ")", ":", "string", "=", "re", ".", "sub", "(", "r\"[ \\-+/\\\\*%&$£#@.,;:'\" ", "?<>]\",", " ", "_\",", " ", "tring)", "", "if", "re", ".", "match", "(", "r\"^\\d\"", ",", "string", ")", ":", "string", "=", "\"a...
f7076a2d3072447719f728caadf08f33a6a26a7a
train
RowWrapper._increment_numeric_suffix
Increment (or add) numeric suffix to identifier.
src/brunns/row/rowwrapper.py
def _increment_numeric_suffix(s): """Increment (or add) numeric suffix to identifier.""" if re.match(r".*\d+$", s): return re.sub(r"\d+$", lambda n: str(int(n.group(0)) + 1), s) return s + "_2"
def _increment_numeric_suffix(s): """Increment (or add) numeric suffix to identifier.""" if re.match(r".*\d+$", s): return re.sub(r"\d+$", lambda n: str(int(n.group(0)) + 1), s) return s + "_2"
[ "Increment", "(", "or", "add", ")", "numeric", "suffix", "to", "identifier", "." ]
brunns/brunns-row
python
https://github.com/brunns/brunns-row/blob/f7076a2d3072447719f728caadf08f33a6a26a7a/src/brunns/row/rowwrapper.py#L76-L80
[ "def", "_increment_numeric_suffix", "(", "s", ")", ":", "if", "re", ".", "match", "(", "r\".*\\d+$\"", ",", "s", ")", ":", "return", "re", ".", "sub", "(", "r\"\\d+$\"", ",", "lambda", "n", ":", "str", "(", "int", "(", "n", ".", "group", "(", "0", ...
f7076a2d3072447719f728caadf08f33a6a26a7a
train
RowWrapper.wrap
Return row tuple for row.
src/brunns/row/rowwrapper.py
def wrap(self, row: Union[Mapping[str, Any], Sequence[Any]]): """Return row tuple for row.""" return ( self.dataclass( **{ ident: row[column_name] for ident, column_name in self.ids_and_column_names.items() } ...
def wrap(self, row: Union[Mapping[str, Any], Sequence[Any]]): """Return row tuple for row.""" return ( self.dataclass( **{ ident: row[column_name] for ident, column_name in self.ids_and_column_names.items() } ...
[ "Return", "row", "tuple", "for", "row", "." ]
brunns/brunns-row
python
https://github.com/brunns/brunns-row/blob/f7076a2d3072447719f728caadf08f33a6a26a7a/src/brunns/row/rowwrapper.py#L82-L95
[ "def", "wrap", "(", "self", ",", "row", ":", "Union", "[", "Mapping", "[", "str", ",", "Any", "]", ",", "Sequence", "[", "Any", "]", "]", ")", ":", "return", "(", "self", ".", "dataclass", "(", "*", "*", "{", "ident", ":", "row", "[", "column_n...
f7076a2d3072447719f728caadf08f33a6a26a7a
train
RowWrapper.wrap_all
Return row tuple for each row in rows.
src/brunns/row/rowwrapper.py
def wrap_all(self, rows: Iterable[Union[Mapping[str, Any], Sequence[Any]]]): """Return row tuple for each row in rows.""" return (self.wrap(r) for r in rows)
def wrap_all(self, rows: Iterable[Union[Mapping[str, Any], Sequence[Any]]]): """Return row tuple for each row in rows.""" return (self.wrap(r) for r in rows)
[ "Return", "row", "tuple", "for", "each", "row", "in", "rows", "." ]
brunns/brunns-row
python
https://github.com/brunns/brunns-row/blob/f7076a2d3072447719f728caadf08f33a6a26a7a/src/brunns/row/rowwrapper.py#L97-L99
[ "def", "wrap_all", "(", "self", ",", "rows", ":", "Iterable", "[", "Union", "[", "Mapping", "[", "str", ",", "Any", "]", ",", "Sequence", "[", "Any", "]", "]", "]", ")", ":", "return", "(", "self", ".", "wrap", "(", "r", ")", "for", "r", "in", ...
f7076a2d3072447719f728caadf08f33a6a26a7a
train
add_error_handlers
Add custom error handlers for PyMacaronCoreExceptions to the app
pymacaron_core/exceptions.py
def add_error_handlers(app): """Add custom error handlers for PyMacaronCoreExceptions to the app""" def handle_validation_error(error): response = jsonify({'message': str(error)}) response.status_code = error.status_code return response app.errorhandler(ValidationError)(handle_vali...
def add_error_handlers(app): """Add custom error handlers for PyMacaronCoreExceptions to the app""" def handle_validation_error(error): response = jsonify({'message': str(error)}) response.status_code = error.status_code return response app.errorhandler(ValidationError)(handle_vali...
[ "Add", "custom", "error", "handlers", "for", "PyMacaronCoreExceptions", "to", "the", "app" ]
pymacaron/pymacaron-core
python
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/exceptions.py#L25-L33
[ "def", "add_error_handlers", "(", "app", ")", ":", "def", "handle_validation_error", "(", "error", ")", ":", "response", "=", "jsonify", "(", "{", "'message'", ":", "str", "(", "error", ")", "}", ")", "response", ".", "status_code", "=", "error", ".", "s...
95070a39ed7065a84244ff5601fea4d54cc72b66
train
FastlyConnection.list_backends
List all backends for a particular service and version.
fastly/__init__.py
def list_backends(self, service_id, version_number): """List all backends for a particular service and version.""" content = self._fetch("/service/%s/version/%d/backend" % (service_id, version_number)) return map(lambda x: FastlyBackend(self, x), content)
def list_backends(self, service_id, version_number): """List all backends for a particular service and version.""" content = self._fetch("/service/%s/version/%d/backend" % (service_id, version_number)) return map(lambda x: FastlyBackend(self, x), content)
[ "List", "all", "backends", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L123-L127
[ "def", "list_backends", "(", "self", ",", "service_id", ",", "version_number", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/backend\"", "%", "(", "service_id", ",", "version_number", ")", ")", "return", "map", "(", "lambda", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.create_backend
Create a backend for a particular service and version.
fastly/__init__.py
def create_backend(self, service_id, version_number, name, address, use_ssl=False, port=80, connect_timeout=1000, first_byte_timeout=15000, between_bytes_timeout=10000, error_threshold=0, max_conn=20, weight=100, auto_loadbalance=False, shield=None, request_condition=None, healthcheck...
def create_backend(self, service_id, version_number, name, address, use_ssl=False, port=80, connect_timeout=1000, first_byte_timeout=15000, between_bytes_timeout=10000, error_threshold=0, max_conn=20, weight=100, auto_loadbalance=False, shield=None, request_condition=None, healthcheck...
[ "Create", "a", "backend", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L130-L167
[ "def", "create_backend", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ",", "address", ",", "use_ssl", "=", "False", ",", "port", "=", "80", ",", "connect_timeout", "=", "1000", ",", "first_byte_timeout", "=", "15000", ",", "between_byt...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.get_backend
Get the backend for a particular service and version.
fastly/__init__.py
def get_backend(self, service_id, version_number, name): """Get the backend for a particular service and version.""" content = self._fetch("/service/%s/version/%d/backend/%s" % (service_id, version_number, name)) return FastlyBackend(self, content)
def get_backend(self, service_id, version_number, name): """Get the backend for a particular service and version.""" content = self._fetch("/service/%s/version/%d/backend/%s" % (service_id, version_number, name)) return FastlyBackend(self, content)
[ "Get", "the", "backend", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L170-L173
[ "def", "get_backend", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/backend/%s\"", "%", "(", "service_id", ",", "version_number", ",", "name", ")", ")", "retu...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.update_backend
Update the backend for a particular service and version.
fastly/__init__.py
def update_backend(self, service_id, version_number, name_key, **kwargs): """Update the backend for a particular service and version.""" body = self._formdata(kwargs, FastlyBackend.FIELDS) content = self._fetch("/service/%s/version/%d/backend/%s" % (service_id, version_number, name_key), method="PUT", body=body) ...
def update_backend(self, service_id, version_number, name_key, **kwargs): """Update the backend for a particular service and version.""" body = self._formdata(kwargs, FastlyBackend.FIELDS) content = self._fetch("/service/%s/version/%d/backend/%s" % (service_id, version_number, name_key), method="PUT", body=body) ...
[ "Update", "the", "backend", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L176-L180
[ "def", "update_backend", "(", "self", ",", "service_id", ",", "version_number", ",", "name_key", ",", "*", "*", "kwargs", ")", ":", "body", "=", "self", ".", "_formdata", "(", "kwargs", ",", "FastlyBackend", ".", "FIELDS", ")", "content", "=", "self", "....
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.check_backends
Performs a health check against each backend in version. If the backend has a specific type of healthcheck, that one is performed, otherwise a HEAD request to / is performed. The first item is the details on the Backend itself. The second item is details of the specific HTTP request performed as a health check. The thi...
fastly/__init__.py
def check_backends(self, service_id, version_number): """Performs a health check against each backend in version. If the backend has a specific type of healthcheck, that one is performed, otherwise a HEAD request to / is performed. The first item is the details on the Backend itself. The second item is details of the...
def check_backends(self, service_id, version_number): """Performs a health check against each backend in version. If the backend has a specific type of healthcheck, that one is performed, otherwise a HEAD request to / is performed. The first item is the details on the Backend itself. The second item is details of the...
[ "Performs", "a", "health", "check", "against", "each", "backend", "in", "version", ".", "If", "the", "backend", "has", "a", "specific", "type", "of", "healthcheck", "that", "one", "is", "performed", "otherwise", "a", "HEAD", "request", "to", "/", "is", "pe...
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L189-L193
[ "def", "check_backends", "(", "self", ",", "service_id", ",", "version_number", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/backend/check_all\"", "%", "(", "service_id", ",", "version_number", ")", ")", "# TODO: Use a strong-typed c...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.list_cache_settings
Get a list of all cache settings for a particular service and version.
fastly/__init__.py
def list_cache_settings(self, service_id, version_number): """Get a list of all cache settings for a particular service and version.""" content = self._fetch("/service/%s/version/%d/cache_settings" % (service_id, version_number)) return map(lambda x: FastlyCacheSettings(self, x), content)
def list_cache_settings(self, service_id, version_number): """Get a list of all cache settings for a particular service and version.""" content = self._fetch("/service/%s/version/%d/cache_settings" % (service_id, version_number)) return map(lambda x: FastlyCacheSettings(self, x), content)
[ "Get", "a", "list", "of", "all", "cache", "settings", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L196-L199
[ "def", "list_cache_settings", "(", "self", ",", "service_id", ",", "version_number", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/cache_settings\"", "%", "(", "service_id", ",", "version_number", ")", ")", "return", "map", "(", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.create_cache_settings
Create a new cache settings object.
fastly/__init__.py
def create_cache_settings(self, service_id, version_number, name, action, ttl=None, stale_ttl=None, cache_condition=None): """Create a new cache settings object.""" body = self._formdata({ "name": name, "action": action, "ttl": ttl, "stale_ttl": stale_ttl, "cache_condition": cache_co...
def create_cache_settings(self, service_id, version_number, name, action, ttl=None, stale_ttl=None, cache_condition=None): """Create a new cache settings object.""" body = self._formdata({ "name": name, "action": action, "ttl": ttl, "stale_ttl": stale_ttl, "cache_condition": cache_co...
[ "Create", "a", "new", "cache", "settings", "object", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L202-L219
[ "def", "create_cache_settings", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ",", "action", ",", "ttl", "=", "None", ",", "stale_ttl", "=", "None", ",", "cache_condition", "=", "None", ")", ":", "body", "=", "self", ".", "_formdata",...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.get_cache_settings
Get a specific cache settings object.
fastly/__init__.py
def get_cache_settings(self, service_id, version_number, name): """Get a specific cache settings object.""" content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name)) return FastlyCacheSettings(self, content)
def get_cache_settings(self, service_id, version_number, name): """Get a specific cache settings object.""" content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name)) return FastlyCacheSettings(self, content)
[ "Get", "a", "specific", "cache", "settings", "object", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L222-L225
[ "def", "get_cache_settings", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/cache_settings/%s\"", "%", "(", "service_id", ",", "version_number", ",", "name", ")", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.update_cache_settings
Update a specific cache settings object.
fastly/__init__.py
def update_cache_settings(self, service_id, version_number, name_key, **kwargs): """Update a specific cache settings object.""" body = self._formdata(kwargs, FastlyCacheSettings.FIELDS) content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name_key), method="PUT", body=bo...
def update_cache_settings(self, service_id, version_number, name_key, **kwargs): """Update a specific cache settings object.""" body = self._formdata(kwargs, FastlyCacheSettings.FIELDS) content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name_key), method="PUT", body=bo...
[ "Update", "a", "specific", "cache", "settings", "object", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L228-L232
[ "def", "update_cache_settings", "(", "self", ",", "service_id", ",", "version_number", ",", "name_key", ",", "*", "*", "kwargs", ")", ":", "body", "=", "self", ".", "_formdata", "(", "kwargs", ",", "FastlyCacheSettings", ".", "FIELDS", ")", "content", "=", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.delete_cache_settings
Delete a specific cache settings object.
fastly/__init__.py
def delete_cache_settings(self, service_id, version_number, name): """Delete a specific cache settings object.""" content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name), method="DELETE") return self._status(content)
def delete_cache_settings(self, service_id, version_number, name): """Delete a specific cache settings object.""" content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name), method="DELETE") return self._status(content)
[ "Delete", "a", "specific", "cache", "settings", "object", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L235-L238
[ "def", "delete_cache_settings", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/cache_settings/%s\"", "%", "(", "service_id", ",", "version_number", ",", "name", ")...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.list_conditions
Gets all conditions for a particular service and version.
fastly/__init__.py
def list_conditions(self, service_id, version_number): """Gets all conditions for a particular service and version.""" content = self._fetch("/service/%s/version/%d/condition" % (service_id, version_number)) return map(lambda x: FastlyCondition(self, x), content)
def list_conditions(self, service_id, version_number): """Gets all conditions for a particular service and version.""" content = self._fetch("/service/%s/version/%d/condition" % (service_id, version_number)) return map(lambda x: FastlyCondition(self, x), content)
[ "Gets", "all", "conditions", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L241-L244
[ "def", "list_conditions", "(", "self", ",", "service_id", ",", "version_number", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/condition\"", "%", "(", "service_id", ",", "version_number", ")", ")", "return", "map", "(", "lambda"...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.create_condition
Creates a new condition.
fastly/__init__.py
def create_condition(self, service_id, version_number, name, _type, statement, priority="10", comment=None): """Creates a new condition.""" body = self._formdata({ "name": name, "type": _type, "statement": statement, "priority": priority, "comment": comment, }, FastlyCondition.FIEL...
def create_condition(self, service_id, version_number, name, _type, statement, priority="10", comment=None): """Creates a new condition.""" body = self._formdata({ "name": name, "type": _type, "statement": statement, "priority": priority, "comment": comment, }, FastlyCondition.FIEL...
[ "Creates", "a", "new", "condition", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L247-L264
[ "def", "create_condition", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ",", "_type", ",", "statement", ",", "priority", "=", "\"10\"", ",", "comment", "=", "None", ")", ":", "body", "=", "self", ".", "_formdata", "(", "{", "\"name...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.get_condition
Gets a specified condition.
fastly/__init__.py
def get_condition(self, service_id, version_number, name): """Gets a specified condition.""" content = self._fetch("/service/%s/version/%d/condition/%s" % (service_id, version_number, name)) return FastlyCondition(self, content)
def get_condition(self, service_id, version_number, name): """Gets a specified condition.""" content = self._fetch("/service/%s/version/%d/condition/%s" % (service_id, version_number, name)) return FastlyCondition(self, content)
[ "Gets", "a", "specified", "condition", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L267-L270
[ "def", "get_condition", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/condition/%s\"", "%", "(", "service_id", ",", "version_number", ",", "name", ")", ")", "...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.update_condition
Updates the specified condition.
fastly/__init__.py
def update_condition(self, service_id, version_number, name_key, **kwargs): """Updates the specified condition.""" body = self._formdata(kwargs, FastlyCondition.FIELDS) content = self._fetch("/service/%s/version/%d/condition/%s" % (service_id, version_number, name_key), method="PUT", body=body) return FastlyCon...
def update_condition(self, service_id, version_number, name_key, **kwargs): """Updates the specified condition.""" body = self._formdata(kwargs, FastlyCondition.FIELDS) content = self._fetch("/service/%s/version/%d/condition/%s" % (service_id, version_number, name_key), method="PUT", body=body) return FastlyCon...
[ "Updates", "the", "specified", "condition", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L273-L277
[ "def", "update_condition", "(", "self", ",", "service_id", ",", "version_number", ",", "name_key", ",", "*", "*", "kwargs", ")", ":", "body", "=", "self", ".", "_formdata", "(", "kwargs", ",", "FastlyCondition", ".", "FIELDS", ")", "content", "=", "self", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.content_edge_check
Retrieve headers and MD5 hash of the content for a particular url from each Fastly edge server.
fastly/__init__.py
def content_edge_check(self, url): """Retrieve headers and MD5 hash of the content for a particular url from each Fastly edge server.""" prefixes = ["http://", "https://"] for prefix in prefixes: if url.startswith(prefix): url = url[len(prefix):] break content = self._fetch("/content/edge_check/%s" %...
def content_edge_check(self, url): """Retrieve headers and MD5 hash of the content for a particular url from each Fastly edge server.""" prefixes = ["http://", "https://"] for prefix in prefixes: if url.startswith(prefix): url = url[len(prefix):] break content = self._fetch("/content/edge_check/%s" %...
[ "Retrieve", "headers", "and", "MD5", "hash", "of", "the", "content", "for", "a", "particular", "url", "from", "each", "Fastly", "edge", "server", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L286-L294
[ "def", "content_edge_check", "(", "self", ",", "url", ")", ":", "prefixes", "=", "[", "\"http://\"", ",", "\"https://\"", "]", "for", "prefix", "in", "prefixes", ":", "if", "url", ".", "startswith", "(", "prefix", ")", ":", "url", "=", "url", "[", "len...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.get_customer
Get a specific customer.
fastly/__init__.py
def get_customer(self, customer_id): """Get a specific customer.""" content = self._fetch("/customer/%s" % customer_id) return FastlyCustomer(self, content)
def get_customer(self, customer_id): """Get a specific customer.""" content = self._fetch("/customer/%s" % customer_id) return FastlyCustomer(self, content)
[ "Get", "a", "specific", "customer", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L303-L306
[ "def", "get_customer", "(", "self", ",", "customer_id", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/customer/%s\"", "%", "customer_id", ")", "return", "FastlyCustomer", "(", "self", ",", "content", ")" ]
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.list_customer_users
List all users from a specified customer id.
fastly/__init__.py
def list_customer_users(self, customer_id): """List all users from a specified customer id.""" content = self._fetch("/customer/users/%s" % customer_id) return map(lambda x: FastlyUser(self, x), content)
def list_customer_users(self, customer_id): """List all users from a specified customer id.""" content = self._fetch("/customer/users/%s" % customer_id) return map(lambda x: FastlyUser(self, x), content)
[ "List", "all", "users", "from", "a", "specified", "customer", "id", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L315-L318
[ "def", "list_customer_users", "(", "self", ",", "customer_id", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/customer/users/%s\"", "%", "customer_id", ")", "return", "map", "(", "lambda", "x", ":", "FastlyUser", "(", "self", ",", "x", ")", ",",...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.update_customer
Update a customer.
fastly/__init__.py
def update_customer(self, customer_id, **kwargs): """Update a customer.""" body = self._formdata(kwargs, FastlyCustomer.FIELDS) content = self._fetch("/customer/%s" % customer_id, method="PUT", body=body) return FastlyCustomer(self, content)
def update_customer(self, customer_id, **kwargs): """Update a customer.""" body = self._formdata(kwargs, FastlyCustomer.FIELDS) content = self._fetch("/customer/%s" % customer_id, method="PUT", body=body) return FastlyCustomer(self, content)
[ "Update", "a", "customer", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L321-L325
[ "def", "update_customer", "(", "self", ",", "customer_id", ",", "*", "*", "kwargs", ")", ":", "body", "=", "self", ".", "_formdata", "(", "kwargs", ",", "FastlyCustomer", ".", "FIELDS", ")", "content", "=", "self", ".", "_fetch", "(", "\"/customer/%s\"", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.delete_customer
Delete a customer.
fastly/__init__.py
def delete_customer(self, customer_id): """Delete a customer.""" content = self._fetch("/customer/%s" % customer_id, method="DELETE") return self._status(content)
def delete_customer(self, customer_id): """Delete a customer.""" content = self._fetch("/customer/%s" % customer_id, method="DELETE") return self._status(content)
[ "Delete", "a", "customer", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L328-L331
[ "def", "delete_customer", "(", "self", ",", "customer_id", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/customer/%s\"", "%", "customer_id", ",", "method", "=", "\"DELETE\"", ")", "return", "self", ".", "_status", "(", "content", ")" ]
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.list_directors
List the directors for a particular service and version.
fastly/__init__.py
def list_directors(self, service_id, version_number): """List the directors for a particular service and version.""" content = self._fetch("/service/%s/version/%d/director" % (service_id, version_number)) return map(lambda x: FastlyDirector(self, x), content)
def list_directors(self, service_id, version_number): """List the directors for a particular service and version.""" content = self._fetch("/service/%s/version/%d/director" % (service_id, version_number)) return map(lambda x: FastlyDirector(self, x), content)
[ "List", "the", "directors", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L334-L337
[ "def", "list_directors", "(", "self", ",", "service_id", ",", "version_number", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/director\"", "%", "(", "service_id", ",", "version_number", ")", ")", "return", "map", "(", "lambda", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.create_director
Create a director for a particular service and version.
fastly/__init__.py
def create_director(self, service_id, version_number, name, quorum=75, _type=FastlyDirectorType.RANDOM, retries=5, shield=None): """Create a director for a particular service and version.""" body = self._formdata({ "name": name, "quorum": quorum, "type": _type, "retries": retries, "shield...
def create_director(self, service_id, version_number, name, quorum=75, _type=FastlyDirectorType.RANDOM, retries=5, shield=None): """Create a director for a particular service and version.""" body = self._formdata({ "name": name, "quorum": quorum, "type": _type, "retries": retries, "shield...
[ "Create", "a", "director", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L340-L356
[ "def", "create_director", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ",", "quorum", "=", "75", ",", "_type", "=", "FastlyDirectorType", ".", "RANDOM", ",", "retries", "=", "5", ",", "shield", "=", "None", ")", ":", "body", "=", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.get_director
Get the director for a particular service and version.
fastly/__init__.py
def get_director(self, service_id, version_number, name): """Get the director for a particular service and version.""" content = self._fetch("/service/%s/version/%d/director/%s" % (service_id, version_number, name)) return FastlyDirector(self, content)
def get_director(self, service_id, version_number, name): """Get the director for a particular service and version.""" content = self._fetch("/service/%s/version/%d/director/%s" % (service_id, version_number, name)) return FastlyDirector(self, content)
[ "Get", "the", "director", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L359-L362
[ "def", "get_director", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/director/%s\"", "%", "(", "service_id", ",", "version_number", ",", "name", ")", ")", "re...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.update_director
Update the director for a particular service and version.
fastly/__init__.py
def update_director(self, service_id, version_number, name_key, **kwargs): """Update the director for a particular service and version.""" body = self._formdata(kwargs, FastlyDirector.FIELDS) content = self._fetch("/service/%s/version/%d/director/%s" % (service_id, version_number, name_key), method="PUT", body=bo...
def update_director(self, service_id, version_number, name_key, **kwargs): """Update the director for a particular service and version.""" body = self._formdata(kwargs, FastlyDirector.FIELDS) content = self._fetch("/service/%s/version/%d/director/%s" % (service_id, version_number, name_key), method="PUT", body=bo...
[ "Update", "the", "director", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L365-L369
[ "def", "update_director", "(", "self", ",", "service_id", ",", "version_number", ",", "name_key", ",", "*", "*", "kwargs", ")", ":", "body", "=", "self", ".", "_formdata", "(", "kwargs", ",", "FastlyDirector", ".", "FIELDS", ")", "content", "=", "self", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.get_director_backend
Returns the relationship between a Backend and a Director. If the Backend has been associated with the Director, it returns a simple record indicating this. Otherwise, returns a 404.
fastly/__init__.py
def get_director_backend(self, service_id, version_number, director_name, backend_name): """Returns the relationship between a Backend and a Director. If the Backend has been associated with the Director, it returns a simple record indicating this. Otherwise, returns a 404.""" content = self._fetch("/service/%s/ver...
def get_director_backend(self, service_id, version_number, director_name, backend_name): """Returns the relationship between a Backend and a Director. If the Backend has been associated with the Director, it returns a simple record indicating this. Otherwise, returns a 404.""" content = self._fetch("/service/%s/ver...
[ "Returns", "the", "relationship", "between", "a", "Backend", "and", "a", "Director", ".", "If", "the", "Backend", "has", "been", "associated", "with", "the", "Director", "it", "returns", "a", "simple", "record", "indicating", "this", ".", "Otherwise", "returns...
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L378-L381
[ "def", "get_director_backend", "(", "self", ",", "service_id", ",", "version_number", ",", "director_name", ",", "backend_name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/director/%s/backend/%s\"", "%", "(", "service_id", ",", "...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.delete_director_backend
Deletes the relationship between a Backend and a Director. The Backend is no longer considered a member of the Director and thus will not have traffic balanced onto it from this Director.
fastly/__init__.py
def delete_director_backend(self, service_id, version_number, director_name, backend_name): """Deletes the relationship between a Backend and a Director. The Backend is no longer considered a member of the Director and thus will not have traffic balanced onto it from this Director.""" content = self._fetch("/servic...
def delete_director_backend(self, service_id, version_number, director_name, backend_name): """Deletes the relationship between a Backend and a Director. The Backend is no longer considered a member of the Director and thus will not have traffic balanced onto it from this Director.""" content = self._fetch("/servic...
[ "Deletes", "the", "relationship", "between", "a", "Backend", "and", "a", "Director", ".", "The", "Backend", "is", "no", "longer", "considered", "a", "member", "of", "the", "Director", "and", "thus", "will", "not", "have", "traffic", "balanced", "onto", "it",...
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L390-L393
[ "def", "delete_director_backend", "(", "self", ",", "service_id", ",", "version_number", ",", "director_name", ",", "backend_name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/director/%s/backend/%s\"", "%", "(", "service_id", ",", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.list_domains
List the domains for a particular service and version.
fastly/__init__.py
def list_domains(self, service_id, version_number): """List the domains for a particular service and version.""" content = self._fetch("/service/%s/version/%d/domain" % (service_id, version_number)) return map(lambda x: FastlyDomain(self, x), content)
def list_domains(self, service_id, version_number): """List the domains for a particular service and version.""" content = self._fetch("/service/%s/version/%d/domain" % (service_id, version_number)) return map(lambda x: FastlyDomain(self, x), content)
[ "List", "the", "domains", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L396-L399
[ "def", "list_domains", "(", "self", ",", "service_id", ",", "version_number", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/domain\"", "%", "(", "service_id", ",", "version_number", ")", ")", "return", "map", "(", "lambda", "x...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
FastlyConnection.create_domain
Create a domain for a particular service and version.
fastly/__init__.py
def create_domain(self, service_id, version_number, name, comment=None): """Create a domain for a particular service and version.""" body = self._formdata({ "name": name, "comment": comment, }, FastlyDomain.FIELDS) content = self._fetch("/service/%s/version/%d/domain" % (service_id, version_nu...
def create_domain(self, service_id, version_number, name, comment=None): """Create a domain for a particular service and version.""" body = self._formdata({ "name": name, "comment": comment, }, FastlyDomain.FIELDS) content = self._fetch("/service/%s/version/%d/domain" % (service_id, version_nu...
[ "Create", "a", "domain", "for", "a", "particular", "service", "and", "version", "." ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L402-L414
[ "def", "create_domain", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ",", "comment", "=", "None", ")", ":", "body", "=", "self", ".", "_formdata", "(", "{", "\"name\"", ":", "name", ",", "\"comment\"", ":", "comment", ",", "}", "...
db2564b047e8af4bce72c3b88d6c27d3d0291425