repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
openstax/cnx-easybake
cnxeasybake/oven.py
Oven.do_counter_reset
def do_counter_reset(self, element, decl, pseudo): """Clear specified counters.""" step = self.state[self.state['current_step']] counter_name = '' for term in decl.value: if type(term) is ast.WhitespaceToken: continue elif type(term) is ast.IdentT...
python
def do_counter_reset(self, element, decl, pseudo): """Clear specified counters.""" step = self.state[self.state['current_step']] counter_name = '' for term in decl.value: if type(term) is ast.WhitespaceToken: continue elif type(term) is ast.IdentT...
[ "def", "do_counter_reset", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "step", "=", "self", ".", "state", "[", "self", ".", "state", "[", "'current_step'", "]", "]", "counter_name", "=", "''", "for", "term", "in", "decl", ".", ...
Clear specified counters.
[ "Clear", "specified", "counters", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L936-L963
openstax/cnx-easybake
cnxeasybake/oven.py
Oven.do_node_set
def do_node_set(self, element, decl, pseudo): """Implement node-set declaration.""" target = serialize(decl.value).strip() step = self.state[self.state['current_step']] elem = self.current_target().tree _, valstep = self.lookup('pending', target) if not valstep: ...
python
def do_node_set(self, element, decl, pseudo): """Implement node-set declaration.""" target = serialize(decl.value).strip() step = self.state[self.state['current_step']] elem = self.current_target().tree _, valstep = self.lookup('pending', target) if not valstep: ...
[ "def", "do_node_set", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "target", "=", "serialize", "(", "decl", ".", "value", ")", ".", "strip", "(", ")", "step", "=", "self", ".", "state", "[", "self", ".", "state", "[", "'curren...
Implement node-set declaration.
[ "Implement", "node", "-", "set", "declaration", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L1008-L1017
openstax/cnx-easybake
cnxeasybake/oven.py
Oven.do_move_to
def do_move_to(self, element, decl, pseudo): """Implement move-to declaration.""" target = serialize(decl.value).strip() step = self.state[self.state['current_step']] elem = self.current_target().tree # Find if the current node already has a move, and remove it. actions...
python
def do_move_to(self, element, decl, pseudo): """Implement move-to declaration.""" target = serialize(decl.value).strip() step = self.state[self.state['current_step']] elem = self.current_target().tree # Find if the current node already has a move, and remove it. actions...
[ "def", "do_move_to", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "target", "=", "serialize", "(", "decl", ".", "value", ")", ".", "strip", "(", ")", "step", "=", "self", ".", "state", "[", "self", ".", "state", "[", "'current...
Implement move-to declaration.
[ "Implement", "move", "-", "to", "declaration", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L1032-L1050
openstax/cnx-easybake
cnxeasybake/oven.py
Oven.do_container
def do_container(self, element, decl, pseudo): """Implement setting tag for new wrapper element.""" value = serialize(decl.value).strip() if '|' in value: namespace, tag = value.split('|', 1) try: namespace = self.css_namespaces[namespace] ex...
python
def do_container(self, element, decl, pseudo): """Implement setting tag for new wrapper element.""" value = serialize(decl.value).strip() if '|' in value: namespace, tag = value.split('|', 1) try: namespace = self.css_namespaces[namespace] ex...
[ "def", "do_container", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "value", "=", "serialize", "(", "decl", ".", "value", ")", ".", "strip", "(", ")", "if", "'|'", "in", "value", ":", "namespace", ",", "tag", "=", "value", "."...
Implement setting tag for new wrapper element.
[ "Implement", "setting", "tag", "for", "new", "wrapper", "element", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L1053-L1071
openstax/cnx-easybake
cnxeasybake/oven.py
Oven.do_class
def do_class(self, element, decl, pseudo): """Implement class declaration - pre-match.""" step = self.state[self.state['current_step']] actions = step['actions'] strval = self.eval_string_value(element, decl.value) actions.append(('attrib', ('class', strval)))
python
def do_class(self, element, decl, pseudo): """Implement class declaration - pre-match.""" step = self.state[self.state['current_step']] actions = step['actions'] strval = self.eval_string_value(element, decl.value) actions.append(('attrib', ('class', strval)))
[ "def", "do_class", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "step", "=", "self", ".", "state", "[", "self", ".", "state", "[", "'current_step'", "]", "]", "actions", "=", "step", "[", "'actions'", "]", "strval", "=", "self",...
Implement class declaration - pre-match.
[ "Implement", "class", "declaration", "-", "pre", "-", "match", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L1074-L1079
openstax/cnx-easybake
cnxeasybake/oven.py
Oven.do_attr_any
def do_attr_any(self, element, decl, pseudo): """Implement generic attribute setting.""" step = self.state[self.state['current_step']] actions = step['actions'] strval = self.eval_string_value(element, decl.value) actions.append(('attrib', (decl.name[5:], strval)))
python
def do_attr_any(self, element, decl, pseudo): """Implement generic attribute setting.""" step = self.state[self.state['current_step']] actions = step['actions'] strval = self.eval_string_value(element, decl.value) actions.append(('attrib', (decl.name[5:], strval)))
[ "def", "do_attr_any", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "step", "=", "self", ".", "state", "[", "self", ".", "state", "[", "'current_step'", "]", "]", "actions", "=", "step", "[", "'actions'", "]", "strval", "=", "sel...
Implement generic attribute setting.
[ "Implement", "generic", "attribute", "setting", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L1082-L1087
openstax/cnx-easybake
cnxeasybake/oven.py
Oven.do_content
def do_content(self, element, decl, pseudo): """Implement content declaration.""" # FIXME Need?: link(id) step = self.state[self.state['current_step']] actions = step['actions'] wastebin = [] elem = self.current_target().tree if elem == element.etree_element or p...
python
def do_content(self, element, decl, pseudo): """Implement content declaration.""" # FIXME Need?: link(id) step = self.state[self.state['current_step']] actions = step['actions'] wastebin = [] elem = self.current_target().tree if elem == element.etree_element or p...
[ "def", "do_content", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "# FIXME Need?: link(id)", "step", "=", "self", ".", "state", "[", "self", ".", "state", "[", "'current_step'", "]", "]", "actions", "=", "step", "[", "'actions'", "]...
Implement content declaration.
[ "Implement", "content", "declaration", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L1098-L1247
openstax/cnx-easybake
cnxeasybake/oven.py
Oven.do_group_by
def do_group_by(self, element, decl, pseudo): """Implement group-by declaration - pre-match.""" sort_css = groupby_css = flags = '' if ',' in decl.value: if decl.value.count(',') == 2: sort_css, groupby_css, flags = \ map(serialize, split(decl....
python
def do_group_by(self, element, decl, pseudo): """Implement group-by declaration - pre-match.""" sort_css = groupby_css = flags = '' if ',' in decl.value: if decl.value.count(',') == 2: sort_css, groupby_css, flags = \ map(serialize, split(decl....
[ "def", "do_group_by", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "sort_css", "=", "groupby_css", "=", "flags", "=", "''", "if", "','", "in", "decl", ".", "value", ":", "if", "decl", ".", "value", ".", "count", "(", "','", ")...
Implement group-by declaration - pre-match.
[ "Implement", "group", "-", "by", "declaration", "-", "pre", "-", "match", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L1250-L1283
openstax/cnx-easybake
cnxeasybake/oven.py
Oven.do_sort_by
def do_sort_by(self, element, decl, pseudo): """Implement sort-by declaration - pre-match.""" if ',' in decl.value: css, flags = split(decl.value, ',') else: css = decl.value flags = None sort = css_to_func(serialize(css), serialize(flags or ''), ...
python
def do_sort_by(self, element, decl, pseudo): """Implement sort-by declaration - pre-match.""" if ',' in decl.value: css, flags = split(decl.value, ',') else: css = decl.value flags = None sort = css_to_func(serialize(css), serialize(flags or ''), ...
[ "def", "do_sort_by", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "if", "','", "in", "decl", ".", "value", ":", "css", ",", "flags", "=", "split", "(", "decl", ".", "value", ",", "','", ")", "else", ":", "css", "=", "decl", ...
Implement sort-by declaration - pre-match.
[ "Implement", "sort", "-", "by", "declaration", "-", "pre", "-", "match", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L1286-L1310
openstax/cnx-easybake
cnxeasybake/oven.py
Oven.do_pass
def do_pass(self, element, decl, pseudo): """No longer valid way to set processing pass.""" log(WARN, u"Old-style pass as declaration not allowed.{}" .format(decl.value).encpde('utf-8'))
python
def do_pass(self, element, decl, pseudo): """No longer valid way to set processing pass.""" log(WARN, u"Old-style pass as declaration not allowed.{}" .format(decl.value).encpde('utf-8'))
[ "def", "do_pass", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "log", "(", "WARN", ",", "u\"Old-style pass as declaration not allowed.{}\"", ".", "format", "(", "decl", ".", "value", ")", ".", "encpde", "(", "'utf-8'", ")", ")" ]
No longer valid way to set processing pass.
[ "No", "longer", "valid", "way", "to", "set", "processing", "pass", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L1313-L1316
dcos/shakedown
shakedown/dcos/command.py
connection_cache
def connection_cache(func: callable): """Connection cache for SSH sessions. This is to prevent opening a new, expensive connection on every command run.""" cache = dict() lock = RLock() @wraps(func) def func_wrapper(host: str, username: str, *args, **kwargs): key = "{h}-{u}".format(h=h...
python
def connection_cache(func: callable): """Connection cache for SSH sessions. This is to prevent opening a new, expensive connection on every command run.""" cache = dict() lock = RLock() @wraps(func) def func_wrapper(host: str, username: str, *args, **kwargs): key = "{h}-{u}".format(h=h...
[ "def", "connection_cache", "(", "func", ":", "callable", ")", ":", "cache", "=", "dict", "(", ")", "lock", "=", "RLock", "(", ")", "@", "wraps", "(", "func", ")", "def", "func_wrapper", "(", "host", ":", "str", ",", "username", ":", "str", ",", "*"...
Connection cache for SSH sessions. This is to prevent opening a new, expensive connection on every command run.
[ "Connection", "cache", "for", "SSH", "sessions", ".", "This", "is", "to", "prevent", "opening", "a", "new", "expensive", "connection", "on", "every", "command", "run", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/command.py#L15-L66
dcos/shakedown
shakedown/dcos/command.py
_get_connection
def _get_connection(host, username: str, key_path: str) \ -> paramiko.Transport or None: """Return an authenticated SSH connection. :param host: host or IP of the machine :type host: str :param username: SSH username :type username: str :param key_path: path to the SSH private key for S...
python
def _get_connection(host, username: str, key_path: str) \ -> paramiko.Transport or None: """Return an authenticated SSH connection. :param host: host or IP of the machine :type host: str :param username: SSH username :type username: str :param key_path: path to the SSH private key for S...
[ "def", "_get_connection", "(", "host", ",", "username", ":", "str", ",", "key_path", ":", "str", ")", "->", "paramiko", ".", "Transport", "or", "None", ":", "if", "not", "username", ":", "username", "=", "shakedown", ".", "cli", ".", "ssh_user", "if", ...
Return an authenticated SSH connection. :param host: host or IP of the machine :type host: str :param username: SSH username :type username: str :param key_path: path to the SSH private key for SSH auth :type key_path: str :return: SSH connection :rtype: paramiko.Transport or None
[ "Return", "an", "authenticated", "SSH", "connection", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/command.py#L70-L99
dcos/shakedown
shakedown/dcos/command.py
run_command
def run_command( host, command, username=None, key_path=None, noisy=True ): """ Run a command via SSH, proxied through the mesos master :param host: host or IP of the machine to execute the command on :type host: str :param command: the command to exe...
python
def run_command( host, command, username=None, key_path=None, noisy=True ): """ Run a command via SSH, proxied through the mesos master :param host: host or IP of the machine to execute the command on :type host: str :param command: the command to exe...
[ "def", "run_command", "(", "host", ",", "command", ",", "username", "=", "None", ",", "key_path", "=", "None", ",", "noisy", "=", "True", ")", ":", "with", "HostSession", "(", "host", ",", "username", ",", "key_path", ",", "noisy", ")", "as", "s", ":...
Run a command via SSH, proxied through the mesos master :param host: host or IP of the machine to execute the command on :type host: str :param command: the command to execute :type command: str :param username: SSH username :type username: str :param key_path: p...
[ "Run", "a", "command", "via", "SSH", "proxied", "through", "the", "mesos", "master" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/command.py#L102-L131
dcos/shakedown
shakedown/dcos/command.py
run_command_on_master
def run_command_on_master( command, username=None, key_path=None, noisy=True ): """ Run a command on the Mesos master """ return run_command(shakedown.master_ip(), command, username, key_path, noisy)
python
def run_command_on_master( command, username=None, key_path=None, noisy=True ): """ Run a command on the Mesos master """ return run_command(shakedown.master_ip(), command, username, key_path, noisy)
[ "def", "run_command_on_master", "(", "command", ",", "username", "=", "None", ",", "key_path", "=", "None", ",", "noisy", "=", "True", ")", ":", "return", "run_command", "(", "shakedown", ".", "master_ip", "(", ")", ",", "command", ",", "username", ",", ...
Run a command on the Mesos master
[ "Run", "a", "command", "on", "the", "Mesos", "master" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/command.py#L134-L143
dcos/shakedown
shakedown/dcos/command.py
run_command_on_leader
def run_command_on_leader( command, username=None, key_path=None, noisy=True ): """ Run a command on the Mesos leader. Important for Multi-Master. """ return run_command(shakedown.master_leader_ip(), command, username, key_path, noisy)
python
def run_command_on_leader( command, username=None, key_path=None, noisy=True ): """ Run a command on the Mesos leader. Important for Multi-Master. """ return run_command(shakedown.master_leader_ip(), command, username, key_path, noisy)
[ "def", "run_command_on_leader", "(", "command", ",", "username", "=", "None", ",", "key_path", "=", "None", ",", "noisy", "=", "True", ")", ":", "return", "run_command", "(", "shakedown", ".", "master_leader_ip", "(", ")", ",", "command", ",", "username", ...
Run a command on the Mesos leader. Important for Multi-Master.
[ "Run", "a", "command", "on", "the", "Mesos", "leader", ".", "Important", "for", "Multi", "-", "Master", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/command.py#L146-L155
dcos/shakedown
shakedown/dcos/command.py
run_command_on_marathon_leader
def run_command_on_marathon_leader( command, username=None, key_path=None, noisy=True ): """ Run a command on the Marathon leader """ return run_command(shakedown.marathon_leader_ip(), command, username, key_path, noisy)
python
def run_command_on_marathon_leader( command, username=None, key_path=None, noisy=True ): """ Run a command on the Marathon leader """ return run_command(shakedown.marathon_leader_ip(), command, username, key_path, noisy)
[ "def", "run_command_on_marathon_leader", "(", "command", ",", "username", "=", "None", ",", "key_path", "=", "None", ",", "noisy", "=", "True", ")", ":", "return", "run_command", "(", "shakedown", ".", "marathon_leader_ip", "(", ")", ",", "command", ",", "us...
Run a command on the Marathon leader
[ "Run", "a", "command", "on", "the", "Marathon", "leader" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/command.py#L158-L167
dcos/shakedown
shakedown/dcos/command.py
run_command_on_agent
def run_command_on_agent( host, command, username=None, key_path=None, noisy=True ): """ Run a command on a Mesos agent, proxied through the master """ return run_command(host, command, username, key_path, noisy)
python
def run_command_on_agent( host, command, username=None, key_path=None, noisy=True ): """ Run a command on a Mesos agent, proxied through the master """ return run_command(host, command, username, key_path, noisy)
[ "def", "run_command_on_agent", "(", "host", ",", "command", ",", "username", "=", "None", ",", "key_path", "=", "None", ",", "noisy", "=", "True", ")", ":", "return", "run_command", "(", "host", ",", "command", ",", "username", ",", "key_path", ",", "noi...
Run a command on a Mesos agent, proxied through the master
[ "Run", "a", "command", "on", "a", "Mesos", "agent", "proxied", "through", "the", "master" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/command.py#L170-L180
dcos/shakedown
shakedown/dcos/command.py
run_dcos_command
def run_dcos_command(command, raise_on_error=False, print_output=True): """ Run `dcos {command}` via DC/OS CLI :param command: the command to execute :type command: str :param raise_on_error: whether to raise a DCOSException if the return code is nonzero :type raise_on_error: bool ...
python
def run_dcos_command(command, raise_on_error=False, print_output=True): """ Run `dcos {command}` via DC/OS CLI :param command: the command to execute :type command: str :param raise_on_error: whether to raise a DCOSException if the return code is nonzero :type raise_on_error: bool ...
[ "def", "run_dcos_command", "(", "command", ",", "raise_on_error", "=", "False", ",", "print_output", "=", "True", ")", ":", "call", "=", "shlex", ".", "split", "(", "command", ")", "call", ".", "insert", "(", "0", ",", "'dcos'", ")", "print", "(", "\"\...
Run `dcos {command}` via DC/OS CLI :param command: the command to execute :type command: str :param raise_on_error: whether to raise a DCOSException if the return code is nonzero :type raise_on_error: bool :param print_output: whether to print the resulting stdout/stderr from ru...
[ "Run", "dcos", "{", "command", "}", "via", "DC", "/", "OS", "CLI" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/command.py#L183-L216
dcos/shakedown
shakedown/dcos/command.py
HostSession._wait_for_recv
def _wait_for_recv(self): """After executing a command, wait for results. Because `recv_ready()` can return False, but still have a valid, open connection, it is not enough to ensure output from a command execution is properly captured. :return: None """ ...
python
def _wait_for_recv(self): """After executing a command, wait for results. Because `recv_ready()` can return False, but still have a valid, open connection, it is not enough to ensure output from a command execution is properly captured. :return: None """ ...
[ "def", "_wait_for_recv", "(", "self", ")", ":", "while", "True", ":", "time", ".", "sleep", "(", "0.2", ")", "if", "self", ".", "session", ".", "recv_ready", "(", ")", "or", "self", ".", "session", ".", "closed", ":", "return" ]
After executing a command, wait for results. Because `recv_ready()` can return False, but still have a valid, open connection, it is not enough to ensure output from a command execution is properly captured. :return: None
[ "After", "executing", "a", "command", "wait", "for", "results", ".", "Because", "recv_ready", "()", "can", "return", "False", "but", "still", "have", "a", "valid", "open", "connection", "it", "is", "not", "enough", "to", "ensure", "output", "from", "a", "c...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/command.py#L264-L276
dcos/shakedown
shakedown/dcos/__init__.py
attach_cluster
def attach_cluster(url): """Attach to an already set-up cluster :return: True if successful, else False """ with shakedown.stdchannel_redirected(sys.stderr, os.devnull): clusters = [c.dict() for c in dcos.cluster.get_clusters()] for c in clusters: if url == c['url']: try:...
python
def attach_cluster(url): """Attach to an already set-up cluster :return: True if successful, else False """ with shakedown.stdchannel_redirected(sys.stderr, os.devnull): clusters = [c.dict() for c in dcos.cluster.get_clusters()] for c in clusters: if url == c['url']: try:...
[ "def", "attach_cluster", "(", "url", ")", ":", "with", "shakedown", ".", "stdchannel_redirected", "(", "sys", ".", "stderr", ",", "os", ".", "devnull", ")", ":", "clusters", "=", "[", "c", ".", "dict", "(", ")", "for", "c", "in", "dcos", ".", "cluste...
Attach to an already set-up cluster :return: True if successful, else False
[ "Attach", "to", "an", "already", "set", "-", "up", "cluster", ":", "return", ":", "True", "if", "successful", "else", "False" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/__init__.py#L9-L23
dcos/shakedown
shakedown/dcos/__init__.py
dcos_version
def dcos_version(): """Return the version of the running cluster. :return: DC/OS cluster version as a string """ url = _gen_url('dcos-metadata/dcos-version.json') response = dcos.http.request('get', url) if response.status_code == 200: return response.json()['version'] else: ...
python
def dcos_version(): """Return the version of the running cluster. :return: DC/OS cluster version as a string """ url = _gen_url('dcos-metadata/dcos-version.json') response = dcos.http.request('get', url) if response.status_code == 200: return response.json()['version'] else: ...
[ "def", "dcos_version", "(", ")", ":", "url", "=", "_gen_url", "(", "'dcos-metadata/dcos-version.json'", ")", "response", "=", "dcos", ".", "http", ".", "request", "(", "'get'", ",", "url", ")", "if", "response", ".", "status_code", "==", "200", ":", "retur...
Return the version of the running cluster. :return: DC/OS cluster version as a string
[ "Return", "the", "version", "of", "the", "running", "cluster", ".", ":", "return", ":", "DC", "/", "OS", "cluster", "version", "as", "a", "string" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/__init__.py#L94-L104
dcos/shakedown
shakedown/dcos/__init__.py
authenticate
def authenticate(username, password): """Authenticate with a DC/OS cluster and return an ACS token. return: ACS token """ url = _gen_url('acs/api/v1/auth/login') creds = { 'uid': username, 'password': password } response = dcos.http.request('post', url, json=creds) if ...
python
def authenticate(username, password): """Authenticate with a DC/OS cluster and return an ACS token. return: ACS token """ url = _gen_url('acs/api/v1/auth/login') creds = { 'uid': username, 'password': password } response = dcos.http.request('post', url, json=creds) if ...
[ "def", "authenticate", "(", "username", ",", "password", ")", ":", "url", "=", "_gen_url", "(", "'acs/api/v1/auth/login'", ")", "creds", "=", "{", "'uid'", ":", "username", ",", "'password'", ":", "password", "}", "response", "=", "dcos", ".", "http", ".",...
Authenticate with a DC/OS cluster and return an ACS token. return: ACS token
[ "Authenticate", "with", "a", "DC", "/", "OS", "cluster", "and", "return", "an", "ACS", "token", ".", "return", ":", "ACS", "token" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/__init__.py#L114-L130
dcos/shakedown
shakedown/dcos/__init__.py
authenticate_oauth
def authenticate_oauth(oauth_token): """Authenticate by checking for a valid OAuth token. return: ACS token """ url = _gen_url('acs/api/v1/auth/login') creds = { 'token': oauth_token } response = dcos.http.request('post', url, json=creds) if response.status_code == 200: ...
python
def authenticate_oauth(oauth_token): """Authenticate by checking for a valid OAuth token. return: ACS token """ url = _gen_url('acs/api/v1/auth/login') creds = { 'token': oauth_token } response = dcos.http.request('post', url, json=creds) if response.status_code == 200: ...
[ "def", "authenticate_oauth", "(", "oauth_token", ")", ":", "url", "=", "_gen_url", "(", "'acs/api/v1/auth/login'", ")", "creds", "=", "{", "'token'", ":", "oauth_token", "}", "response", "=", "dcos", ".", "http", ".", "request", "(", "'post'", ",", "url", ...
Authenticate by checking for a valid OAuth token. return: ACS token
[ "Authenticate", "by", "checking", "for", "a", "valid", "OAuth", "token", ".", "return", ":", "ACS", "token" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/__init__.py#L133-L148
dcos/shakedown
shakedown/dcos/__init__.py
_gen_url
def _gen_url(url_path): """Return an absolute URL by combining DC/OS URL and url_path. :param url_path: path to append to DC/OS URL :type url_path: str :return: absolute URL :rtype: str """ from six.moves import urllib return urllib.parse.urljoin(dcos_url(), url_path)
python
def _gen_url(url_path): """Return an absolute URL by combining DC/OS URL and url_path. :param url_path: path to append to DC/OS URL :type url_path: str :return: absolute URL :rtype: str """ from six.moves import urllib return urllib.parse.urljoin(dcos_url(), url_path)
[ "def", "_gen_url", "(", "url_path", ")", ":", "from", "six", ".", "moves", "import", "urllib", "return", "urllib", ".", "parse", ".", "urljoin", "(", "dcos_url", "(", ")", ",", "url_path", ")" ]
Return an absolute URL by combining DC/OS URL and url_path. :param url_path: path to append to DC/OS URL :type url_path: str :return: absolute URL :rtype: str
[ "Return", "an", "absolute", "URL", "by", "combining", "DC", "/", "OS", "URL", "and", "url_path", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/__init__.py#L155-L164
dcos/shakedown
shakedown/dcos/master.py
partition_master
def partition_master(incoming=True, outgoing=True): """ Partition master's port alone. To keep DC/OS cluster running. :param incoming: Partition incoming traffic to master process. Default True. :param outgoing: Partition outgoing traffic from master process. Default True. """ echo('Partitioning m...
python
def partition_master(incoming=True, outgoing=True): """ Partition master's port alone. To keep DC/OS cluster running. :param incoming: Partition incoming traffic to master process. Default True. :param outgoing: Partition outgoing traffic from master process. Default True. """ echo('Partitioning m...
[ "def", "partition_master", "(", "incoming", "=", "True", ",", "outgoing", "=", "True", ")", ":", "echo", "(", "'Partitioning master. Incoming:{} | Outgoing:{}'", ".", "format", "(", "incoming", ",", "outgoing", ")", ")", "network", ".", "save_iptables", "(", "sh...
Partition master's port alone. To keep DC/OS cluster running. :param incoming: Partition incoming traffic to master process. Default True. :param outgoing: Partition outgoing traffic from master process. Default True.
[ "Partition", "master", "s", "port", "alone", ".", "To", "keep", "DC", "/", "OS", "cluster", "running", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/master.py#L16-L37
dcos/shakedown
shakedown/dcos/master.py
get_all_masters
def get_all_masters(): """ Returns the json object that represents each of the masters. """ masters = [] for master in __master_zk_nodes_keys(): master_zk_str = get_zk_node_data(master)['str'] masters.append(json.loads(master_zk_str)) return masters
python
def get_all_masters(): """ Returns the json object that represents each of the masters. """ masters = [] for master in __master_zk_nodes_keys(): master_zk_str = get_zk_node_data(master)['str'] masters.append(json.loads(master_zk_str)) return masters
[ "def", "get_all_masters", "(", ")", ":", "masters", "=", "[", "]", "for", "master", "in", "__master_zk_nodes_keys", "(", ")", ":", "master_zk_str", "=", "get_zk_node_data", "(", "master", ")", "[", "'str'", "]", "masters", ".", "append", "(", "json", ".", ...
Returns the json object that represents each of the masters.
[ "Returns", "the", "json", "object", "that", "represents", "each", "of", "the", "masters", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/master.py#L93-L101
dcos/shakedown
shakedown/dcos/agent.py
get_public_agents_public_ip
def get_public_agents_public_ip(): """Provides a list public IPs for public agents in the cluster""" public_ip_list = [] agents = get_public_agents() for agent in agents: status, public_ip = shakedown.run_command_on_agent(agent, "/opt/mesosphere/bin/detect_ip_public") public_ip_list.appe...
python
def get_public_agents_public_ip(): """Provides a list public IPs for public agents in the cluster""" public_ip_list = [] agents = get_public_agents() for agent in agents: status, public_ip = shakedown.run_command_on_agent(agent, "/opt/mesosphere/bin/detect_ip_public") public_ip_list.appe...
[ "def", "get_public_agents_public_ip", "(", ")", ":", "public_ip_list", "=", "[", "]", "agents", "=", "get_public_agents", "(", ")", "for", "agent", "in", "agents", ":", "status", ",", "public_ip", "=", "shakedown", ".", "run_command_on_agent", "(", "agent", ",...
Provides a list public IPs for public agents in the cluster
[ "Provides", "a", "list", "public", "IPs", "for", "public", "agents", "in", "the", "cluster" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/agent.py#L11-L19
dcos/shakedown
shakedown/dcos/agent.py
get_public_agents
def get_public_agents(): """Provides a list of hostnames / private IPs that are public agents in the cluster""" agent_list = [] agents = __get_all_agents() for agent in agents: for reservation in agent["reserved_resources"]: if "slave_public" in reservation: agent_lis...
python
def get_public_agents(): """Provides a list of hostnames / private IPs that are public agents in the cluster""" agent_list = [] agents = __get_all_agents() for agent in agents: for reservation in agent["reserved_resources"]: if "slave_public" in reservation: agent_lis...
[ "def", "get_public_agents", "(", ")", ":", "agent_list", "=", "[", "]", "agents", "=", "__get_all_agents", "(", ")", "for", "agent", "in", "agents", ":", "for", "reservation", "in", "agent", "[", "\"reserved_resources\"", "]", ":", "if", "\"slave_public\"", ...
Provides a list of hostnames / private IPs that are public agents in the cluster
[ "Provides", "a", "list", "of", "hostnames", "/", "private", "IPs", "that", "are", "public", "agents", "in", "the", "cluster" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/agent.py#L22-L31
dcos/shakedown
shakedown/dcos/agent.py
get_private_agents
def get_private_agents(): """Provides a list of hostnames / IPs that are private agents in the cluster""" agent_list = [] agents = __get_all_agents() for agent in agents: if(len(agent["reserved_resources"]) == 0): agent_list.append(agent["hostname"]) else: privat...
python
def get_private_agents(): """Provides a list of hostnames / IPs that are private agents in the cluster""" agent_list = [] agents = __get_all_agents() for agent in agents: if(len(agent["reserved_resources"]) == 0): agent_list.append(agent["hostname"]) else: privat...
[ "def", "get_private_agents", "(", ")", ":", "agent_list", "=", "[", "]", "agents", "=", "__get_all_agents", "(", ")", "for", "agent", "in", "agents", ":", "if", "(", "len", "(", "agent", "[", "\"reserved_resources\"", "]", ")", "==", "0", ")", ":", "ag...
Provides a list of hostnames / IPs that are private agents in the cluster
[ "Provides", "a", "list", "of", "hostnames", "/", "IPs", "that", "are", "private", "agents", "in", "the", "cluster" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/agent.py#L34-L51
dcos/shakedown
shakedown/dcos/agent.py
get_agents
def get_agents(): """Provides a list of hostnames / IPs of all agents in the cluster""" agent_list = [] agents = __get_all_agents() for agent in agents: agent_list.append(agent["hostname"]) return agent_list
python
def get_agents(): """Provides a list of hostnames / IPs of all agents in the cluster""" agent_list = [] agents = __get_all_agents() for agent in agents: agent_list.append(agent["hostname"]) return agent_list
[ "def", "get_agents", "(", ")", ":", "agent_list", "=", "[", "]", "agents", "=", "__get_all_agents", "(", ")", "for", "agent", "in", "agents", ":", "agent_list", ".", "append", "(", "agent", "[", "\"hostname\"", "]", ")", "return", "agent_list" ]
Provides a list of hostnames / IPs of all agents in the cluster
[ "Provides", "a", "list", "of", "hostnames", "/", "IPs", "of", "all", "agents", "in", "the", "cluster" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/agent.py#L54-L62
dcos/shakedown
shakedown/dcos/agent.py
partition_agent
def partition_agent(host): """ Partition a node from all network traffic except for SSH and loopback :param hostname: host or IP of the machine to partition from the cluster """ network.save_iptables(host) network.flush_all_rules(host) network.allow_all_traffic(host) network.run_iptabl...
python
def partition_agent(host): """ Partition a node from all network traffic except for SSH and loopback :param hostname: host or IP of the machine to partition from the cluster """ network.save_iptables(host) network.flush_all_rules(host) network.allow_all_traffic(host) network.run_iptabl...
[ "def", "partition_agent", "(", "host", ")", ":", "network", ".", "save_iptables", "(", "host", ")", "network", ".", "flush_all_rules", "(", "host", ")", "network", ".", "allow_all_traffic", "(", "host", ")", "network", ".", "run_iptables", "(", "host", ",", ...
Partition a node from all network traffic except for SSH and loopback :param hostname: host or IP of the machine to partition from the cluster
[ "Partition", "a", "node", "from", "all", "network", "traffic", "except", "for", "SSH", "and", "loopback" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/agent.py#L78-L90
dcos/shakedown
shakedown/dcos/agent.py
kill_process_on_host
def kill_process_on_host( hostname, pattern ): """ Kill the process matching pattern at ip :param hostname: the hostname or ip address of the host on which the process will be killed :param pattern: a regular expression matching the name of the process to kill """ status, stdout = ...
python
def kill_process_on_host( hostname, pattern ): """ Kill the process matching pattern at ip :param hostname: the hostname or ip address of the host on which the process will be killed :param pattern: a regular expression matching the name of the process to kill """ status, stdout = ...
[ "def", "kill_process_on_host", "(", "hostname", ",", "pattern", ")", ":", "status", ",", "stdout", "=", "run_command_on_agent", "(", "hostname", ",", "\"ps aux | grep -v grep | grep '{}'\"", ".", "format", "(", "pattern", ")", ")", "pids", "=", "[", "p", ".", ...
Kill the process matching pattern at ip :param hostname: the hostname or ip address of the host on which the process will be killed :param pattern: a regular expression matching the name of the process to kill
[ "Kill", "the", "process", "matching", "pattern", "at", "ip" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/agent.py#L113-L131
dcos/shakedown
shakedown/dcos/agent.py
kill_process_from_pid_file_on_host
def kill_process_from_pid_file_on_host(hostname, pid_file='app.pid'): """ Retrieves the PID of a process from a pid file on host and kills it. :param hostname: the hostname or ip address of the host on which the process will be killed :param pid_file: pid file to use holding the pid number to kill """ ...
python
def kill_process_from_pid_file_on_host(hostname, pid_file='app.pid'): """ Retrieves the PID of a process from a pid file on host and kills it. :param hostname: the hostname or ip address of the host on which the process will be killed :param pid_file: pid file to use holding the pid number to kill """ ...
[ "def", "kill_process_from_pid_file_on_host", "(", "hostname", ",", "pid_file", "=", "'app.pid'", ")", ":", "status", ",", "pid", "=", "run_command_on_agent", "(", "hostname", ",", "'cat {}'", ".", "format", "(", "pid_file", ")", ")", "status", ",", "stdout", "...
Retrieves the PID of a process from a pid file on host and kills it. :param hostname: the hostname or ip address of the host on which the process will be killed :param pid_file: pid file to use holding the pid number to kill
[ "Retrieves", "the", "PID", "of", "a", "process", "from", "a", "pid", "file", "on", "host", "and", "kills", "it", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/agent.py#L134-L146
dcos/shakedown
shakedown/dcos/spinner.py
wait_for
def wait_for( predicate, timeout_seconds=120, sleep_seconds=1, ignore_exceptions=True, inverse_predicate=False, noisy=False, required_consecutive_success_count=1): """ waits or spins for a predicate, returning the result. Predicate is a function that r...
python
def wait_for( predicate, timeout_seconds=120, sleep_seconds=1, ignore_exceptions=True, inverse_predicate=False, noisy=False, required_consecutive_success_count=1): """ waits or spins for a predicate, returning the result. Predicate is a function that r...
[ "def", "wait_for", "(", "predicate", ",", "timeout_seconds", "=", "120", ",", "sleep_seconds", "=", "1", ",", "ignore_exceptions", "=", "True", ",", "inverse_predicate", "=", "False", ",", "noisy", "=", "False", ",", "required_consecutive_success_count", "=", "1...
waits or spins for a predicate, returning the result. Predicate is a function that returns a truthy or falsy value. An exception in the function will be returned. A timeout will throw a TimeoutExpired Exception.
[ "waits", "or", "spins", "for", "a", "predicate", "returning", "the", "result", ".", "Predicate", "is", "a", "function", "that", "returns", "a", "truthy", "or", "falsy", "value", ".", "An", "exception", "in", "the", "function", "will", "be", "returned", "."...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/spinner.py#L12-L60
dcos/shakedown
shakedown/dcos/spinner.py
__stringify_predicate
def __stringify_predicate(predicate): """ Reflection of function name and parameters of the predicate being used. """ funname = getsource(predicate).strip().split(' ')[2].rstrip(',') params = 'None' # if args dig in the stack if '()' not in funname: stack = getouterframes(currentframe()...
python
def __stringify_predicate(predicate): """ Reflection of function name and parameters of the predicate being used. """ funname = getsource(predicate).strip().split(' ')[2].rstrip(',') params = 'None' # if args dig in the stack if '()' not in funname: stack = getouterframes(currentframe()...
[ "def", "__stringify_predicate", "(", "predicate", ")", ":", "funname", "=", "getsource", "(", "predicate", ")", ".", "strip", "(", ")", ".", "split", "(", "' '", ")", "[", "2", "]", ".", "rstrip", "(", "','", ")", "params", "=", "'None'", "# if args di...
Reflection of function name and parameters of the predicate being used.
[ "Reflection", "of", "function", "name", "and", "parameters", "of", "the", "predicate", "being", "used", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/spinner.py#L63-L76
dcos/shakedown
shakedown/dcos/spinner.py
time_wait
def time_wait( predicate, timeout_seconds=120, sleep_seconds=1, ignore_exceptions=True, inverse_predicate=False, noisy=True, required_consecutive_success_count=1): """ waits or spins for a predicate and returns the time of the wait. An exception in the function will be returned. ...
python
def time_wait( predicate, timeout_seconds=120, sleep_seconds=1, ignore_exceptions=True, inverse_predicate=False, noisy=True, required_consecutive_success_count=1): """ waits or spins for a predicate and returns the time of the wait. An exception in the function will be returned. ...
[ "def", "time_wait", "(", "predicate", ",", "timeout_seconds", "=", "120", ",", "sleep_seconds", "=", "1", ",", "ignore_exceptions", "=", "True", ",", "inverse_predicate", "=", "False", ",", "noisy", "=", "True", ",", "required_consecutive_success_count", "=", "1...
waits or spins for a predicate and returns the time of the wait. An exception in the function will be returned. A timeout will throw a TimeoutExpired Exception.
[ "waits", "or", "spins", "for", "a", "predicate", "and", "returns", "the", "time", "of", "the", "wait", ".", "An", "exception", "in", "the", "function", "will", "be", "returned", ".", "A", "timeout", "will", "throw", "a", "TimeoutExpired", "Exception", "." ...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/spinner.py#L79-L94
dcos/shakedown
shakedown/dcos/spinner.py
wait_while_exceptions
def wait_while_exceptions( predicate, timeout_seconds=120, sleep_seconds=1, noisy=False): """ waits for a predicate, ignoring exceptions, returning the result. Predicate is a function. Exceptions will trigger the sleep and retry; any non-exception result will ...
python
def wait_while_exceptions( predicate, timeout_seconds=120, sleep_seconds=1, noisy=False): """ waits for a predicate, ignoring exceptions, returning the result. Predicate is a function. Exceptions will trigger the sleep and retry; any non-exception result will ...
[ "def", "wait_while_exceptions", "(", "predicate", ",", "timeout_seconds", "=", "120", ",", "sleep_seconds", "=", "1", ",", "noisy", "=", "False", ")", ":", "start_time", "=", "time_module", ".", "time", "(", ")", "timeout", "=", "Deadline", ".", "create_dead...
waits for a predicate, ignoring exceptions, returning the result. Predicate is a function. Exceptions will trigger the sleep and retry; any non-exception result will be returned. A timeout will throw a TimeoutExpired Exception.
[ "waits", "for", "a", "predicate", "ignoring", "exceptions", "returning", "the", "result", ".", "Predicate", "is", "a", "function", ".", "Exceptions", "will", "trigger", "the", "sleep", "and", "retry", ";", "any", "non", "-", "exception", "result", "will", "b...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/spinner.py#L97-L128
dcos/shakedown
shakedown/dcos/spinner.py
elapse_time
def elapse_time(start, end=None, precision=3): """ Simple time calculation utility. Given a start time, it will provide an elapse time. """ if end is None: end = time_module.time() return round(end-start, precision)
python
def elapse_time(start, end=None, precision=3): """ Simple time calculation utility. Given a start time, it will provide an elapse time. """ if end is None: end = time_module.time() return round(end-start, precision)
[ "def", "elapse_time", "(", "start", ",", "end", "=", "None", ",", "precision", "=", "3", ")", ":", "if", "end", "is", "None", ":", "end", "=", "time_module", ".", "time", "(", ")", "return", "round", "(", "end", "-", "start", ",", "precision", ")" ...
Simple time calculation utility. Given a start time, it will provide an elapse time.
[ "Simple", "time", "calculation", "utility", ".", "Given", "a", "start", "time", "it", "will", "provide", "an", "elapse", "time", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/spinner.py#L131-L136
dcos/shakedown
shakedown/dcos/spinner.py
pretty_duration
def pretty_duration(seconds): """ Returns a user-friendly representation of the provided duration in seconds. For example: 62.8 => "1m2.8s", or 129837.8 => "2d12h4m57.8s" """ if seconds is None: return '' ret = '' if seconds >= 86400: ret += '{:.0f}d'.format(int(seconds / 86400))...
python
def pretty_duration(seconds): """ Returns a user-friendly representation of the provided duration in seconds. For example: 62.8 => "1m2.8s", or 129837.8 => "2d12h4m57.8s" """ if seconds is None: return '' ret = '' if seconds >= 86400: ret += '{:.0f}d'.format(int(seconds / 86400))...
[ "def", "pretty_duration", "(", "seconds", ")", ":", "if", "seconds", "is", "None", ":", "return", "''", "ret", "=", "''", "if", "seconds", ">=", "86400", ":", "ret", "+=", "'{:.0f}d'", ".", "format", "(", "int", "(", "seconds", "/", "86400", ")", ")"...
Returns a user-friendly representation of the provided duration in seconds. For example: 62.8 => "1m2.8s", or 129837.8 => "2d12h4m57.8s"
[ "Returns", "a", "user", "-", "friendly", "representation", "of", "the", "provided", "duration", "in", "seconds", ".", "For", "example", ":", "62", ".", "8", "=", ">", "1m2", ".", "8s", "or", "129837", ".", "8", "=", ">", "2d12h4m57", ".", "8s" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/spinner.py#L139-L157
dcos/shakedown
shakedown/cli/helpers.py
read_config
def read_config(args): """ Read configuration options from ~/.shakedown (if exists) :param args: a dict of arguments :type args: dict :return: a dict of arguments :rtype: dict """ configfile = os.path.expanduser('~/.shakedown') if os.path.isfile(configfile): w...
python
def read_config(args): """ Read configuration options from ~/.shakedown (if exists) :param args: a dict of arguments :type args: dict :return: a dict of arguments :rtype: dict """ configfile = os.path.expanduser('~/.shakedown') if os.path.isfile(configfile): w...
[ "def", "read_config", "(", "args", ")", ":", "configfile", "=", "os", ".", "path", ".", "expanduser", "(", "'~/.shakedown'", ")", "if", "os", ".", "path", ".", "isfile", "(", "configfile", ")", ":", "with", "open", "(", "configfile", ",", "'r'", ")", ...
Read configuration options from ~/.shakedown (if exists) :param args: a dict of arguments :type args: dict :return: a dict of arguments :rtype: dict
[ "Read", "configuration", "options", "from", "~", "/", ".", "shakedown", "(", "if", "exists", ")" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/cli/helpers.py#L10-L32
dcos/shakedown
shakedown/cli/helpers.py
set_config_defaults
def set_config_defaults(args): """ Set configuration defaults :param args: a dict of arguments :type args: dict :return: a dict of arguments :rtype: dict """ defaults = { 'fail': 'fast', 'stdout': 'fail' } for key in defaults: if not args[k...
python
def set_config_defaults(args): """ Set configuration defaults :param args: a dict of arguments :type args: dict :return: a dict of arguments :rtype: dict """ defaults = { 'fail': 'fast', 'stdout': 'fail' } for key in defaults: if not args[k...
[ "def", "set_config_defaults", "(", "args", ")", ":", "defaults", "=", "{", "'fail'", ":", "'fast'", ",", "'stdout'", ":", "'fail'", "}", "for", "key", "in", "defaults", ":", "if", "not", "args", "[", "key", "]", ":", "args", "[", "key", "]", "=", "...
Set configuration defaults :param args: a dict of arguments :type args: dict :return: a dict of arguments :rtype: dict
[ "Set", "configuration", "defaults" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/cli/helpers.py#L35-L54
dcos/shakedown
shakedown/cli/helpers.py
banner
def banner(): """ Display a product banner :return: a delightful Mesosphere logo rendered in unicode :rtype: str """ banner_dict = { 'a0': click.style(chr(9601), fg='magenta'), 'a1': click.style(chr(9601), fg='magenta', bold=True), 'b0': click.style(chr(9616), fg='m...
python
def banner(): """ Display a product banner :return: a delightful Mesosphere logo rendered in unicode :rtype: str """ banner_dict = { 'a0': click.style(chr(9601), fg='magenta'), 'a1': click.style(chr(9601), fg='magenta', bold=True), 'b0': click.style(chr(9616), fg='m...
[ "def", "banner", "(", ")", ":", "banner_dict", "=", "{", "'a0'", ":", "click", ".", "style", "(", "chr", "(", "9601", ")", ",", "fg", "=", "'magenta'", ")", ",", "'a1'", ":", "click", ".", "style", "(", "chr", "(", "9601", ")", ",", "fg", "=", ...
Display a product banner :return: a delightful Mesosphere logo rendered in unicode :rtype: str
[ "Display", "a", "product", "banner" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/cli/helpers.py#L75-L121
dcos/shakedown
shakedown/cli/helpers.py
decorate
def decorate(text, style): """ Console decoration style definitions :param text: the text string to decorate :type text: str :param style: the style used to decorate the string :type style: str :return: a decorated string :rtype: str """ return { 's...
python
def decorate(text, style): """ Console decoration style definitions :param text: the text string to decorate :type text: str :param style: the style used to decorate the string :type style: str :return: a decorated string :rtype: str """ return { 's...
[ "def", "decorate", "(", "text", ",", "style", ")", ":", "return", "{", "'step-maj'", ":", "click", ".", "style", "(", "\"\\n\"", "+", "'> '", "+", "text", ",", "fg", "=", "'yellow'", ",", "bold", "=", "True", ")", ",", "'step-min'", ":", "click", "...
Console decoration style definitions :param text: the text string to decorate :type text: str :param style: the style used to decorate the string :type style: str :return: a decorated string :rtype: str
[ "Console", "decoration", "style", "definitions" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/cli/helpers.py#L124-L150
dcos/shakedown
shakedown/cli/helpers.py
echo
def echo(text, **kwargs): """ Print results to the console :param text: the text string to print :type text: str :return: a string :rtype: str """ if shakedown.cli.quiet: return if not 'n' in kwargs: kwargs['n'] = True if 'd' in kwargs: te...
python
def echo(text, **kwargs): """ Print results to the console :param text: the text string to print :type text: str :return: a string :rtype: str """ if shakedown.cli.quiet: return if not 'n' in kwargs: kwargs['n'] = True if 'd' in kwargs: te...
[ "def", "echo", "(", "text", ",", "*", "*", "kwargs", ")", ":", "if", "shakedown", ".", "cli", ".", "quiet", ":", "return", "if", "not", "'n'", "in", "kwargs", ":", "kwargs", "[", "'n'", "]", "=", "True", "if", "'d'", "in", "kwargs", ":", "text", ...
Print results to the console :param text: the text string to print :type text: str :return: a string :rtype: str
[ "Print", "results", "to", "the", "console" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/cli/helpers.py#L153-L178
dcos/shakedown
shakedown/dcos/security.py
add_user
def add_user(uid, password, desc=None): """ Adds user to the DCOS Enterprise. If not description is provided the uid will be used for the description. :param uid: user id :type uid: str :param password: password :type password: str :param desc: description of user ...
python
def add_user(uid, password, desc=None): """ Adds user to the DCOS Enterprise. If not description is provided the uid will be used for the description. :param uid: user id :type uid: str :param password: password :type password: str :param desc: description of user ...
[ "def", "add_user", "(", "uid", ",", "password", ",", "desc", "=", "None", ")", ":", "try", ":", "desc", "=", "uid", "if", "desc", "is", "None", "else", "desc", "user_object", "=", "{", "\"description\"", ":", "desc", ",", "\"password\"", ":", "password...
Adds user to the DCOS Enterprise. If not description is provided the uid will be used for the description. :param uid: user id :type uid: str :param password: password :type password: str :param desc: description of user :type desc: str
[ "Adds", "user", "to", "the", "DCOS", "Enterprise", ".", "If", "not", "description", "is", "provided", "the", "uid", "will", "be", "used", "for", "the", "description", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L17-L37
dcos/shakedown
shakedown/dcos/security.py
get_user
def get_user(uid): """ Returns a user from the DCOS Enterprise. It returns None if none exists. :param uid: user id :type uid: str :return: User :rtype: dict """ try: acl_url = urljoin(_acl_url(), 'users/{}'.format(uid)) r = http.get(acl_url) return ...
python
def get_user(uid): """ Returns a user from the DCOS Enterprise. It returns None if none exists. :param uid: user id :type uid: str :return: User :rtype: dict """ try: acl_url = urljoin(_acl_url(), 'users/{}'.format(uid)) r = http.get(acl_url) return ...
[ "def", "get_user", "(", "uid", ")", ":", "try", ":", "acl_url", "=", "urljoin", "(", "_acl_url", "(", ")", ",", "'users/{}'", ".", "format", "(", "uid", ")", ")", "r", "=", "http", ".", "get", "(", "acl_url", ")", "return", "r", ".", "json", "(",...
Returns a user from the DCOS Enterprise. It returns None if none exists. :param uid: user id :type uid: str :return: User :rtype: dict
[ "Returns", "a", "user", "from", "the", "DCOS", "Enterprise", ".", "It", "returns", "None", "if", "none", "exists", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L40-L57
dcos/shakedown
shakedown/dcos/security.py
remove_user
def remove_user(uid): """ Removes a user from the DCOS Enterprise. :param uid: user id :type uid: str """ try: acl_url = urljoin(_acl_url(), 'users/{}'.format(uid)) r = http.delete(acl_url) assert r.status_code == 204 except DCOSHTTPException as e: # does...
python
def remove_user(uid): """ Removes a user from the DCOS Enterprise. :param uid: user id :type uid: str """ try: acl_url = urljoin(_acl_url(), 'users/{}'.format(uid)) r = http.delete(acl_url) assert r.status_code == 204 except DCOSHTTPException as e: # does...
[ "def", "remove_user", "(", "uid", ")", ":", "try", ":", "acl_url", "=", "urljoin", "(", "_acl_url", "(", ")", ",", "'users/{}'", ".", "format", "(", "uid", ")", ")", "r", "=", "http", ".", "delete", "(", "acl_url", ")", "assert", "r", ".", "status_...
Removes a user from the DCOS Enterprise. :param uid: user id :type uid: str
[ "Removes", "a", "user", "from", "the", "DCOS", "Enterprise", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L60-L73
dcos/shakedown
shakedown/dcos/security.py
ensure_resource
def ensure_resource(rid): """ Creates or confirms that a resource is added into the DCOS Enterprise System. Example: dcos:service:marathon:marathon:services:/example-secure :param rid: resource ID :type rid: str """ try: acl_url = urljoin(_acl_url(), 'acls/{}'.format(rid)) ...
python
def ensure_resource(rid): """ Creates or confirms that a resource is added into the DCOS Enterprise System. Example: dcos:service:marathon:marathon:services:/example-secure :param rid: resource ID :type rid: str """ try: acl_url = urljoin(_acl_url(), 'acls/{}'.format(rid)) ...
[ "def", "ensure_resource", "(", "rid", ")", ":", "try", ":", "acl_url", "=", "urljoin", "(", "_acl_url", "(", ")", ",", "'acls/{}'", ".", "format", "(", "rid", ")", ")", "r", "=", "http", ".", "put", "(", "acl_url", ",", "json", "=", "{", "'descript...
Creates or confirms that a resource is added into the DCOS Enterprise System. Example: dcos:service:marathon:marathon:services:/example-secure :param rid: resource ID :type rid: str
[ "Creates", "or", "confirms", "that", "a", "resource", "is", "added", "into", "the", "DCOS", "Enterprise", "System", ".", "Example", ":", "dcos", ":", "service", ":", "marathon", ":", "marathon", ":", "services", ":", "/", "example", "-", "secure" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L76-L89
dcos/shakedown
shakedown/dcos/security.py
set_user_permission
def set_user_permission(rid, uid, action='full'): """ Sets users permission on a given resource. The resource will be created if it doesn't exist. Actions are: read, write, update, delete, full. :param uid: user id :type uid: str :param rid: resource ID :type rid: str ...
python
def set_user_permission(rid, uid, action='full'): """ Sets users permission on a given resource. The resource will be created if it doesn't exist. Actions are: read, write, update, delete, full. :param uid: user id :type uid: str :param rid: resource ID :type rid: str ...
[ "def", "set_user_permission", "(", "rid", ",", "uid", ",", "action", "=", "'full'", ")", ":", "rid", "=", "rid", ".", "replace", "(", "'/'", ",", "'%252F'", ")", "# Create ACL if it does not yet exist.", "ensure_resource", "(", "rid", ")", "# Set the permission ...
Sets users permission on a given resource. The resource will be created if it doesn't exist. Actions are: read, write, update, delete, full. :param uid: user id :type uid: str :param rid: resource ID :type rid: str :param action: read, write, update, delete or full ...
[ "Sets", "users", "permission", "on", "a", "given", "resource", ".", "The", "resource", "will", "be", "created", "if", "it", "doesn", "t", "exist", ".", "Actions", "are", ":", "read", "write", "update", "delete", "full", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L92-L114
dcos/shakedown
shakedown/dcos/security.py
remove_user_permission
def remove_user_permission(rid, uid, action='full'): """ Removes user permission on a given resource. :param uid: user id :type uid: str :param rid: resource ID :type rid: str :param action: read, write, update, delete or full :type action: str """ rid = rid....
python
def remove_user_permission(rid, uid, action='full'): """ Removes user permission on a given resource. :param uid: user id :type uid: str :param rid: resource ID :type rid: str :param action: read, write, update, delete or full :type action: str """ rid = rid....
[ "def", "remove_user_permission", "(", "rid", ",", "uid", ",", "action", "=", "'full'", ")", ":", "rid", "=", "rid", ".", "replace", "(", "'/'", ",", "'%252F'", ")", "try", ":", "acl_url", "=", "urljoin", "(", "_acl_url", "(", ")", ",", "'acls/{}/users/...
Removes user permission on a given resource. :param uid: user id :type uid: str :param rid: resource ID :type rid: str :param action: read, write, update, delete or full :type action: str
[ "Removes", "user", "permission", "on", "a", "given", "resource", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L117-L135
dcos/shakedown
shakedown/dcos/security.py
no_user
def no_user(): """ Provides a context with no logged in user. """ o_token = dcos_acs_token() dcos.config.set_val('core.dcos_acs_token', '') yield dcos.config.set_val('core.dcos_acs_token', o_token)
python
def no_user(): """ Provides a context with no logged in user. """ o_token = dcos_acs_token() dcos.config.set_val('core.dcos_acs_token', '') yield dcos.config.set_val('core.dcos_acs_token', o_token)
[ "def", "no_user", "(", ")", ":", "o_token", "=", "dcos_acs_token", "(", ")", "dcos", ".", "config", ".", "set_val", "(", "'core.dcos_acs_token'", ",", "''", ")", "yield", "dcos", ".", "config", ".", "set_val", "(", "'core.dcos_acs_token'", ",", "o_token", ...
Provides a context with no logged in user.
[ "Provides", "a", "context", "with", "no", "logged", "in", "user", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L139-L145
dcos/shakedown
shakedown/dcos/security.py
new_dcos_user
def new_dcos_user(user_id, password): """ Provides a context with a newly created user. """ o_token = dcos_acs_token() shakedown.add_user(user_id, password, user_id) token = shakedown.authenticate(user_id, password) dcos.config.set_val('core.dcos_acs_token', token) yield dcos.config.set...
python
def new_dcos_user(user_id, password): """ Provides a context with a newly created user. """ o_token = dcos_acs_token() shakedown.add_user(user_id, password, user_id) token = shakedown.authenticate(user_id, password) dcos.config.set_val('core.dcos_acs_token', token) yield dcos.config.set...
[ "def", "new_dcos_user", "(", "user_id", ",", "password", ")", ":", "o_token", "=", "dcos_acs_token", "(", ")", "shakedown", ".", "add_user", "(", "user_id", ",", "password", ",", "user_id", ")", "token", "=", "shakedown", ".", "authenticate", "(", "user_id",...
Provides a context with a newly created user.
[ "Provides", "a", "context", "with", "a", "newly", "created", "user", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L149-L159
dcos/shakedown
shakedown/dcos/security.py
dcos_user
def dcos_user(user_id, password): """ Provides a context with user otherthan super """ o_token = dcos_acs_token() token = shakedown.authenticate(user_id, password) dcos.config.set_val('core.dcos_acs_token', token) yield dcos.config.set_val('core.dcos_acs_token', o_token)
python
def dcos_user(user_id, password): """ Provides a context with user otherthan super """ o_token = dcos_acs_token() token = shakedown.authenticate(user_id, password) dcos.config.set_val('core.dcos_acs_token', token) yield dcos.config.set_val('core.dcos_acs_token', o_token)
[ "def", "dcos_user", "(", "user_id", ",", "password", ")", ":", "o_token", "=", "dcos_acs_token", "(", ")", "token", "=", "shakedown", ".", "authenticate", "(", "user_id", ",", "password", ")", "dcos", ".", "config", ".", "set_val", "(", "'core.dcos_acs_token...
Provides a context with user otherthan super
[ "Provides", "a", "context", "with", "user", "otherthan", "super" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L163-L172
dcos/shakedown
shakedown/dcos/security.py
add_group
def add_group(id, description=None): """ Adds group to the DCOS Enterprise. If not description is provided the id will be used for the description. :param id: group id :type id: str :param desc: description of user :type desc: str """ if not description: de...
python
def add_group(id, description=None): """ Adds group to the DCOS Enterprise. If not description is provided the id will be used for the description. :param id: group id :type id: str :param desc: description of user :type desc: str """ if not description: de...
[ "def", "add_group", "(", "id", ",", "description", "=", "None", ")", ":", "if", "not", "description", ":", "description", "=", "id", "data", "=", "{", "'description'", ":", "description", "}", "acl_url", "=", "urljoin", "(", "_acl_url", "(", ")", ",", ...
Adds group to the DCOS Enterprise. If not description is provided the id will be used for the description. :param id: group id :type id: str :param desc: description of user :type desc: str
[ "Adds", "group", "to", "the", "DCOS", "Enterprise", ".", "If", "not", "description", "is", "provided", "the", "id", "will", "be", "used", "for", "the", "description", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L175-L196
dcos/shakedown
shakedown/dcos/security.py
get_group
def get_group(id): """ Returns a group from the DCOS Enterprise. It returns None if none exists. :param id: group id :type id: str :return: Group :rtype: dict """ acl_url = urljoin(_acl_url(), 'groups/{}'.format(id)) try: r = http.get(acl_url) return r.j...
python
def get_group(id): """ Returns a group from the DCOS Enterprise. It returns None if none exists. :param id: group id :type id: str :return: Group :rtype: dict """ acl_url = urljoin(_acl_url(), 'groups/{}'.format(id)) try: r = http.get(acl_url) return r.j...
[ "def", "get_group", "(", "id", ")", ":", "acl_url", "=", "urljoin", "(", "_acl_url", "(", ")", ",", "'groups/{}'", ".", "format", "(", "id", ")", ")", "try", ":", "r", "=", "http", ".", "get", "(", "acl_url", ")", "return", "r", ".", "json", "(",...
Returns a group from the DCOS Enterprise. It returns None if none exists. :param id: group id :type id: str :return: Group :rtype: dict
[ "Returns", "a", "group", "from", "the", "DCOS", "Enterprise", ".", "It", "returns", "None", "if", "none", "exists", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L199-L213
dcos/shakedown
shakedown/dcos/security.py
remove_group
def remove_group(id): """ Removes a group from the DCOS Enterprise. The group is removed regardless of associated users. :param id: group id :type id: str """ acl_url = urljoin(_acl_url(), 'groups/{}'.format(id)) try: r = http.delete(acl_url) print(r.status_code...
python
def remove_group(id): """ Removes a group from the DCOS Enterprise. The group is removed regardless of associated users. :param id: group id :type id: str """ acl_url = urljoin(_acl_url(), 'groups/{}'.format(id)) try: r = http.delete(acl_url) print(r.status_code...
[ "def", "remove_group", "(", "id", ")", ":", "acl_url", "=", "urljoin", "(", "_acl_url", "(", ")", ",", "'groups/{}'", ".", "format", "(", "id", ")", ")", "try", ":", "r", "=", "http", ".", "delete", "(", "acl_url", ")", "print", "(", "r", ".", "s...
Removes a group from the DCOS Enterprise. The group is removed regardless of associated users. :param id: group id :type id: str
[ "Removes", "a", "group", "from", "the", "DCOS", "Enterprise", ".", "The", "group", "is", "removed", "regardless", "of", "associated", "users", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L216-L229
dcos/shakedown
shakedown/dcos/security.py
add_user_to_group
def add_user_to_group(uid, gid, exist_ok=True): """ Adds a user to a group within DCOS Enterprise. The group and user must exist. :param uid: user id :type uid: str :param gid: group id :type gid: str :param exist_ok: True if it is ok for the relationship to pre-exi...
python
def add_user_to_group(uid, gid, exist_ok=True): """ Adds a user to a group within DCOS Enterprise. The group and user must exist. :param uid: user id :type uid: str :param gid: group id :type gid: str :param exist_ok: True if it is ok for the relationship to pre-exi...
[ "def", "add_user_to_group", "(", "uid", ",", "gid", ",", "exist_ok", "=", "True", ")", ":", "acl_url", "=", "urljoin", "(", "_acl_url", "(", ")", ",", "'groups/{}/users/{}'", ".", "format", "(", "gid", ",", "uid", ")", ")", "try", ":", "r", "=", "htt...
Adds a user to a group within DCOS Enterprise. The group and user must exist. :param uid: user id :type uid: str :param gid: group id :type gid: str :param exist_ok: True if it is ok for the relationship to pre-exist. :type exist_ok: bool
[ "Adds", "a", "user", "to", "a", "group", "within", "DCOS", "Enterprise", ".", "The", "group", "and", "user", "must", "exist", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L232-L251
dcos/shakedown
shakedown/dcos/security.py
remove_user_from_group
def remove_user_from_group(uid, gid): """ Removes a user from a group within DCOS Enterprise. :param uid: user id :type uid: str :param gid: group id :type gid: str """ acl_url = urljoin(_acl_url(), 'groups/{}/users/{}'.format(gid, uid)) try: r = http.delete(acl_...
python
def remove_user_from_group(uid, gid): """ Removes a user from a group within DCOS Enterprise. :param uid: user id :type uid: str :param gid: group id :type gid: str """ acl_url = urljoin(_acl_url(), 'groups/{}/users/{}'.format(gid, uid)) try: r = http.delete(acl_...
[ "def", "remove_user_from_group", "(", "uid", ",", "gid", ")", ":", "acl_url", "=", "urljoin", "(", "_acl_url", "(", ")", ",", "'groups/{}/users/{}'", ".", "format", "(", "gid", ",", "uid", ")", ")", "try", ":", "r", "=", "http", ".", "delete", "(", "...
Removes a user from a group within DCOS Enterprise. :param uid: user id :type uid: str :param gid: group id :type gid: str
[ "Removes", "a", "user", "from", "a", "group", "within", "DCOS", "Enterprise", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L254-L267
openstax/cnx-easybake
cnxeasybake/scripts/main.py
easybake
def easybake(css_in, html_in=sys.stdin, html_out=sys.stdout, last_step=None, coverage_file=None, use_repeatable_ids=False): """Process the given HTML file stream with the css stream.""" html_doc = etree.parse(html_in) oven = Oven(css_in, use_repeatable_ids) oven.bake(html_doc, last_step) ...
python
def easybake(css_in, html_in=sys.stdin, html_out=sys.stdout, last_step=None, coverage_file=None, use_repeatable_ids=False): """Process the given HTML file stream with the css stream.""" html_doc = etree.parse(html_in) oven = Oven(css_in, use_repeatable_ids) oven.bake(html_doc, last_step) ...
[ "def", "easybake", "(", "css_in", ",", "html_in", "=", "sys", ".", "stdin", ",", "html_out", "=", "sys", ".", "stdout", ",", "last_step", "=", "None", ",", "coverage_file", "=", "None", ",", "use_repeatable_ids", "=", "False", ")", ":", "html_doc", "=", ...
Process the given HTML file stream with the css stream.
[ "Process", "the", "given", "HTML", "file", "stream", "with", "the", "css", "stream", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/scripts/main.py#L15-L30
openstax/cnx-easybake
cnxeasybake/scripts/main.py
main
def main(argv=None): """Commandline script wrapping Baker.""" parser = argparse.ArgumentParser(description="Process raw HTML to baked" " (embedded numbering and" " collation)") parser.add_argument('-v', '--vers...
python
def main(argv=None): """Commandline script wrapping Baker.""" parser = argparse.ArgumentParser(description="Process raw HTML to baked" " (embedded numbering and" " collation)") parser.add_argument('-v', '--vers...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Process raw HTML to baked\"", "\" (embedded numbering and\"", "\" collation)\"", ")", "parser", ".", "add_argument", "(", "'-v'", ",", ...
Commandline script wrapping Baker.
[ "Commandline", "script", "wrapping", "Baker", "." ]
train
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/scripts/main.py#L44-L99
dcos/shakedown
shakedown/dcos/marathon.py
mom_version
def mom_version(name='marathon-user'): """Returns the version of marathon on marathon. """ if service_available_predicate(name): with marathon_on_marathon(name): return marathon_version() else: # We can either skip the corresponding test by returning False # or ra...
python
def mom_version(name='marathon-user'): """Returns the version of marathon on marathon. """ if service_available_predicate(name): with marathon_on_marathon(name): return marathon_version() else: # We can either skip the corresponding test by returning False # or ra...
[ "def", "mom_version", "(", "name", "=", "'marathon-user'", ")", ":", "if", "service_available_predicate", "(", "name", ")", ":", "with", "marathon_on_marathon", "(", "name", ")", ":", "return", "marathon_version", "(", ")", "else", ":", "# We can either skip the c...
Returns the version of marathon on marathon.
[ "Returns", "the", "version", "of", "marathon", "on", "marathon", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/marathon.py#L33-L43
dcos/shakedown
shakedown/dcos/marathon.py
mom_version_less_than
def mom_version_less_than(version, name='marathon-user'): """ Returns True if MoM with the given {name} exists and has a version less than {version}. Note that if MoM does not exist False is returned. :param version: required version :type: string :param name: MoM name, default is '...
python
def mom_version_less_than(version, name='marathon-user'): """ Returns True if MoM with the given {name} exists and has a version less than {version}. Note that if MoM does not exist False is returned. :param version: required version :type: string :param name: MoM name, default is '...
[ "def", "mom_version_less_than", "(", "version", ",", "name", "=", "'marathon-user'", ")", ":", "if", "service_available_predicate", "(", "name", ")", ":", "return", "mom_version", "(", ")", "<", "LooseVersion", "(", "version", ")", "else", ":", "# We can either ...
Returns True if MoM with the given {name} exists and has a version less than {version}. Note that if MoM does not exist False is returned. :param version: required version :type: string :param name: MoM name, default is 'marathon-user' :type: string :return: True if vers...
[ "Returns", "True", "if", "MoM", "with", "the", "given", "{", "name", "}", "exists", "and", "has", "a", "version", "less", "than", "{", "version", "}", ".", "Note", "that", "if", "MoM", "does", "not", "exist", "False", "is", "returned", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/marathon.py#L46-L63
dcos/shakedown
shakedown/dcos/marathon.py
marathon_on_marathon
def marathon_on_marathon(name='marathon-user'): """ Context manager for altering the marathon client for MoM :param name: service name of MoM to use :type name: str """ toml_config_o = config.get_config() dcos_url = config.get_config_val('core.dcos_url', toml_config_o) service_name = 'servi...
python
def marathon_on_marathon(name='marathon-user'): """ Context manager for altering the marathon client for MoM :param name: service name of MoM to use :type name: str """ toml_config_o = config.get_config() dcos_url = config.get_config_val('core.dcos_url', toml_config_o) service_name = 'servi...
[ "def", "marathon_on_marathon", "(", "name", "=", "'marathon-user'", ")", ":", "toml_config_o", "=", "config", ".", "get_config", "(", ")", "dcos_url", "=", "config", ".", "get_config_val", "(", "'core.dcos_url'", ",", "toml_config_o", ")", "service_name", "=", "...
Context manager for altering the marathon client for MoM :param name: service name of MoM to use :type name: str
[ "Context", "manager", "for", "altering", "the", "marathon", "client", "for", "MoM", ":", "param", "name", ":", "service", "name", "of", "MoM", "to", "use", ":", "type", "name", ":", "str" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/marathon.py#L102-L118
dcos/shakedown
shakedown/dcos/helpers.py
get_transport
def get_transport(host, username, key): """ Create a transport object :param host: the hostname to connect to :type host: str :param username: SSH username :type username: str :param key: key object used for authentication :type key: paramiko.RSAKey :return:...
python
def get_transport(host, username, key): """ Create a transport object :param host: the hostname to connect to :type host: str :param username: SSH username :type username: str :param key: key object used for authentication :type key: paramiko.RSAKey :return:...
[ "def", "get_transport", "(", "host", ",", "username", ",", "key", ")", ":", "if", "host", "==", "shakedown", ".", "master_ip", "(", ")", ":", "transport", "=", "paramiko", ".", "Transport", "(", "host", ")", "else", ":", "transport_master", "=", "paramik...
Create a transport object :param host: the hostname to connect to :type host: str :param username: SSH username :type username: str :param key: key object used for authentication :type key: paramiko.RSAKey :return: a transport object :rtype: paramiko.Tra...
[ "Create", "a", "transport", "object" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/helpers.py#L11-L43
dcos/shakedown
shakedown/dcos/helpers.py
start_transport
def start_transport(transport, username, key): """ Begin a transport client and authenticate it :param transport: the transport object to start :type transport: paramiko.Transport :param username: SSH username :type username: str :param key: key object used for authenticatio...
python
def start_transport(transport, username, key): """ Begin a transport client and authenticate it :param transport: the transport object to start :type transport: paramiko.Transport :param username: SSH username :type username: str :param key: key object used for authenticatio...
[ "def", "start_transport", "(", "transport", ",", "username", ",", "key", ")", ":", "transport", ".", "start_client", "(", ")", "agent", "=", "paramiko", ".", "agent", ".", "Agent", "(", ")", "keys", "=", "itertools", ".", "chain", "(", "(", "key", ",",...
Begin a transport client and authenticate it :param transport: the transport object to start :type transport: paramiko.Transport :param username: SSH username :type username: str :param key: key object used for authentication :type key: paramiko.RSAKey :return: ...
[ "Begin", "a", "transport", "client", "and", "authenticate", "it" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/helpers.py#L46-L73
dcos/shakedown
shakedown/dcos/helpers.py
validate_key
def validate_key(key_path): """ Validate a key :param key_path: path to a key to use for authentication :type key_path: str :return: key object used for authentication :rtype: paramiko.RSAKey """ key_path = os.path.expanduser(key_path) if not os.path.isfile(key_path):...
python
def validate_key(key_path): """ Validate a key :param key_path: path to a key to use for authentication :type key_path: str :return: key object used for authentication :rtype: paramiko.RSAKey """ key_path = os.path.expanduser(key_path) if not os.path.isfile(key_path):...
[ "def", "validate_key", "(", "key_path", ")", ":", "key_path", "=", "os", ".", "path", ".", "expanduser", "(", "key_path", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "key_path", ")", ":", "return", "False", "return", "paramiko", ".", "RSAK...
Validate a key :param key_path: path to a key to use for authentication :type key_path: str :return: key object used for authentication :rtype: paramiko.RSAKey
[ "Validate", "a", "key" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/helpers.py#L86-L101
dcos/shakedown
shakedown/dcos/service.py
get_service
def get_service( service_name, inactive=False, completed=False ): """ Get a dictionary describing a service :param service_name: the service name :type service_name: str :param inactive: whether to include inactive services :type inactive: bool :param ...
python
def get_service( service_name, inactive=False, completed=False ): """ Get a dictionary describing a service :param service_name: the service name :type service_name: str :param inactive: whether to include inactive services :type inactive: bool :param ...
[ "def", "get_service", "(", "service_name", ",", "inactive", "=", "False", ",", "completed", "=", "False", ")", ":", "services", "=", "mesos", ".", "get_master", "(", ")", ".", "frameworks", "(", "inactive", "=", "inactive", ",", "completed", "=", "complete...
Get a dictionary describing a service :param service_name: the service name :type service_name: str :param inactive: whether to include inactive services :type inactive: bool :param completed: whether to include completed services :type completed: bool :return: a...
[ "Get", "a", "dictionary", "describing", "a", "service", ":", "param", "service_name", ":", "the", "service", "name", ":", "type", "service_name", ":", "str", ":", "param", "inactive", ":", "whether", "to", "include", "inactive", "services", ":", "type", "ina...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L13-L36
dcos/shakedown
shakedown/dcos/service.py
get_service_framework_id
def get_service_framework_id( service_name, inactive=False, completed=False ): """ Get the framework ID for a service :param service_name: the service name :type service_name: str :param inactive: whether to include inactive services :type inactive: bool ...
python
def get_service_framework_id( service_name, inactive=False, completed=False ): """ Get the framework ID for a service :param service_name: the service name :type service_name: str :param inactive: whether to include inactive services :type inactive: bool ...
[ "def", "get_service_framework_id", "(", "service_name", ",", "inactive", "=", "False", ",", "completed", "=", "False", ")", ":", "service", "=", "get_service", "(", "service_name", ",", "inactive", ",", "completed", ")", "if", "service", "is", "not", "None", ...
Get the framework ID for a service :param service_name: the service name :type service_name: str :param inactive: whether to include inactive services :type inactive: bool :param completed: whether to include completed services :type completed: bool :return: a fr...
[ "Get", "the", "framework", "ID", "for", "a", "service", ":", "param", "service_name", ":", "the", "service", "name", ":", "type", "service_name", ":", "str", ":", "param", "inactive", ":", "whether", "to", "include", "inactive", "services", ":", "type", "i...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L39-L61
dcos/shakedown
shakedown/dcos/service.py
get_service_tasks
def get_service_tasks( service_name, inactive=False, completed=False ): """ Get a list of tasks associated with a service :param service_name: the service name :type service_name: str :param inactive: whether to include inactive services :type inactive: bool ...
python
def get_service_tasks( service_name, inactive=False, completed=False ): """ Get a list of tasks associated with a service :param service_name: the service name :type service_name: str :param inactive: whether to include inactive services :type inactive: bool ...
[ "def", "get_service_tasks", "(", "service_name", ",", "inactive", "=", "False", ",", "completed", "=", "False", ")", ":", "service", "=", "get_service", "(", "service_name", ",", "inactive", ",", "completed", ")", "if", "service", "is", "not", "None", "and",...
Get a list of tasks associated with a service :param service_name: the service name :type service_name: str :param inactive: whether to include inactive services :type inactive: bool :param completed: whether to include completed services :type completed: bool :r...
[ "Get", "a", "list", "of", "tasks", "associated", "with", "a", "service", ":", "param", "service_name", ":", "the", "service", "name", ":", "type", "service_name", ":", "str", ":", "param", "inactive", ":", "whether", "to", "include", "inactive", "services", ...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L64-L86
dcos/shakedown
shakedown/dcos/service.py
get_service_task_ids
def get_service_task_ids( service_name, task_predicate=None, inactive=False, completed=False ): """ Get a list of task IDs associated with a service :param service_name: the service name :type service_name: str :param task_predicate: filter function which acce...
python
def get_service_task_ids( service_name, task_predicate=None, inactive=False, completed=False ): """ Get a list of task IDs associated with a service :param service_name: the service name :type service_name: str :param task_predicate: filter function which acce...
[ "def", "get_service_task_ids", "(", "service_name", ",", "task_predicate", "=", "None", ",", "inactive", "=", "False", ",", "completed", "=", "False", ")", ":", "tasks", "=", "get_service_tasks", "(", "service_name", ",", "inactive", ",", "completed", ")", "if...
Get a list of task IDs associated with a service :param service_name: the service name :type service_name: str :param task_predicate: filter function which accepts a task object and returns a boolean :type task_predicate: function, or None :param inactive: whether to include inac...
[ "Get", "a", "list", "of", "task", "IDs", "associated", "with", "a", "service", ":", "param", "service_name", ":", "the", "service", "name", ":", "type", "service_name", ":", "str", ":", "param", "task_predicate", ":", "filter", "function", "which", "accepts"...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L89-L112
dcos/shakedown
shakedown/dcos/service.py
get_service_task
def get_service_task( service_name, task_name, inactive=False, completed=False ): """ Get a dictionary describing a service task, or None :param service_name: the service name :type service_name: str :param task_name: the task name :type task_name: str...
python
def get_service_task( service_name, task_name, inactive=False, completed=False ): """ Get a dictionary describing a service task, or None :param service_name: the service name :type service_name: str :param task_name: the task name :type task_name: str...
[ "def", "get_service_task", "(", "service_name", ",", "task_name", ",", "inactive", "=", "False", ",", "completed", "=", "False", ")", ":", "service", "=", "get_service_tasks", "(", "service_name", ",", "inactive", ",", "completed", ")", "if", "service", "is", ...
Get a dictionary describing a service task, or None :param service_name: the service name :type service_name: str :param task_name: the task name :type task_name: str :param inactive: whether to include inactive services :type inactive: bool :param completed: whet...
[ "Get", "a", "dictionary", "describing", "a", "service", "task", "or", "None", ":", "param", "service_name", ":", "the", "service", "name", ":", "type", "service_name", ":", "str", ":", "param", "task_name", ":", "the", "task", "name", ":", "type", "task_na...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L131-L158
dcos/shakedown
shakedown/dcos/service.py
get_marathon_task
def get_marathon_task( task_name, inactive=False, completed=False ): """ Get a dictionary describing a named marathon task """ return get_service_task('marathon', task_name, inactive, completed)
python
def get_marathon_task( task_name, inactive=False, completed=False ): """ Get a dictionary describing a named marathon task """ return get_service_task('marathon', task_name, inactive, completed)
[ "def", "get_marathon_task", "(", "task_name", ",", "inactive", "=", "False", ",", "completed", "=", "False", ")", ":", "return", "get_service_task", "(", "'marathon'", ",", "task_name", ",", "inactive", ",", "completed", ")" ]
Get a dictionary describing a named marathon task
[ "Get", "a", "dictionary", "describing", "a", "named", "marathon", "task" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L161-L169
dcos/shakedown
shakedown/dcos/service.py
get_mesos_task
def get_mesos_task(task_name): """ Get a mesos task with a specific task name """ tasks = get_mesos_tasks() if tasks is not None: for task in tasks: if task['name'] == task_name: return task return None
python
def get_mesos_task(task_name): """ Get a mesos task with a specific task name """ tasks = get_mesos_tasks() if tasks is not None: for task in tasks: if task['name'] == task_name: return task return None
[ "def", "get_mesos_task", "(", "task_name", ")", ":", "tasks", "=", "get_mesos_tasks", "(", ")", "if", "tasks", "is", "not", "None", ":", "for", "task", "in", "tasks", ":", "if", "task", "[", "'name'", "]", "==", "task_name", ":", "return", "task", "ret...
Get a mesos task with a specific task name
[ "Get", "a", "mesos", "task", "with", "a", "specific", "task", "name" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L172-L181
dcos/shakedown
shakedown/dcos/service.py
get_service_ips
def get_service_ips( service_name, task_name=None, inactive=False, completed=False ): """ Get a set of the IPs associated with a service :param service_name: the service name :type service_name: str :param task_name: the task name :type task_name: str ...
python
def get_service_ips( service_name, task_name=None, inactive=False, completed=False ): """ Get a set of the IPs associated with a service :param service_name: the service name :type service_name: str :param task_name: the task name :type task_name: str ...
[ "def", "get_service_ips", "(", "service_name", ",", "task_name", "=", "None", ",", "inactive", "=", "False", ",", "completed", "=", "False", ")", ":", "service_tasks", "=", "get_service_tasks", "(", "service_name", ",", "inactive", ",", "completed", ")", "ips"...
Get a set of the IPs associated with a service :param service_name: the service name :type service_name: str :param task_name: the task name :type task_name: str :param inactive: wehther to include inactive services :type inactive: bool :param completed: whether t...
[ "Get", "a", "set", "of", "the", "IPs", "associated", "with", "a", "service", ":", "param", "service_name", ":", "the", "service", "name", ":", "type", "service_name", ":", "str", ":", "param", "task_name", ":", "the", "task", "name", ":", "type", "task_n...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L184-L218
dcos/shakedown
shakedown/dcos/service.py
service_healthy
def service_healthy(service_name, app_id=None): """ Check whether a named service is healthy :param service_name: the service name :type service_name: str :param app_id: app_id to filter :type app_id: str :return: True if healthy, False otherwise :rtype: bool ""...
python
def service_healthy(service_name, app_id=None): """ Check whether a named service is healthy :param service_name: the service name :type service_name: str :param app_id: app_id to filter :type app_id: str :return: True if healthy, False otherwise :rtype: bool ""...
[ "def", "service_healthy", "(", "service_name", ",", "app_id", "=", "None", ")", ":", "marathon_client", "=", "marathon", ".", "create_client", "(", ")", "apps", "=", "marathon_client", ".", "get_apps_for_framework", "(", "service_name", ")", "if", "apps", ":", ...
Check whether a named service is healthy :param service_name: the service name :type service_name: str :param app_id: app_id to filter :type app_id: str :return: True if healthy, False otherwise :rtype: bool
[ "Check", "whether", "a", "named", "service", "is", "healthy" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L221-L247
dcos/shakedown
shakedown/dcos/service.py
delete_persistent_data
def delete_persistent_data(role, zk_node): """ Deletes any persistent data associated with the specified role, and zk node. :param role: the mesos role to delete, or None to omit this :type role: str :param zk_node: the zookeeper node to be deleted, or None to skip this deletion :ty...
python
def delete_persistent_data(role, zk_node): """ Deletes any persistent data associated with the specified role, and zk node. :param role: the mesos role to delete, or None to omit this :type role: str :param zk_node: the zookeeper node to be deleted, or None to skip this deletion :ty...
[ "def", "delete_persistent_data", "(", "role", ",", "zk_node", ")", ":", "if", "role", ":", "destroy_volumes", "(", "role", ")", "unreserve_resources", "(", "role", ")", "if", "zk_node", ":", "delete_zk_node", "(", "zk_node", ")" ]
Deletes any persistent data associated with the specified role, and zk node. :param role: the mesos role to delete, or None to omit this :type role: str :param zk_node: the zookeeper node to be deleted, or None to skip this deletion :type zk_node: str
[ "Deletes", "any", "persistent", "data", "associated", "with", "the", "specified", "role", "and", "zk", "node", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L266-L279
dcos/shakedown
shakedown/dcos/service.py
destroy_volumes
def destroy_volumes(role): """ Destroys all volumes on all the slaves in the cluster for the role. """ state = dcos_agents_state() if not state or 'slaves' not in state.keys(): return False all_success = True for agent in state['slaves']: if not destroy_volume(agent, role): ...
python
def destroy_volumes(role): """ Destroys all volumes on all the slaves in the cluster for the role. """ state = dcos_agents_state() if not state or 'slaves' not in state.keys(): return False all_success = True for agent in state['slaves']: if not destroy_volume(agent, role): ...
[ "def", "destroy_volumes", "(", "role", ")", ":", "state", "=", "dcos_agents_state", "(", ")", "if", "not", "state", "or", "'slaves'", "not", "in", "state", ".", "keys", "(", ")", ":", "return", "False", "all_success", "=", "True", "for", "agent", "in", ...
Destroys all volumes on all the slaves in the cluster for the role.
[ "Destroys", "all", "volumes", "on", "all", "the", "slaves", "in", "the", "cluster", "for", "the", "role", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L282-L292
dcos/shakedown
shakedown/dcos/service.py
destroy_volume
def destroy_volume(agent, role): """ Deletes the volumes on the specific agent for the role """ volumes = [] agent_id = agent['id'] reserved_resources_full = agent.get('reserved_resources_full', None) if not reserved_resources_full: # doesn't exist return True reserved_reso...
python
def destroy_volume(agent, role): """ Deletes the volumes on the specific agent for the role """ volumes = [] agent_id = agent['id'] reserved_resources_full = agent.get('reserved_resources_full', None) if not reserved_resources_full: # doesn't exist return True reserved_reso...
[ "def", "destroy_volume", "(", "agent", ",", "role", ")", ":", "volumes", "=", "[", "]", "agent_id", "=", "agent", "[", "'id'", "]", "reserved_resources_full", "=", "agent", ".", "get", "(", "'reserved_resources_full'", ",", "None", ")", "if", "not", "reser...
Deletes the volumes on the specific agent for the role
[ "Deletes", "the", "volumes", "on", "the", "specific", "agent", "for", "the", "role" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L295-L337
dcos/shakedown
shakedown/dcos/service.py
unreserve_resources
def unreserve_resources(role): """ Unreserves all the resources for all the slaves for the role. """ state = dcos_agents_state() if not state or 'slaves' not in state.keys(): return False all_success = True for agent in state['slaves']: if not unreserve_resource(agent, role): ...
python
def unreserve_resources(role): """ Unreserves all the resources for all the slaves for the role. """ state = dcos_agents_state() if not state or 'slaves' not in state.keys(): return False all_success = True for agent in state['slaves']: if not unreserve_resource(agent, role): ...
[ "def", "unreserve_resources", "(", "role", ")", ":", "state", "=", "dcos_agents_state", "(", ")", "if", "not", "state", "or", "'slaves'", "not", "in", "state", ".", "keys", "(", ")", ":", "return", "False", "all_success", "=", "True", "for", "agent", "in...
Unreserves all the resources for all the slaves for the role.
[ "Unreserves", "all", "the", "resources", "for", "all", "the", "slaves", "for", "the", "role", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L340-L350
dcos/shakedown
shakedown/dcos/service.py
wait_for_service_endpoint
def wait_for_service_endpoint(service_name, timeout_sec=120): """Checks the service url if available it returns true, on expiration it returns false""" master_count = len(get_all_masters()) return time_wait(lambda: service_available_predicate(service_name), timeout_seconds=timeout_...
python
def wait_for_service_endpoint(service_name, timeout_sec=120): """Checks the service url if available it returns true, on expiration it returns false""" master_count = len(get_all_masters()) return time_wait(lambda: service_available_predicate(service_name), timeout_seconds=timeout_...
[ "def", "wait_for_service_endpoint", "(", "service_name", ",", "timeout_sec", "=", "120", ")", ":", "master_count", "=", "len", "(", "get_all_masters", "(", ")", ")", "return", "time_wait", "(", "lambda", ":", "service_available_predicate", "(", "service_name", ")"...
Checks the service url if available it returns true, on expiration it returns false
[ "Checks", "the", "service", "url", "if", "available", "it", "returns", "true", "on", "expiration", "it", "returns", "false" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L410-L417
dcos/shakedown
shakedown/dcos/service.py
task_states_predicate
def task_states_predicate(service_name, expected_task_count, expected_task_states): """ Returns whether the provided service_names's tasks have expected_task_count tasks in any of expected_task_states. For example, if service 'foo' has 5 tasks which are TASK_STAGING or TASK_RUNNING. :param ...
python
def task_states_predicate(service_name, expected_task_count, expected_task_states): """ Returns whether the provided service_names's tasks have expected_task_count tasks in any of expected_task_states. For example, if service 'foo' has 5 tasks which are TASK_STAGING or TASK_RUNNING. :param ...
[ "def", "task_states_predicate", "(", "service_name", ",", "expected_task_count", ",", "expected_task_states", ")", ":", "try", ":", "tasks", "=", "get_service_tasks", "(", "service_name", ")", "except", "(", "DCOSConnectionError", ",", "DCOSHTTPException", ")", ":", ...
Returns whether the provided service_names's tasks have expected_task_count tasks in any of expected_task_states. For example, if service 'foo' has 5 tasks which are TASK_STAGING or TASK_RUNNING. :param service_name: the service name :type service_name: str :param expected_task_...
[ "Returns", "whether", "the", "provided", "service_names", "s", "tasks", "have", "expected_task_count", "tasks", "in", "any", "of", "expected_task_states", ".", "For", "example", "if", "service", "foo", "has", "5", "tasks", "which", "are", "TASK_STAGING", "or", "...
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L427-L459
dcos/shakedown
shakedown/dcos/service.py
wait_for_service_tasks_state
def wait_for_service_tasks_state( service_name, expected_task_count, expected_task_states, timeout_sec=120 ): """ Returns once the service has at least N tasks in one of the specified state(s) :param service_name: the service name :type service_name: str :par...
python
def wait_for_service_tasks_state( service_name, expected_task_count, expected_task_states, timeout_sec=120 ): """ Returns once the service has at least N tasks in one of the specified state(s) :param service_name: the service name :type service_name: str :par...
[ "def", "wait_for_service_tasks_state", "(", "service_name", ",", "expected_task_count", ",", "expected_task_states", ",", "timeout_sec", "=", "120", ")", ":", "return", "time_wait", "(", "lambda", ":", "task_states_predicate", "(", "service_name", ",", "expected_task_co...
Returns once the service has at least N tasks in one of the specified state(s) :param service_name: the service name :type service_name: str :param expected_task_count: the expected number of tasks in the specified state(s) :type expected_task_count: int :param expected_task_sta...
[ "Returns", "once", "the", "service", "has", "at", "least", "N", "tasks", "in", "one", "of", "the", "specified", "state", "(", "s", ")" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L462-L484
dcos/shakedown
shakedown/dcos/service.py
tasks_all_replaced_predicate
def tasks_all_replaced_predicate( service_name, old_task_ids, task_predicate=None ): """ Returns whether ALL of old_task_ids have been replaced with new tasks :param service_name: the service name :type service_name: str :param old_task_ids: list of original task ids...
python
def tasks_all_replaced_predicate( service_name, old_task_ids, task_predicate=None ): """ Returns whether ALL of old_task_ids have been replaced with new tasks :param service_name: the service name :type service_name: str :param old_task_ids: list of original task ids...
[ "def", "tasks_all_replaced_predicate", "(", "service_name", ",", "old_task_ids", ",", "task_predicate", "=", "None", ")", ":", "try", ":", "task_ids", "=", "get_service_task_ids", "(", "service_name", ",", "task_predicate", ")", "except", "DCOSHTTPException", ":", "...
Returns whether ALL of old_task_ids have been replaced with new tasks :param service_name: the service name :type service_name: str :param old_task_ids: list of original task ids as returned by get_service_task_ids :type old_task_ids: [str] :param task_predicate: filter to use w...
[ "Returns", "whether", "ALL", "of", "old_task_ids", "have", "been", "replaced", "with", "new", "tasks" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L507-L537
dcos/shakedown
shakedown/dcos/service.py
tasks_missing_predicate
def tasks_missing_predicate( service_name, old_task_ids, task_predicate=None ): """ Returns whether any of old_task_ids are no longer present :param service_name: the service name :type service_name: str :param old_task_ids: list of original task ids as returned by g...
python
def tasks_missing_predicate( service_name, old_task_ids, task_predicate=None ): """ Returns whether any of old_task_ids are no longer present :param service_name: the service name :type service_name: str :param old_task_ids: list of original task ids as returned by g...
[ "def", "tasks_missing_predicate", "(", "service_name", ",", "old_task_ids", ",", "task_predicate", "=", "None", ")", ":", "try", ":", "task_ids", "=", "get_service_task_ids", "(", "service_name", ",", "task_predicate", ")", "except", "DCOSHTTPException", ":", "print...
Returns whether any of old_task_ids are no longer present :param service_name: the service name :type service_name: str :param old_task_ids: list of original task ids as returned by get_service_task_ids :type old_task_ids: [str] :param task_predicate: filter to use when searchin...
[ "Returns", "whether", "any", "of", "old_task_ids", "are", "no", "longer", "present" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L540-L568
dcos/shakedown
shakedown/dcos/service.py
wait_for_service_tasks_all_changed
def wait_for_service_tasks_all_changed( service_name, old_task_ids, task_predicate=None, timeout_sec=120 ): """ Returns once ALL of old_task_ids have been replaced with new tasks :param service_name: the service name :type service_name: str :param old_task_id...
python
def wait_for_service_tasks_all_changed( service_name, old_task_ids, task_predicate=None, timeout_sec=120 ): """ Returns once ALL of old_task_ids have been replaced with new tasks :param service_name: the service name :type service_name: str :param old_task_id...
[ "def", "wait_for_service_tasks_all_changed", "(", "service_name", ",", "old_task_ids", ",", "task_predicate", "=", "None", ",", "timeout_sec", "=", "120", ")", ":", "return", "time_wait", "(", "lambda", ":", "tasks_all_replaced_predicate", "(", "service_name", ",", ...
Returns once ALL of old_task_ids have been replaced with new tasks :param service_name: the service name :type service_name: str :param old_task_ids: list of original task ids as returned by get_service_task_ids :type old_task_ids: [str] :param task_predicate: filter to use when...
[ "Returns", "once", "ALL", "of", "old_task_ids", "have", "been", "replaced", "with", "new", "tasks" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L571-L593
dcos/shakedown
shakedown/dcos/service.py
wait_for_service_tasks_all_unchanged
def wait_for_service_tasks_all_unchanged( service_name, old_task_ids, task_predicate=None, timeout_sec=30 ): """ Returns after verifying that NONE of old_task_ids have been removed or replaced from the service :param service_name: the service name :type service_name:...
python
def wait_for_service_tasks_all_unchanged( service_name, old_task_ids, task_predicate=None, timeout_sec=30 ): """ Returns after verifying that NONE of old_task_ids have been removed or replaced from the service :param service_name: the service name :type service_name:...
[ "def", "wait_for_service_tasks_all_unchanged", "(", "service_name", ",", "old_task_ids", ",", "task_predicate", "=", "None", ",", "timeout_sec", "=", "30", ")", ":", "try", ":", "time_wait", "(", "lambda", ":", "tasks_missing_predicate", "(", "service_name", ",", ...
Returns after verifying that NONE of old_task_ids have been removed or replaced from the service :param service_name: the service name :type service_name: str :param old_task_ids: list of original task ids as returned by get_service_task_ids :type old_task_ids: [str] :param task...
[ "Returns", "after", "verifying", "that", "NONE", "of", "old_task_ids", "have", "been", "removed", "or", "replaced", "from", "the", "service" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/service.py#L596-L623
dcos/shakedown
shakedown/dcos/docker.py
docker_version
def docker_version(host=None, component='server'): """ Return the version of Docker [Server] :param host: host or IP of the machine Docker is running on :type host: str :param component: Docker component :type component: str :return: Docker version :rtype: str ""...
python
def docker_version(host=None, component='server'): """ Return the version of Docker [Server] :param host: host or IP of the machine Docker is running on :type host: str :param component: Docker component :type component: str :return: Docker version :rtype: str ""...
[ "def", "docker_version", "(", "host", "=", "None", ",", "component", "=", "'server'", ")", ":", "if", "component", ".", "lower", "(", ")", "==", "'client'", ":", "component", "=", "'Client'", "else", ":", "component", "=", "'Server'", "# sudo is required for...
Return the version of Docker [Server] :param host: host or IP of the machine Docker is running on :type host: str :param component: Docker component :type component: str :return: Docker version :rtype: str
[ "Return", "the", "version", "of", "Docker", "[", "Server", "]" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/docker.py#L12-L39
dcos/shakedown
shakedown/dcos/docker.py
create_docker_credentials_file
def create_docker_credentials_file( username, password, file_name='docker.tar.gz'): """ Create a docker credentials file. Docker username and password are used to create a `{file_name}` with `.docker/config.json` containing the credentials. :param username: docker us...
python
def create_docker_credentials_file( username, password, file_name='docker.tar.gz'): """ Create a docker credentials file. Docker username and password are used to create a `{file_name}` with `.docker/config.json` containing the credentials. :param username: docker us...
[ "def", "create_docker_credentials_file", "(", "username", ",", "password", ",", "file_name", "=", "'docker.tar.gz'", ")", ":", "import", "base64", "auth_hash", "=", "base64", ".", "b64encode", "(", "'{}:{}'", ".", "format", "(", "username", ",", "password", ")",...
Create a docker credentials file. Docker username and password are used to create a `{file_name}` with `.docker/config.json` containing the credentials. :param username: docker username :type username: str :param password: docker password :type password: str :par...
[ "Create", "a", "docker", "credentials", "file", ".", "Docker", "username", "and", "password", "are", "used", "to", "create", "a", "{", "file_name", "}", "with", ".", "docker", "/", "config", ".", "json", "containing", "the", "credentials", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/docker.py#L64-L105
dcos/shakedown
shakedown/dcos/docker.py
distribute_docker_credentials_to_private_agents
def distribute_docker_credentials_to_private_agents( username, password, file_name='docker.tar.gz'): """ Create and distributes a docker credentials file to all private agents :param username: docker username :type username: str :param password: docker password ...
python
def distribute_docker_credentials_to_private_agents( username, password, file_name='docker.tar.gz'): """ Create and distributes a docker credentials file to all private agents :param username: docker username :type username: str :param password: docker password ...
[ "def", "distribute_docker_credentials_to_private_agents", "(", "username", ",", "password", ",", "file_name", "=", "'docker.tar.gz'", ")", ":", "create_docker_credentials_file", "(", "username", ",", "password", ",", "file_name", ")", "try", ":", "__distribute_docker_cred...
Create and distributes a docker credentials file to all private agents :param username: docker username :type username: str :param password: docker password :type password: str :param file_name: credentials file name `docker.tar.gz` by default :type file_name: str
[ "Create", "and", "distributes", "a", "docker", "credentials", "file", "to", "all", "private", "agents" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/docker.py#L117-L136
dcos/shakedown
shakedown/dcos/docker.py
prefetch_docker_image_on_private_agents
def prefetch_docker_image_on_private_agents( image, timeout=timedelta(minutes=5).total_seconds()): """ Given a docker image. An app with the image is scale across the private agents to ensure that the image is prefetched to all nodes. :param image: docker image name :type im...
python
def prefetch_docker_image_on_private_agents( image, timeout=timedelta(minutes=5).total_seconds()): """ Given a docker image. An app with the image is scale across the private agents to ensure that the image is prefetched to all nodes. :param image: docker image name :type im...
[ "def", "prefetch_docker_image_on_private_agents", "(", "image", ",", "timeout", "=", "timedelta", "(", "minutes", "=", "5", ")", ".", "total_seconds", "(", ")", ")", ":", "agents", "=", "len", "(", "shakedown", ".", "get_private_agents", "(", ")", ")", "app"...
Given a docker image. An app with the image is scale across the private agents to ensure that the image is prefetched to all nodes. :param image: docker image name :type image: str :param timeout: timeout for deployment wait in secs (default: 5m) :type password: int
[ "Given", "a", "docker", "image", ".", "An", "app", "with", "the", "image", "is", "scale", "across", "the", "private", "agents", "to", "ensure", "that", "the", "image", "is", "prefetched", "to", "all", "nodes", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/docker.py#L139-L168
dcos/shakedown
shakedown/dcos/package.py
_get_options
def _get_options(options_file=None): """ Read in options_file as JSON. :param options_file: filename to return :type options_file: str :return: options as dictionary :rtype: dict """ if options_file is not None: with open(options_file, 'r') as opt_file: ...
python
def _get_options(options_file=None): """ Read in options_file as JSON. :param options_file: filename to return :type options_file: str :return: options as dictionary :rtype: dict """ if options_file is not None: with open(options_file, 'r') as opt_file: ...
[ "def", "_get_options", "(", "options_file", "=", "None", ")", ":", "if", "options_file", "is", "not", "None", ":", "with", "open", "(", "options_file", ",", "'r'", ")", "as", "opt_file", ":", "options", "=", "json", ".", "loads", "(", "opt_file", ".", ...
Read in options_file as JSON. :param options_file: filename to return :type options_file: str :return: options as dictionary :rtype: dict
[ "Read", "in", "options_file", "as", "JSON", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L10-L25
dcos/shakedown
shakedown/dcos/package.py
install_package
def install_package( package_name, package_version=None, service_name=None, options_file=None, options_json=None, wait_for_completion=False, timeout_sec=600, expected_running_tasks=0 ): """ Install a package via the DC/OS library :param packag...
python
def install_package( package_name, package_version=None, service_name=None, options_file=None, options_json=None, wait_for_completion=False, timeout_sec=600, expected_running_tasks=0 ): """ Install a package via the DC/OS library :param packag...
[ "def", "install_package", "(", "package_name", ",", "package_version", "=", "None", ",", "service_name", "=", "None", ",", "options_file", "=", "None", ",", "options_json", "=", "None", ",", "wait_for_completion", "=", "False", ",", "timeout_sec", "=", "600", ...
Install a package via the DC/OS library :param package_name: name of the package :type package_name: str :param package_version: version of the package (defaults to latest) :type package_version: str :param service_name: unique service name for the package :type service_...
[ "Install", "a", "package", "via", "the", "DC", "/", "OS", "library" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L46-L144
dcos/shakedown
shakedown/dcos/package.py
install_package_and_wait
def install_package_and_wait( package_name, package_version=None, service_name=None, options_file=None, options_json=None, wait_for_completion=True, timeout_sec=600, expected_running_tasks=0 ): """ Install a package via the DC/OS library and wait for c...
python
def install_package_and_wait( package_name, package_version=None, service_name=None, options_file=None, options_json=None, wait_for_completion=True, timeout_sec=600, expected_running_tasks=0 ): """ Install a package via the DC/OS library and wait for c...
[ "def", "install_package_and_wait", "(", "package_name", ",", "package_version", "=", "None", ",", "service_name", "=", "None", ",", "options_file", "=", "None", ",", "options_json", "=", "None", ",", "wait_for_completion", "=", "True", ",", "timeout_sec", "=", "...
Install a package via the DC/OS library and wait for completion
[ "Install", "a", "package", "via", "the", "DC", "/", "OS", "library", "and", "wait", "for", "completion" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L147-L169
dcos/shakedown
shakedown/dcos/package.py
package_installed
def package_installed(package_name, service_name=None): """ Check whether the package package_name is currently installed. :param package_name: package name :type package_name: str :param service_name: service_name :type service_name: str :return: True if installed, False o...
python
def package_installed(package_name, service_name=None): """ Check whether the package package_name is currently installed. :param package_name: package name :type package_name: str :param service_name: service_name :type service_name: str :return: True if installed, False o...
[ "def", "package_installed", "(", "package_name", ",", "service_name", "=", "None", ")", ":", "package_manager", "=", "_get_package_manager", "(", ")", "app_installed", "=", "len", "(", "package_manager", ".", "installed_apps", "(", "package_name", ",", "service_name...
Check whether the package package_name is currently installed. :param package_name: package name :type package_name: str :param service_name: service_name :type service_name: str :return: True if installed, False otherwise :rtype: bool
[ "Check", "whether", "the", "package", "package_name", "is", "currently", "installed", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L172-L194
dcos/shakedown
shakedown/dcos/package.py
uninstall_package
def uninstall_package( package_name, service_name=None, all_instances=False, wait_for_completion=False, timeout_sec=600 ): """ Uninstall a package using the DC/OS library. :param package_name: name of the package :type package_name: str :param service...
python
def uninstall_package( package_name, service_name=None, all_instances=False, wait_for_completion=False, timeout_sec=600 ): """ Uninstall a package using the DC/OS library. :param package_name: name of the package :type package_name: str :param service...
[ "def", "uninstall_package", "(", "package_name", ",", "service_name", "=", "None", ",", "all_instances", "=", "False", ",", "wait_for_completion", "=", "False", ",", "timeout_sec", "=", "600", ")", ":", "package_manager", "=", "_get_package_manager", "(", ")", "...
Uninstall a package using the DC/OS library. :param package_name: name of the package :type package_name: str :param service_name: unique service name for the package :type service_name: str :param all_instances: uninstall all instances of package :type all_instances: bo...
[ "Uninstall", "a", "package", "using", "the", "DC", "/", "OS", "library", "." ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L197-L246
dcos/shakedown
shakedown/dcos/package.py
uninstall_package_and_wait
def uninstall_package_and_wait( package_name, service_name=None, all_instances=False, wait_for_completion=True, timeout_sec=600 ): """ Uninstall a package via the DC/OS library and wait for completion :param package_name: name of the package :type package_nam...
python
def uninstall_package_and_wait( package_name, service_name=None, all_instances=False, wait_for_completion=True, timeout_sec=600 ): """ Uninstall a package via the DC/OS library and wait for completion :param package_name: name of the package :type package_nam...
[ "def", "uninstall_package_and_wait", "(", "package_name", ",", "service_name", "=", "None", ",", "all_instances", "=", "False", ",", "wait_for_completion", "=", "True", ",", "timeout_sec", "=", "600", ")", ":", "return", "uninstall_package", "(", "package_name", "...
Uninstall a package via the DC/OS library and wait for completion :param package_name: name of the package :type package_name: str :param service_name: unique service name for the package :type service_name: str :param all_instances: uninstall all instances of package :t...
[ "Uninstall", "a", "package", "via", "the", "DC", "/", "OS", "library", "and", "wait", "for", "completion" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L249-L279
dcos/shakedown
shakedown/dcos/package.py
uninstall_package_and_data
def uninstall_package_and_data( package_name, service_name=None, role=None, principal=None, zk_node=None, timeout_sec=600): """ Uninstall a package via the DC/OS library, wait for completion, and delete any persistent data :param package_name: name of the pac...
python
def uninstall_package_and_data( package_name, service_name=None, role=None, principal=None, zk_node=None, timeout_sec=600): """ Uninstall a package via the DC/OS library, wait for completion, and delete any persistent data :param package_name: name of the pac...
[ "def", "uninstall_package_and_data", "(", "package_name", ",", "service_name", "=", "None", ",", "role", "=", "None", ",", "principal", "=", "None", ",", "zk_node", "=", "None", ",", "timeout_sec", "=", "600", ")", ":", "start", "=", "time", ".", "time", ...
Uninstall a package via the DC/OS library, wait for completion, and delete any persistent data :param package_name: name of the package :type package_name: str :param service_name: unique service name for the package :type service_name: str :param role: role to use when deleting...
[ "Uninstall", "a", "package", "via", "the", "DC", "/", "OS", "library", "wait", "for", "completion", "and", "delete", "any", "persistent", "data" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L282-L335
dcos/shakedown
shakedown/dcos/package.py
add_package_repo
def add_package_repo( repo_name, repo_url, index=None, wait_for_package=None, expect_prev_version=None): """ Add a repository to the list of package sources :param repo_name: name of the repository to add :type repo_name: str :param repo_url: location...
python
def add_package_repo( repo_name, repo_url, index=None, wait_for_package=None, expect_prev_version=None): """ Add a repository to the list of package sources :param repo_name: name of the repository to add :type repo_name: str :param repo_url: location...
[ "def", "add_package_repo", "(", "repo_name", ",", "repo_url", ",", "index", "=", "None", ",", "wait_for_package", "=", "None", ",", "expect_prev_version", "=", "None", ")", ":", "package_manager", "=", "_get_package_manager", "(", ")", "if", "wait_for_package", ...
Add a repository to the list of package sources :param repo_name: name of the repository to add :type repo_name: str :param repo_url: location of the repository to add :type repo_url: str :param index: index (precedence) for this repository :type index: int :para...
[ "Add", "a", "repository", "to", "the", "list", "of", "package", "sources" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L352-L383
dcos/shakedown
shakedown/dcos/package.py
remove_package_repo
def remove_package_repo(repo_name, wait_for_package=None): """ Remove a repository from the list of package sources :param repo_name: name of the repository to remove :type repo_name: str :param wait_for_package: the package whose version should change after the repo is removed :typ...
python
def remove_package_repo(repo_name, wait_for_package=None): """ Remove a repository from the list of package sources :param repo_name: name of the repository to remove :type repo_name: str :param wait_for_package: the package whose version should change after the repo is removed :typ...
[ "def", "remove_package_repo", "(", "repo_name", ",", "wait_for_package", "=", "None", ")", ":", "package_manager", "=", "_get_package_manager", "(", ")", "if", "wait_for_package", ":", "prev_version", "=", "package_manager", ".", "get_package_version", "(", "wait_for_...
Remove a repository from the list of package sources :param repo_name: name of the repository to remove :type repo_name: str :param wait_for_package: the package whose version should change after the repo is removed :type wait_for_package: str, or None :returns: True if success...
[ "Remove", "a", "repository", "from", "the", "list", "of", "package", "sources" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L386-L408
dcos/shakedown
shakedown/dcos/package.py
get_package_versions
def get_package_versions(package_name): """ Returns the list of versions of a given package :param package_name: name of the package :type package_name: str """ package_manager = _get_package_manager() pkg = package_manager.get_package_version(package_name, None) return pkg.package_v...
python
def get_package_versions(package_name): """ Returns the list of versions of a given package :param package_name: name of the package :type package_name: str """ package_manager = _get_package_manager() pkg = package_manager.get_package_version(package_name, None) return pkg.package_v...
[ "def", "get_package_versions", "(", "package_name", ")", ":", "package_manager", "=", "_get_package_manager", "(", ")", "pkg", "=", "package_manager", ".", "get_package_version", "(", "package_name", ",", "None", ")", "return", "pkg", ".", "package_versions", "(", ...
Returns the list of versions of a given package :param package_name: name of the package :type package_name: str
[ "Returns", "the", "list", "of", "versions", "of", "a", "given", "package", ":", "param", "package_name", ":", "name", "of", "the", "package", ":", "type", "package_name", ":", "str" ]
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L425-L432